refactor(service): 重构服务代码结构并更新配置
This commit is contained in:
@@ -2,6 +2,34 @@ package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
// 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 string `orm:"head_msg" json:"headMsg"`
|
||||
Form any `orm:"form_json" json:"form"`
|
||||
RequestMapping any `orm:"request_mapping" json:"requestMapping"`
|
||||
ResponseMapping any `orm:"response_mapping" json:"responseMapping"`
|
||||
ResponseBody any `orm:"response_body" json:"responseBody"`
|
||||
TokenMapping string `orm:"token_mapping" json:"tokenMapping"`
|
||||
Prompt string `orm:"prompt" json:"prompt"`
|
||||
IsPrivate int `orm:"is_private" json:"isPrivate"`
|
||||
IsChatModel int `orm:"is_chat_model" json:"isChatModel"`
|
||||
ApiKey string `orm:"api_key" json:"apiKey"`
|
||||
Enabled int `orm:"enabled" json:"enabled"`
|
||||
MaxConcurrency int `orm:"max_concurrency" json:"maxConcurrency"`
|
||||
QueueLimit int `orm:"queue_limit" json:"queueLimit"`
|
||||
TimeoutSeconds int `orm:"timeout_seconds" json:"timeoutSeconds"`
|
||||
ExpectedSeconds int `orm:"expected_seconds" json:"expectedSeconds"`
|
||||
RetryTimes int `orm:"retry_times" json:"retryTimes"`
|
||||
RetryQueueMaxSeconds int `orm:"retry_queue_max_seconds" json:"retryQueueMaxSeconds"`
|
||||
AutoCleanSeconds int `orm:"auto_clean_seconds" json:"autoCleanSeconds"`
|
||||
Remark string `orm:"remark" json:"remark"`
|
||||
}
|
||||
|
||||
type asynchModelCol struct {
|
||||
beans.SQLBaseCol
|
||||
ModelName string
|
||||
@@ -55,31 +83,3 @@ var AsynchModelCol = asynchModelCol{
|
||||
AutoCleanSeconds: "auto_clean_seconds",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
// 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 string `orm:"head_msg" json:"headMsg"`
|
||||
Form any `orm:"form_json" json:"form"`
|
||||
RequestMapping any `orm:"request_mapping" json:"requestMapping"`
|
||||
ResponseMapping any `orm:"response_mapping" json:"responseMapping"`
|
||||
ResponseBody any `orm:"response_body" json:"responseBody"`
|
||||
TokenMapping string `orm:"token_mapping" json:"tokenMapping"`
|
||||
Prompt string `orm:"prompt" json:"prompt"`
|
||||
IsPrivate int `orm:"is_private" json:"isPrivate"`
|
||||
IsChatModel int `orm:"is_chat_model" json:"isChatModel"`
|
||||
ApiKey string `orm:"api_key" json:"apiKey"`
|
||||
Enabled int `orm:"enabled" json:"enabled"`
|
||||
MaxConcurrency int `orm:"max_concurrency" json:"maxConcurrency"`
|
||||
QueueLimit int `orm:"queue_limit" json:"queueLimit"`
|
||||
TimeoutSeconds int `orm:"timeout_seconds" json:"timeoutSeconds"`
|
||||
ExpectedSeconds int `orm:"expected_seconds" json:"expectedSeconds"`
|
||||
RetryTimes int `orm:"retry_times" json:"retryTimes"`
|
||||
RetryQueueMaxSeconds int `orm:"retry_queue_max_seconds" json:"retryQueueMaxSeconds"`
|
||||
AutoCleanSeconds int `orm:"auto_clean_seconds" json:"autoCleanSeconds"`
|
||||
Remark string `orm:"remark" json:"remark"`
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
type promptConfigCol struct {
|
||||
beans.SQLBaseCol
|
||||
ModelTypeId string
|
||||
ModelType string
|
||||
PromptInfo string
|
||||
ResponseJsonSchema string
|
||||
Enabled string
|
||||
Version string
|
||||
}
|
||||
|
||||
var PromptConfigCol = promptConfigCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
ModelTypeId: "model_type_id",
|
||||
ModelType: "model_type",
|
||||
PromptInfo: "prompt_info",
|
||||
ResponseJsonSchema: "response_json_schema",
|
||||
Enabled: "enabled",
|
||||
Version: "version",
|
||||
}
|
||||
|
||||
// PromptConfig 模型提示词配置
|
||||
//
|
||||
// 说明:
|
||||
// - prompt_info 使用 JSONB 保存(对外用 json 传输)
|
||||
// - response_json_schema 为模型返回 JSON 格式约束
|
||||
// - enabled:1启用/0禁用
|
||||
type PromptConfig struct {
|
||||
beans.SQLBaseDO `orm:",inline"`
|
||||
ModelTypeId int `orm:"model_type_id" json:"modelTypeId"`
|
||||
ModelType string `orm:"model_type" json:"modelType"`
|
||||
PromptInfo any `orm:"prompt_info" json:"promptInfo"`
|
||||
ResponseJsonSchema any `orm:"response_json_schema" json:"responseJsonSchema"`
|
||||
Enabled int `orm:"enabled" json:"enabled"`
|
||||
Version string `orm:"version" json:"version"`
|
||||
}
|
||||
@@ -2,6 +2,14 @@ package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
type ComposeSession struct {
|
||||
beans.SQLBaseDO `orm:",inline"`
|
||||
SessionId string `orm:"session_id" json:"sessionId"`
|
||||
RequestContent any `orm:"request_content" json:"requestContent"`
|
||||
ResponseContent any `orm:"response_content" json:"responseContent"`
|
||||
Remark string `orm:"remark" json:"remark"`
|
||||
}
|
||||
|
||||
type composeSessionCol struct {
|
||||
beans.SQLBaseCol
|
||||
SessionId string
|
||||
@@ -17,11 +25,3 @@ var ComposeSessionCol = composeSessionCol{
|
||||
ResponseContent: "response_content",
|
||||
Remark: "remark",
|
||||
}
|
||||
|
||||
type ComposeSession struct {
|
||||
beans.SQLBaseDO `orm:",inline"`
|
||||
SessionId string `orm:"session_id" json:"sessionId"`
|
||||
RequestContent any `orm:"request_content" json:"requestContent"`
|
||||
ResponseContent any `orm:"response_content" json:"responseContent"`
|
||||
Remark string `orm:"remark" json:"remark"`
|
||||
}
|
||||
@@ -2,6 +2,20 @@ package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
type ComposeTask struct {
|
||||
beans.SQLBaseDO `orm:",inline"`
|
||||
TaskId string `orm:"task_id" json:"taskId"`
|
||||
ModelName string `orm:"model_name" json:"modelName"`
|
||||
SkillName string `orm:"skill_name" json:"skillName"`
|
||||
LimitWords int `orm:"limit_words" json:"limitWords"`
|
||||
RequestPayload any `orm:"request_payload" json:"requestPayload"`
|
||||
CallbackPayload any `orm:"callback_payload" json:"callbackPayload"`
|
||||
ModelResult any `orm:"model_result" json:"modelResult"`
|
||||
Messages any `orm:"messages" json:"messages"`
|
||||
Status string `orm:"status" json:"status"`
|
||||
ErrorMessage string `orm:"error_message" json:"errorMessage"`
|
||||
}
|
||||
|
||||
type composeTaskCol struct {
|
||||
beans.SQLBaseCol
|
||||
TaskId string
|
||||
@@ -29,17 +43,3 @@ var ComposeTaskCol = composeTaskCol{
|
||||
Status: "status",
|
||||
ErrorMessage: "error_message",
|
||||
}
|
||||
|
||||
type ComposeTask struct {
|
||||
beans.SQLBaseDO `orm:",inline"`
|
||||
TaskId string `orm:"task_id" json:"taskId"`
|
||||
ModelName string `orm:"model_name" json:"modelName"`
|
||||
SkillName string `orm:"skill_name" json:"skillName"`
|
||||
LimitWords int `orm:"limit_words" json:"limitWords"`
|
||||
RequestPayload any `orm:"request_payload" json:"requestPayload"`
|
||||
CallbackPayload any `orm:"callback_payload" json:"callbackPayload"`
|
||||
ModelResult any `orm:"model_result" json:"modelResult"`
|
||||
Messages any `orm:"messages" json:"messages"`
|
||||
Status string `orm:"status" json:"status"`
|
||||
ErrorMessage string `orm:"error_message" json:"errorMessage"`
|
||||
}
|
||||
49
model/entity/prompts_provider_protocol.go
Normal file
49
model/entity/prompts_provider_protocol.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
// ProviderProtocol 模型协议映射配置
|
||||
type ProviderProtocol struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
// 业务字段
|
||||
ProviderName string `orm:"provider_name" json:"providerName"`
|
||||
TargetField string `orm:"target_field" json:"targetField"`
|
||||
MergeOrder any `orm:"merge_order" json:"mergeOrder"`
|
||||
RoleMapping any `orm:"role_mapping" json:"roleMapping"`
|
||||
ContentMapping any `orm:"content_mapping" json:"contentMapping"`
|
||||
Capabilities any `orm:"capabilities" json:"capabilities"`
|
||||
RequestTemplate any `orm:"request_template" json:"requestTemplate"`
|
||||
SystemPromptTemplate string `orm:"system_prompt_template" json:"systemPromptTemplate"`
|
||||
Status int `orm:"status" json:"status"`
|
||||
Remark string `orm:"remark" json:"remark"`
|
||||
}
|
||||
|
||||
// providerProtocolCol 列名
|
||||
type providerProtocolCol struct {
|
||||
beans.SQLBaseCol
|
||||
ProviderName string
|
||||
TargetField string
|
||||
MergeOrder string
|
||||
RoleMapping string
|
||||
ContentMapping string
|
||||
Capabilities string
|
||||
RequestTemplate string
|
||||
SystemPromptTemplate string
|
||||
Status string
|
||||
Remark string
|
||||
}
|
||||
|
||||
// ProviderProtocolCol 列名常量
|
||||
var ProviderProtocolCol = providerProtocolCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
ProviderName: "provider_name",
|
||||
TargetField: "target_field",
|
||||
MergeOrder: "merge_order",
|
||||
RoleMapping: "role_mapping",
|
||||
ContentMapping: "content_mapping",
|
||||
Capabilities: "capabilities",
|
||||
RequestTemplate: "request_template",
|
||||
SystemPromptTemplate: "system_prompt_template",
|
||||
Status: "status",
|
||||
Remark: "remark",
|
||||
}
|
||||
Reference in New Issue
Block a user