33 lines
854 B
Go
33 lines
854 B
Go
package quesbank
|
|
|
|
// AIType AI类型
|
|
type AIType string
|
|
|
|
const (
|
|
AITypeChatGLM AIType = "chatglm" // 智谱AI
|
|
AITypeXingHuo AIType = "xinghuo" // 讯飞星火
|
|
AITypeTongYi AIType = "tongyi" // 通义千问
|
|
AITypeDouBao AIType = "doubao" // 豆包
|
|
AITypeOpenAI AIType = "openai" // OpenAI
|
|
AITypeOther AIType = "other" // 其他兼容OpenAI格式的API
|
|
)
|
|
|
|
// AIConfig AI配置
|
|
type AIConfig struct {
|
|
Type AIType `json:"type"` // AI类型
|
|
URL string `json:"url"` // API地址(Other类型必填)
|
|
Model string `json:"model"` // 模型名称
|
|
APIKey string `json:"apiKey"` // API密钥
|
|
}
|
|
|
|
// AIChatMessage 聊天消息
|
|
type AIChatMessage struct {
|
|
Role string `json:"role"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
// AIChatMessages 聊天消息列表
|
|
type AIChatMessages struct {
|
|
Messages []AIChatMessage `json:"messages"`
|
|
}
|