新增 TakeBusinessFields、WriteBusinessFields、SetByPath 与 GetByPath 等工具,支持按映射路径写入请求体与解析响应,并更新相关依赖。
61 lines
2.5 KiB
Go
61 lines
2.5 KiB
Go
package entity
|
|
|
|
import (
|
|
"gitea.redpowerfuture.com/red-future/common/beans"
|
|
)
|
|
|
|
type modelSessionCol struct {
|
|
beans.SQLBaseCol
|
|
ModelId string
|
|
BizName string
|
|
SessionId string
|
|
RetryCount string
|
|
RequestPath string
|
|
ResponsePath string
|
|
OriginalRequestPath string
|
|
OriginalResponsePath string
|
|
DurationSeconds string
|
|
PromptTokens string
|
|
CompletionTokens string
|
|
TotalTokens string
|
|
TotalCost string
|
|
ErrorMsg string
|
|
}
|
|
|
|
var ModelSessionCol = modelSessionCol{
|
|
SQLBaseCol: beans.DefSQLBaseCol,
|
|
ModelId: "model_id",
|
|
BizName: "biz_name",
|
|
SessionId: "session_id",
|
|
RetryCount: "retry_count",
|
|
RequestPath: "request_path",
|
|
ResponsePath: "response_path",
|
|
OriginalRequestPath: "original_request_path",
|
|
OriginalResponsePath: "original_response_path",
|
|
DurationSeconds: "duration_seconds",
|
|
PromptTokens: "prompt_tokens",
|
|
CompletionTokens: "completion_tokens",
|
|
TotalTokens: "total_tokens",
|
|
TotalCost: "total_cost",
|
|
ErrorMsg: "error_msg",
|
|
}
|
|
|
|
// ModelSession 模型网关任务
|
|
type ModelSession struct {
|
|
beans.SQLBaseDO `orm:",inline"`
|
|
ModelId int64 `orm:"model_id" json:"modelId" dc:"模型ID"`
|
|
BizName string `orm:"biz_name" json:"bizName" dc:"业务名称"`
|
|
SessionId string `orm:"session_id" json:"sessionId" dc:"会话ID"`
|
|
RetryCount int `orm:"retry_count" json:"retryCount" dc:"重试"`
|
|
RequestPath string `orm:"request_path" json:"requestPath" dc:"请求参数保存路径"`
|
|
ResponsePath string `orm:"response_path" json:"responsePath" dc:"响应结果保存路径"`
|
|
OriginalRequestPath string `orm:"original_request_path" json:"originalRequestPath" dc:"原始请求参数保存路径"`
|
|
OriginalResponsePath string `orm:"original_response_path" json:"originalResponsePath" dc:"原始响应结果保存路径"`
|
|
DurationSeconds int64 `orm:"duration_seconds" json:"durationSeconds" dc:"耗时(秒)"`
|
|
PromptTokens int64 `orm:"prompt_tokens" json:"promptTokens" dc:"输入token"`
|
|
CompletionTokens int64 `orm:"completion_tokens" json:"completionTokens" dc:"输出token"`
|
|
TotalTokens int64 `orm:"total_tokens" json:"totalTokens" dc:"总token"`
|
|
TotalCost float64 `orm:"total_cost" json:"totalCost" dc:"总费用(元)"`
|
|
ErrorMsg string `orm:"error_msg" json:"errorMsg" dc:"错误消息"`
|
|
}
|