Skip to content

Commit 0b845c2

Browse files
feat(ent): add requested model to usage log schema
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent fe60412 commit 0b845c2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

backend/ent/schema/usage_log.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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"),

0 commit comments

Comments
 (0)