File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,12 @@ func (UsageLog) Fields() []ent.Field {
4141 field .String ("model" ).
4242 MaxLen (100 ).
4343 NotEmpty (),
44+ // RequestedModel stores the client-requested model name for stable display and analytics.
45+ // NULL means historical rows written before requested_model dual-write was introduced.
46+ field .String ("requested_model" ).
47+ MaxLen (100 ).
48+ Optional ().
49+ Nillable (),
4450 // UpstreamModel stores the actual upstream model name when model mapping
4551 // is applied. NULL means no mapping — the requested model was used as-is.
4652 field .String ("upstream_model" ).
@@ -181,6 +187,7 @@ func (UsageLog) Indexes() []ent.Index {
181187 index .Fields ("subscription_id" ),
182188 index .Fields ("created_at" ),
183189 index .Fields ("model" ),
190+ index .Fields ("requested_model" ),
184191 index .Fields ("request_id" ),
185192 // 复合索引用于时间范围查询
186193 index .Fields ("user_id" , "created_at" ),
You can’t perform that action at this time.
0 commit comments