refactor(model): 移除异步模型相关实体和数据访问对象
This commit is contained in:
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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"`
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user