32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
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兼容)
|
||
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"`
|
||
}
|