61 lines
2.2 KiB
Go
61 lines
2.2 KiB
Go
package v1
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
// AIConfigGetReq 获取AI配置请求
|
|
type AIConfigGetReq struct {
|
|
g.Meta `path:"/ai-config" method:"get" tags:"AIConfig" summary:"获取AI配置"`
|
|
}
|
|
|
|
// AIConfigGetResp AI配置响应
|
|
type AIConfigGetResp struct {
|
|
Type string `json:"type"` // AI类型: chatglm, xinghuo, tongyi, doubao, openai, other
|
|
URL string `json:"url"` // API地址(other类型必填)
|
|
Model string `json:"model"` // 模型名称
|
|
APIKey string `json:"apiKey"` // API密钥(返回时脱敏)
|
|
}
|
|
|
|
// AIConfigUpdateReq 更新AI配置请求
|
|
type AIConfigUpdateReq struct {
|
|
g.Meta `path:"/ai-config" method:"put" tags:"AIConfig" summary:"更新AI配置" permission:"sys:ai:edit"`
|
|
Type string `json:"type" v:"required|in:chatglm,xinghuo,tongyi,doubao,openai,other#AI类型不能为空|AI类型不合法"`
|
|
URL string `json:"url"` // API地址(other类型必填)
|
|
Model string `json:"model"` // 模型名称
|
|
APIKey string `json:"apiKey" v:"required#API密钥不能为空"` // API密钥
|
|
}
|
|
|
|
// AIConfigTestReq 测试AI配置请求
|
|
type AIConfigTestReq struct {
|
|
g.Meta `path:"/ai-config/test" method:"post" tags:"AIConfig" summary:"测试AI配置" permission:"sys:ai:edit"`
|
|
Type string `json:"type" v:"required|in:chatglm,xinghuo,tongyi,doubao,openai,other#AI类型不能为空|AI类型不合法"`
|
|
URL string `json:"url"`
|
|
Model string `json:"model"`
|
|
APIKey string `json:"apiKey" v:"required#API密钥不能为空"`
|
|
}
|
|
|
|
// AIConfigTestResp 测试AI配置响应
|
|
type AIConfigTestResp struct {
|
|
Success bool `json:"success"` // 是否成功
|
|
Message string `json:"message"` // 测试结果消息
|
|
}
|
|
|
|
// AITypeListReq 获取支持的AI类型列表请求
|
|
type AITypeListReq struct {
|
|
g.Meta `path:"/ai-config/types" method:"get" tags:"AIConfig" summary:"获取支持的AI类型列表"`
|
|
}
|
|
|
|
// AITypeItem AI类型项
|
|
type AITypeItem struct {
|
|
Type string `json:"type"` // 类型标识
|
|
Name string `json:"name"` // 显示名称
|
|
Description string `json:"description"` // 描述
|
|
NeedURL bool `json:"needUrl"` // 是否需要自定义URL
|
|
}
|
|
|
|
// AITypeListResp AI类型列表响应
|
|
type AITypeListResp struct {
|
|
Types []AITypeItem `json:"types"`
|
|
}
|