feat(usage): 使用记录增加计费模式字段 — 记录/展示/筛选 token/按次/图片
- DB: usage_logs 表新增 billing_mode VARCHAR(20) 列 - 后端: RecordUsage 写入时根据 image_count 判定计费模式 - 前端: 使用记录表格新增计费模式 badge 列 + 筛选下拉
This commit is contained in:
@@ -28,6 +28,14 @@ const (
|
||||
FieldRequestedModel = "requested_model"
|
||||
// FieldUpstreamModel holds the string denoting the upstream_model field in the database.
|
||||
FieldUpstreamModel = "upstream_model"
|
||||
// FieldChannelID holds the string denoting the channel_id field in the database.
|
||||
FieldChannelID = "channel_id"
|
||||
// FieldModelMappingChain holds the string denoting the model_mapping_chain field in the database.
|
||||
FieldModelMappingChain = "model_mapping_chain"
|
||||
// FieldBillingTier holds the string denoting the billing_tier field in the database.
|
||||
FieldBillingTier = "billing_tier"
|
||||
// FieldBillingMode holds the string denoting the billing_mode field in the database.
|
||||
FieldBillingMode = "billing_mode"
|
||||
// FieldGroupID holds the string denoting the group_id field in the database.
|
||||
FieldGroupID = "group_id"
|
||||
// FieldSubscriptionID holds the string denoting the subscription_id field in the database.
|
||||
@@ -141,6 +149,10 @@ var Columns = []string{
|
||||
FieldModel,
|
||||
FieldRequestedModel,
|
||||
FieldUpstreamModel,
|
||||
FieldChannelID,
|
||||
FieldModelMappingChain,
|
||||
FieldBillingTier,
|
||||
FieldBillingMode,
|
||||
FieldGroupID,
|
||||
FieldSubscriptionID,
|
||||
FieldInputTokens,
|
||||
@@ -189,6 +201,12 @@ var (
|
||||
RequestedModelValidator func(string) error
|
||||
// UpstreamModelValidator is a validator for the "upstream_model" field. It is called by the builders before save.
|
||||
UpstreamModelValidator func(string) error
|
||||
// ModelMappingChainValidator is a validator for the "model_mapping_chain" field. It is called by the builders before save.
|
||||
ModelMappingChainValidator func(string) error
|
||||
// BillingTierValidator is a validator for the "billing_tier" field. It is called by the builders before save.
|
||||
BillingTierValidator func(string) error
|
||||
// BillingModeValidator is a validator for the "billing_mode" field. It is called by the builders before save.
|
||||
BillingModeValidator func(string) error
|
||||
// DefaultInputTokens holds the default value on creation for the "input_tokens" field.
|
||||
DefaultInputTokens int
|
||||
// DefaultOutputTokens holds the default value on creation for the "output_tokens" field.
|
||||
@@ -278,6 +296,26 @@ func ByUpstreamModel(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpstreamModel, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByChannelID orders the results by the channel_id field.
|
||||
func ByChannelID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldChannelID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelMappingChain orders the results by the model_mapping_chain field.
|
||||
func ByModelMappingChain(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelMappingChain, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBillingTier orders the results by the billing_tier field.
|
||||
func ByBillingTier(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBillingTier, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBillingMode orders the results by the billing_mode field.
|
||||
func ByBillingMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBillingMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGroupID orders the results by the group_id field.
|
||||
func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGroupID, opts...).ToFunc()
|
||||
|
||||
Reference in New Issue
Block a user