feat(prompt): 重构提示词服务并添加模型类型子分类

This commit is contained in:
2026-05-22 09:49:46 +08:00
parent a34eb4ea61
commit 92092575bc
9 changed files with 353 additions and 540 deletions

View File

@@ -3,21 +3,26 @@ package dto
import "github.com/gogf/gf/v2/frame/g"
type ComposeMessagesReq struct {
g.Meta `path:"/composeMessages" method:"post" tags:"提示词处理" summary:"拼接提示词" dc:"按 modelTypeId 读取 prompts_model_prompt.prompt_info 与 response_json_schemaform 作为系统表单userForm 作为用户表单,结合 userFiles 调用 model-gateway并直接返回最终 messages"`
ModelName string `p:"modelName" json:"modelName" v:"required#modelName不能为空" dc:"实际请求的网关模型名称"`
BuildType int `p:"buildType" json:"buildType" v:"required#buildType不能为空" dc:"构建类型"` //判断节点
SessionId string `p:"sessionId" json:"sessionId" v:"required#sessionId不能为空" dc:"会话ID"`
Cause string `p:"cause" json:"cause" v:"required-if:IsBuilder,false#原因不能为空" dc:"原因"`
Form map[string]any `p:"form" json:"form" dc:"系统表单form 下所有字段都作为系统提示词来源"`
UserForm []map[string]any `p:"userForm" json:"userForm" dc:"用户表单:userForm 下所有字段都作为用户提示词来源;若与 form 含义接近则严格覆盖系统字段"`
SkillName string `p:"skillName" json:"skillName" dc:"技能名称"`
UserFiles []string `p:"userFiles" json:"userFiles" dc:"用户附件地址列表"`
g.Meta `path:"/composeMessages" method:"post" tags:"提示词处理" summary:"拼接提示词" dc:"按 modelTypeId 读取 prompts_model_prompt.prompt_info 与 response_json_schemaform 作为系统表单userForm 作为用户表单,结合 userFiles 调用 model-gateway并直接返回最终 messages"`
ModelName string `p:"modelName" json:"modelName" v:"required#modelName不能为空" dc:"实际请求的网关模型名称"`
BuildType int `p:"buildType" json:"buildType" v:"required#buildType不能为空" dc:"构建类型"` //判断节点
SessionId string `p:"sessionId" json:"sessionId" v:"required#sessionId不能为空" dc:"会话ID"`
Cause string `p:"cause" json:"cause" v:"required-if:IsBuilder,false#原因不能为空" dc:"原因"`
CallbackUrl string `p:"callbackUrl" json:"callbackUrl" dc:"回调地址"`
Form map[string]any `p:"form" json:"form" dc:"系统表单:form 下所有字段都作为系统提示词来源"`
UserForm []map[string]any `p:"userForm" json:"userForm" dc:"用户表单userForm 下所有字段都作为用户提示词来源;若与 form 含义接近则严格覆盖系统字段"`
SkillName string `p:"skillName" json:"skillName" dc:"技能名称"`
UserFiles []string `p:"userFiles" json:"userFiles" dc:"用户附件地址列表"`
}
type ComposeMessagesRes struct {
TaskId string `json:"taskId" dc:"任务ID"`
}
/*
Messages *MultiRoundResult `json:"messages,omitempty" dc:"最终消息数组"`
EpicycleId int64 `json:"epicycleId" dc:"轮次ID"`
}
*/
// MultiRoundResult 多轮返回结果
type MultiRoundResult struct {

View File

@@ -7,39 +7,48 @@ type ComposeTask struct {
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"`
BuildType int `orm:"build_type" json:"buildType"`
CallbackUrl string `orm:"callback_url" json:"callbackUrl"`
GatewayState int `orm:"gateway_state" json:"gatewayState"`
RequestPayload any `orm:"request_payload" json:"requestPayload"`
CallbackPayload any `orm:"callback_payload" json:"callbackPayload"`
ModelResult any `orm:"model_result" json:"modelResult"`
ResultText string `orm:"result_text" json:"resultText"`
Messages any `orm:"messages" json:"messages"`
Status string `orm:"status" json:"status"`
ErrorMessage string `orm:"error_message" json:"errorMessage"`
OssFile string `orm:"oss_file" json:"ossFile"`
FileType string `orm:"file_type" json:"fileType"`
}
type composeTaskCol struct {
beans.SQLBaseCol
TaskId string
ModelName string
SkillName string
LimitWords string
RequestPayload string
CallbackPayload string
ModelResult string
Messages string
Status string
ErrorMessage string
TaskId string
ModelName string
SkillName string
BuildType string
CallbackUrl string
GatewayState string
RequestPayload string
ResultText string
Messages string
Status string
ErrorMessage string
OssFile string
FileType string
}
var ComposeTaskCol = composeTaskCol{
SQLBaseCol: beans.DefSQLBaseCol,
TaskId: "task_id",
ModelName: "model_name",
SkillName: "skill_name",
LimitWords: "limit_words",
RequestPayload: "request_payload",
CallbackPayload: "callback_payload",
ModelResult: "model_result",
Messages: "messages",
Status: "status",
ErrorMessage: "error_message",
SQLBaseCol: beans.DefSQLBaseCol,
TaskId: "task_id",
ModelName: "model_name",
SkillName: "skill_name",
BuildType: "build_type",
CallbackUrl: "callback_url",
GatewayState: "gateway_state",
RequestPayload: "request_payload",
ResultText: "result_text",
Messages: "messages",
Status: "status",
ErrorMessage: "error_message",
OssFile: "oss_file",
FileType: "file_type",
}