🎨 优化项目结构 && 完善ai配置
This commit is contained in:
@@ -1,31 +1,28 @@
|
||||
package request
|
||||
|
||||
// Message 消息结构
|
||||
type Message struct {
|
||||
Role string `json:"role"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// CharacterCard 角色卡片
|
||||
type CharacterCard struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Personality string `json:"personality"`
|
||||
Scenario string `json:"scenario"`
|
||||
}
|
||||
|
||||
// ChatCompletionRequest 聊天补全请求(OpenAI兼容)
|
||||
// ChatCompletionRequest OpenAI兼容的聊天请求
|
||||
type ChatCompletionRequest struct {
|
||||
Model string `json:"model"`
|
||||
Messages []Message `json:"messages" binding:"required"`
|
||||
PresetID uint `json:"presetId"`
|
||||
BindingKey string `json:"bindingKey"`
|
||||
CharacterCard *CharacterCard `json:"characterCard"`
|
||||
Variables map[string]string `json:"variables"`
|
||||
Temperature *float64 `json:"temperature"`
|
||||
TopP *float64 `json:"topP"`
|
||||
MaxTokens *int `json:"maxTokens"`
|
||||
FrequencyPenalty *float64 `json:"frequencyPenalty"`
|
||||
PresencePenalty *float64 `json:"presencePenalty"`
|
||||
Stream bool `json:"stream"`
|
||||
Model string `json:"model"`
|
||||
Messages []ChatMessage `json:"messages"`
|
||||
Temperature *float64 `json:"temperature,omitempty"`
|
||||
TopP *float64 `json:"top_p,omitempty"`
|
||||
N *int `json:"n,omitempty"`
|
||||
Stream bool `json:"stream,omitempty"`
|
||||
Stop interface{} `json:"stop,omitempty"`
|
||||
MaxTokens *int `json:"max_tokens,omitempty"`
|
||||
PresencePenalty *float64 `json:"presence_penalty,omitempty"`
|
||||
FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"`
|
||||
LogitBias map[string]float64 `json:"logit_bias,omitempty"`
|
||||
User string `json:"user,omitempty"`
|
||||
|
||||
// 扩展字段 - 用于指定预设和提供商
|
||||
PresetName string `json:"preset_name,omitempty"` // 预设名称
|
||||
ProviderName string `json:"provider_name,omitempty"` // 提供商名称
|
||||
BindingName string `json:"binding_name,omitempty"` // 绑定名称(优先级最高)
|
||||
}
|
||||
|
||||
type ChatMessage struct {
|
||||
Role string `json:"role"` // system, user, assistant
|
||||
Content string `json:"content"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user