refactor(model): 重构模型网关结构和流式响应解析

This commit is contained in:
WangLiZhao
2026-07-06 13:20:19 +08:00
parent 1ce1913437
commit d3a8043337
6 changed files with 199 additions and 107 deletions
+8 -11
View File
@@ -22,7 +22,6 @@ type modelGatewayModelCol struct {
TimeoutSeconds string
RetryTimes string
OperatorName string
TokenConfig string
ExtendMapping string
QueryConfig string
StreamConfig string
@@ -50,7 +49,6 @@ var ModelGatewayModelCol = modelGatewayModelCol{
TimeoutSeconds: "timeout_seconds",
RetryTimes: "retry_times",
OperatorName: "operator_name",
TokenConfig: "token_config",
ExtendMapping: "extend_mapping",
QueryConfig: "query_config",
StreamConfig: "stream_config",
@@ -61,29 +59,28 @@ var ModelGatewayModelCol = modelGatewayModelCol{
type ModelGatewayModel struct {
beans.SQLBaseDO `orm:",inline"`
ModelName string `orm:"model_name" json:"modelName"`
OperatorName string `orm:"operator_name" json:"operatorName"`
ModelType int `orm:"model_type" json:"modelType"`
BaseURL string `orm:"base_url" json:"baseUrl"`
HttpMethod string `orm:"http_method" json:"httpMethod"`
HeadMsg map[string]any `orm:"head_msg" json:"headMsg"`
Form []Form `orm:"form_json" json:"form"`
RequestMapping map[string]any `orm:"request_mapping" json:"requestMapping"`
ResponseMapping map[string]any `orm:"response_mapping" json:"responseMapping"`
RequiredFields []string `orm:"required_fields" json:"requiredFields"`
IsPrivate *int `orm:"is_private" json:"isPrivate"`
IsChatModel *int `orm:"is_chat_model" json:"isChatModel"`
CallMode *int `orm:"call_mode" json:"callMode"`
ApiKey string `orm:"api_key" json:"apiKey"`
Enabled *int `orm:"enabled" json:"enabled"`
MaxConcurrency int `orm:"max_concurrency" json:"maxConcurrency"`
TimeoutSeconds int `orm:"timeout_seconds" json:"timeoutSeconds"`
RetryTimes int `orm:"retry_times" json:"retryTimes"`
OperatorName string `orm:"operator_name" json:"operatorName"`
TokenConfig map[string]any `orm:"token_config" json:"tokenConfig"`
Form []Form `orm:"form_json" json:"form"`
RequestMapping map[string]any `orm:"request_mapping" json:"requestMapping"`
ResponseMapping map[string]any `orm:"response_mapping" json:"responseMapping"`
ExtendMapping map[string]any `orm:"extend_mapping" json:"extendMapping"`
QueryConfig map[string]any `orm:"query_config" json:"queryConfig"`
StreamConfig map[string]any `orm:"stream_config" json:"streamConfig"`
SpecialParams map[string]any `orm:"special_params" json:"specialParams"`
BillingConfig map[string]any `orm:"billing_config" json:"billingConfig"`
RequiredFields []string `orm:"required_fields" json:"requiredFields"`
MaxConcurrency int `orm:"max_concurrency" json:"maxConcurrency"`
TimeoutSeconds int `orm:"timeout_seconds" json:"timeoutSeconds"`
RetryTimes int `orm:"retry_times" json:"retryTimes"`
}
type Form struct {