feat: 支持火山引擎的云雀大模型

This commit is contained in:
lisongwei
2024-03-12 14:13:08 +08:00
parent be8a0ec184
commit 62ef79e345
7 changed files with 390 additions and 10 deletions

View File

@@ -1,15 +1,18 @@
package types
import "encoding/json"
// ApiRequest API 请求实体
type ApiRequest struct {
Model string `json:"model,omitempty"` // 兼容百度文心一言
Temperature float32 `json:"temperature"`
MaxTokens int `json:"max_tokens,omitempty"` // 兼容百度文心一言
Stream bool `json:"stream"`
Messages []interface{} `json:"messages,omitempty"`
Prompt []interface{} `json:"prompt,omitempty"` // 兼容 ChatGLM
Tools []interface{} `json:"tools,omitempty"`
Functions []interface{} `json:"functions,omitempty"` // 兼容中转平台
Model string `json:"-"`
ModelRaw json.RawMessage `json:"model,omitempty"` // 兼容 model 字段不是字符串的接口
Temperature float32 `json:"temperature"`
MaxTokens int `json:"max_tokens,omitempty"` // 兼容百度文心一言
Stream bool `json:"stream"`
Messages []interface{} `json:"messages,omitempty"`
Prompt []interface{} `json:"prompt,omitempty"` // 兼容 ChatGLM
Tools []interface{} `json:"tools,omitempty"`
Functions []interface{} `json:"functions,omitempty"` // 兼容中转平台
ToolChoice string `json:"tool_choice,omitempty"`

View File

@@ -135,6 +135,7 @@ type ChatConfig struct {
ChatGML ModelAPIConfig `json:"chat_gml"`
Baidu ModelAPIConfig `json:"baidu"`
XunFei ModelAPIConfig `json:"xun_fei"`
Skylark ModelAPIConfig `json:"skylark"`
EnableContext bool `json:"enable_context"` // 是否开启聊天上下文
EnableHistory bool `json:"enable_history"` // 是否允许保存聊天记录
@@ -150,6 +151,7 @@ const ChatGLM = Platform("ChatGLM")
const Baidu = Platform("Baidu")
const XunFei = Platform("XunFei")
const QWen = Platform("QWen")
const Skylark = Platform("Skylark")
// UserChatConfig 用户的聊天配置
type UserChatConfig struct {