修复智能体bug
This commit is contained in:
@@ -3,12 +3,14 @@ package models
|
||||
import "time"
|
||||
|
||||
// PlatformAgentApi 智能体API管理表: yz_platform_agent_api
|
||||
// 按上游接口存储调用地址、密钥列表、模型列表
|
||||
// 按上游接口存储调用地址、请求协议、密钥列表、模型列表
|
||||
// Provider 为用户自由填写的上游名称,不做枚举约束
|
||||
// Protocol 显式指定请求协议,决定拼哪个端点路径与用哪种鉴权头
|
||||
// ApiKeys 存 JSON 数组,支持同一上游下挂多个账号的密钥,每条可带备注
|
||||
type PlatformAgentApi struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
Provider string `orm:"column(provider);size(100)" json:"provider"`
|
||||
Protocol string `orm:"column(protocol);size(30);default(chat_completions)" json:"protocol"`
|
||||
BaseURL string `orm:"column(base_url);size(500)" json:"base_url"`
|
||||
UseCustomURL int8 `orm:"column(use_custom_url);default(0)" json:"use_custom_url"`
|
||||
CustomURL string `orm:"column(custom_url);size(500)" json:"custom_url"`
|
||||
@@ -42,3 +44,17 @@ type AgentApiKey struct {
|
||||
Key string `json:"key"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// 请求协议枚举,与前端 constants.js 的 PROTOCOLS 保持一致
|
||||
const (
|
||||
// AgentProtocolChatCompletions OpenAI Chat Completions API,端点 {base}/chat/completions
|
||||
AgentProtocolChatCompletions = "chat_completions"
|
||||
// AgentProtocolResponses OpenAI Responses API,端点 {base}/responses
|
||||
AgentProtocolResponses = "responses"
|
||||
// AgentProtocolAnthropic Anthropic Messages API,端点 {base}/messages
|
||||
AgentProtocolAnthropic = "anthropic"
|
||||
// AgentProtocolGemini Google Gemini generateContent,端点 {base}/models/{model}:generateContent
|
||||
AgentProtocolGemini = "gemini"
|
||||
// AgentProtocolCustom 自定义:直接把填写的地址当完整端点请求,不追加任何路径
|
||||
AgentProtocolCustom = "custom"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user