From 05cf1b9828f1a25eb0ac2221f17c309eadd7261f Mon Sep 17 00:00:00 2001 From: WangLiZhao <1838393649@qq.com> Date: Wed, 3 Jun 2026 13:31:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor(model):=20=E7=A7=BB=E9=99=A4=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E6=A8=A1=E5=9E=8B=E7=9B=B8=E5=85=B3=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E5=92=8C=E6=95=B0=E6=8D=AE=E8=AE=BF=E9=97=AE=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/model_dao.go | 29 ---------- model/entity/asynch_model.go | 103 ----------------------------------- 2 files changed, 132 deletions(-) delete mode 100644 dao/model_dao.go delete mode 100644 model/entity/asynch_model.go diff --git a/dao/model_dao.go b/dao/model_dao.go deleted file mode 100644 index 7aabdc7..0000000 --- a/dao/model_dao.go +++ /dev/null @@ -1,29 +0,0 @@ -package dao - -import ( - "context" - "prompts-core/consts/public" - "prompts-core/model/entity" - - "gitea.com/red-future/common/db/gfdb" -) - -var Model = &modelDao{} - -type modelDao struct{} - -// Get 获取模型 -func (d *modelDao) Get(ctx context.Context, req *entity.AsynchModel, fields ...string) (m *entity.AsynchModel, err error) { - r, err := gfdb.DB(ctx, public.DbNameModelGateway).Model(ctx, public.TableNameModel). - OmitEmpty(). - Where(entity.AsynchModelCol.Id, req.Id). - Where(entity.AsynchModelCol.Creator, req.Creator). - Where(entity.AsynchModelCol.IsChatModel, req.IsChatModel). - Where(entity.AsynchModelCol.ModelName, req.ModelName). - Fields(fields).One() - if err != nil { - return - } - err = r.Struct(&m) - return -} diff --git a/model/entity/asynch_model.go b/model/entity/asynch_model.go deleted file mode 100644 index 5202e45..0000000 --- a/model/entity/asynch_model.go +++ /dev/null @@ -1,103 +0,0 @@ -package entity - -import "gitea.com/red-future/common/beans" - -type asynchModelCol struct { - beans.SQLBaseCol - ModelName string - ModelType string - BaseURL string - HttpMethod string - HeadMsg string - FormJSON string - RequestMapping string - ResponseMapping string - ResponseBody string - ResponseTokenField string - IsPrivate string - IsChatModel string - IsAsync string - IsStream string - ApiKey string - Enabled string - MaxConcurrency string - TimeoutSeconds string - RetryTimes string - AutoCleanSeconds string - IsOwner string - OperatorName string - TokenConfig string - ExtendMapping string - QueryConfig string - StreamConfig string - FirstFrame string - LastFrame string - CallbackUrl string -} - -var AsynchModelCol = asynchModelCol{ - SQLBaseCol: beans.DefSQLBaseCol, - ModelName: "model_name", - ModelType: "model_type", - BaseURL: "base_url", - HttpMethod: "http_method", - HeadMsg: "head_msg", - FormJSON: "form_json", - RequestMapping: "request_mapping", - ResponseMapping: "response_mapping", - ResponseBody: "response_body", - ResponseTokenField: "response_token_field", - IsPrivate: "is_private", - IsChatModel: "is_chat_model", - IsAsync: "is_async", - IsStream: "is_stream", - ApiKey: "api_key", - Enabled: "enabled", - MaxConcurrency: "max_concurrency", - TimeoutSeconds: "timeout_seconds", - RetryTimes: "retry_times", - AutoCleanSeconds: "auto_clean_seconds", - IsOwner: "is_owner", - OperatorName: "operator_name", - TokenConfig: "token_config", - ExtendMapping: "extend_mapping", - QueryConfig: "query_config", - StreamConfig: "stream_config", - FirstFrame: "first_frame", - LastFrame: "last_frame", - CallbackUrl: "callback_url", -} - -// AsynchModel 异步模型配置 -type AsynchModel struct { - beans.SQLBaseDO `orm:",inline"` - ModelName string `orm:"model_name" json:"modelName"` - 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 []map[string]any `orm:"form_json" json:"form"` - RequestMapping map[string]any `orm:"request_mapping" json:"requestMapping"` - ResponseMapping map[string]any `orm:"response_mapping" json:"responseMapping"` - ResponseBody string `orm:"response_body" json:"responseBody"` - ResponseTokenField string `orm:"response_token_field" json:"responseTokenField"` - IsPrivate *int `orm:"is_private" json:"isPrivate"` - IsChatModel *int `orm:"is_chat_model" json:"isChatModel"` - IsAsync *int `orm:"is_async" json:"isAsync"` - IsStream *int `orm:"is_stream" json:"isStream"` - 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"` - AutoCleanSeconds int `orm:"auto_clean_seconds" json:"autoCleanSeconds"` - IsOwner *int `json:"isOwner" orm:"is_owner"` - OperatorName string `orm:"operator_name" json:"operatorName"` - TokenConfig map[string]any `orm:"token_config" json:"tokenConfig"` - 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"` - FirstFrame string `orm:"first_frame" json:"firstFrame"` - LastFrame string `orm:"last_frame" json:"lastFrame"` - CallbackUrl string `orm:"callback_url" json:"callbackUrl"` -}