60 lines
2.6 KiB
Go
60 lines
2.6 KiB
Go
package app
|
|
|
|
import (
|
|
"git.echol.cn/loser/ai_proxy/server/global"
|
|
)
|
|
|
|
// AiPreset AI预设模板
|
|
type AiPreset struct {
|
|
global.GVA_MODEL
|
|
UserID uint `json:"userId" gorm:"comment:用户ID;index"`
|
|
Name string `json:"name" gorm:"comment:预设名称;size:200;not null"`
|
|
Description string `json:"description" gorm:"comment:预设描述;type:text"`
|
|
Prompts Prompts `json:"prompts" gorm:"comment:提示词数组;type:jsonb;not null"`
|
|
RegexScripts RegexScripts `json:"regexScripts" gorm:"comment:正则脚本;type:jsonb"`
|
|
Temperature float64 `json:"temperature" gorm:"comment:温度;default:1.0"`
|
|
TopP float64 `json:"topP" gorm:"comment:TopP;default:0.9"`
|
|
MaxTokens int `json:"maxTokens" gorm:"comment:最大Token数;default:4096"`
|
|
FrequencyPenalty float64 `json:"frequencyPenalty" gorm:"comment:频率惩罚;default:0"`
|
|
PresencePenalty float64 `json:"presencePenalty" gorm:"comment:存在惩罚;default:0"`
|
|
StreamEnabled bool `json:"streamEnabled" gorm:"comment:是否启用流式;default:true"`
|
|
IsDefault bool `json:"isDefault" gorm:"comment:是否默认;default:false"`
|
|
IsPublic bool `json:"isPublic" gorm:"comment:是否公开;default:false"`
|
|
}
|
|
|
|
func (AiPreset) TableName() string {
|
|
return "ai_presets"
|
|
}
|
|
|
|
// Prompt 提示词结构
|
|
type Prompt struct {
|
|
Name string `json:"name"`
|
|
SystemPrompt bool `json:"system_prompt"`
|
|
Role string `json:"role"`
|
|
Content string `json:"content"`
|
|
Identifier string `json:"identifier"`
|
|
InjectionPosition int `json:"injection_position"`
|
|
InjectionDepth int `json:"injection_depth"`
|
|
InjectionOrder int `json:"injection_order"`
|
|
InjectionTrigger []string `json:"injection_trigger"`
|
|
Marker bool `json:"marker"`
|
|
ForbidOverrides bool `json:"forbid_overrides"`
|
|
}
|
|
|
|
// RegexScript 正则脚本
|
|
type RegexScript struct {
|
|
ID string `json:"id"`
|
|
ScriptName string `json:"scriptName"`
|
|
FindRegex string `json:"findRegex"`
|
|
ReplaceString string `json:"replaceString"`
|
|
TrimStrings []string `json:"trimStrings"`
|
|
Placement []int `json:"placement"`
|
|
Disabled bool `json:"disabled"`
|
|
MarkdownOnly bool `json:"markdownOnly"`
|
|
PromptOnly bool `json:"promptOnly"`
|
|
RunOnEdit bool `json:"runOnEdit"`
|
|
SubstituteRegex int `json:"substituteRegex"`
|
|
MinDepth *int `json:"minDepth"`
|
|
MaxDepth *int `json:"maxDepth"`
|
|
}
|