Files
ai_proxy/server/model/app/ai_provider.go
2026-03-03 06:05:51 +08:00

24 lines
1.2 KiB
Go

package app
import (
"git.echol.cn/loser/ai_proxy/server/global"
)
// AiProvider AI服务提供商配置
type AiProvider struct {
global.GVA_MODEL
Name string `json:"name" gorm:"comment:提供商名称;size:100;not null;uniqueIndex"`
Type string `json:"type" gorm:"comment:提供商类型;size:50;not null"` // openai, claude, gemini 等
BaseURL string `json:"baseUrl" gorm:"comment:API基础地址;size:500;not null"`
Endpoint string `json:"endpoint" gorm:"comment:API端点;size:200"` // 如 /v1/chat/completions
UpstreamKey string `json:"upstreamKey" gorm:"comment:上游API密钥;type:text"` // 上游 AI 的 key
Model string `json:"model" gorm:"comment:默认模型;size:100"`
ProxyKey string `json:"proxyKey" gorm:"comment:代理访问密钥;size:100;uniqueIndex"` // 用户访问本代理时使用的 key
Config map[string]interface{} `json:"config" gorm:"comment:额外配置;type:jsonb;serializer:json"`
IsActive bool `json:"isActive" gorm:"comment:是否启用;default:true"`
}
func (AiProvider) TableName() string {
return "ai_providers"
}