🎉 初始化项目
This commit is contained in:
42
server/model/app/request/ai_preset.go
Normal file
42
server/model/app/request/ai_preset.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package request
|
||||
|
||||
import "git.echol.cn/loser/ai_proxy/server/model/app"
|
||||
|
||||
// CreateAiPresetRequest 创建预设请求
|
||||
type CreateAiPresetRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
Prompts []app.Prompt `json:"prompts" binding:"required"`
|
||||
RegexScripts []app.RegexScript `json:"regexScripts"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
TopP float64 `json:"topP"`
|
||||
MaxTokens int `json:"maxTokens"`
|
||||
FrequencyPenalty float64 `json:"frequencyPenalty"`
|
||||
PresencePenalty float64 `json:"presencePenalty"`
|
||||
StreamEnabled bool `json:"streamEnabled"`
|
||||
IsDefault bool `json:"isDefault"`
|
||||
IsPublic bool `json:"isPublic"`
|
||||
}
|
||||
|
||||
// UpdateAiPresetRequest 更新预设请求
|
||||
type UpdateAiPresetRequest struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Prompts []app.Prompt `json:"prompts"`
|
||||
RegexScripts []app.RegexScript `json:"regexScripts"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
TopP float64 `json:"topP"`
|
||||
MaxTokens int `json:"maxTokens"`
|
||||
FrequencyPenalty float64 `json:"frequencyPenalty"`
|
||||
PresencePenalty float64 `json:"presencePenalty"`
|
||||
StreamEnabled bool `json:"streamEnabled"`
|
||||
IsDefault bool `json:"isDefault"`
|
||||
IsPublic bool `json:"isPublic"`
|
||||
}
|
||||
|
||||
// ImportAiPresetRequest 导入预设请求(支持SillyTavern格式)
|
||||
type ImportAiPresetRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Data interface{} `json:"data" binding:"required"`
|
||||
}
|
||||
23
server/model/app/request/ai_preset_binding.go
Normal file
23
server/model/app/request/ai_preset_binding.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package request
|
||||
|
||||
// CreateBindingRequest 创建绑定请求
|
||||
type CreateBindingRequest struct {
|
||||
PresetID uint `json:"presetId" binding:"required"`
|
||||
ProviderID uint `json:"providerId" binding:"required"`
|
||||
Priority int `json:"priority"`
|
||||
}
|
||||
|
||||
// UpdateBindingRequest 更新绑定请求
|
||||
type UpdateBindingRequest struct {
|
||||
ID uint `json:"id" binding:"required"`
|
||||
Priority int `json:"priority"`
|
||||
IsActive bool `json:"isActive"`
|
||||
}
|
||||
|
||||
// GetBindingListRequest 获取绑定列表请求
|
||||
type GetBindingListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
ProviderID uint `json:"providerId" form:"providerId"`
|
||||
PresetID uint `json:"presetId" form:"presetId"`
|
||||
}
|
||||
28
server/model/app/request/ai_provider.go
Normal file
28
server/model/app/request/ai_provider.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package request
|
||||
|
||||
// CreateAiProviderRequest 创建AI提供商请求
|
||||
type CreateAiProviderRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Type string `json:"type" binding:"required"`
|
||||
BaseURL string `json:"baseUrl" binding:"required,url"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
UpstreamKey string `json:"upstreamKey" binding:"required"`
|
||||
Model string `json:"model"`
|
||||
ProxyKey string `json:"proxyKey" binding:"required"`
|
||||
Config map[string]interface{} `json:"config"`
|
||||
IsActive bool `json:"isActive"`
|
||||
}
|
||||
|
||||
// UpdateAiProviderRequest 更新AI提供商请求
|
||||
type UpdateAiProviderRequest struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
BaseURL string `json:"baseUrl"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
UpstreamKey string `json:"upstreamKey"`
|
||||
Model string `json:"model"`
|
||||
ProxyKey string `json:"proxyKey"`
|
||||
Config map[string]interface{} `json:"config"`
|
||||
IsActive bool `json:"isActive"`
|
||||
}
|
||||
15
server/model/app/request/ai_provider_extra.go
Normal file
15
server/model/app/request/ai_provider_extra.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package request
|
||||
|
||||
// TestConnectionRequest 测试连接请求
|
||||
type TestConnectionRequest struct {
|
||||
BaseURL string `json:"baseUrl" binding:"required"`
|
||||
UpstreamKey string `json:"upstreamKey" binding:"required"`
|
||||
Type string `json:"type" binding:"required"` // openai, claude, gemini 等
|
||||
}
|
||||
|
||||
// GetModelsRequest 获取模型列表请求
|
||||
type GetModelsRequest struct {
|
||||
BaseURL string `json:"baseUrl" binding:"required"`
|
||||
UpstreamKey string `json:"upstreamKey" binding:"required"`
|
||||
Type string `json:"type" binding:"required"`
|
||||
}
|
||||
31
server/model/app/request/ai_proxy.go
Normal file
31
server/model/app/request/ai_proxy.go
Normal file
@@ -0,0 +1,31 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user