🎨 优化模型配置 && 新增apikey功能 && 完善通用接口

This commit is contained in:
2026-03-03 17:13:24 +08:00
parent 2714e63d2a
commit 7dae1a6e2b
46 changed files with 3063 additions and 278 deletions

View File

@@ -0,0 +1,24 @@
package app
import (
"git.echol.cn/loser/ai_proxy/server/global"
)
// AiModel AI模型配置
type AiModel struct {
global.GVA_MODEL
Name string `json:"name" gorm:"type:varchar(100);not null;comment:模型名称"`
DisplayName string `json:"display_name" gorm:"type:varchar(100);comment:显示名称"`
ProviderID uint `json:"provider_id" gorm:"not null;index;comment:提供商ID"`
Provider AiProvider `json:"provider" gorm:"foreignKey:ProviderID"`
PresetID *uint `json:"preset_id" gorm:"index;comment:绑定的预设ID"`
Preset *AiPreset `json:"preset,omitempty" gorm:"foreignKey:PresetID"`
Enabled bool `json:"enabled" gorm:"default:true;comment:是否启用"`
MaxTokens int `json:"max_tokens" gorm:"default:4096;comment:最大token数"`
Description string `json:"description" gorm:"type:text;comment:模型描述"`
UserID uint `json:"user_id" gorm:"index;comment:用户ID"`
}
func (AiModel) TableName() string {
return "ai_models"
}