feat(ai): sync gateway providers and model discovery (#14426)
* feat(ai): sync gateway providers and model discovery Add provider account types and protocol-aware model discovery, and replace predefined models with editable model pools. Align provider icons with AI Gateway, preserve international Coding Plan restrictions, and filter account counts consistently with selectable accounts. * fix(ai): preserve Ollama base paths during model discovery * fix(ai): restore custom DashScope image protocol support
@@ -562,7 +562,7 @@ func (b *BaseApi) CreateAgentAccountModel(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags AI
|
// @Tags AI
|
||||||
// @Summary Update model service model
|
// @Summary Update model service models
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.AgentAccountModelUpdateReq true "request"
|
// @Param request body dto.AgentAccountModelUpdateReq true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
|
|||||||
@@ -317,10 +317,13 @@ type AgentAccountVerifyModelUpdateReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountModelDiscoverReq struct {
|
type AgentAccountModelDiscoverReq struct {
|
||||||
Provider string `json:"provider" validate:"required"`
|
AccountID uint `json:"accountId"`
|
||||||
BaseURL string `json:"baseURL" validate:"required"`
|
AccountType string `json:"accountType"`
|
||||||
APIKey string `json:"apiKey" validate:"required"`
|
Provider string `json:"provider" validate:"required_without=AccountID"`
|
||||||
APIType string `json:"apiType" validate:"required"`
|
BaseURL string `json:"baseURL" validate:"required_without=AccountID"`
|
||||||
|
APIKey string `json:"apiKey" validate:"required_without=AccountID"`
|
||||||
|
APIType string `json:"apiType" validate:"required_without=AccountID"`
|
||||||
|
AuthMode string `json:"authMode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountModelCreateReq struct {
|
type AgentAccountModelCreateReq struct {
|
||||||
@@ -330,8 +333,9 @@ type AgentAccountModelCreateReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountModelUpdateReq struct {
|
type AgentAccountModelUpdateReq struct {
|
||||||
AccountID uint `json:"accountId" validate:"required"`
|
AccountID uint `json:"accountId" validate:"required"`
|
||||||
Model AgentAccountModel `json:"model" validate:"required"`
|
Models []AgentAccountModel `json:"models" validate:"required,min=1"`
|
||||||
|
VerifyModel string `json:"verifyModel"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountModelDeleteReq struct {
|
type AgentAccountModelDeleteReq struct {
|
||||||
@@ -341,6 +345,7 @@ type AgentAccountModelDeleteReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountCreateReq struct {
|
type AgentAccountCreateReq struct {
|
||||||
|
AccountType string `json:"accountType"`
|
||||||
Provider string `json:"provider" validate:"required"`
|
Provider string `json:"provider" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
APIKey string `json:"apiKey" validate:"required"`
|
APIKey string `json:"apiKey" validate:"required"`
|
||||||
@@ -355,6 +360,7 @@ type AgentAccountCreateReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountUpdateReq struct {
|
type AgentAccountUpdateReq struct {
|
||||||
|
AccountType string `json:"accountType"`
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
APIKey string `json:"apiKey" validate:"required"`
|
APIKey string `json:"apiKey" validate:"required"`
|
||||||
@@ -385,17 +391,20 @@ type AgentAccountDeleteReq struct {
|
|||||||
|
|
||||||
type AgentAccountSearch struct {
|
type AgentAccountSearch struct {
|
||||||
PageInfo
|
PageInfo
|
||||||
Provider string `json:"provider"`
|
ExcludeCodingPlanProviders []string `json:"excludeCodingPlanProviders"`
|
||||||
APIType string `json:"apiType"`
|
Provider string `json:"provider"`
|
||||||
TextOnly bool `json:"textOnly"`
|
APIType string `json:"apiType"`
|
||||||
Name string `json:"name"`
|
TextOnly bool `json:"textOnly"`
|
||||||
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountProviderCountReq struct {
|
type AgentAccountProviderCountReq struct {
|
||||||
Providers []string `json:"providers"`
|
ExcludeCodingPlanProviders []string `json:"excludeCodingPlanProviders"`
|
||||||
|
Providers []string `json:"providers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AgentAccountInfo struct {
|
type AgentAccountInfo struct {
|
||||||
|
AccountType string `json:"accountType"`
|
||||||
AppInstallID uint `json:"appInstallId"`
|
AppInstallID uint `json:"appInstallId"`
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
MasterAccountID uint `json:"masterAccountId"`
|
MasterAccountID uint `json:"masterAccountId"`
|
||||||
@@ -433,13 +442,14 @@ type ProviderAPIInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ProviderInfo struct {
|
type ProviderInfo struct {
|
||||||
Sort uint `json:"-"`
|
AccountTypes []ProviderAccountTypeInfo `json:"accountTypes"`
|
||||||
Provider string `json:"provider"`
|
Sort uint `json:"-"`
|
||||||
DisplayName string `json:"displayName"`
|
Provider string `json:"provider"`
|
||||||
BaseURL string `json:"baseUrl"`
|
DisplayName string `json:"displayName"`
|
||||||
DefaultAPIType string `json:"defaultApiType"`
|
BaseURL string `json:"baseUrl"`
|
||||||
APITypes []ProviderAPIInfo `json:"apiTypes"`
|
DefaultAPIType string `json:"defaultApiType"`
|
||||||
Models []ProviderModelInfo `json:"models"`
|
APITypes []ProviderAPIInfo `json:"apiTypes"`
|
||||||
|
Models []ProviderModelInfo `json:"models"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AgentFeishuConfigReq struct {
|
type AgentFeishuConfigReq struct {
|
||||||
@@ -852,3 +862,8 @@ type AgentSkillUninstallReq struct {
|
|||||||
AgentID uint `json:"agentId" validate:"required"`
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProviderAccountTypeInfo struct {
|
||||||
|
Key string `json:"key"`
|
||||||
|
APITypes []ProviderAPIInfo `json:"apiTypes"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import "time"
|
|||||||
|
|
||||||
type AgentAccount struct {
|
type AgentAccount struct {
|
||||||
BaseModel
|
BaseModel
|
||||||
|
AccountType string `json:"accountType"`
|
||||||
AppInstallID uint `json:"appInstallId"`
|
AppInstallID uint `json:"appInstallId"`
|
||||||
Provider string `json:"provider"`
|
Provider string `json:"provider"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AccountTypePreset struct {
|
||||||
|
Key string `json:"key"`
|
||||||
|
APIConfigs []APIConfig `json:"apiTypes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindAccountType(provider, accountType string) (AccountTypePreset, bool) {
|
||||||
|
meta, ok := catalog[provider]
|
||||||
|
if !ok || len(meta.AccountTypes) == 0 {
|
||||||
|
return AccountTypePreset{}, false
|
||||||
|
}
|
||||||
|
if accountType == "" {
|
||||||
|
switch provider {
|
||||||
|
case "bailian", "ark", "xiaomi":
|
||||||
|
accountType = "payAsYouGo"
|
||||||
|
case "kimi", "zai":
|
||||||
|
accountType = "chinaApi"
|
||||||
|
default:
|
||||||
|
return meta.AccountTypes[0], true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, item := range meta.AccountTypes {
|
||||||
|
if item.Key == accountType {
|
||||||
|
return item, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AccountTypePreset{}, false
|
||||||
|
}
|
||||||
|
|
||||||
|
func Purpose(apiType string) string {
|
||||||
|
switch apiType {
|
||||||
|
case "openai-completions", "openai-responses", "anthropic-messages", "gemini-generate-content":
|
||||||
|
return "text"
|
||||||
|
case "openai-embeddings":
|
||||||
|
return "embedding"
|
||||||
|
case "rerank":
|
||||||
|
return "rerank"
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(apiType, "-images") {
|
||||||
|
return "image"
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(apiType, "-transcriptions") {
|
||||||
|
return "transcription"
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(apiType, "-speech") {
|
||||||
|
return "speech"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
@@ -9,13 +9,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type APIConfig struct {
|
type APIConfig struct {
|
||||||
APIType string
|
Route string `json:"route"`
|
||||||
BaseURL string
|
DiscoveryRoute string `json:"discoveryRoute"`
|
||||||
EditableBaseURL bool
|
DiscoveryAuthMode string `json:"discoveryAuthMode"`
|
||||||
DiscoverModels bool
|
Purpose string `json:"purpose"`
|
||||||
DefaultAuthMode string
|
Discovery string `json:"discovery"`
|
||||||
AuthModes []string
|
APIType string `json:"apiType"`
|
||||||
Models []Model
|
BaseURL string `json:"baseUrl"`
|
||||||
|
EditableBaseURL bool `json:"editableBaseUrl"`
|
||||||
|
DiscoverModels bool `json:"supportsModelDiscovery"`
|
||||||
|
DefaultAuthMode string `json:"defaultAuthMode"`
|
||||||
|
AuthModes []string `json:"authModes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -23,245 +27,598 @@ const (
|
|||||||
AuthModeXAPIKey = "x-api-key"
|
AuthModeXAPIKey = "x-api-key"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Model struct {
|
|
||||||
ID string
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Meta struct {
|
type Meta struct {
|
||||||
|
AccountTypes []AccountTypePreset
|
||||||
Key string
|
Key string
|
||||||
DisplayName string
|
DisplayName string
|
||||||
DisplayNameKey string
|
DisplayNameKey string
|
||||||
Sort uint
|
Sort uint
|
||||||
DefaultAPIType string
|
DefaultAPIType string
|
||||||
APIConfigs []APIConfig
|
|
||||||
EnvKey string
|
EnvKey string
|
||||||
Models []Model
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var catalog = map[string]Meta{
|
var catalog = map[string]Meta{
|
||||||
"custom": {
|
"custom": {
|
||||||
Key: "custom", DisplayName: "Custom", Sort: 10, DefaultAPIType: "openai-completions", EnvKey: "CUSTOM_API_KEY",
|
Key: "custom",
|
||||||
APIConfigs: editableAPIConfigs(true, "openai-completions", "openai-responses", "anthropic-messages", "openai-images", "dashscope-images", "openai-embeddings"),
|
DisplayName: "Custom",
|
||||||
|
Sort: 10,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "CUSTOM_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key", "bearer"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "dashscope-images", Purpose: "image", Discovery: "DiscoveryNone", EditableBaseURL: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "rerank", Purpose: "rerank", Discovery: "DiscoveryNone", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-transcriptions", Purpose: "transcription", Route: "/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-speech", Purpose: "speech", Route: "/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"ollama": {
|
"ollama": {
|
||||||
Key: "ollama", DisplayName: "Ollama", Sort: 15, DefaultAPIType: "openai-responses",
|
Key: "ollama",
|
||||||
APIConfigs: editableAPIConfigs(false, "openai-responses", "openai-completions", "openai-embeddings"),
|
DisplayName: "Ollama",
|
||||||
},
|
Sort: 40,
|
||||||
// llmman (https://github.com/llmmanorg/llmman): local runner with Ollama/OpenAI-compatible routes on 127.0.0.1:17434.
|
DefaultAPIType: "openai-responses",
|
||||||
"llmman": {
|
AccountTypes: []AccountTypePreset{
|
||||||
Key: "llmman", DisplayName: "llmman", Sort: 75, DefaultAPIType: "openai-responses",
|
{
|
||||||
APIConfigs: []APIConfig{
|
Key: "default",
|
||||||
{APIType: "openai-responses", BaseURL: "http://127.0.0.1:17434/v1", EditableBaseURL: true},
|
APIConfigs: []APIConfig{
|
||||||
{APIType: "openai-completions", BaseURL: "http://127.0.0.1:17434/v1", EditableBaseURL: true},
|
{APIType: "openai-responses", Purpose: "text", Route: "/v1", Discovery: "DiscoveryOllamaModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
{APIType: "openai-embeddings", BaseURL: "http://127.0.0.1:17434/v1", EditableBaseURL: true},
|
{APIType: "openai-completions", Purpose: "text", Route: "/v1", Discovery: "DiscoveryOllamaModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", Discovery: "DiscoveryOllamaModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", Route: "/v1", Discovery: "DiscoveryOllamaModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", Route: "/v1", Discovery: "DiscoveryOllamaModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"vllm": {
|
"vllm": {
|
||||||
Key: "vllm", DisplayName: "vLLM", Sort: 20, DefaultAPIType: "openai-completions", EnvKey: "VLLM_API_KEY",
|
Key: "vllm",
|
||||||
APIConfigs: editableAPIConfigs(false, "openai-completions", "openai-responses", "anthropic-messages", "openai-images", "openai-embeddings"),
|
DisplayName: "vLLM",
|
||||||
|
Sort: 20,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "VLLM_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer", "x-api-key"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "rerank", Purpose: "rerank", Route: "/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-transcriptions", Purpose: "transcription", Route: "/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"1panel-ai-gateway": {
|
"1panel-ai-gateway": {
|
||||||
Key: "1panel-ai-gateway", DisplayName: "1Panel AI Gateway", DisplayNameKey: "AIProvider1PanelGateway", Sort: 21, DefaultAPIType: "openai-completions", EnvKey: "ONEPANEL_AI_GATEWAY_API_KEY",
|
Key: "1panel-ai-gateway",
|
||||||
APIConfigs: editableAPIConfigs(true, "openai-completions", "openai-responses", "anthropic-messages", "openai-images", "openai-embeddings"),
|
DisplayName: "1Panel AI Gateway",
|
||||||
|
DisplayNameKey: "AIProvider1PanelGateway",
|
||||||
|
Sort: 30,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "ONEPANEL_AI_GATEWAY_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", EditableBaseURL: true, DiscoverModels: true},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", EditableBaseURL: true, DiscoverModels: true},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", EditableBaseURL: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key", "bearer"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", EditableBaseURL: true},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", EditableBaseURL: true},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"deepseek": {
|
"deepseek": {
|
||||||
Key: "deepseek", DisplayName: "DeepSeek", Sort: 25, DefaultAPIType: "openai-completions", EnvKey: "DEEPSEEK_API_KEY",
|
Key: "deepseek",
|
||||||
APIConfigs: []APIConfig{
|
DisplayName: "DeepSeek",
|
||||||
{APIType: "openai-completions", BaseURL: "https://api.deepseek.com"},
|
Sort: 60,
|
||||||
{APIType: "openai-responses", BaseURL: "https://api.deepseek.com"},
|
DefaultAPIType: "openai-completions",
|
||||||
anthropicAPIConfig("https://api.deepseek.com/anthropic", AuthModeXAPIKey),
|
EnvKey: "DEEPSEEK_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.deepseek.com", Discovery: "DiscoveryOpenAIModels", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://api.deepseek.com", Discovery: "DiscoveryOpenAIModels", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.deepseek.com/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Models: []Model{{ID: "deepseek-flash", Name: "deepseek-flash"}, {ID: "deepseek-v4-pro", Name: "deepseek-v4-pro"}},
|
|
||||||
},
|
},
|
||||||
"bailian-coding-plan": {
|
"bailian-coding-plan": {
|
||||||
Key: "bailian-coding-plan", DisplayNameKey: "AIProviderBailianCodingPlan", Sort: 30, DefaultAPIType: "openai-completions", EnvKey: "QWEN_API_KEY",
|
Key: "bailian-coding-plan",
|
||||||
APIConfigs: []APIConfig{
|
DisplayNameKey: "AIProviderBailianCodingPlan",
|
||||||
{APIType: "openai-completions", BaseURL: "https://coding.dashscope.aliyuncs.com/v1"},
|
Sort: 210,
|
||||||
anthropicAPIConfig("https://coding.dashscope.aliyuncs.com/apps/anthropic", AuthModeBearer),
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "QWEN_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "codingPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://coding.dashscope.aliyuncs.com/v1", Route: "/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://coding.dashscope.aliyuncs.com/apps/anthropic", Route: "/apps/anthropic", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Models: []Model{
|
},
|
||||||
{ID: "qwen3-coder-plus", Name: "Qwen3-Coder-Plus"},
|
"bailian": {
|
||||||
{ID: "qwen3-max-2026-01-23", Name: "Qwen3-Max-2026-01-23"},
|
Key: "bailian",
|
||||||
{ID: "qwen3-coder-next", Name: "Qwen3-Coder-Next"},
|
DisplayNameKey: "AIProviderBailian",
|
||||||
{ID: "glm-4.7", Name: "GLM-4.7"},
|
Sort: 80,
|
||||||
{ID: "kimi-k2.5", Name: "Kimi K2.5"},
|
DefaultAPIType: "openai-completions",
|
||||||
{ID: "qwen3.5-plus", Name: "Qwen3.5-Plus"},
|
EnvKey: "DASHSCOPE_API_KEY",
|
||||||
{ID: "glm-5", Name: "GLM-5"},
|
AccountTypes: []AccountTypePreset{
|
||||||
{ID: "qwen3.6-plus", Name: "Qwen3.6-Plus"},
|
{
|
||||||
{ID: "qwen3.7-plus", Name: "Qwen3.7-Plus"},
|
Key: "codingPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://coding.dashscope.aliyuncs.com/v1", Route: "/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://coding.dashscope.aliyuncs.com/apps/anthropic", Route: "/apps/anthropic", Discovery: "DiscoveryNone", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "tokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1", Route: "/compatible-mode/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/compatible-mode/v1", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1", Route: "/compatible-mode/v1", Discovery: "DiscoveryNone", DiscoveryRoute: "/compatible-mode/v1", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://token-plan.cn-beijing.maas.aliyuncs.com/apps/anthropic", Route: "/apps/anthropic", Discovery: "DiscoveryNone", DiscoveryRoute: "/compatible-mode/v1", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "dashscope-transcriptions", Purpose: "transcription", BaseURL: "https://token-plan.cn-beijing.maas.aliyuncs.com", Discovery: "DiscoveryNone", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "dashscope-speech", Purpose: "speech", BaseURL: "https://token-plan.cn-beijing.maas.aliyuncs.com", Discovery: "DiscoveryNone", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "payAsYouGo",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1", Route: "/compatible-mode/v1", Discovery: "DiscoveryDashScopeModels", DiscoveryRoute: "/compatible-mode/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1", Route: "/compatible-mode/v1", Discovery: "DiscoveryDashScopeModels", DiscoveryRoute: "/compatible-mode/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://dashscope.aliyuncs.com/apps/anthropic", Route: "/apps/anthropic", Discovery: "DiscoveryDashScopeModels", DiscoveryRoute: "/compatible-mode/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "dashscope-images", Purpose: "image", BaseURL: "https://dashscope.aliyuncs.com", Discovery: "DiscoveryDashScopeModels", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1", Route: "/compatible-mode/v1", Discovery: "DiscoveryDashScopeModels", DiscoveryRoute: "/compatible-mode/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "rerank", Purpose: "rerank", BaseURL: "https://dashscope.aliyuncs.com", Discovery: "DiscoveryNone", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "dashscope-transcriptions", Purpose: "transcription", BaseURL: "https://dashscope.aliyuncs.com", Discovery: "DiscoveryDashScopeModels", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "dashscope-speech", Purpose: "speech", BaseURL: "https://dashscope.aliyuncs.com", Discovery: "DiscoveryDashScopeModels", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ark-coding-plan": {
|
"ark-coding-plan": {
|
||||||
Key: "ark-coding-plan", DisplayNameKey: "AIProviderArkCodingPlan", Sort: 35, DefaultAPIType: "openai-completions", EnvKey: "ARK_API_KEY",
|
Key: "ark-coding-plan",
|
||||||
APIConfigs: []APIConfig{
|
DisplayNameKey: "AIProviderArkCodingPlan",
|
||||||
{APIType: "openai-completions", BaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3"},
|
Sort: 220,
|
||||||
anthropicAPIConfig("https://ark.cn-beijing.volces.com/api/coding", AuthModeBearer),
|
DefaultAPIType: "openai-completions",
|
||||||
},
|
EnvKey: "ARK_API_KEY",
|
||||||
Models: []Model{
|
AccountTypes: []AccountTypePreset{
|
||||||
{ID: "ark-code-latest", Name: "Ark Coding Plan"}, {ID: "doubao-seed-code", Name: "Doubao Seed Code"},
|
|
||||||
{ID: "glm-4.7", Name: "GLM 4.7 Coding"}, {ID: "kimi-k2-thinking", Name: "Kimi K2 Thinking"},
|
|
||||||
{ID: "kimi-k2.5", Name: "Kimi K2.5 Coding"}, {ID: "doubao-seed-code-preview-251028", Name: "Doubao Seed Code Preview"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"zai": {
|
|
||||||
Key: "zai", DisplayName: "Z.ai", Sort: 40, DefaultAPIType: "openai-completions", EnvKey: "ZAI_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{
|
|
||||||
{APIType: "openai-completions", BaseURL: "https://open.bigmodel.cn/api/paas/v4", EditableBaseURL: true},
|
|
||||||
{APIType: "openai-images", BaseURL: "https://open.bigmodel.cn/api/paas/v4", EditableBaseURL: true},
|
|
||||||
},
|
|
||||||
Models: []Model{{ID: "glm-5", Name: "GLM-5"}, {ID: "glm-4.7", Name: "GLM-4.7"}, {ID: "glm-4.7-flash", Name: "GLM-4.7-Flash"}, {ID: "glm-4.7-flashx", Name: "GLM-4.7-FlashX"}},
|
|
||||||
},
|
|
||||||
"minimax": {
|
|
||||||
Key: "minimax", DisplayName: "MiniMax (CN)", Sort: 45, DefaultAPIType: "anthropic-messages", EnvKey: "MINIMAX_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{
|
|
||||||
anthropicAPIConfig("https://api.minimaxi.com/anthropic", AuthModeXAPIKey, AuthModeBearer),
|
|
||||||
{APIType: "openai-completions", BaseURL: "https://api.minimaxi.com/v1"},
|
|
||||||
{APIType: "minimax-images", BaseURL: "https://api.minimaxi.com"},
|
|
||||||
},
|
|
||||||
Models: []Model{{ID: "MiniMax-M3.1-Flash", Name: "MiniMax M3.1 Flash"}, {ID: "MiniMax-M3", Name: "MiniMax M3"}},
|
|
||||||
},
|
|
||||||
"xiaomi": {
|
|
||||||
Key: "xiaomi", DisplayName: "Xiaomi", Sort: 46, DefaultAPIType: "openai-completions", EnvKey: "XIAOMI_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{
|
|
||||||
{APIType: "openai-completions", BaseURL: "https://api.xiaomimimo.com/v1"},
|
|
||||||
{APIType: "openai-responses", BaseURL: "https://api.xiaomimimo.com/v1"},
|
|
||||||
anthropicAPIConfig("https://api.xiaomimimo.com/anthropic", AuthModeBearer),
|
|
||||||
},
|
|
||||||
Models: []Model{{ID: "mimo-v2.5", Name: "Xiaomi MiMo V2.5"}, {ID: "mimo-v2.5-pro", Name: "Xiaomi MiMo V2.5 Pro"}},
|
|
||||||
},
|
|
||||||
"kimi": {
|
|
||||||
Key: "kimi", DisplayName: "Kimi (CN)", Sort: 50, DefaultAPIType: "openai-completions", EnvKey: "KIMI_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{{APIType: "openai-completions", BaseURL: "https://api.moonshot.cn/v1"}},
|
|
||||||
Models: []Model{{ID: "kimi-k2.5", Name: "Kimi K2.5"}, {ID: "kimi-k2-0905-preview", Name: "Kimi K2 0905 Preview"}, {ID: "kimi-k2-thinking", Name: "Kimi K2 Thinking"}},
|
|
||||||
},
|
|
||||||
"kimi-coding": {
|
|
||||||
Key: "kimi-coding", DisplayName: "Kimi Coding", Sort: 51, DefaultAPIType: "anthropic-messages", EnvKey: "KIMI_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{anthropicAPIConfig("https://api.kimi.com/coding/", AuthModeXAPIKey)},
|
|
||||||
Models: []Model{{ID: "kimi-code", Name: "Kimi Code"}, {ID: "k2p5", Name: "Kimi K2.5"}},
|
|
||||||
},
|
|
||||||
"openai": {
|
|
||||||
Key: "openai", DisplayName: "OpenAI", Sort: 55, DefaultAPIType: "openai-responses", EnvKey: "OPENAI_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{
|
|
||||||
{APIType: "openai-responses", BaseURL: "https://api.openai.com/v1"},
|
|
||||||
{APIType: "openai-completions", BaseURL: "https://api.openai.com/v1"},
|
|
||||||
{APIType: "openai-images", BaseURL: "https://api.openai.com/v1"},
|
|
||||||
{APIType: "openai-embeddings", BaseURL: "https://api.openai.com/v1", Models: []Model{
|
|
||||||
{ID: "text-embedding-3-small", Name: "text-embedding-3-small"},
|
|
||||||
{ID: "text-embedding-3-large", Name: "text-embedding-3-large"},
|
|
||||||
}},
|
|
||||||
},
|
|
||||||
Models: []Model{{ID: "gpt-5.4", Name: "gpt-5.4"}, {ID: "gpt-5.4-pro", Name: "gpt-5.4-pro"}, {ID: "gpt-5.4-mini", Name: "gpt-5.4-mini"}, {ID: "gpt-5.4-nano", Name: "gpt-5.4-nano"}},
|
|
||||||
},
|
|
||||||
"openrouter": {
|
|
||||||
Key: "openrouter", DisplayName: "OpenRouter", Sort: 56, DefaultAPIType: "openai-completions", EnvKey: "OPENROUTER_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{
|
|
||||||
{APIType: "openai-completions", BaseURL: "https://openrouter.ai/api/v1"},
|
|
||||||
{APIType: "openrouter-images", BaseURL: "https://openrouter.ai"},
|
|
||||||
},
|
|
||||||
Models: []Model{{ID: "openrouter/free", Name: "openrouter/free"}, {ID: "openrouter/auto", Name: "openrouter/auto"}},
|
|
||||||
},
|
|
||||||
"anthropic": {
|
|
||||||
Key: "anthropic", DisplayName: "Anthropic", Sort: 60, DefaultAPIType: "anthropic-messages", EnvKey: "ANTHROPIC_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{anthropicAPIConfig("https://api.anthropic.com", AuthModeXAPIKey)},
|
|
||||||
Models: []Model{{ID: "claude-sonnet-4-6", Name: "Claude Sonnet 4.6"}, {ID: "claude-opus-4-6", Name: "Claude Opus 4.6"}, {ID: "claude-opus-4-5", Name: "Claude Opus 4.5"}, {ID: "claude-sonnet-4-5", Name: "Claude Sonnet 4.5"}, {ID: "claude-haiku-4-5", Name: "Claude Haiku 4.5"}},
|
|
||||||
},
|
|
||||||
"gemini": {
|
|
||||||
Key: "gemini", DisplayName: "Gemini", Sort: 65, DefaultAPIType: "gemini-generate-content", EnvKey: "GEMINI_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{{APIType: "gemini-generate-content", BaseURL: "https://generativelanguage.googleapis.com"}},
|
|
||||||
Models: []Model{{ID: "gemini-3-flash-preview", Name: "Gemini 3 Flash Preview"}, {ID: "gemini-flash-latest", Name: "Gemini Flash Latest"}, {ID: "gemini-3-pro-preview", Name: "Gemini 3 Pro Preview"}},
|
|
||||||
},
|
|
||||||
"moonshot": {
|
|
||||||
Key: "moonshot", DisplayName: "Moonshot (Global)", Sort: 70, DefaultAPIType: "openai-completions", EnvKey: "MOONSHOT_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{{APIType: "openai-completions", BaseURL: "https://api.moonshot.ai/v1"}},
|
|
||||||
Models: []Model{{ID: "kimi-k2.5", Name: "Kimi K2.5"}, {ID: "kimi-k2-0905-preview", Name: "Kimi K2 0905 Preview"}, {ID: "kimi-k2-thinking", Name: "Kimi K2 Thinking"}},
|
|
||||||
},
|
|
||||||
"bailian": {
|
|
||||||
Key: "bailian", DisplayNameKey: "AIProviderBailian", Sort: 31, DefaultAPIType: "openai-completions", EnvKey: "DASHSCOPE_API_KEY",
|
|
||||||
APIConfigs: []APIConfig{
|
|
||||||
{
|
{
|
||||||
APIType: "openai-completions", BaseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
Key: "codingPlan",
|
||||||
DiscoverModels: true,
|
APIConfigs: []APIConfig{
|
||||||
Models: []Model{{ID: "qwen3.7-plus", Name: "qwen3.7-plus"}, {ID: "qwen3.6-plus", Name: "qwen3.6-plus"}, {ID: "qwen3.6-flash", Name: "qwen3.6-flash"}},
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", Route: "/api/coding/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
},
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", Route: "/api/coding/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
{
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/coding", Route: "/api/coding", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
APIType: "openai-responses", BaseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", Route: "/api/coding/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
DiscoverModels: true,
|
|
||||||
Models: []Model{{ID: "qwen3.7-plus", Name: "qwen3.7-plus"}, {ID: "qwen3.6-plus", Name: "qwen3.6-plus"}, {ID: "qwen3.6-flash", Name: "qwen3.6-flash"}},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
APIType: "anthropic-messages", BaseURL: "https://dashscope.aliyuncs.com/apps/anthropic",
|
|
||||||
DefaultAuthMode: AuthModeBearer,
|
|
||||||
AuthModes: []string{AuthModeBearer},
|
|
||||||
Models: []Model{{ID: "qwen3.7-plus", Name: "qwen3.7-plus"}, {ID: "qwen3.6-plus", Name: "qwen3.6-plus"}, {ID: "qwen3.6-flash", Name: "qwen3.6-flash"}},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
APIType: "dashscope-images", BaseURL: "https://dashscope.aliyuncs.com",
|
|
||||||
Models: []Model{
|
|
||||||
{ID: "qwen-image-2.0-pro", Name: "qwen-image-2.0-pro"},
|
|
||||||
{ID: "qwen-image-2.0", Name: "qwen-image-2.0"},
|
|
||||||
{ID: "wan2.7-image-pro", Name: "wan2.7-image-pro"},
|
|
||||||
{ID: "wan2.7-image", Name: "wan2.7-image"},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ark": {
|
"ark": {
|
||||||
Key: "ark", DisplayNameKey: "AIProviderArk", Sort: 36, DefaultAPIType: "openai-completions", EnvKey: "ARK_API_KEY",
|
Key: "ark",
|
||||||
APIConfigs: []APIConfig{
|
DisplayNameKey: "AIProviderArk",
|
||||||
|
Sort: 110,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "ARK_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
{
|
{
|
||||||
APIType: "openai-completions", BaseURL: "https://ark.cn-beijing.volces.com/api/v3",
|
Key: "codingPlan",
|
||||||
DiscoverModels: true,
|
APIConfigs: []APIConfig{
|
||||||
Models: []Model{{ID: "doubao-seed-2-0-pro-260215", Name: "doubao-seed-2-0-pro-260215"}, {ID: "doubao-seed-2-0-lite-260215", Name: "doubao-seed-2-0-lite-260215"}},
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", Route: "/api/coding/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", Route: "/api/coding/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/coding", Route: "/api/coding", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", Route: "/api/coding/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/coding/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
APIType: "openai-responses", BaseURL: "https://ark.cn-beijing.volces.com/api/v3",
|
Key: "agentPlan",
|
||||||
DiscoverModels: true,
|
APIConfigs: []APIConfig{
|
||||||
Models: []Model{{ID: "doubao-seed-2-0-pro-260215", Name: "doubao-seed-2-0-pro-260215"}, {ID: "doubao-seed-2-0-lite-260215", Name: "doubao-seed-2-0-lite-260215"}},
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/plan/v3", Route: "/api/plan/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/plan/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/plan/v3", Route: "/api/plan/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/plan/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/plan", Route: "/api/plan", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/plan/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", BaseURL: "https://ark.cn-beijing.volces.com/api/plan/v3", Route: "/api/plan/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/plan/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://ark.cn-beijing.volces.com/api/plan/v3", Route: "/api/plan/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/plan/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
APIType: "openai-images", BaseURL: "https://ark.cn-beijing.volces.com/api/v3",
|
Key: "payAsYouGo",
|
||||||
Models: []Model{
|
APIConfigs: []APIConfig{
|
||||||
{ID: "doubao-seedream-5-0-260128", Name: "doubao-seedream-5-0-260128"},
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/v3", Route: "/api/v3", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v3", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
{ID: "doubao-seedream-5-0-lite-260128", Name: "doubao-seedream-5-0-lite-260128"},
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://ark.cn-beijing.volces.com/api/v3", Route: "/api/v3", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v3", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
{ID: "doubao-seedream-4-5-251128", Name: "doubao-seedream-4-5-251128"},
|
{APIType: "openai-images", Purpose: "image", BaseURL: "https://ark.cn-beijing.volces.com/api/v3", Route: "/api/v3", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v3", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://ark.cn-beijing.volces.com/api/v3", Route: "/api/v3", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v3", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "speech",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "doubao-transcriptions", Purpose: "transcription", BaseURL: "https://openspeech.bytedance.com", Discovery: "DiscoveryNone", DiscoveryAuthMode: "x-api-key", DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
{APIType: "doubao-speech", Purpose: "speech", BaseURL: "https://openspeech.bytedance.com", Discovery: "DiscoveryNone", DiscoveryAuthMode: "x-api-key", DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"zai": {
|
||||||
|
Key: "zai",
|
||||||
|
DisplayName: "Z.ai",
|
||||||
|
Sort: 120,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "ZAI_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "chinaCodingPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://open.bigmodel.cn/api/coding/paas/v4", Route: "/api/coding/paas/v4", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/coding/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://open.bigmodel.cn/api/anthropic", Route: "/api/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/coding/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "globalCodingPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.z.ai/api/coding/paas/v4", Route: "/api/coding/paas/v4", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/coding/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.z.ai/api/anthropic", Route: "/api/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/coding/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "chinaApi",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://open.bigmodel.cn/api/paas/v4", Route: "/api/paas/v4", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://open.bigmodel.cn/api/anthropic", Route: "/api/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", BaseURL: "https://open.bigmodel.cn/api/paas/v4", Route: "/api/paas/v4", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/paas/v4", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "rerank", Purpose: "rerank", BaseURL: "https://open.bigmodel.cn/api/paas/v4", Route: "/api/paas/v4", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/paas/v4", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "globalApi",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.z.ai/api/paas/v4", Route: "/api/paas/v4", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.z.ai/api/anthropic", Route: "/api/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/paas/v4", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", BaseURL: "https://api.z.ai/api/paas/v4", Route: "/api/paas/v4", Discovery: "DiscoveryNone", DiscoveryRoute: "/api/paas/v4", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"minimax": {
|
||||||
|
Key: "minimax",
|
||||||
|
DisplayName: "MiniMax (CN)",
|
||||||
|
Sort: 130,
|
||||||
|
DefaultAPIType: "anthropic-messages",
|
||||||
|
EnvKey: "MINIMAX_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.minimaxi.com/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/anthropic", DiscoveryAuthMode: "x-api-key", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key", "bearer"}},
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.minimaxi.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/anthropic", DiscoveryAuthMode: "x-api-key", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://api.minimaxi.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/anthropic", DiscoveryAuthMode: "x-api-key", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "minimax-images", Purpose: "image", BaseURL: "https://api.minimaxi.com", Discovery: "DiscoveryNone", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "minimax-speech", Purpose: "speech", BaseURL: "https://api.minimaxi.com", Discovery: "DiscoveryNone", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"xiaomi": {
|
||||||
|
Key: "xiaomi",
|
||||||
|
DisplayName: "Xiaomi",
|
||||||
|
Sort: 140,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "XIAOMI_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "tokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://token-plan-cn.xiaomimimo.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://token-plan-cn.xiaomimimo.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://token-plan-cn.xiaomimimo.com/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", EditableBaseURL: true, DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "payAsYouGo",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.xiaomimimo.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://api.xiaomimimo.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.xiaomimimo.com/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "mimo-transcriptions", Purpose: "transcription", BaseURL: "https://api.xiaomimimo.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "mimo-speech", Purpose: "speech", BaseURL: "https://api.xiaomimimo.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"kimi": {
|
||||||
|
Key: "kimi",
|
||||||
|
DisplayName: "Kimi (CN)",
|
||||||
|
Sort: 150,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "KIMI_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "chinaTokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.kimi.com/coding/v1", Route: "/coding/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/coding/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.kimi.com/coding", Route: "/coding", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/coding/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key", "bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "globalTokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.kimi.com/coding/v1", Route: "/coding/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/coding/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.kimi.com/coding", Route: "/coding", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/coding/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key", "bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "chinaApi",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.moonshot.cn/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.moonshot.cn/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "globalApi",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.moonshot.ai/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.moonshot.ai/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"kimi-coding": {
|
||||||
|
Key: "kimi-coding",
|
||||||
|
DisplayName: "Kimi Coding",
|
||||||
|
Sort: 230,
|
||||||
|
DefaultAPIType: "anthropic-messages",
|
||||||
|
EnvKey: "KIMI_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "chinaTokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.kimi.com/coding/v1", Route: "/coding/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/coding/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.kimi.com/coding", Route: "/coding", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/coding/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key", "bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"openai": {
|
||||||
|
Key: "openai",
|
||||||
|
DisplayName: "OpenAI",
|
||||||
|
Sort: 170,
|
||||||
|
DefaultAPIType: "openai-responses",
|
||||||
|
EnvKey: "OPENAI_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://api.openai.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.openai.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", BaseURL: "https://api.openai.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://api.openai.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-transcriptions", Purpose: "transcription", BaseURL: "https://api.openai.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-speech", Purpose: "speech", BaseURL: "https://api.openai.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"openrouter": {
|
||||||
|
Key: "openrouter",
|
||||||
|
DisplayName: "OpenRouter",
|
||||||
|
Sort: 180,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "OPENROUTER_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://openrouter.ai/api/v1", Route: "/api/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://openrouter.ai/api/v1", Route: "/api/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://openrouter.ai/api", Route: "/api", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openrouter-images", Purpose: "image", BaseURL: "https://openrouter.ai", Discovery: "DiscoveryOpenAIModels", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://openrouter.ai/api/v1", Route: "/api/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "rerank", Purpose: "rerank", BaseURL: "https://openrouter.ai/api/v1", Route: "/api/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-transcriptions", Purpose: "transcription", BaseURL: "https://openrouter.ai/api/v1", Route: "/api/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-speech", Purpose: "speech", BaseURL: "https://openrouter.ai/api/v1", Route: "/api/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/api/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"anthropic": {
|
||||||
|
Key: "anthropic",
|
||||||
|
DisplayName: "Anthropic",
|
||||||
|
Sort: 190,
|
||||||
|
DefaultAPIType: "anthropic-messages",
|
||||||
|
EnvKey: "ANTHROPIC_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.anthropic.com", Discovery: "DiscoveryAnthropicModels", DiscoveryAuthMode: "x-api-key", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"gemini": {
|
||||||
|
Key: "gemini",
|
||||||
|
DisplayName: "Gemini",
|
||||||
|
Sort: 200,
|
||||||
|
DefaultAPIType: "gemini-generate-content",
|
||||||
|
EnvKey: "GEMINI_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "gemini-generate-content", Purpose: "text", BaseURL: "https://generativelanguage.googleapis.com", Discovery: "DiscoveryGeminiModels", DiscoveryAuthMode: "x-goog-api-key", DiscoverModels: true, DefaultAuthMode: "x-goog-api-key", AuthModes: []string{"x-goog-api-key"}},
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://generativelanguage.googleapis.com/v1beta/openai", Route: "/v1beta/openai", Discovery: "DiscoveryGeminiModels", DiscoveryAuthMode: "x-goog-api-key", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "gemini-speech", Purpose: "speech", BaseURL: "https://generativelanguage.googleapis.com", Discovery: "DiscoveryGeminiModels", DiscoveryAuthMode: "x-goog-api-key", DiscoverModels: true, DefaultAuthMode: "x-goog-api-key", AuthModes: []string{"x-goog-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"moonshot": {
|
||||||
|
Key: "moonshot",
|
||||||
|
DisplayName: "Moonshot (Global)",
|
||||||
|
Sort: 240,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
EnvKey: "MOONSHOT_API_KEY",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "globalApi",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.moonshot.ai/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.moonshot.ai/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"llmman": {
|
||||||
|
Key: "llmman",
|
||||||
|
DisplayName: "llmman",
|
||||||
|
Sort: 250,
|
||||||
|
DefaultAPIType: "openai-responses",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "http://127.0.0.1:17434/v1", EditableBaseURL: true, DiscoverModels: true},
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "http://127.0.0.1:17434/v1", EditableBaseURL: true, DiscoverModels: true},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "http://127.0.0.1:17434/v1", EditableBaseURL: true},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"tokenhub": {
|
||||||
|
Key: "tokenhub",
|
||||||
|
DisplayName: "TokenHub",
|
||||||
|
Sort: 70,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "chinaTokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://tokenhub.tencentmaas.com/plan/v3", Route: "/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://tokenhub.tencentmaas.com/plan/anthropic", Route: "/anthropic", Discovery: "DiscoveryNone", DiscoveryRoute: "/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "globalTokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://tokenhub-intl.tencentmaas.com/plan/v3", Route: "/v3", Discovery: "DiscoveryNone", DiscoveryRoute: "/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://tokenhub-intl.tencentmaas.com/plan/anthropic", Route: "/anthropic", Discovery: "DiscoveryNone", DiscoveryRoute: "/v3", DiscoveryAuthMode: "bearer", DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "chinaApi",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://tokenhub.tencentmaas.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://tokenhub.tencentmaas.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://tokenhub.tencentmaas.com", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
{APIType: "tokenhub-images", Purpose: "image", BaseURL: "https://tokenhub.tencentmaas.com", Discovery: "DiscoveryOpenAIModels", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://tokenhub.tencentmaas.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "tokenhub-transcriptions", Purpose: "transcription", BaseURL: "https://tokenhub.tencentmaas.com", Discovery: "DiscoveryOpenAIModels", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "tokenhub-speech", Purpose: "speech", BaseURL: "https://tokenhub.tencentmaas.com", Discovery: "DiscoveryOpenAIModels", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "globalApi",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://tokenhub-intl.tencentmaas.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://tokenhub-intl.tencentmaas.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://tokenhub-intl.tencentmaas.com", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://tokenhub-intl.tencentmaas.com/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"qianfan": {
|
||||||
|
Key: "qianfan",
|
||||||
|
DisplayName: "百度千帆",
|
||||||
|
Sort: 90,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "codingPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://qianfan.baidubce.com/v2/coding", Route: "/v2/coding", Discovery: "DiscoveryNone", DiscoveryRoute: "/v2/coding", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://qianfan.baidubce.com/anthropic/coding", Route: "/anthropic/coding", Discovery: "DiscoveryNone", DiscoveryRoute: "/v2/coding", DiscoveryAuthMode: "bearer", DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "tokenPlan",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://qianfan.baidubce.com/v2", Route: "/v2", Discovery: "DiscoveryNone", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://qianfan.baidubce.com/anthropic", Route: "/anthropic", Discovery: "DiscoveryNone", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "payAsYouGo",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://qianfan.baidubce.com/v2", Route: "/v2", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://qianfan.baidubce.com/v2", Route: "/v2", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://qianfan.baidubce.com/anthropic", Route: "/anthropic", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
{APIType: "openai-images", Purpose: "image", BaseURL: "https://qianfan.baidubce.com/v2", Route: "/v2", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://qianfan.baidubce.com/v2", Route: "/v2", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "rerank", Purpose: "rerank", BaseURL: "https://qianfan.baidubce.com/v2", Route: "/v2", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v2", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"siliconflow": {
|
||||||
|
Key: "siliconflow",
|
||||||
|
DisplayName: "SiliconFlow",
|
||||||
|
Sort: 100,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "default",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://api.siliconflow.cn/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://api.siliconflow.cn", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "siliconflow-images", Purpose: "image", BaseURL: "https://api.siliconflow.cn/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-embeddings", Purpose: "embedding", BaseURL: "https://api.siliconflow.cn/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "rerank", Purpose: "rerank", BaseURL: "https://api.siliconflow.cn/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-transcriptions", Purpose: "transcription", BaseURL: "https://api.siliconflow.cn/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-speech", Purpose: "speech", BaseURL: "https://api.siliconflow.cn/v1", Route: "/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"opencode": {
|
||||||
|
Key: "opencode",
|
||||||
|
DisplayName: "OpenCode",
|
||||||
|
Sort: 160,
|
||||||
|
DefaultAPIType: "openai-completions",
|
||||||
|
AccountTypes: []AccountTypePreset{
|
||||||
|
{
|
||||||
|
Key: "go",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://opencode.ai/zen/go/v1", Route: "/zen/go/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/zen/go/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://opencode.ai/zen/go/v1", Route: "/zen/go/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/zen/go/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://opencode.ai/zen/go", Route: "/zen/go", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/zen/go/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "zen",
|
||||||
|
APIConfigs: []APIConfig{
|
||||||
|
{APIType: "openai-completions", Purpose: "text", BaseURL: "https://opencode.ai/zen/v1", Route: "/zen/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/zen/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "openai-responses", Purpose: "text", BaseURL: "https://opencode.ai/zen/v1", Route: "/zen/v1", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/zen/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "bearer", AuthModes: []string{"bearer"}},
|
||||||
|
{APIType: "anthropic-messages", Purpose: "text", BaseURL: "https://opencode.ai/zen", Route: "/zen", Discovery: "DiscoveryOpenAIModels", DiscoveryRoute: "/zen/v1", DiscoveryAuthMode: "bearer", DiscoverModels: true, DefaultAuthMode: "x-api-key", AuthModes: []string{"x-api-key"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
func editableAPIConfigs(discoverModels bool, apiTypes ...string) []APIConfig {
|
|
||||||
configs := make([]APIConfig, 0, len(apiTypes))
|
|
||||||
for _, apiType := range apiTypes {
|
|
||||||
if apiType == "anthropic-messages" {
|
|
||||||
config := anthropicAPIConfig("", AuthModeXAPIKey, AuthModeBearer)
|
|
||||||
config.EditableBaseURL = true
|
|
||||||
configs = append(configs, config)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
configs = append(configs, APIConfig{
|
|
||||||
APIType: apiType,
|
|
||||||
EditableBaseURL: true,
|
|
||||||
DiscoverModels: discoverModels && (apiType == "openai-completions" || apiType == "openai-responses"),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return configs
|
|
||||||
}
|
|
||||||
|
|
||||||
func anthropicAPIConfig(baseURL, defaultAuthMode string, additionalAuthModes ...string) APIConfig {
|
|
||||||
authModes := []string{defaultAuthMode}
|
|
||||||
for _, authMode := range additionalAuthModes {
|
|
||||||
if authMode != defaultAuthMode {
|
|
||||||
authModes = append(authModes, authMode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return APIConfig{
|
|
||||||
APIType: "anthropic-messages",
|
|
||||||
BaseURL: baseURL,
|
|
||||||
DefaultAuthMode: defaultAuthMode,
|
|
||||||
AuthModes: authModes,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Get(key string) (Meta, bool) {
|
func Get(key string) (Meta, bool) {
|
||||||
@@ -269,18 +626,18 @@ func Get(key string) (Meta, bool) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return Meta{}, false
|
return Meta{}, false
|
||||||
}
|
}
|
||||||
return cloneMeta(meta), true
|
return meta, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func All() map[string]Meta {
|
func All() map[string]Meta {
|
||||||
result := make(map[string]Meta, len(catalog))
|
result := make(map[string]Meta, len(catalog))
|
||||||
for key, meta := range catalog {
|
for key, meta := range catalog {
|
||||||
result[key] = cloneMeta(meta)
|
result[key] = meta
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func FindAPIConfig(key, apiType string) (APIConfig, bool) {
|
func FindAPIConfig(key, apiType string, accountType ...string) (APIConfig, bool) {
|
||||||
meta, ok := catalog[key]
|
meta, ok := catalog[key]
|
||||||
if !ok {
|
if !ok {
|
||||||
return APIConfig{}, false
|
return APIConfig{}, false
|
||||||
@@ -289,42 +646,27 @@ func FindAPIConfig(key, apiType string) (APIConfig, bool) {
|
|||||||
if target == "" {
|
if target == "" {
|
||||||
target = meta.DefaultAPIType
|
target = meta.DefaultAPIType
|
||||||
}
|
}
|
||||||
for _, config := range meta.APIConfigs {
|
presets := meta.AccountTypes
|
||||||
if config.APIType == target {
|
if len(accountType) > 0 {
|
||||||
config.AuthModes = append([]string(nil), config.AuthModes...)
|
preset, ok := FindAccountType(key, accountType[0])
|
||||||
config.Models = append([]Model(nil), config.Models...)
|
if !ok {
|
||||||
return config, true
|
return APIConfig{}, false
|
||||||
|
}
|
||||||
|
presets = []AccountTypePreset{preset}
|
||||||
|
}
|
||||||
|
for _, preset := range presets {
|
||||||
|
for _, config := range preset.APIConfigs {
|
||||||
|
if config.APIType == target {
|
||||||
|
config.AuthModes = append([]string(nil), config.AuthModes...)
|
||||||
|
return config, true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return APIConfig{}, false
|
return APIConfig{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultModels(key, apiType string) []Model {
|
func ResolveAuthMode(provider, apiType, requested string, accountType ...string) (string, error) {
|
||||||
meta, ok := catalog[key]
|
config, ok := FindAPIConfig(provider, apiType, accountType...)
|
||||||
if !ok {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
target := strings.TrimSpace(apiType)
|
|
||||||
if target == "" {
|
|
||||||
target = meta.DefaultAPIType
|
|
||||||
}
|
|
||||||
for _, config := range meta.APIConfigs {
|
|
||||||
if config.APIType != target {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if len(config.Models) > 0 {
|
|
||||||
return append([]Model(nil), config.Models...)
|
|
||||||
}
|
|
||||||
if IsImageAPIType(config.APIType) || IsEmbeddingAPIType(config.APIType) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return append([]Model(nil), meta.Models...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ResolveAuthMode(provider, apiType, requested string) (string, error) {
|
|
||||||
config, ok := FindAPIConfig(provider, apiType)
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", fmt.Errorf("provider %s does not support api type %s", provider, apiType)
|
return "", fmt.Errorf("provider %s does not support api type %s", provider, apiType)
|
||||||
}
|
}
|
||||||
@@ -359,8 +701,8 @@ func DefaultAPIType(key string) string {
|
|||||||
return meta.DefaultAPIType
|
return meta.DefaultAPIType
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResolveBaseURL(key, apiType, requested string) (string, error) {
|
func ResolveBaseURL(key, apiType, requested string, accountType ...string) (string, error) {
|
||||||
config, ok := FindAPIConfig(key, apiType)
|
config, ok := FindAPIConfig(key, apiType, accountType...)
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", fmt.Errorf("provider %s does not support api type %s", key, apiType)
|
return "", fmt.Errorf("provider %s does not support api type %s", key, apiType)
|
||||||
}
|
}
|
||||||
@@ -417,7 +759,7 @@ func IsEmbeddingAPIType(apiType string) bool {
|
|||||||
|
|
||||||
func IsImageAPIType(apiType string) bool {
|
func IsImageAPIType(apiType string) bool {
|
||||||
switch apiType {
|
switch apiType {
|
||||||
case "openai-images", "dashscope-images", "minimax-images", "openrouter-images":
|
case "openai-images", "dashscope-images", "minimax-images", "openrouter-images", "tokenhub-images", "siliconflow-images":
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
@@ -481,15 +823,3 @@ var legacyModelPrefixes = map[string][]string{
|
|||||||
"gemini": {"google", "gemini"},
|
"gemini": {"google", "gemini"},
|
||||||
"moonshot": {"moonshot"},
|
"moonshot": {"moonshot"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func cloneMeta(meta Meta) Meta {
|
|
||||||
clone := meta
|
|
||||||
clone.APIConfigs = make([]APIConfig, len(meta.APIConfigs))
|
|
||||||
for index, config := range meta.APIConfigs {
|
|
||||||
clone.APIConfigs[index] = config
|
|
||||||
clone.APIConfigs[index].AuthModes = append([]string(nil), config.AuthModes...)
|
|
||||||
clone.APIConfigs[index].Models = append([]Model(nil), config.Models...)
|
|
||||||
}
|
|
||||||
clone.Models = append([]Model(nil), meta.Models...)
|
|
||||||
return clone
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package provider
|
package provider
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -65,17 +67,26 @@ func DiscoverModels(baseURL, apiKey string) ([]string, error) {
|
|||||||
|
|
||||||
func buildModelDiscoveryURL(baseURL string) string {
|
func buildModelDiscoveryURL(baseURL string) string {
|
||||||
base := strings.TrimRight(strings.TrimSpace(baseURL), "/")
|
base := strings.TrimRight(strings.TrimSpace(baseURL), "/")
|
||||||
for _, apiType := range []string{"openai-completions", "openai-responses", "anthropic-messages"} {
|
parsed, err := url.Parse(base)
|
||||||
base = normalizeEndpointPath(apiType, base)
|
if err != nil {
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case strings.HasSuffix(base, "/models"):
|
|
||||||
return base
|
return base
|
||||||
case hasAPIVersionSuffix(base):
|
|
||||||
return base + "/models"
|
|
||||||
default:
|
|
||||||
return base + "/v1/models"
|
|
||||||
}
|
}
|
||||||
|
path := strings.TrimRight(parsed.Path, "/")
|
||||||
|
for _, suffix := range []string{"/chat/completions", "/responses", "/messages", "/images/generations", "/embeddings"} {
|
||||||
|
if strings.HasSuffix(strings.ToLower(path), suffix) {
|
||||||
|
path = path[:len(path)-len(suffix)]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !strings.HasSuffix(path, "/models") {
|
||||||
|
if !hasAPIVersionSuffix(path) {
|
||||||
|
path += "/v1"
|
||||||
|
}
|
||||||
|
path += "/models"
|
||||||
|
}
|
||||||
|
parsed.Path = path
|
||||||
|
parsed.RawPath = ""
|
||||||
|
return parsed.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasAPIVersionSuffix(value string) bool {
|
func hasAPIVersionSuffix(value string) bool {
|
||||||
@@ -86,3 +97,161 @@ func hasAPIVersionSuffix(value string) bool {
|
|||||||
_, err := strconv.Atoi(segment[1:])
|
_, err := strconv.Atoi(segment[1:])
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DiscoverProtocolModels(provider string, config APIConfig, baseURL, apiKey, authMode string) ([]string, error) {
|
||||||
|
if baseURL == "" {
|
||||||
|
baseURL = config.BaseURL
|
||||||
|
}
|
||||||
|
if config.DiscoveryAuthMode != "" && provider != "custom" && provider != "vllm" {
|
||||||
|
authMode = config.DiscoveryAuthMode
|
||||||
|
}
|
||||||
|
if config.Route != config.DiscoveryRoute && provider != "custom" && provider != "vllm" && config.Discovery != "DiscoveryOllamaModels" {
|
||||||
|
baseURL = strings.TrimSuffix(strings.TrimRight(baseURL, "/"), config.Route) + config.DiscoveryRoute
|
||||||
|
}
|
||||||
|
endpoint := buildModelDiscoveryURL(baseURL)
|
||||||
|
strategy := config.Discovery
|
||||||
|
root, err := url.Parse(baseURL)
|
||||||
|
if err != nil {
|
||||||
|
return nil, aihttp.ErrTarget
|
||||||
|
}
|
||||||
|
root.Path, root.RawQuery = "", ""
|
||||||
|
switch strategy {
|
||||||
|
case "DiscoveryGeminiModels":
|
||||||
|
endpoint = root.String() + "/v1beta/models?pageSize=100"
|
||||||
|
authMode = "x-goog-api-key"
|
||||||
|
case "DiscoveryAnthropicModels":
|
||||||
|
endpoint = strings.TrimRight(baseURL, "/") + "/v1/models?limit=100"
|
||||||
|
case "DiscoveryOllamaModels":
|
||||||
|
endpoint = strings.TrimSuffix(strings.TrimRight(baseURL, "/"), "/v1") + "/api/tags"
|
||||||
|
case "DiscoveryDashScopeModels":
|
||||||
|
if config.Purpose == "text" {
|
||||||
|
endpoint = root.String() + "/compatible-mode/v1/models"
|
||||||
|
strategy = "DiscoveryOpenAIModels"
|
||||||
|
} else {
|
||||||
|
endpoint = root.String() + "/api/v1/models?page_size=100&page_no=1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if provider == "deepseek" {
|
||||||
|
endpoint = root.String() + "/models"
|
||||||
|
}
|
||||||
|
if provider == "minimax" {
|
||||||
|
endpoint = root.String() + "/v1/models"
|
||||||
|
authMode = "bearer"
|
||||||
|
}
|
||||||
|
if provider == "openrouter" {
|
||||||
|
endpoint = root.String() + "/api/v1/models?output_modalities=" + url.QueryEscape(config.Purpose)
|
||||||
|
if config.Purpose == "embedding" {
|
||||||
|
endpoint = root.String() + "/api/v1/models?output_modalities=embeddings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result := []string{}
|
||||||
|
seen := map[string]bool{}
|
||||||
|
seenPages := map[string]bool{}
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), defaultVerifyTimeout)
|
||||||
|
defer cancel()
|
||||||
|
for page := 0; page < 50; page++ {
|
||||||
|
if seenPages[endpoint] {
|
||||||
|
return nil, aihttp.ErrResponse
|
||||||
|
}
|
||||||
|
seenPages[endpoint] = true
|
||||||
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, aihttp.ErrTarget
|
||||||
|
}
|
||||||
|
if apiKey != "" {
|
||||||
|
switch authMode {
|
||||||
|
case "x-api-key":
|
||||||
|
req.Header.Set("x-api-key", apiKey)
|
||||||
|
case "x-goog-api-key":
|
||||||
|
req.Header.Set("x-goog-api-key", apiKey)
|
||||||
|
default:
|
||||||
|
req.Header.Set("Authorization", "Bearer "+apiKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
req.Header.Set("anthropic-version", "2023-06-01")
|
||||||
|
response, err := aihttp.NewClient(defaultVerifyTimeout).Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, aihttp.SafeError(err, endpoint, apiKey)
|
||||||
|
}
|
||||||
|
body, readErr := aihttp.ReadResponseBody(response.Body)
|
||||||
|
response.Body.Close()
|
||||||
|
if readErr != nil {
|
||||||
|
return nil, readErr
|
||||||
|
}
|
||||||
|
if response.StatusCode != http.StatusOK {
|
||||||
|
return nil, aihttp.HTTPError(response.StatusCode, body, endpoint, apiKey)
|
||||||
|
}
|
||||||
|
var payload struct {
|
||||||
|
Data []struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
} `json:"data"`
|
||||||
|
Models []struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
} `json:"models"`
|
||||||
|
HasMore bool `json:"has_more"`
|
||||||
|
LastID string `json:"last_id"`
|
||||||
|
NextPageToken string `json:"nextPageToken"`
|
||||||
|
Output struct {
|
||||||
|
Models []struct {
|
||||||
|
Model string `json:"model"`
|
||||||
|
Capabilities []string `json:"capabilities"`
|
||||||
|
} `json:"models"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
Page int `json:"page_no"`
|
||||||
|
} `json:"output"`
|
||||||
|
}
|
||||||
|
if json.Unmarshal(body, &payload) != nil {
|
||||||
|
return nil, aihttp.ErrResponse
|
||||||
|
}
|
||||||
|
ids := []string{}
|
||||||
|
for _, row := range payload.Output.Models {
|
||||||
|
for _, capability := range row.Capabilities {
|
||||||
|
if map[string]string{"TG": "text", "IG": "image", "TR": "embedding", "ME": "embedding", "ASR": "transcription", "TTS": "speech"}[capability] == config.Purpose {
|
||||||
|
ids = append(ids, row.Model)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, row := range payload.Data {
|
||||||
|
ids = append(ids, row.ID)
|
||||||
|
}
|
||||||
|
for _, row := range payload.Models {
|
||||||
|
id := row.Name
|
||||||
|
if row.Model != "" {
|
||||||
|
id = row.Model
|
||||||
|
}
|
||||||
|
ids = append(ids, strings.TrimPrefix(id, "models/"))
|
||||||
|
}
|
||||||
|
for _, id := range ids {
|
||||||
|
id = strings.TrimSpace(id)
|
||||||
|
if id == "" || len(id) > 512 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !seen[id] {
|
||||||
|
result = append(result, id)
|
||||||
|
seen[id] = true
|
||||||
|
}
|
||||||
|
if len(result) > aihttp.MaxDiscoveredModels {
|
||||||
|
return nil, fmt.Errorf("model discovery exceeded the model limit")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next, _ := url.Parse(endpoint)
|
||||||
|
query := next.Query()
|
||||||
|
if strategy == "DiscoveryAnthropicModels" && payload.HasMore && payload.LastID != "" {
|
||||||
|
query.Set("after_id", payload.LastID)
|
||||||
|
} else if strategy == "DiscoveryGeminiModels" && payload.NextPageToken != "" {
|
||||||
|
query.Set("pageToken", payload.NextPageToken)
|
||||||
|
} else if strategy == "DiscoveryDashScopeModels" && payload.Output.Page*100 < payload.Output.Total {
|
||||||
|
if payload.Output.Page < 1 || len(payload.Output.Models) == 0 {
|
||||||
|
return nil, aihttp.ErrResponse
|
||||||
|
}
|
||||||
|
query.Set("page_no", strconv.Itoa(payload.Output.Page+1))
|
||||||
|
} else {
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
next.RawQuery = query.Encode()
|
||||||
|
endpoint = next.String()
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("model discovery exceeded the page limit")
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func BuildTextRequestURL(apiType, baseURL, model string) string {
|
||||||
|
baseURL = strings.TrimRight(strings.TrimSpace(baseURL), "/")
|
||||||
|
parsed, err := url.Parse(baseURL)
|
||||||
|
if err != nil {
|
||||||
|
return baseURL
|
||||||
|
}
|
||||||
|
path := strings.TrimRight(parsed.Path, "/")
|
||||||
|
var endpoint string
|
||||||
|
switch apiType {
|
||||||
|
case "openai-completions":
|
||||||
|
endpoint = "/chat/completions"
|
||||||
|
case "openai-responses":
|
||||||
|
endpoint = "/responses"
|
||||||
|
case "anthropic-messages":
|
||||||
|
endpoint = "/messages"
|
||||||
|
case "gemini-generate-content":
|
||||||
|
if strings.Contains(path, "/models/") && strings.HasSuffix(path, ":generateContent") {
|
||||||
|
return parsed.String()
|
||||||
|
}
|
||||||
|
if !strings.HasSuffix(path, "/v1beta") {
|
||||||
|
path += "/v1beta"
|
||||||
|
}
|
||||||
|
parsed.Path = path + "/models/" + strings.TrimSpace(model) + ":generateContent"
|
||||||
|
parsed.RawPath = ""
|
||||||
|
return parsed.String()
|
||||||
|
default:
|
||||||
|
return baseURL
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(path, endpoint) {
|
||||||
|
return parsed.String()
|
||||||
|
}
|
||||||
|
versioned := false
|
||||||
|
for _, segment := range strings.Split(path, "/") {
|
||||||
|
if hasAPIVersionSuffix(segment) || segment == "v1beta" {
|
||||||
|
versioned = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (apiType == "anthropic-messages" && !strings.HasSuffix(path, "/v1")) || (apiType != "anthropic-messages" && !versioned) {
|
||||||
|
path += "/v1"
|
||||||
|
}
|
||||||
|
parsed.Path = path + endpoint
|
||||||
|
parsed.RawPath = ""
|
||||||
|
return parsed.String()
|
||||||
|
}
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
package provider
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
|
||||||
"net/http/httptest"
|
|
||||||
"reflect"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestMiniMaxCatalog(t *testing.T) {
|
|
||||||
meta, ok := Get("minimax")
|
|
||||||
if !ok || !reflect.DeepEqual(meta.Models, []Model{{ID: "MiniMax-M3.1-Flash", Name: "MiniMax M3.1 Flash"}, {ID: "MiniMax-M3", Name: "MiniMax M3"}}) {
|
|
||||||
t.Fatalf("unexpected MiniMax models: %+v", meta.Models)
|
|
||||||
}
|
|
||||||
if meta.DefaultAPIType != "anthropic-messages" {
|
|
||||||
t.Fatalf("changed default protocol: %s", meta.DefaultAPIType)
|
|
||||||
}
|
|
||||||
for _, provider := range All() {
|
|
||||||
for _, model := range provider.Models {
|
|
||||||
if strings.Contains(strings.ToLower(model.ID), "minimax") && model.ID != "MiniMax-M3.1-Flash" && model.ID != "MiniMax-M3" {
|
|
||||||
t.Errorf("legacy suggestion in %s: %s", provider.Key, model.ID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMiniMaxVerificationRequests(t *testing.T) {
|
|
||||||
for _, region := range []string{"https://api.minimaxi.com", "https://api.minimax.io"} {
|
|
||||||
for _, protocol := range []string{"anthropic-messages", "openai-completions"} {
|
|
||||||
for _, auth := range []string{AuthModeXAPIKey, AuthModeBearer} {
|
|
||||||
for _, model := range []string{"MiniMax-M3.1-Flash", "MiniMax-M3", "MiniMax-M2.7", "MiniMax-M2.7-highspeed", "custom-model"} {
|
|
||||||
t.Run(region+"/"+protocol+"/"+auth+"/"+model, func(t *testing.T) {
|
|
||||||
base, endpoint := region+"/v1", "/chat/completions"
|
|
||||||
if protocol == "anthropic-messages" {
|
|
||||||
base, endpoint = region+"/anthropic", "/v1/messages"
|
|
||||||
}
|
|
||||||
built := BuildVerifyRequest("minimax", protocol, auth, base, "test-key", model)
|
|
||||||
if built.URL != base+endpoint {
|
|
||||||
t.Fatalf("URL = %s", built.URL)
|
|
||||||
}
|
|
||||||
var captured map[string]interface{}
|
|
||||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if r.Method != http.MethodPost || r.URL.Path != strings.TrimPrefix(base, region)+endpoint {
|
|
||||||
t.Errorf("unexpected request: %s %s", r.Method, r.URL.Path)
|
|
||||||
}
|
|
||||||
if protocol == "anthropic-messages" && auth == AuthModeXAPIKey {
|
|
||||||
if r.Header.Get("x-api-key") != "test-key" || r.Header.Get("Authorization") != "" {
|
|
||||||
t.Error("incorrect API key authentication")
|
|
||||||
}
|
|
||||||
} else if r.Header.Get("Authorization") != "Bearer test-key" {
|
|
||||||
t.Error("incorrect bearer authentication")
|
|
||||||
}
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&captured); err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
}
|
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
}))
|
|
||||||
defer server.Close()
|
|
||||||
if err := VerifyAccount("minimax", protocol, auth, server.URL+strings.TrimPrefix(base, region), "test-key", model); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if captured["model"] != model || captured["stream"] != false || captured["max_tokens"] != float64(defaultVerifyMaxTokens) {
|
|
||||||
t.Fatalf("unexpected serialized body: %#v", captured)
|
|
||||||
}
|
|
||||||
if model == "MiniMax-M3.1-Flash" {
|
|
||||||
if protocol == "anthropic-messages" {
|
|
||||||
if !reflect.DeepEqual(captured["thinking"], map[string]interface{}{"type": "adaptive"}) || !reflect.DeepEqual(captured["output_config"], map[string]interface{}{"effort": "max"}) || captured["reasoning_effort"] != nil {
|
|
||||||
t.Fatalf("invalid Anthropic Flash reasoning: %#v", captured)
|
|
||||||
}
|
|
||||||
} else if captured["reasoning_effort"] != "max" || captured["thinking"] != nil || captured["output_config"] != nil {
|
|
||||||
t.Fatalf("invalid OpenAI Flash reasoning: %#v", captured)
|
|
||||||
}
|
|
||||||
} else if captured["reasoning_effort"] != nil || captured["thinking"] != nil || captured["output_config"] != nil {
|
|
||||||
t.Fatalf("changed legacy/custom reasoning: %#v", captured)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMiniMaxExplicitGatewayAndCustomModels(t *testing.T) {
|
|
||||||
for _, provider := range []string{"bailian-coding-plan", "custom", "openrouter"} {
|
|
||||||
for _, protocol := range []string{"openai-completions", "anthropic-messages"} {
|
|
||||||
for _, model := range []string{"MiniMax-M2.5", "MiniMax-M3.1-Flash", "my-custom-model"} {
|
|
||||||
request := BuildVerifyRequest(provider, protocol, AuthModeBearer, "https://example.test/v1", "test-key", model)
|
|
||||||
var body map[string]interface{}
|
|
||||||
if err := json.Unmarshal(request.Body, &body); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if body["model"] != model || body["reasoning_effort"] != nil || body["output_config"] != nil || body["thinking"] != nil {
|
|
||||||
t.Fatalf("changed explicit %s request: %#v", provider, body)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,7 @@ func BuildOpenClawProviderPatch(provider, modelName, apiType, authMode, baseURL,
|
|||||||
if _, ok := FindAPIConfig(provider, resolvedAPIType); !ok {
|
if _, ok := FindAPIConfig(provider, resolvedAPIType); !ok {
|
||||||
resolvedAPIType = DefaultAPIType(provider)
|
resolvedAPIType = DefaultAPIType(provider)
|
||||||
}
|
}
|
||||||
if IsImageAPIType(resolvedAPIType) || IsEmbeddingAPIType(resolvedAPIType) {
|
if Purpose(resolvedAPIType) != "text" {
|
||||||
return nil, fmt.Errorf("api type %s does not support text generation", resolvedAPIType)
|
return nil, fmt.Errorf("api type %s does not support text generation", resolvedAPIType)
|
||||||
}
|
}
|
||||||
resolvedAuthMode, err := ResolveAuthMode(provider, resolvedAPIType, authMode)
|
resolvedAuthMode, err := ResolveAuthMode(provider, resolvedAPIType, authMode)
|
||||||
@@ -37,12 +37,12 @@ func BuildOpenClawProviderPatch(provider, modelName, apiType, authMode, baseURL,
|
|||||||
switch provider {
|
switch provider {
|
||||||
case "gemini":
|
case "gemini":
|
||||||
providerKey = "google"
|
providerKey = "google"
|
||||||
resolvedAPIType = "google-generative-ai"
|
if resolvedAPIType == "gemini-generate-content" {
|
||||||
|
resolvedAPIType = "google-generative-ai"
|
||||||
|
}
|
||||||
usesBearer = false
|
usesBearer = false
|
||||||
case "moonshot", "kimi":
|
case "moonshot", "kimi":
|
||||||
providerKey = "moonshot"
|
providerKey = "moonshot"
|
||||||
resolvedAPIType = "openai-completions"
|
|
||||||
usesBearer = false
|
|
||||||
case "ollama", "llmman":
|
case "ollama", "llmman":
|
||||||
apiKey = provider
|
apiKey = provider
|
||||||
usesBearer = false
|
usesBearer = false
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package provider
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -24,6 +25,14 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func VerifyAccount(provider, apiType, authMode, baseURL, apiKey, model string) error {
|
func VerifyAccount(provider, apiType, authMode, baseURL, apiKey, model string) error {
|
||||||
|
if Purpose(apiType) == "speech" || Purpose(apiType) == "transcription" {
|
||||||
|
return fmt.Errorf("%s verification requires audio input; disable automatic verification and test with an audio client", apiType)
|
||||||
|
}
|
||||||
|
switch apiType {
|
||||||
|
case "openai-completions", "openai-responses", "anthropic-messages", "gemini-generate-content", "openai-embeddings", "openai-images", "dashscope-images", "minimax-images", "openrouter-images", "tokenhub-images", "siliconflow-images", "rerank":
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("automatic verification is not supported for %s", apiType)
|
||||||
|
}
|
||||||
req := BuildVerifyRequest(provider, apiType, authMode, baseURL, apiKey, model)
|
req := BuildVerifyRequest(provider, apiType, authMode, baseURL, apiKey, model)
|
||||||
httpReq, err := http.NewRequest(req.Method, req.URL, bytes.NewReader(req.Body))
|
httpReq, err := http.NewRequest(req.Method, req.URL, bytes.NewReader(req.Body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -56,8 +65,8 @@ func BuildVerifyRequest(provider, apiType, authMode, baseURL, apiKey, model stri
|
|||||||
headers := map[string]string{"Content-Type": "application/json"}
|
headers := map[string]string{"Content-Type": "application/json"}
|
||||||
request := VerifyRequest{Method: http.MethodPost, Headers: headers}
|
request := VerifyRequest{Method: http.MethodPost, Headers: headers}
|
||||||
|
|
||||||
if provider == "gemini" {
|
if apiType == "gemini-generate-content" {
|
||||||
request.URL = baseURL + "/v1beta/models/" + strings.TrimSpace(model) + ":generateContent"
|
request.URL = BuildTextRequestURL(apiType, baseURL, model)
|
||||||
headers["x-goog-api-key"] = apiKey
|
headers["x-goog-api-key"] = apiKey
|
||||||
request.Body = mustJSON(map[string]interface{}{
|
request.Body = mustJSON(map[string]interface{}{
|
||||||
"contents": []map[string]interface{}{{"parts": []map[string]string{{"text": "test"}}}},
|
"contents": []map[string]interface{}{{"parts": []map[string]string{{"text": "test"}}}},
|
||||||
@@ -66,6 +75,26 @@ func BuildVerifyRequest(provider, apiType, authMode, baseURL, apiKey, model stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch apiType {
|
switch apiType {
|
||||||
|
case "rerank":
|
||||||
|
request.URL = strings.TrimRight(baseURL, "/") + "/rerank"
|
||||||
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
|
request.Body = mustJSON(map[string]interface{}{"model": model, "query": "test", "documents": []string{"test"}})
|
||||||
|
if provider == "bailian" {
|
||||||
|
if model == "qwen3-rerank" {
|
||||||
|
request.URL = baseURL + "/compatible-api/v1/reranks"
|
||||||
|
} else {
|
||||||
|
request.URL = baseURL + "/api/v1/services/rerank/text-rerank/text-rerank"
|
||||||
|
request.Body = mustJSON(map[string]interface{}{"model": model, "input": map[string]interface{}{"query": "test", "documents": []string{"test"}}})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "tokenhub-images":
|
||||||
|
request.URL = imageVerifyURL(provider, baseURL, "/v1/wand/hunyuan-image/v3-generation")
|
||||||
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
|
request.Body = mustJSON(map[string]interface{}{"model": model, "prompt": "test"})
|
||||||
|
case "siliconflow-images":
|
||||||
|
request.URL = imageVerifyURL(provider, baseURL, "/images/generations")
|
||||||
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
|
request.Body = mustJSON(map[string]interface{}{"model": model, "prompt": "test", "image_size": "1024x1024", "batch_size": 1})
|
||||||
case "openai-embeddings":
|
case "openai-embeddings":
|
||||||
request.URL = embeddingVerifyURL(baseURL)
|
request.URL = embeddingVerifyURL(baseURL)
|
||||||
headers["Authorization"] = "Bearer " + apiKey
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
@@ -93,7 +122,7 @@ func BuildVerifyRequest(provider, apiType, authMode, baseURL, apiKey, model stri
|
|||||||
headers["Authorization"] = "Bearer " + apiKey
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
request.Body = mustJSON(map[string]interface{}{"model": model, "prompt": "test", "n": 1, "response_format": "url"})
|
request.Body = mustJSON(map[string]interface{}{"model": model, "prompt": "test", "n": 1, "response_format": "url"})
|
||||||
case "anthropic-messages":
|
case "anthropic-messages":
|
||||||
request.URL = baseURL + "/v1/messages"
|
request.URL = BuildTextRequestURL(apiType, baseURL, model)
|
||||||
if authMode == AuthModeBearer {
|
if authMode == AuthModeBearer {
|
||||||
headers["Authorization"] = "Bearer " + apiKey
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
} else {
|
} else {
|
||||||
@@ -110,11 +139,11 @@ func BuildVerifyRequest(provider, apiType, authMode, baseURL, apiKey, model stri
|
|||||||
}
|
}
|
||||||
request.Body = mustJSON(body)
|
request.Body = mustJSON(body)
|
||||||
case "openai-responses":
|
case "openai-responses":
|
||||||
request.URL = baseURL + "/responses"
|
request.URL = BuildTextRequestURL(apiType, baseURL, model)
|
||||||
headers["Authorization"] = "Bearer " + apiKey
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
request.Body = mustJSON(map[string]interface{}{"model": model, "input": "test", "max_output_tokens": defaultVerifyMaxTokens, "stream": false})
|
request.Body = mustJSON(map[string]interface{}{"model": model, "input": "test", "max_output_tokens": defaultVerifyMaxTokens, "stream": false})
|
||||||
default:
|
default:
|
||||||
request.URL = baseURL + "/chat/completions"
|
request.URL = BuildTextRequestURL(apiType, baseURL, model)
|
||||||
if (provider != "ollama" && provider != "llmman") || strings.TrimSpace(apiKey) != "" {
|
if (provider != "ollama" && provider != "llmman") || strings.TrimSpace(apiKey) != "" {
|
||||||
headers["Authorization"] = "Bearer " + apiKey
|
headers["Authorization"] = "Bearer " + apiKey
|
||||||
}
|
}
|
||||||
@@ -137,7 +166,7 @@ func embeddingVerifyURL(baseURL string) string {
|
|||||||
if strings.HasSuffix(lowerBaseURL, "/embeddings") {
|
if strings.HasSuffix(lowerBaseURL, "/embeddings") {
|
||||||
return baseURL
|
return baseURL
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(lowerBaseURL, "/v1") {
|
if hasAPIVersionSuffix(lowerBaseURL) {
|
||||||
return baseURL + "/embeddings"
|
return baseURL + "/embeddings"
|
||||||
}
|
}
|
||||||
return baseURL + "/v1/embeddings"
|
return baseURL + "/v1/embeddings"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type IAgentAccountRepo interface {
|
|||||||
DeleteByID(id uint) error
|
DeleteByID(id uint) error
|
||||||
List(opts ...DBOption) ([]model.AgentAccount, error)
|
List(opts ...DBOption) ([]model.AgentAccount, error)
|
||||||
Count() (int64, error)
|
Count() (int64, error)
|
||||||
CountTextByProviders(providers []string) (map[string]int64, error)
|
CountTextByProviders(providers []string, opts ...DBOption) (map[string]int64, error)
|
||||||
SaveWithModels(account *model.AgentAccount, models []model.AgentAccountModel) error
|
SaveWithModels(account *model.AgentAccount, models []model.AgentAccountModel) error
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ func (a AgentAccountRepo) Count() (int64, error) {
|
|||||||
return count, err
|
return count, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a AgentAccountRepo) CountTextByProviders(providers []string) (map[string]int64, error) {
|
func (a AgentAccountRepo) CountTextByProviders(providers []string, opts ...DBOption) (map[string]int64, error) {
|
||||||
normalizedProviders := normalizeProviders(providers)
|
normalizedProviders := normalizeProviders(providers)
|
||||||
counts := make(map[string]int64, len(normalizedProviders))
|
counts := make(map[string]int64, len(normalizedProviders))
|
||||||
for _, provider := range normalizedProviders {
|
for _, provider := range normalizedProviders {
|
||||||
@@ -117,7 +117,7 @@ func (a AgentAccountRepo) CountTextByProviders(providers []string) (map[string]i
|
|||||||
Count int64
|
Count int64
|
||||||
}
|
}
|
||||||
var rows []providerCount
|
var rows []providerCount
|
||||||
if err := getDb().
|
if err := getDb(opts...).
|
||||||
Model(&model.AgentAccount{}).
|
Model(&model.AgentAccount{}).
|
||||||
Select("provider, COUNT(*) as count").
|
Select("provider, COUNT(*) as count").
|
||||||
Where("provider IN ?", normalizedProviders).
|
Where("provider IN ?", normalizedProviders).
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ type IAgentAccountModelRepo interface {
|
|||||||
GetFirst(opts ...DBOption) (*model.AgentAccountModel, error)
|
GetFirst(opts ...DBOption) (*model.AgentAccountModel, error)
|
||||||
Create(item *model.AgentAccountModel) error
|
Create(item *model.AgentAccountModel) error
|
||||||
Save(item *model.AgentAccountModel) error
|
Save(item *model.AgentAccountModel) error
|
||||||
SaveWithAccount(item *model.AgentAccountModel, account *model.AgentAccount) error
|
|
||||||
DeleteByID(id uint) error
|
DeleteByID(id uint) error
|
||||||
DeleteWithAccount(id uint, account *model.AgentAccount) error
|
DeleteWithAccount(id uint, account *model.AgentAccount) error
|
||||||
Delete(opts ...DBOption) error
|
Delete(opts ...DBOption) error
|
||||||
@@ -46,15 +45,6 @@ func (a AgentAccountModelRepo) Save(item *model.AgentAccountModel) error {
|
|||||||
return getDb().Save(item).Error
|
return getDb().Save(item).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a AgentAccountModelRepo) SaveWithAccount(item *model.AgentAccountModel, account *model.AgentAccount) error {
|
|
||||||
return getDb().Transaction(func(tx *gorm.DB) error {
|
|
||||||
if err := tx.Save(item).Error; err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return tx.Save(account).Error
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a AgentAccountModelRepo) DeleteByID(id uint) error {
|
func (a AgentAccountModelRepo) DeleteByID(id uint) error {
|
||||||
return getDb().Delete(&model.AgentAccountModel{}, id).Error
|
return getDb().Delete(&model.AgentAccountModel{}, id).Error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,16 @@ func WithByAPIType(apiType string) DBOption {
|
|||||||
|
|
||||||
func WithTextAPIType() DBOption {
|
func WithTextAPIType() DBOption {
|
||||||
return func(g *gorm.DB) *gorm.DB {
|
return func(g *gorm.DB) *gorm.DB {
|
||||||
return g.Where("api_type NOT LIKE ? AND api_type <> ?", "%-images", "openai-embeddings")
|
return g.Where("api_type IN ?", []string{"", "openai-completions", "openai-responses", "anthropic-messages", "gemini-generate-content"})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithExcludeCodingPlanProviders(providers []string) DBOption {
|
||||||
|
return func(g *gorm.DB) *gorm.DB {
|
||||||
|
if len(providers) == 0 {
|
||||||
|
return g
|
||||||
|
}
|
||||||
|
return g.Where("(provider NOT IN ? OR account_type IS NULL OR account_type <> ?)", providers, "codingPlan")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -713,6 +713,7 @@ func (a AgentService) ensureBatchInstallAccount(req dto.AgentBatchInstallReq) (u
|
|||||||
}
|
}
|
||||||
account.MasterAccountID = req.MasterAccountID
|
account.MasterAccountID = req.MasterAccountID
|
||||||
account.Provider = snapshot.Provider
|
account.Provider = snapshot.Provider
|
||||||
|
account.AccountType = snapshot.AccountType
|
||||||
account.Name = snapshot.Name
|
account.Name = snapshot.Name
|
||||||
account.APIKey = snapshot.APIKey
|
account.APIKey = snapshot.APIKey
|
||||||
account.RememberAPIKey = snapshot.RememberAPIKey
|
account.RememberAPIKey = snapshot.RememberAPIKey
|
||||||
@@ -1000,32 +1001,19 @@ func (a AgentService) GetProviders() ([]dto.ProviderInfo, error) {
|
|||||||
definitions := providercatalog.All()
|
definitions := providercatalog.All()
|
||||||
providers := make([]dto.ProviderInfo, 0, len(definitions))
|
providers := make([]dto.ProviderInfo, 0, len(definitions))
|
||||||
for key, def := range definitions {
|
for key, def := range definitions {
|
||||||
models := make([]dto.ProviderModelInfo, 0, len(def.Models))
|
accountTypes := make([]dto.ProviderAccountTypeInfo, 0, len(def.AccountTypes))
|
||||||
for _, item := range def.Models {
|
for _, preset := range def.AccountTypes {
|
||||||
models = append(models, dto.ProviderModelInfo{
|
item := dto.ProviderAccountTypeInfo{Key: preset.Key, APITypes: []dto.ProviderAPIInfo{}}
|
||||||
ID: item.ID,
|
for _, config := range preset.APIConfigs {
|
||||||
Name: item.Name,
|
item.APITypes = append(item.APITypes, dto.ProviderAPIInfo{
|
||||||
})
|
APIType: config.APIType, BaseURL: config.BaseURL, EditableBaseURL: config.EditableBaseURL,
|
||||||
}
|
SupportsModelDiscovery: config.DiscoverModels, DefaultAuthMode: config.DefaultAuthMode,
|
||||||
apiTypes := make([]dto.ProviderAPIInfo, 0, len(def.APIConfigs))
|
AuthModes: config.AuthModes, Models: []dto.ProviderModelInfo{},
|
||||||
for _, item := range def.APIConfigs {
|
|
||||||
apiModels := make([]dto.ProviderModelInfo, 0, len(item.Models))
|
|
||||||
for _, model := range item.Models {
|
|
||||||
apiModels = append(apiModels, dto.ProviderModelInfo{
|
|
||||||
ID: model.ID,
|
|
||||||
Name: model.Name,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
apiTypes = append(apiTypes, dto.ProviderAPIInfo{
|
accountTypes = append(accountTypes, item)
|
||||||
APIType: item.APIType,
|
|
||||||
BaseURL: item.BaseURL,
|
|
||||||
EditableBaseURL: item.EditableBaseURL,
|
|
||||||
SupportsModelDiscovery: item.DiscoverModels,
|
|
||||||
DefaultAuthMode: item.DefaultAuthMode,
|
|
||||||
AuthModes: item.AuthModes,
|
|
||||||
Models: apiModels,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
apiTypes := accountTypes[0].APITypes
|
||||||
baseURL, _ := providercatalog.DefaultBaseURL(key)
|
baseURL, _ := providercatalog.DefaultBaseURL(key)
|
||||||
providers = append(providers, dto.ProviderInfo{
|
providers = append(providers, dto.ProviderInfo{
|
||||||
Sort: def.Sort,
|
Sort: def.Sort,
|
||||||
@@ -1034,7 +1022,8 @@ func (a AgentService) GetProviders() ([]dto.ProviderInfo, error) {
|
|||||||
BaseURL: baseURL,
|
BaseURL: baseURL,
|
||||||
DefaultAPIType: def.DefaultAPIType,
|
DefaultAPIType: def.DefaultAPIType,
|
||||||
APITypes: apiTypes,
|
APITypes: apiTypes,
|
||||||
Models: models,
|
Models: []dto.ProviderModelInfo{},
|
||||||
|
AccountTypes: accountTypes,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
sort.Slice(providers, func(i, j int) bool {
|
sort.Slice(providers, func(i, j int) bool {
|
||||||
@@ -1045,6 +1034,11 @@ func (a AgentService) GetProviders() ([]dto.ProviderInfo, error) {
|
|||||||
|
|
||||||
func (a AgentService) CreateAccount(req dto.AgentAccountCreateReq) error {
|
func (a AgentService) CreateAccount(req dto.AgentAccountCreateReq) error {
|
||||||
provider := req.Provider
|
provider := req.Provider
|
||||||
|
preset, ok := providercatalog.FindAccountType(provider, req.AccountType)
|
||||||
|
if !ok {
|
||||||
|
return buserr.WithDetail("ErrInvalidParams", "unsupported provider type", nil)
|
||||||
|
}
|
||||||
|
req.AccountType = preset.Key
|
||||||
if err := ensureAgentAccountNameAvailable(provider, req.Name, 0); err != nil {
|
if err := ensureAgentAccountNameAvailable(provider, req.Name, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1057,7 +1051,7 @@ func (a AgentService) CreateAccount(req dto.AgentAccountCreateReq) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
validateAvailability := req.ValidateAvailability == nil || *req.ValidateAvailability
|
validateAvailability := req.ValidateAvailability == nil || *req.ValidateAvailability
|
||||||
resolvedInput, err := resolveAgentAccountInput(provider, req.APIType, req.AuthMode, req.APIKey, req.BaseURL, verifyModel, validateAvailability, false)
|
resolvedInput, err := resolveAgentAccountInput(provider, req.APIType, req.AuthMode, req.APIKey, req.BaseURL, verifyModel, validateAvailability, false, req.AccountType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1068,6 +1062,7 @@ func (a AgentService) CreateAccount(req dto.AgentAccountCreateReq) error {
|
|||||||
}
|
}
|
||||||
account := &model.AgentAccount{
|
account := &model.AgentAccount{
|
||||||
Provider: resolvedInput.Provider,
|
Provider: resolvedInput.Provider,
|
||||||
|
AccountType: req.AccountType,
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
APIKey: resolvedInput.APIKey,
|
APIKey: resolvedInput.APIKey,
|
||||||
RememberAPIKey: req.RememberAPIKey,
|
RememberAPIKey: req.RememberAPIKey,
|
||||||
@@ -1106,6 +1101,9 @@ func (a AgentService) UpdateAccount(req dto.AgentAccountUpdateReq) error {
|
|||||||
if req.APIType != account.APIType {
|
if req.APIType != account.APIType {
|
||||||
return buserr.WithDetail("ErrInvalidParams", "API type cannot be changed", nil)
|
return buserr.WithDetail("ErrInvalidParams", "API type cannot be changed", nil)
|
||||||
}
|
}
|
||||||
|
if req.AccountType != "" && req.AccountType != account.AccountType {
|
||||||
|
return buserr.WithDetail("ErrInvalidParams", "account type cannot be changed", nil)
|
||||||
|
}
|
||||||
provider := account.Provider
|
provider := account.Provider
|
||||||
if err := ensureAgentAccountNameAvailable(provider, req.Name, account.ID); err != nil {
|
if err := ensureAgentAccountNameAvailable(provider, req.Name, account.ID); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1144,10 +1142,19 @@ func (a AgentService) UpdateAccount(req dto.AgentAccountUpdateReq) error {
|
|||||||
if req.ValidateAvailability != nil {
|
if req.ValidateAvailability != nil {
|
||||||
validateAvailability = *req.ValidateAvailability
|
validateAvailability = *req.ValidateAvailability
|
||||||
}
|
}
|
||||||
resolvedInput, err := resolveAgentAccountInput(provider, req.APIType, req.AuthMode, req.APIKey, req.BaseURL, verifyModel, false, account.AppInstallID != 0 && len(models) == 0)
|
resolvedInput, err := resolveAgentAccountInput(provider, req.APIType, req.AuthMode, req.APIKey, req.BaseURL, verifyModel, false, account.AppInstallID != 0 && len(models) == 0, account.AccountType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if provider == "ollama" && req.Models != nil {
|
||||||
|
if err := resolveUpdatedOllamaModels(resolvedInput.BaseURL, resolvedInput.APIKey, previousModels, models); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
verifyModel, err = resolveAgentAccountVerifyModel(provider, verifyModel, models)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
previousVerifyModel := account.VerifyModel
|
previousVerifyModel := account.VerifyModel
|
||||||
if previousVerifyModel == "" && len(previousModels) > 0 {
|
if previousVerifyModel == "" && len(previousModels) > 0 {
|
||||||
previousVerifyModel = previousModels[0].ID
|
previousVerifyModel = previousModels[0].ID
|
||||||
@@ -1156,7 +1163,7 @@ func (a AgentService) UpdateAccount(req dto.AgentAccountUpdateReq) error {
|
|||||||
account.APIType != resolvedInput.APIType || account.AuthMode != resolvedInput.AuthMode || !sameProviderModelID(provider, previousVerifyModel, verifyModel)
|
account.APIType != resolvedInput.APIType || account.AuthMode != resolvedInput.AuthMode || !sameProviderModelID(provider, previousVerifyModel, verifyModel)
|
||||||
shouldVerify := validateAvailability && (connectionChanged || !account.ValidateAvailability)
|
shouldVerify := validateAvailability && (connectionChanged || !account.ValidateAvailability)
|
||||||
if shouldVerify {
|
if shouldVerify {
|
||||||
if _, err := resolveAgentAccountInput(provider, req.APIType, req.AuthMode, req.APIKey, req.BaseURL, verifyModel, true, false); err != nil {
|
if _, err := resolveAgentAccountInput(provider, req.APIType, req.AuthMode, req.APIKey, req.BaseURL, verifyModel, true, false, account.AccountType); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1217,7 +1224,7 @@ func (a AgentService) UpdateAccount(req dto.AgentAccountUpdateReq) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a AgentService) PageAccounts(req dto.AgentAccountSearch) (int64, []dto.AgentAccountInfo, error) {
|
func (a AgentService) PageAccounts(req dto.AgentAccountSearch) (int64, []dto.AgentAccountInfo, error) {
|
||||||
var opts []repo.DBOption
|
opts := []repo.DBOption{repo.WithExcludeCodingPlanProviders(req.ExcludeCodingPlanProviders)}
|
||||||
if strings.TrimSpace(req.Provider) != "" {
|
if strings.TrimSpace(req.Provider) != "" {
|
||||||
opts = append(opts, repo.WithByProvider(req.Provider))
|
opts = append(opts, repo.WithByProvider(req.Provider))
|
||||||
}
|
}
|
||||||
@@ -1261,6 +1268,7 @@ func (a AgentService) PageAccounts(req dto.AgentAccountSearch) (int64, []dto.Age
|
|||||||
appInstallID = item.AppInstallID
|
appInstallID = item.AppInstallID
|
||||||
}
|
}
|
||||||
items = append(items, dto.AgentAccountInfo{
|
items = append(items, dto.AgentAccountInfo{
|
||||||
|
AccountType: item.AccountType,
|
||||||
AppInstallID: appInstallID,
|
AppInstallID: appInstallID,
|
||||||
ID: item.ID,
|
ID: item.ID,
|
||||||
MasterAccountID: item.MasterAccountID,
|
MasterAccountID: item.MasterAccountID,
|
||||||
@@ -1307,7 +1315,7 @@ func (a AgentService) PageAccounts(req dto.AgentAccountSearch) (int64, []dto.Age
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a AgentService) CountAccountsByProviders(req dto.AgentAccountProviderCountReq) (map[string]int64, error) {
|
func (a AgentService) CountAccountsByProviders(req dto.AgentAccountProviderCountReq) (map[string]int64, error) {
|
||||||
return agentAccountRepo.CountTextByProviders(req.Providers)
|
return agentAccountRepo.CountTextByProviders(req.Providers, repo.WithExcludeCodingPlanProviders(req.ExcludeCodingPlanProviders))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a AgentService) GetAccountModels(req dto.AgentAccountModelReq) ([]dto.AgentAccountModel, error) {
|
func (a AgentService) GetAccountModels(req dto.AgentAccountModelReq) ([]dto.AgentAccountModel, error) {
|
||||||
@@ -1363,15 +1371,31 @@ func (a AgentService) UpdateAccountVerifyModel(req dto.AgentAccountVerifyModelUp
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a AgentService) DiscoverAccountModels(req dto.AgentAccountModelDiscoverReq) ([]dto.AgentAccountModel, error) {
|
func (a AgentService) DiscoverAccountModels(req dto.AgentAccountModelDiscoverReq) ([]dto.AgentAccountModel, error) {
|
||||||
config, ok := providercatalog.FindAPIConfig(req.Provider, req.APIType)
|
if req.AccountID != 0 {
|
||||||
|
account, err := agentAccountRepo.GetFirst(repo.WithByID(req.AccountID))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
req.Provider, req.AccountType, req.APIType = account.Provider, account.AccountType, account.APIType
|
||||||
|
req.BaseURL, req.APIKey, req.AuthMode = account.BaseURL, account.APIKey, account.AuthMode
|
||||||
|
}
|
||||||
|
config, ok := providercatalog.FindAPIConfig(req.Provider, req.APIType, req.AccountType)
|
||||||
if !ok || !config.DiscoverModels {
|
if !ok || !config.DiscoverModels {
|
||||||
return nil, buserr.New("ErrAgentAccountModelsRequired")
|
return nil, buserr.New("ErrAgentAccountModelsRequired")
|
||||||
}
|
}
|
||||||
baseURL, err := providercatalog.ResolveBaseURL(req.Provider, req.APIType, req.BaseURL)
|
baseURL := req.BaseURL
|
||||||
if err != nil {
|
if req.AccountID == 0 {
|
||||||
return nil, buserr.WithErr("ErrAgentAccountUnavailable", err)
|
var err error
|
||||||
|
baseURL, err = providercatalog.ResolveBaseURL(req.Provider, req.APIType, req.BaseURL, req.AccountType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, buserr.WithErr("ErrAgentAccountUnavailable", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
models, err := providercatalog.DiscoverModels(baseURL, req.APIKey)
|
authMode, err := providercatalog.ResolveAuthMode(req.Provider, req.APIType, req.AuthMode, req.AccountType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
models, err := providercatalog.DiscoverProtocolModels(req.Provider, config, baseURL, req.APIKey, authMode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, buserr.WithErr("ErrAgentAccountUnavailable", err)
|
return nil, buserr.WithErr("ErrAgentAccountUnavailable", err)
|
||||||
}
|
}
|
||||||
@@ -1443,76 +1467,45 @@ func (a AgentService) UpdateAccountModel(req dto.AgentAccountModelUpdateReq) err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
record, err := agentAccountModelRepo.GetFirst(repo.WithByID(req.Model.RecordID), repo.WithByAccountID(req.AccountID))
|
if account.AppInstallID != 0 {
|
||||||
|
return buserr.WithDetail("ErrInvalidParams", "local model pool is managed by the deployment", nil)
|
||||||
|
}
|
||||||
|
previousModels, err := loadAgentAccountModels(account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
models, err := loadAgentAccountModels(account)
|
models, err := normalizeAgentAccountModels(account, req.Models)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
nextModel, err := normalizeAgentAccountModel(account, req.Model)
|
if account.Provider == "ollama" {
|
||||||
if err != nil {
|
if err := resolveUpdatedOllamaModels(account.BaseURL, account.APIKey, previousModels, models); err != nil {
|
||||||
return err
|
|
||||||
}
|
|
||||||
if account.Provider == "ollama" && !sameProviderModelID("ollama", record.Model, nextModel.ID) {
|
|
||||||
if account.AppInstallID != 0 {
|
|
||||||
return buserr.New("ErrInvalidParams")
|
|
||||||
}
|
|
||||||
nextModel.ID, err = resolveExistingOllamaModel(account, nextModel.ID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nextModel.RecordID = req.Model.RecordID
|
|
||||||
for _, item := range models {
|
|
||||||
if item.RecordID == req.Model.RecordID {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if sameProviderModelID(account.Provider, item.ID, nextModel.ID) {
|
|
||||||
return buserr.New("ErrRecordExist")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nextModels := make([]dto.AgentAccountModel, 0, len(models))
|
|
||||||
for _, item := range models {
|
|
||||||
if item.RecordID == req.Model.RecordID {
|
|
||||||
nextModels = append(nextModels, nextModel)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
nextModels = append(nextModels, item)
|
|
||||||
}
|
|
||||||
if err := ensureAccountModelsNotBound(account, nextModels); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
agentAccountMutationMu.Lock()
|
agentAccountMutationMu.Lock()
|
||||||
defer agentAccountMutationMu.Unlock()
|
defer agentAccountMutationMu.Unlock()
|
||||||
if err := ensureAgentAccountUnchanged(account, models); err != nil {
|
if err := ensureAgentAccountUnchanged(account, previousModels); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := ensureAccountModelsNotBound(account, nextModels); err != nil {
|
if err := ensureAccountModelsNotBound(account, models); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
previousModelID := record.Model
|
verifyModel, err := resolveAgentAccountVerifyModel(account.Provider, req.VerifyModel, models)
|
||||||
record.Model = nextModel.ID
|
|
||||||
record.Name = nextModel.Name
|
|
||||||
verifyModel := account.VerifyModel
|
|
||||||
if verifyModel == "" && len(models) > 0 {
|
|
||||||
verifyModel = models[0].ID
|
|
||||||
}
|
|
||||||
if sameProviderModelID(account.Provider, verifyModel, previousModelID) && !sameProviderModelID(account.Provider, previousModelID, nextModel.ID) {
|
|
||||||
if account.ValidateAvailability {
|
|
||||||
account.Verified = false
|
|
||||||
account.VerifiedAt = nil
|
|
||||||
account.VerifyError = ""
|
|
||||||
}
|
|
||||||
account.VerifyModel = nextModel.ID
|
|
||||||
err = agentAccountModelRepo.SaveWithAccount(record, account)
|
|
||||||
} else {
|
|
||||||
err = agentAccountModelRepo.Save(record)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if account.ValidateAvailability && !sameProviderModelID(account.Provider, account.VerifyModel, verifyModel) {
|
||||||
|
account.Verified, account.VerifiedAt, account.VerifyError = false, nil, ""
|
||||||
|
}
|
||||||
|
account.VerifyModel = verifyModel
|
||||||
|
rows := make([]model.AgentAccountModel, 0, len(models))
|
||||||
|
for _, item := range models {
|
||||||
|
rows = append(rows, model.AgentAccountModel{Model: item.ID, Name: item.Name})
|
||||||
|
}
|
||||||
|
if err := agentAccountRepo.SaveWithModels(account, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
terminalai.InvalidateTerminalRuntimeCache()
|
terminalai.InvalidateTerminalRuntimeCache()
|
||||||
terminalai.InvalidateFileAIRuntimeCache()
|
terminalai.InvalidateFileAIRuntimeCache()
|
||||||
return a.syncAgentsByAccount(account)
|
return a.syncAgentsByAccount(account)
|
||||||
@@ -1632,7 +1625,7 @@ func (a AgentService) VerifyAccount(req dto.AgentAccountVerifyReq) error {
|
|||||||
}
|
}
|
||||||
verifyModel, verifyErr := resolveAgentAccountVerifyModel(account.Provider, account.VerifyModel, models)
|
verifyModel, verifyErr := resolveAgentAccountVerifyModel(account.Provider, account.VerifyModel, models)
|
||||||
if verifyErr == nil {
|
if verifyErr == nil {
|
||||||
_, verifyErr = resolveAgentAccountInput(account.Provider, account.APIType, account.AuthMode, account.APIKey, account.BaseURL, verifyModel, true, false)
|
verifyErr = providercatalog.VerifyAccount(account.Provider, account.APIType, account.AuthMode, account.BaseURL, account.APIKey, verifyModel)
|
||||||
}
|
}
|
||||||
agentAccountMutationMu.Lock()
|
agentAccountMutationMu.Lock()
|
||||||
defer agentAccountMutationMu.Unlock()
|
defer agentAccountMutationMu.Unlock()
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ func normalizeHermesTimezone(timezone string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func resolveHermesProvider(provider, apiType string) string {
|
func resolveHermesProvider(provider, apiType string) string {
|
||||||
if apiType == "anthropic-messages" && (provider == "deepseek" || provider == "bailian-coding-plan" || provider == "ark-coding-plan" || provider == "xiaomi") {
|
if apiType == "anthropic-messages" && (provider == "deepseek" || provider == "bailian" || provider == "bailian-coding-plan" || provider == "ark" || provider == "ark-coding-plan" || provider == "xiaomi") {
|
||||||
return "anthropic"
|
return "anthropic"
|
||||||
}
|
}
|
||||||
switch provider {
|
switch provider {
|
||||||
|
|||||||
@@ -338,6 +338,34 @@ func deleteRemoteOllamaModel(account *model.AgentAccount, modelName string) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resolveUpdatedOllamaModels(baseURL, apiKey string, previousModels, models []dto.AgentAccountModel) error {
|
||||||
|
var available []string
|
||||||
|
for index, item := range models {
|
||||||
|
if _, ok := findAgentAccountModelForProvider("ollama", previousModels, item.ID); ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if available == nil {
|
||||||
|
var err error
|
||||||
|
available, err = providercatalog.DiscoverModels(baseURL, apiKey)
|
||||||
|
if err != nil {
|
||||||
|
return buserr.WithErr("ErrAgentAccountUnavailable", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
found := false
|
||||||
|
for _, id := range available {
|
||||||
|
if sameProviderModelID("ollama", id, item.ID) {
|
||||||
|
models[index].ID = id
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return buserr.New("ErrRecordNotFound")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func resolveExistingOllamaModel(account *model.AgentAccount, modelID string) (string, error) {
|
func resolveExistingOllamaModel(account *model.AgentAccount, modelID string) (string, error) {
|
||||||
available, err := providercatalog.DiscoverModels(account.BaseURL, account.APIKey)
|
available, err := providercatalog.DiscoverModels(account.BaseURL, account.APIKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"path/filepath"
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
providercatalog "github.com/1Panel-dev/1Panel/agent/app/provider"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestMiniMaxOpenclawModelMetadata(t *testing.T) {
|
|
||||||
for _, provider := range []string{"minimax", "custom", "bailian-coding-plan"} {
|
|
||||||
for _, protocol := range []string{"anthropic-messages", "openai-completions"} {
|
|
||||||
for _, id := range []string{"MiniMax-M3.1-Flash", "MiniMax-M3", "MiniMax-M2.7", "MiniMax-M2.5", "saved-custom"} {
|
|
||||||
t.Run(provider+"/"+protocol+"/"+id, func(t *testing.T) {
|
|
||||||
account := &model.AgentAccount{Provider: provider, APIType: protocol, BaseURL: "https://example.test/v1", APIKey: "test-key"}
|
|
||||||
_, entry, _, _, err := buildOpenclawAccountModelConfig(account, dto.AgentAccountModel{ID: id, Name: "Saved name"})
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
payload, err := json.Marshal(entry)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
var actual modelEntry
|
|
||||||
if err := json.Unmarshal(payload, &actual); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if actual.ID != id || actual.Name != "Saved name" {
|
|
||||||
t.Fatalf("changed saved identity: %s", payload)
|
|
||||||
}
|
|
||||||
if provider == "minimax" && id == "MiniMax-M3.1-Flash" {
|
|
||||||
if actual.ContextWindow != 1000000 || actual.MaxTokens != 524288 || !reflect.DeepEqual(actual.Input, []string{"text", "image"}) {
|
|
||||||
t.Fatalf("incorrect direct Flash metadata: %s", payload)
|
|
||||||
}
|
|
||||||
} else if actual.ContextWindow != 0 || actual.MaxTokens != 0 {
|
|
||||||
t.Fatalf("changed existing/gateway limits: %s", payload)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMiniMaxPreservesSavedOpenclawMetadata(t *testing.T) {
|
|
||||||
current := &modelsConfig{Mode: "merge", Providers: map[string]modelProvider{
|
|
||||||
"minimax": {Models: []modelEntry{{ID: "MiniMax-M3.1-Flash", Input: []string{"text"}, ContextWindow: 32000, MaxTokens: 4096}}},
|
|
||||||
}}
|
|
||||||
conf := map[string]interface{}{}
|
|
||||||
if err := applyOpenclawModelsConfig(conf, current); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
next := &modelsConfig{Mode: "merge", Providers: map[string]modelProvider{
|
|
||||||
"minimax": {Models: []modelEntry{{ID: "MiniMax-M3.1-Flash", Input: []string{"text", "image"}, ContextWindow: 1000000, MaxTokens: 524288}}},
|
|
||||||
}}
|
|
||||||
preserveOpenclawModelMetadata(conf, next)
|
|
||||||
if !reflect.DeepEqual(next.Providers["minimax"].Models, current.Providers["minimax"].Models) {
|
|
||||||
t.Fatalf("saved metadata changed: %+v", next)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMiniMaxDefaultAccountRequest(t *testing.T) {
|
|
||||||
for _, protocol := range []string{"anthropic-messages", "openai-completions"} {
|
|
||||||
account := &model.AgentAccount{Provider: "minimax", APIType: protocol}
|
|
||||||
models, err := buildInitialAgentAccountModels(account, nil)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
selected, err := resolveAgentAccountVerifyModel("minimax", "", models)
|
|
||||||
if err != nil || selected != "MiniMax-M3.1-Flash" || len(models) != 2 || models[1].ID != "MiniMax-M3" {
|
|
||||||
t.Fatalf("unexpected default: %s, %+v, %v", selected, models, err)
|
|
||||||
}
|
|
||||||
request := providercatalog.BuildVerifyRequest("minimax", protocol, "", "https://example.test", "test-key", selected)
|
|
||||||
var body map[string]interface{}
|
|
||||||
if err := json.Unmarshal(request.Body, &body); err != nil || body["model"] != selected {
|
|
||||||
t.Fatalf("default request: %s, %v", request.Body, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMiniMaxHermesConfiguration(t *testing.T) {
|
|
||||||
for _, protocol := range []string{"anthropic-messages", "openai-completions"} {
|
|
||||||
for _, id := range []string{"MiniMax-M3.1-Flash", "MiniMax-M3", "MiniMax-M2.7", "my-custom-model"} {
|
|
||||||
dir := t.TempDir()
|
|
||||||
account := &model.AgentAccount{Provider: "minimax", APIType: protocol, BaseURL: "https://api.minimaxi.com/anthropic", APIKey: "test-key"}
|
|
||||||
if err := writeHermesConfig(dir, account, id, ""); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
conf, err := readHermesConfig(filepath.Join(dir, "config.yaml"))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if conf.Model.Default != id || conf.Model.Provider != "minimax-cn" || conf.Model.BaseURL != account.BaseURL {
|
|
||||||
t.Fatalf("changed Hermes selection: %+v", conf.Model)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMiniMaxExplicitAccountModels(t *testing.T) {
|
|
||||||
for _, provider := range []string{"minimax", "bailian-coding-plan", "custom"} {
|
|
||||||
account := &model.AgentAccount{Provider: provider, APIType: "openai-completions"}
|
|
||||||
requested := []dto.AgentAccountModel{{ID: "MiniMax-M2.5", Name: "Saved legacy"}, {ID: "my-custom-model", Name: "Saved custom"}}
|
|
||||||
actual, err := buildInitialAgentAccountModels(account, requested)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if !reflect.DeepEqual(actual, requested) {
|
|
||||||
t.Fatalf("changed explicit %s models: %+v", provider, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -114,14 +114,14 @@ func ensureContainerRunning(containerName string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveAgentAccountInput(provider, apiType, authMode, apiKey, baseURL, modelID string, validateAvailability, allowEmptyModel bool) (resolvedAgentAccountInput, error) {
|
func resolveAgentAccountInput(provider, apiType, authMode, apiKey, baseURL, modelID string, validateAvailability, allowEmptyModel bool, accountType ...string) (resolvedAgentAccountInput, error) {
|
||||||
resolvedAPIKey := strings.TrimSpace(apiKey)
|
resolvedAPIKey := strings.TrimSpace(apiKey)
|
||||||
resolvedAPIType := strings.TrimSpace(apiType)
|
resolvedAPIType := strings.TrimSpace(apiType)
|
||||||
resolvedAuthMode, err := providercatalog.ResolveAuthMode(provider, resolvedAPIType, authMode)
|
resolvedAuthMode, err := providercatalog.ResolveAuthMode(provider, resolvedAPIType, authMode, accountType...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resolvedAgentAccountInput{}, err
|
return resolvedAgentAccountInput{}, err
|
||||||
}
|
}
|
||||||
resolvedBaseURL, err := providercatalog.ResolveBaseURL(provider, resolvedAPIType, baseURL)
|
resolvedBaseURL, err := providercatalog.ResolveBaseURL(provider, resolvedAPIType, baseURL, accountType...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "base url is required") {
|
if strings.Contains(err.Error(), "base url is required") {
|
||||||
return resolvedAgentAccountInput{}, buserr.New("ErrAgentBaseURLRequired")
|
return resolvedAgentAccountInput{}, buserr.New("ErrAgentBaseURLRequired")
|
||||||
@@ -774,10 +774,6 @@ type modelEntry struct {
|
|||||||
MaxTokens int `json:"maxTokens,omitempty"`
|
MaxTokens int `json:"maxTokens,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func requiresOpenclawProviderModels(provider string) bool {
|
|
||||||
return provider != "gemini"
|
|
||||||
}
|
|
||||||
|
|
||||||
func applyOpenclawModelsConfig(conf map[string]interface{}, models *modelsConfig) error {
|
func applyOpenclawModelsConfig(conf map[string]interface{}, models *modelsConfig) error {
|
||||||
if models == nil {
|
if models == nil {
|
||||||
delete(conf, "models")
|
delete(conf, "models")
|
||||||
@@ -1265,7 +1261,7 @@ func buildOpenclawModelsFromAccount(account *model.AgentAccount, selectedModel s
|
|||||||
if primaryModel == "" {
|
if primaryModel == "" {
|
||||||
return "", nil, nil, buserr.New("ErrAgentModelNotInAccount")
|
return "", nil, nil, buserr.New("ErrAgentModelNotInAccount")
|
||||||
}
|
}
|
||||||
if !requiresOpenclawProviderModels(account.Provider) {
|
if account.Provider == "gemini" && providerCfg.Api == "google-generative-ai" {
|
||||||
return primaryModel, defaultsModels, nil, nil
|
return primaryModel, defaultsModels, nil, nil
|
||||||
}
|
}
|
||||||
providerCfg.Models = entries
|
providerCfg.Models = entries
|
||||||
@@ -1349,21 +1345,7 @@ func buildInitialAgentAccountModels(account *model.AgentAccount, requested []dto
|
|||||||
if len(requested) > 0 {
|
if len(requested) > 0 {
|
||||||
return normalizeAgentAccountModels(account, requested)
|
return normalizeAgentAccountModels(account, requested)
|
||||||
}
|
}
|
||||||
defaultModels := providercatalog.DefaultModels(account.Provider, account.APIType)
|
return nil, buserr.New("ErrAgentAccountModelsRequired")
|
||||||
if len(defaultModels) == 0 {
|
|
||||||
if requiresInitialAgentAccountModels(account.Provider) {
|
|
||||||
return nil, buserr.New("ErrAgentAccountModelsRequired")
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
requested = make([]dto.AgentAccountModel, 0, len(defaultModels))
|
|
||||||
for _, item := range defaultModels {
|
|
||||||
requested = append(requested, dto.AgentAccountModel{
|
|
||||||
ID: item.ID,
|
|
||||||
Name: item.Name,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return normalizeAgentAccountModels(account, requested)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildDiscoveredAgentAccountModels(modelIDs []string) []dto.AgentAccountModel {
|
func buildDiscoveredAgentAccountModels(modelIDs []string) []dto.AgentAccountModel {
|
||||||
@@ -1402,39 +1384,6 @@ func loadAgentAccountModels(account *model.AgentAccount) ([]dto.AgentAccountMode
|
|||||||
return listPersistedAgentAccountModels(account.ID)
|
return listPersistedAgentAccountModels(account.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MergeCatalogAgentAccountModelsForMigration(account *model.AgentAccount, existing []dto.AgentAccountModel) ([]dto.AgentAccountModel, error) {
|
|
||||||
if account == nil {
|
|
||||||
return nil, fmt.Errorf("account is required")
|
|
||||||
}
|
|
||||||
meta, ok := providercatalog.Get(account.Provider)
|
|
||||||
if !ok || len(meta.Models) == 0 {
|
|
||||||
return append([]dto.AgentAccountModel(nil), existing...), nil
|
|
||||||
}
|
|
||||||
requested := append([]dto.AgentAccountModel(nil), existing...)
|
|
||||||
seen := make(map[string]struct{}, len(existing))
|
|
||||||
for _, item := range existing {
|
|
||||||
target := strings.TrimSpace(item.ID)
|
|
||||||
if target == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
seen[target] = struct{}{}
|
|
||||||
}
|
|
||||||
for _, item := range meta.Models {
|
|
||||||
target := strings.TrimSpace(item.ID)
|
|
||||||
if _, ok := seen[target]; ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
requested = append(requested, dto.AgentAccountModel{
|
|
||||||
ID: item.ID,
|
|
||||||
Name: item.Name,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(requested) == len(existing) {
|
|
||||||
return append([]dto.AgentAccountModel(nil), existing...), nil
|
|
||||||
}
|
|
||||||
return normalizeAgentAccountModels(account, requested)
|
|
||||||
}
|
|
||||||
|
|
||||||
func listPersistedAgentAccountModels(accountID uint) ([]dto.AgentAccountModel, error) {
|
func listPersistedAgentAccountModels(accountID uint) ([]dto.AgentAccountModel, error) {
|
||||||
if accountID == 0 {
|
if accountID == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@@ -1487,10 +1436,14 @@ func normalizeAgentAccountModels(account *model.AgentAccount, models []dto.Agent
|
|||||||
if strings.TrimSpace(normalizedItem.ID) == "" {
|
if strings.TrimSpace(normalizedItem.ID) == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, ok := seen[normalizedItem.ID]; ok {
|
modelKey := normalizedItem.ID
|
||||||
|
if account.Provider == "ollama" && !strings.Contains(path.Base(modelKey), ":") {
|
||||||
|
modelKey += ":latest"
|
||||||
|
}
|
||||||
|
if _, ok := seen[modelKey]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
seen[normalizedItem.ID] = struct{}{}
|
seen[modelKey] = struct{}{}
|
||||||
normalized = append(normalized, normalizedItem)
|
normalized = append(normalized, normalizedItem)
|
||||||
}
|
}
|
||||||
if len(normalized) == 0 {
|
if len(normalized) == 0 {
|
||||||
@@ -1515,15 +1468,6 @@ func normalizeAgentAccountModel(account *model.AgentAccount, model dto.AgentAcco
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func requiresInitialAgentAccountModels(provider string) bool {
|
|
||||||
switch provider {
|
|
||||||
case "custom", "vllm", "ollama", "llmman":
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func sameProviderModelID(provider, left, right string) bool {
|
func sameProviderModelID(provider, left, right string) bool {
|
||||||
leftTrimmed := strings.TrimSpace(left)
|
leftTrimmed := strings.TrimSpace(left)
|
||||||
rightTrimmed := strings.TrimSpace(right)
|
rightTrimmed := strings.TrimSpace(right)
|
||||||
|
|||||||
@@ -8,107 +8,6 @@
|
|||||||
"formatZH": "更新 Ollama 绑定域名 [domain]",
|
"formatZH": "更新 Ollama 绑定域名 [domain]",
|
||||||
"formatEN": "update Ollama bind domain [domain]"
|
"formatEN": "update Ollama bind domain [domain]"
|
||||||
},
|
},
|
||||||
"/xpack/model/downloader/featured/sync/status": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新推荐模型自动同步 [value]",
|
|
||||||
"formatEN": "update featured model automatic synchronization [value]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/hf/download": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"repoID",
|
|
||||||
"revision"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "下载 Hugging Face 模型 [repoID]",
|
|
||||||
"formatEN": "download Hugging Face model [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/local/delete": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "删除本地模型 [name]",
|
|
||||||
"formatEN": "delete local model [name]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/modelscope/download": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"repoID",
|
|
||||||
"revision"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "下载 ModelScope 模型 [repoID]",
|
|
||||||
"formatEN": "download ModelScope model [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/settings": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"modelDir"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新模型下载设置 [modelDir]",
|
|
||||||
"formatEN": "update model downloader settings [modelDir]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/tasks/cancel": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "model_download_tasks",
|
|
||||||
"output_column": "repo_id",
|
|
||||||
"output_value": "repoID"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "取消模型下载任务 [repoID]",
|
|
||||||
"formatEN": "cancel model download task [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/tasks/remove": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "model_download_tasks",
|
|
||||||
"output_column": "repo_id",
|
|
||||||
"output_value": "repoID"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "移除模型下载任务 [repoID]",
|
|
||||||
"formatEN": "remove model download task [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/tasks/retry": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "model_download_tasks",
|
|
||||||
"output_column": "repo_id",
|
|
||||||
"output_value": "repoID"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "重试模型下载任务 [repoID]",
|
|
||||||
"formatEN": "retry model download task [repoID]"
|
|
||||||
},
|
|
||||||
"/ai/ollama/close": {
|
"/ai/ollama/close": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"name"
|
"name"
|
||||||
@@ -3815,6 +3714,25 @@
|
|||||||
"formatZH": "[domain] PHP 配置修改",
|
"formatZH": "[domain] PHP 配置修改",
|
||||||
"formatEN": "[domain] PHP conf update"
|
"formatEN": "[domain] PHP conf update"
|
||||||
},
|
},
|
||||||
|
"/runtimes/php/extensions/import": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "同步 PHP 扩展模版 [name]",
|
||||||
|
"formatEN": "Sync PHP extension template [name]"
|
||||||
|
},
|
||||||
|
"/runtimes/php/extensions/push": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"sourceNode",
|
||||||
|
"targetNodes"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "推送 PHP 扩展模版 [sourceNode] 至 [targetNodes]",
|
||||||
|
"formatEN": "Push PHP extension template from [sourceNode] to [targetNodes]"
|
||||||
|
},
|
||||||
"/runtimes/php/update": {
|
"/runtimes/php/update": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"websiteId"
|
"websiteId"
|
||||||
@@ -4211,6 +4129,282 @@
|
|||||||
"formatZH": "扫描系统垃圾文件",
|
"formatZH": "扫描系统垃圾文件",
|
||||||
"formatEN": "scan System Junk Files"
|
"formatEN": "scan System Junk Files"
|
||||||
},
|
},
|
||||||
|
"/vms": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机 [name]",
|
||||||
|
"formatEN": "create VM [name]"
|
||||||
|
},
|
||||||
|
"/vms/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "virtual_machines",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机 [name]",
|
||||||
|
"formatEN": "delete VM [name]"
|
||||||
|
},
|
||||||
|
"/vms/disks/resize": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"target",
|
||||||
|
"sizeGiB"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "扩容虚拟机 [name] 磁盘 [target] 至 [sizeGiB] GiB",
|
||||||
|
"formatEN": "expand VM [name] disk [target] to [sizeGiB] GiB"
|
||||||
|
},
|
||||||
|
"/vms/environment/enable": {
|
||||||
|
"bodyKeys": [],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "启用虚拟机运行环境",
|
||||||
|
"formatEN": "enable VM runtime environment"
|
||||||
|
},
|
||||||
|
"/vms/iso": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机镜像 [name] [type]",
|
||||||
|
"formatEN": "create VM ISO [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/iso/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_isos",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机镜像 [name]",
|
||||||
|
"formatEN": "delete VM ISO [name]"
|
||||||
|
},
|
||||||
|
"/vms/iso/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新虚拟机镜像 [name] [type]",
|
||||||
|
"formatEN": "update VM ISO [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/networks": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机网络 [name] [type]",
|
||||||
|
"formatEN": "create VM network [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/networks/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_networks",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机网络 [name]",
|
||||||
|
"formatEN": "delete VM network [name]"
|
||||||
|
},
|
||||||
|
"/vms/networks/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_networks",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "更新虚拟机网络 [name]",
|
||||||
|
"formatEN": "update VM network [name]"
|
||||||
|
},
|
||||||
|
"/vms/operate": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"operate"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "操作虚拟机 [name] [operate]",
|
||||||
|
"formatEN": "operate VM [name] [operate]"
|
||||||
|
},
|
||||||
|
"/vms/orphans/clean": {
|
||||||
|
"bodyKeys": [],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "清理虚拟机孤立数据",
|
||||||
|
"formatEN": "clean VM orphaned data"
|
||||||
|
},
|
||||||
|
"/vms/rename": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"newName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "重命名虚拟机 [name] 为 [newName]",
|
||||||
|
"formatEN": "rename VM [name] to [newName]"
|
||||||
|
},
|
||||||
|
"/vms/snapshots": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"snapshotName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机 [name] 快照 [snapshotName]",
|
||||||
|
"formatEN": "create VM [name] snapshot [snapshotName]"
|
||||||
|
},
|
||||||
|
"/vms/snapshots/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"snapshotName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "删除虚拟机 [name] 快照 [snapshotName]",
|
||||||
|
"formatEN": "delete VM [name] snapshot [snapshotName]"
|
||||||
|
},
|
||||||
|
"/vms/snapshots/recover": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"snapshotName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "恢复虚拟机 [name] 快照 [snapshotName]",
|
||||||
|
"formatEN": "recover VM [name] snapshot [snapshotName]"
|
||||||
|
},
|
||||||
|
"/vms/storages": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机存储 [name] [type]",
|
||||||
|
"formatEN": "create VM storage [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/storages/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_storages",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机存储 [name]",
|
||||||
|
"formatEN": "delete VM storage [name]"
|
||||||
|
},
|
||||||
|
"/vms/storages/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_storages",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "更新虚拟机存储 [name]",
|
||||||
|
"formatEN": "update VM storage [name]"
|
||||||
|
},
|
||||||
|
"/vms/sync": {
|
||||||
|
"bodyKeys": [],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "同步虚拟机",
|
||||||
|
"formatEN": "sync virtual machines"
|
||||||
|
},
|
||||||
|
"/vms/templates": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"templateName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机 [name] 模板 [templateName]",
|
||||||
|
"formatEN": "create VM [name] template [templateName]"
|
||||||
|
},
|
||||||
|
"/vms/templates/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_templates",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机模板 [name]",
|
||||||
|
"formatEN": "delete VM template [name]"
|
||||||
|
},
|
||||||
|
"/vms/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新虚拟机 [name]",
|
||||||
|
"formatEN": "update VM [name]"
|
||||||
|
},
|
||||||
"/websites": {
|
"/websites": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"alias"
|
"alias"
|
||||||
@@ -5011,6 +5205,107 @@
|
|||||||
"formatZH": "更新离线告警日志 [id]",
|
"formatZH": "更新离线告警日志 [id]",
|
||||||
"formatEN": "update offline alert log [id]"
|
"formatEN": "update offline alert log [id]"
|
||||||
},
|
},
|
||||||
|
"/xpack/model/downloader/featured/sync/status": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"value"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新推荐模型自动同步 [value]",
|
||||||
|
"formatEN": "update featured model automatic synchronization [value]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/hf/download": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"repoID",
|
||||||
|
"revision"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "下载 Hugging Face 模型 [repoID]",
|
||||||
|
"formatEN": "download Hugging Face model [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/local/delete": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "删除本地模型 [name]",
|
||||||
|
"formatEN": "delete local model [name]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/modelscope/download": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"repoID",
|
||||||
|
"revision"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "下载 ModelScope 模型 [repoID]",
|
||||||
|
"formatEN": "download ModelScope model [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/settings": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"modelDir"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新模型下载设置 [modelDir]",
|
||||||
|
"formatEN": "update model downloader settings [modelDir]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/tasks/cancel": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "model_download_tasks",
|
||||||
|
"output_column": "repo_id",
|
||||||
|
"output_value": "repoID"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "取消模型下载任务 [repoID]",
|
||||||
|
"formatEN": "cancel model download task [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/tasks/remove": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "model_download_tasks",
|
||||||
|
"output_column": "repo_id",
|
||||||
|
"output_value": "repoID"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "移除模型下载任务 [repoID]",
|
||||||
|
"formatEN": "remove model download task [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/tasks/retry": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "model_download_tasks",
|
||||||
|
"output_column": "repo_id",
|
||||||
|
"output_value": "repoID"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "重试模型下载任务 [repoID]",
|
||||||
|
"formatEN": "retry model download task [repoID]"
|
||||||
|
},
|
||||||
"/xpack/monitor/config/global": {
|
"/xpack/monitor/config/global": {
|
||||||
"bodyKeys": [],
|
"bodyKeys": [],
|
||||||
"paramKeys": [],
|
"paramKeys": [],
|
||||||
@@ -5130,6 +5425,17 @@
|
|||||||
"formatZH": "创建 vLLM [name]",
|
"formatZH": "创建 vLLM [name]",
|
||||||
"formatEN": "create vLLM [name]"
|
"formatEN": "create vLLM [name]"
|
||||||
},
|
},
|
||||||
|
"/xpack/vllm/monitor/setting/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"vllmID",
|
||||||
|
"key",
|
||||||
|
"value"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "修改 vLLM [vllmID] 监控设置 [key]-[value]",
|
||||||
|
"formatEN": "update vLLM [vllmID] monitor setting [key]-[value]"
|
||||||
|
},
|
||||||
"/xpack/vllm/operate": {
|
"/xpack/vllm/operate": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"id",
|
"id",
|
||||||
@@ -5159,282 +5465,6 @@
|
|||||||
"formatZH": "更新 vLLM [name]",
|
"formatZH": "更新 vLLM [name]",
|
||||||
"formatEN": "update vLLM [name]"
|
"formatEN": "update vLLM [name]"
|
||||||
},
|
},
|
||||||
"/vms": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机 [name]",
|
|
||||||
"formatEN": "create VM [name]"
|
|
||||||
},
|
|
||||||
"/vms/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "virtual_machines",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机 [name]",
|
|
||||||
"formatEN": "delete VM [name]"
|
|
||||||
},
|
|
||||||
"/vms/disks/resize": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"target",
|
|
||||||
"sizeGiB"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "扩容虚拟机 [name] 磁盘 [target] 至 [sizeGiB] GiB",
|
|
||||||
"formatEN": "expand VM [name] disk [target] to [sizeGiB] GiB"
|
|
||||||
},
|
|
||||||
"/vms/environment/enable": {
|
|
||||||
"bodyKeys": [],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "启用虚拟机运行环境",
|
|
||||||
"formatEN": "enable VM runtime environment"
|
|
||||||
},
|
|
||||||
"/vms/iso": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机镜像 [name] [type]",
|
|
||||||
"formatEN": "create VM ISO [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/iso/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_isos",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机镜像 [name]",
|
|
||||||
"formatEN": "delete VM ISO [name]"
|
|
||||||
},
|
|
||||||
"/vms/iso/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新虚拟机镜像 [name] [type]",
|
|
||||||
"formatEN": "update VM ISO [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/networks": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机网络 [name] [type]",
|
|
||||||
"formatEN": "create VM network [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/networks/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_networks",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机网络 [name]",
|
|
||||||
"formatEN": "delete VM network [name]"
|
|
||||||
},
|
|
||||||
"/vms/networks/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_networks",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "更新虚拟机网络 [name]",
|
|
||||||
"formatEN": "update VM network [name]"
|
|
||||||
},
|
|
||||||
"/vms/operate": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"operate"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "操作虚拟机 [name] [operate]",
|
|
||||||
"formatEN": "operate VM [name] [operate]"
|
|
||||||
},
|
|
||||||
"/vms/orphans/clean": {
|
|
||||||
"bodyKeys": [],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "清理虚拟机孤立数据",
|
|
||||||
"formatEN": "clean VM orphaned data"
|
|
||||||
},
|
|
||||||
"/vms/rename": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"newName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "重命名虚拟机 [name] 为 [newName]",
|
|
||||||
"formatEN": "rename VM [name] to [newName]"
|
|
||||||
},
|
|
||||||
"/vms/snapshots": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"snapshotName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机 [name] 快照 [snapshotName]",
|
|
||||||
"formatEN": "create VM [name] snapshot [snapshotName]"
|
|
||||||
},
|
|
||||||
"/vms/snapshots/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"snapshotName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "删除虚拟机 [name] 快照 [snapshotName]",
|
|
||||||
"formatEN": "delete VM [name] snapshot [snapshotName]"
|
|
||||||
},
|
|
||||||
"/vms/snapshots/recover": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"snapshotName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "恢复虚拟机 [name] 快照 [snapshotName]",
|
|
||||||
"formatEN": "recover VM [name] snapshot [snapshotName]"
|
|
||||||
},
|
|
||||||
"/vms/storages": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机存储 [name] [type]",
|
|
||||||
"formatEN": "create VM storage [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/storages/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_storages",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机存储 [name]",
|
|
||||||
"formatEN": "delete VM storage [name]"
|
|
||||||
},
|
|
||||||
"/vms/storages/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_storages",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "更新虚拟机存储 [name]",
|
|
||||||
"formatEN": "update VM storage [name]"
|
|
||||||
},
|
|
||||||
"/vms/sync": {
|
|
||||||
"bodyKeys": [],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "同步虚拟机",
|
|
||||||
"formatEN": "sync virtual machines"
|
|
||||||
},
|
|
||||||
"/vms/templates": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"templateName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机 [name] 模板 [templateName]",
|
|
||||||
"formatEN": "create VM [name] template [templateName]"
|
|
||||||
},
|
|
||||||
"/vms/templates/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_templates",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机模板 [name]",
|
|
||||||
"formatEN": "delete VM template [name]"
|
|
||||||
},
|
|
||||||
"/vms/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新虚拟机 [name]",
|
|
||||||
"formatEN": "update VM [name]"
|
|
||||||
},
|
|
||||||
"/xpack/waf/block/export": {
|
"/xpack/waf/block/export": {
|
||||||
"bodyKeys": [],
|
"bodyKeys": [],
|
||||||
"paramKeys": [],
|
"paramKeys": [],
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ func agentDBMigrations() []*gormigrate.Migration {
|
|||||||
migrations.MigrateVMDatabase,
|
migrations.MigrateVMDatabase,
|
||||||
migrations.UpdateModelServicesQuickJumpRouter,
|
migrations.UpdateModelServicesQuickJumpRouter,
|
||||||
migrations.AddAgentAccountVerificationResult,
|
migrations.AddAgentAccountVerificationResult,
|
||||||
|
migrations.AddAgentAccountType,
|
||||||
migrations.AddGPUGroup,
|
migrations.AddGPUGroup,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/provider"
|
||||||
|
"github.com/go-gormigrate/gormigrate/v2"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
var AddAgentAccountType = &gormigrate.Migration{
|
||||||
|
ID: "202611120002",
|
||||||
|
Migrate: func(tx *gorm.DB) error {
|
||||||
|
if err := tx.AutoMigrate(&model.AgentAccount{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for key := range provider.All() {
|
||||||
|
preset, ok := provider.FindAccountType(key, "")
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err := tx.Model(&model.AgentAccount{}).Where("provider = ? AND (account_type = ? OR account_type IS NULL)", key, "").Update("account_type", preset.Key).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||||
providercatalog "github.com/1Panel-dev/1Panel/agent/app/provider"
|
providercatalog "github.com/1Panel-dev/1Panel/agent/app/provider"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/service"
|
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -57,7 +56,6 @@ func buildMigratedAgentAccountModels(tx *gorm.DB, account *legacyAgentAccountMod
|
|||||||
if account == nil {
|
if account == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
baseAccount := account.AgentAccount
|
|
||||||
requested := make([]dto.AgentAccountModel, 0)
|
requested := make([]dto.AgentAccountModel, 0)
|
||||||
if strings.TrimSpace(account.LegacyModels) != "" {
|
if strings.TrimSpace(account.LegacyModels) != "" {
|
||||||
if err := json.Unmarshal([]byte(account.LegacyModels), &requested); err != nil {
|
if err := json.Unmarshal([]byte(account.LegacyModels), &requested); err != nil {
|
||||||
@@ -93,14 +91,7 @@ func buildMigratedAgentAccountModels(tx *gorm.DB, account *legacyAgentAccountMod
|
|||||||
appendModel(agent.Model)
|
appendModel(agent.Model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
models, err := service.MergeCatalogAgentAccountModelsForMigration(&baseAccount, requested)
|
return requested, nil
|
||||||
if err != nil {
|
|
||||||
if strings.TrimSpace(err.Error()) == "model is required" {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return models, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NormalizeAgentAccountModelIDs(tx *gorm.DB) error {
|
func NormalizeAgentAccountModelIDs(tx *gorm.DB) error {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
@@ -102,6 +101,9 @@ func NewClient(cfg ClientConfig) (Client, error) {
|
|||||||
cfg.Provider = providerKey
|
cfg.Provider = providerKey
|
||||||
cfg.BaseURL = baseURL
|
cfg.BaseURL = baseURL
|
||||||
cfg.APIType = normalizeClientAPIType(providerKey, cfg.APIType)
|
cfg.APIType = normalizeClientAPIType(providerKey, cfg.APIType)
|
||||||
|
if providercatalog.Purpose(cfg.APIType) != "text" {
|
||||||
|
return nil, fmt.Errorf("api type %s does not support text generation", cfg.APIType)
|
||||||
|
}
|
||||||
authMode, err := providercatalog.ResolveAuthMode(providerKey, cfg.APIType, cfg.AuthMode)
|
authMode, err := providercatalog.ResolveAuthMode(providerKey, cfg.APIType, cfg.AuthMode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -149,7 +151,7 @@ func (c *terminalAIClient) chatCompletionOpenAI(ctx context.Context, req ChatCom
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("marshal request: %w", err)
|
return nil, fmt.Errorf("marshal request: %w", err)
|
||||||
}
|
}
|
||||||
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, buildChatCompletionsURL(c.config.BaseURL), bytes.NewReader(body))
|
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, providercatalog.BuildTextRequestURL(c.config.APIType, c.config.BaseURL, c.config.Model), bytes.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("create request: %w", err)
|
return nil, fmt.Errorf("create request: %w", err)
|
||||||
}
|
}
|
||||||
@@ -193,7 +195,7 @@ func (c *terminalAIClient) chatCompletionOpenAIResponses(ctx context.Context, re
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("marshal request: %w", err)
|
return nil, fmt.Errorf("marshal request: %w", err)
|
||||||
}
|
}
|
||||||
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, buildResponsesURL(c.config.BaseURL), bytes.NewReader(body))
|
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, providercatalog.BuildTextRequestURL(c.config.APIType, c.config.BaseURL, c.config.Model), bytes.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("create request: %w", err)
|
return nil, fmt.Errorf("create request: %w", err)
|
||||||
}
|
}
|
||||||
@@ -241,7 +243,7 @@ func (c *terminalAIClient) chatCompletionAnthropic(ctx context.Context, req Chat
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("marshal request: %w", err)
|
return nil, fmt.Errorf("marshal request: %w", err)
|
||||||
}
|
}
|
||||||
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, buildAnthropicMessagesURL(c.config.BaseURL), bytes.NewReader(body))
|
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, providercatalog.BuildTextRequestURL(c.config.APIType, c.config.BaseURL, c.config.Model), bytes.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("create request: %w", err)
|
return nil, fmt.Errorf("create request: %w", err)
|
||||||
}
|
}
|
||||||
@@ -291,7 +293,7 @@ func (c *terminalAIClient) chatCompletionGemini(ctx context.Context, req ChatCom
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("marshal request: %w", err)
|
return nil, fmt.Errorf("marshal request: %w", err)
|
||||||
}
|
}
|
||||||
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, buildGeminiGenerateContentURL(c.config.BaseURL, strings.TrimSpace(c.config.Model)), bytes.NewReader(body))
|
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, providercatalog.BuildTextRequestURL(c.config.APIType, c.config.BaseURL, c.config.Model), bytes.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("create request: %w", err)
|
return nil, fmt.Errorf("create request: %w", err)
|
||||||
}
|
}
|
||||||
@@ -509,81 +511,6 @@ func normalizeBaseURL(provider, rawBaseURL string) string {
|
|||||||
return strings.TrimRight(baseURL, "/")
|
return strings.TrimRight(baseURL, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildChatCompletionsURL(baseURL string) string {
|
|
||||||
baseURL = strings.TrimRight(strings.TrimSpace(baseURL), "/")
|
|
||||||
if strings.HasSuffix(baseURL, "/chat/completions") {
|
|
||||||
return baseURL
|
|
||||||
}
|
|
||||||
parsed, err := url.Parse(baseURL)
|
|
||||||
if err != nil {
|
|
||||||
return baseURL + "/chat/completions"
|
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case strings.HasSuffix(parsed.Path, "/v1"):
|
|
||||||
parsed.Path += "/chat/completions"
|
|
||||||
case strings.HasSuffix(parsed.Path, "/v1beta"):
|
|
||||||
parsed.Path += "/chat/completions"
|
|
||||||
default:
|
|
||||||
parsed.Path = strings.TrimRight(parsed.Path, "/") + "/v1/chat/completions"
|
|
||||||
}
|
|
||||||
return strings.TrimRight(parsed.String(), "/")
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildResponsesURL(baseURL string) string {
|
|
||||||
baseURL = strings.TrimRight(strings.TrimSpace(baseURL), "/")
|
|
||||||
if strings.HasSuffix(baseURL, "/responses") {
|
|
||||||
return baseURL
|
|
||||||
}
|
|
||||||
parsed, err := url.Parse(baseURL)
|
|
||||||
if err != nil {
|
|
||||||
return baseURL + "/responses"
|
|
||||||
}
|
|
||||||
if strings.HasSuffix(parsed.Path, "/v1") {
|
|
||||||
parsed.Path += "/responses"
|
|
||||||
} else {
|
|
||||||
parsed.Path = strings.TrimRight(parsed.Path, "/") + "/v1/responses"
|
|
||||||
}
|
|
||||||
return strings.TrimRight(parsed.String(), "/")
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildAnthropicMessagesURL(baseURL string) string {
|
|
||||||
baseURL = strings.TrimRight(strings.TrimSpace(baseURL), "/")
|
|
||||||
if strings.HasSuffix(baseURL, "/messages") {
|
|
||||||
return baseURL
|
|
||||||
}
|
|
||||||
parsed, err := url.Parse(baseURL)
|
|
||||||
if err != nil {
|
|
||||||
return baseURL + "/messages"
|
|
||||||
}
|
|
||||||
if strings.HasSuffix(parsed.Path, "/v1") {
|
|
||||||
parsed.Path += "/messages"
|
|
||||||
} else {
|
|
||||||
parsed.Path = strings.TrimRight(parsed.Path, "/") + "/v1/messages"
|
|
||||||
}
|
|
||||||
return strings.TrimRight(parsed.String(), "/")
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildGeminiGenerateContentURL(baseURL, model string) string {
|
|
||||||
baseURL = strings.TrimRight(strings.TrimSpace(baseURL), "/")
|
|
||||||
model = strings.TrimSpace(model)
|
|
||||||
if model == "" {
|
|
||||||
model = "gemini-3-flash-preview"
|
|
||||||
}
|
|
||||||
parsed, err := url.Parse(baseURL)
|
|
||||||
if err != nil {
|
|
||||||
return strings.TrimRight(baseURL, "/") + "/v1beta/models/" + model + ":generateContent"
|
|
||||||
}
|
|
||||||
if strings.Contains(parsed.Path, "/models/") && strings.HasSuffix(parsed.Path, ":generateContent") {
|
|
||||||
return parsed.String()
|
|
||||||
}
|
|
||||||
if strings.Contains(parsed.Path, "/v1beta") {
|
|
||||||
parsed.Path = strings.TrimRight(parsed.Path, "/") + "/models/" + model + ":generateContent"
|
|
||||||
} else {
|
|
||||||
parsed.Path = strings.TrimRight(parsed.Path, "/") + "/v1beta/models/" + model + ":generateContent"
|
|
||||||
}
|
|
||||||
return parsed.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
func thinkingModeForModel(model string) *ThinkingMode {
|
func thinkingModeForModel(model string) *ThinkingMode {
|
||||||
if strings.EqualFold(strings.TrimSpace(model), "kimi-k2.5") {
|
if strings.EqualFold(strings.TrimSpace(model), "kimi-k2.5") {
|
||||||
return &ThinkingMode{Type: "disabled"}
|
return &ThinkingMode{Type: "disabled"}
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ func ResolveGeneratorConfig(accountID uint) (GeneratorConfig, time.Duration, err
|
|||||||
if provider == "" {
|
if provider == "" {
|
||||||
return GeneratorConfig{}, 0, fmt.Errorf("agent account provider is required")
|
return GeneratorConfig{}, 0, fmt.Errorf("agent account provider is required")
|
||||||
}
|
}
|
||||||
apiType := strings.TrimSpace(account.APIType)
|
apiType := normalizeClientAPIType(provider, account.APIType)
|
||||||
if providercatalog.IsImageAPIType(apiType) {
|
if providercatalog.Purpose(apiType) != "text" {
|
||||||
return GeneratorConfig{}, 0, fmt.Errorf("api type %s does not support text generation", apiType)
|
return GeneratorConfig{}, 0, fmt.Errorf("api type %s does not support text generation", apiType)
|
||||||
}
|
}
|
||||||
model, err := resolveAccountModelConfig(account.ID, provider)
|
model, err := resolveAccountModelConfig(account.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return GeneratorConfig{}, 0, err
|
return GeneratorConfig{}, 0, err
|
||||||
}
|
}
|
||||||
@@ -90,15 +90,7 @@ func lookupProviderAPIKey(provider string) string {
|
|||||||
return strings.TrimSpace(os.Getenv(envKey))
|
return strings.TrimSpace(os.Getenv(envKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultModelForProvider(provider string) string {
|
func resolveAccountModelConfig(accountID uint) (string, error) {
|
||||||
meta, ok := providercatalog.Get(provider)
|
|
||||||
if !ok || len(meta.Models) == 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return meta.Models[0].ID
|
|
||||||
}
|
|
||||||
|
|
||||||
func resolveAccountModelConfig(accountID uint, provider string) (string, error) {
|
|
||||||
if accountID > 0 {
|
if accountID > 0 {
|
||||||
rows, err := agentAccountModelRepo.List(repo.WithByAccountID(accountID), repo.WithOrderAsc("sort_order"), repo.WithOrderAsc("id"))
|
rows, err := agentAccountModelRepo.List(repo.WithByAccountID(accountID), repo.WithOrderAsc("sort_order"), repo.WithOrderAsc("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -108,7 +100,7 @@ func resolveAccountModelConfig(accountID uint, provider string) (string, error)
|
|||||||
return strings.TrimSpace(rows[0].Model), nil
|
return strings.TrimSpace(rows[0].Model), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultModelForProvider(provider), nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResolveGeneratorConfigFromAgentSettings() (GeneratorConfig, uint, time.Duration, error) {
|
func ResolveGeneratorConfigFromAgentSettings() (GeneratorConfig, uint, time.Duration, error) {
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ const docTemplate = `{
|
|||||||
"Timestamp": []
|
"Timestamp": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"summary": "Update model service model",
|
"summary": "Update model service models",
|
||||||
"tags": [
|
"tags": [
|
||||||
"AI"
|
"AI"
|
||||||
]
|
]
|
||||||
@@ -33977,6 +33977,9 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountCreateReq": {
|
"dto.AgentAccountCreateReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -34035,6 +34038,9 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountInfo": {
|
"dto.AgentAccountInfo": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -34080,9 +34086,19 @@ const docTemplate = `{
|
|||||||
"rememberApiKey": {
|
"rememberApiKey": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"validateAvailability": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"verified": {
|
"verified": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"verifiedAt": {
|
||||||
|
"format": "date-time",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"verifyError": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"verifyModel": {
|
"verifyModel": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -34135,25 +34151,33 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountModelDiscoverReq": {
|
"dto.AgentAccountModelDiscoverReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountId": {
|
||||||
|
"description": "Existing account ID. When provided, connection settings are loaded from the saved account.",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"apiType": {
|
"apiType": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"authMode": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"baseURL": {
|
"baseURL": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"provider": {
|
"provider": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
|
||||||
"apiKey",
|
|
||||||
"apiType",
|
|
||||||
"baseURL",
|
|
||||||
"provider"
|
|
||||||
],
|
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"dto.AgentAccountModelReq": {
|
"dto.AgentAccountModelReq": {
|
||||||
@@ -34172,18 +34196,31 @@ const docTemplate = `{
|
|||||||
"accountId": {
|
"accountId": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"model": {
|
"models": {
|
||||||
"$ref": "#/definitions/dto.AgentAccountModel"
|
"type": "array",
|
||||||
|
"minItems": 1,
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.AgentAccountModel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"verifyModel": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"accountId",
|
"accountId",
|
||||||
"model"
|
"models"
|
||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"dto.AgentAccountProviderCountReq": {
|
"dto.AgentAccountProviderCountReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"excludeCodingPlanProviders": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"providers": {
|
"providers": {
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -34195,6 +34232,12 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountSearch": {
|
"dto.AgentAccountSearch": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"excludeCodingPlanProviders": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"apiType": {
|
"apiType": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -34222,6 +34265,9 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountUpdateReq": {
|
"dto.AgentAccountUpdateReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -34237,6 +34283,12 @@ const docTemplate = `{
|
|||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"models": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.AgentAccountModel"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -44654,8 +44706,28 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"dto.ProviderAccountTypeInfo": {
|
||||||
|
"properties": {
|
||||||
|
"apiTypes": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.ProviderAPIInfo"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"dto.ProviderInfo": {
|
"dto.ProviderInfo": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountTypes": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.ProviderAccountTypeInfo"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"apiTypes": {
|
"apiTypes": {
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/dto.ProviderAPIInfo"
|
"$ref": "#/definitions/dto.ProviderAPIInfo"
|
||||||
|
|||||||
@@ -307,7 +307,7 @@
|
|||||||
"Timestamp": []
|
"Timestamp": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"summary": "Update model service model",
|
"summary": "Update model service models",
|
||||||
"tags": [
|
"tags": [
|
||||||
"AI"
|
"AI"
|
||||||
]
|
]
|
||||||
@@ -32664,6 +32664,9 @@
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountCreateReq": {
|
"dto.AgentAccountCreateReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -32722,12 +32725,18 @@
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountInfo": {
|
"dto.AgentAccountInfo": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"apiType": {
|
"apiType": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"appInstallId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"authMode": {
|
"authMode": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -32764,9 +32773,19 @@
|
|||||||
"rememberApiKey": {
|
"rememberApiKey": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"validateAvailability": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"verified": {
|
"verified": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"verifiedAt": {
|
||||||
|
"format": "date-time",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"verifyError": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"verifyModel": {
|
"verifyModel": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -32819,25 +32838,33 @@
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountModelDiscoverReq": {
|
"dto.AgentAccountModelDiscoverReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountId": {
|
||||||
|
"description": "Existing account ID. When provided, connection settings are loaded from the saved account.",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"apiType": {
|
"apiType": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"authMode": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"baseURL": {
|
"baseURL": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"provider": {
|
"provider": {
|
||||||
|
"description": "Required when accountId is not provided.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
|
||||||
"apiKey",
|
|
||||||
"apiType",
|
|
||||||
"baseURL",
|
|
||||||
"provider"
|
|
||||||
],
|
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"dto.AgentAccountModelReq": {
|
"dto.AgentAccountModelReq": {
|
||||||
@@ -32856,18 +32883,31 @@
|
|||||||
"accountId": {
|
"accountId": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"model": {
|
"models": {
|
||||||
"$ref": "#/definitions/dto.AgentAccountModel"
|
"type": "array",
|
||||||
|
"minItems": 1,
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.AgentAccountModel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"verifyModel": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"accountId",
|
"accountId",
|
||||||
"model"
|
"models"
|
||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"dto.AgentAccountProviderCountReq": {
|
"dto.AgentAccountProviderCountReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"excludeCodingPlanProviders": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"providers": {
|
"providers": {
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -32879,6 +32919,12 @@
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountSearch": {
|
"dto.AgentAccountSearch": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"excludeCodingPlanProviders": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"apiType": {
|
"apiType": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -32906,6 +32952,9 @@
|
|||||||
},
|
},
|
||||||
"dto.AgentAccountUpdateReq": {
|
"dto.AgentAccountUpdateReq": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -32921,6 +32970,12 @@
|
|||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"models": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.AgentAccountModel"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -43051,8 +43106,28 @@
|
|||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"dto.ProviderAccountTypeInfo": {
|
||||||
|
"properties": {
|
||||||
|
"apiTypes": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.ProviderAPIInfo"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"dto.ProviderInfo": {
|
"dto.ProviderInfo": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accountTypes": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.ProviderAccountTypeInfo"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
"apiTypes": {
|
"apiTypes": {
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/dto.ProviderAPIInfo"
|
"$ref": "#/definitions/dto.ProviderAPIInfo"
|
||||||
|
|||||||
@@ -8,107 +8,6 @@
|
|||||||
"formatZH": "更新 Ollama 绑定域名 [domain]",
|
"formatZH": "更新 Ollama 绑定域名 [domain]",
|
||||||
"formatEN": "update Ollama bind domain [domain]"
|
"formatEN": "update Ollama bind domain [domain]"
|
||||||
},
|
},
|
||||||
"/xpack/model/downloader/featured/sync/status": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新推荐模型自动同步 [value]",
|
|
||||||
"formatEN": "update featured model automatic synchronization [value]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/hf/download": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"repoID",
|
|
||||||
"revision"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "下载 Hugging Face 模型 [repoID]",
|
|
||||||
"formatEN": "download Hugging Face model [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/local/delete": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "删除本地模型 [name]",
|
|
||||||
"formatEN": "delete local model [name]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/modelscope/download": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"repoID",
|
|
||||||
"revision"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "下载 ModelScope 模型 [repoID]",
|
|
||||||
"formatEN": "download ModelScope model [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/settings": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"modelDir"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新模型下载设置 [modelDir]",
|
|
||||||
"formatEN": "update model downloader settings [modelDir]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/tasks/cancel": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "model_download_tasks",
|
|
||||||
"output_column": "repo_id",
|
|
||||||
"output_value": "repoID"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "取消模型下载任务 [repoID]",
|
|
||||||
"formatEN": "cancel model download task [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/tasks/remove": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "model_download_tasks",
|
|
||||||
"output_column": "repo_id",
|
|
||||||
"output_value": "repoID"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "移除模型下载任务 [repoID]",
|
|
||||||
"formatEN": "remove model download task [repoID]"
|
|
||||||
},
|
|
||||||
"/xpack/model/downloader/tasks/retry": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "model_download_tasks",
|
|
||||||
"output_column": "repo_id",
|
|
||||||
"output_value": "repoID"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "重试模型下载任务 [repoID]",
|
|
||||||
"formatEN": "retry model download task [repoID]"
|
|
||||||
},
|
|
||||||
"/ai/ollama/close": {
|
"/ai/ollama/close": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"name"
|
"name"
|
||||||
@@ -3815,6 +3714,25 @@
|
|||||||
"formatZH": "[domain] PHP 配置修改",
|
"formatZH": "[domain] PHP 配置修改",
|
||||||
"formatEN": "[domain] PHP conf update"
|
"formatEN": "[domain] PHP conf update"
|
||||||
},
|
},
|
||||||
|
"/runtimes/php/extensions/import": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "同步 PHP 扩展模版 [name]",
|
||||||
|
"formatEN": "Sync PHP extension template [name]"
|
||||||
|
},
|
||||||
|
"/runtimes/php/extensions/push": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"sourceNode",
|
||||||
|
"targetNodes"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "推送 PHP 扩展模版 [sourceNode] 至 [targetNodes]",
|
||||||
|
"formatEN": "Push PHP extension template from [sourceNode] to [targetNodes]"
|
||||||
|
},
|
||||||
"/runtimes/php/update": {
|
"/runtimes/php/update": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"websiteId"
|
"websiteId"
|
||||||
@@ -4211,6 +4129,282 @@
|
|||||||
"formatZH": "扫描系统垃圾文件",
|
"formatZH": "扫描系统垃圾文件",
|
||||||
"formatEN": "scan System Junk Files"
|
"formatEN": "scan System Junk Files"
|
||||||
},
|
},
|
||||||
|
"/vms": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机 [name]",
|
||||||
|
"formatEN": "create VM [name]"
|
||||||
|
},
|
||||||
|
"/vms/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "virtual_machines",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机 [name]",
|
||||||
|
"formatEN": "delete VM [name]"
|
||||||
|
},
|
||||||
|
"/vms/disks/resize": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"target",
|
||||||
|
"sizeGiB"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "扩容虚拟机 [name] 磁盘 [target] 至 [sizeGiB] GiB",
|
||||||
|
"formatEN": "expand VM [name] disk [target] to [sizeGiB] GiB"
|
||||||
|
},
|
||||||
|
"/vms/environment/enable": {
|
||||||
|
"bodyKeys": [],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "启用虚拟机运行环境",
|
||||||
|
"formatEN": "enable VM runtime environment"
|
||||||
|
},
|
||||||
|
"/vms/iso": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机镜像 [name] [type]",
|
||||||
|
"formatEN": "create VM ISO [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/iso/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_isos",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机镜像 [name]",
|
||||||
|
"formatEN": "delete VM ISO [name]"
|
||||||
|
},
|
||||||
|
"/vms/iso/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新虚拟机镜像 [name] [type]",
|
||||||
|
"formatEN": "update VM ISO [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/networks": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机网络 [name] [type]",
|
||||||
|
"formatEN": "create VM network [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/networks/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_networks",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机网络 [name]",
|
||||||
|
"formatEN": "delete VM network [name]"
|
||||||
|
},
|
||||||
|
"/vms/networks/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_networks",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "更新虚拟机网络 [name]",
|
||||||
|
"formatEN": "update VM network [name]"
|
||||||
|
},
|
||||||
|
"/vms/operate": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"operate"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "操作虚拟机 [name] [operate]",
|
||||||
|
"formatEN": "operate VM [name] [operate]"
|
||||||
|
},
|
||||||
|
"/vms/orphans/clean": {
|
||||||
|
"bodyKeys": [],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "清理虚拟机孤立数据",
|
||||||
|
"formatEN": "clean VM orphaned data"
|
||||||
|
},
|
||||||
|
"/vms/rename": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"newName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "重命名虚拟机 [name] 为 [newName]",
|
||||||
|
"formatEN": "rename VM [name] to [newName]"
|
||||||
|
},
|
||||||
|
"/vms/snapshots": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"snapshotName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机 [name] 快照 [snapshotName]",
|
||||||
|
"formatEN": "create VM [name] snapshot [snapshotName]"
|
||||||
|
},
|
||||||
|
"/vms/snapshots/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"snapshotName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "删除虚拟机 [name] 快照 [snapshotName]",
|
||||||
|
"formatEN": "delete VM [name] snapshot [snapshotName]"
|
||||||
|
},
|
||||||
|
"/vms/snapshots/recover": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"snapshotName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "恢复虚拟机 [name] 快照 [snapshotName]",
|
||||||
|
"formatEN": "recover VM [name] snapshot [snapshotName]"
|
||||||
|
},
|
||||||
|
"/vms/storages": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机存储 [name] [type]",
|
||||||
|
"formatEN": "create VM storage [name] [type]"
|
||||||
|
},
|
||||||
|
"/vms/storages/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_storages",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机存储 [name]",
|
||||||
|
"formatEN": "delete VM storage [name]"
|
||||||
|
},
|
||||||
|
"/vms/storages/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_storages",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "更新虚拟机存储 [name]",
|
||||||
|
"formatEN": "update VM storage [name]"
|
||||||
|
},
|
||||||
|
"/vms/sync": {
|
||||||
|
"bodyKeys": [],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "同步虚拟机",
|
||||||
|
"formatEN": "sync virtual machines"
|
||||||
|
},
|
||||||
|
"/vms/templates": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"templateName"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "创建虚拟机 [name] 模板 [templateName]",
|
||||||
|
"formatEN": "create VM [name] template [templateName]"
|
||||||
|
},
|
||||||
|
"/vms/templates/del": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "vm_templates",
|
||||||
|
"output_column": "name",
|
||||||
|
"output_value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "删除虚拟机模板 [name]",
|
||||||
|
"formatEN": "delete VM template [name]"
|
||||||
|
},
|
||||||
|
"/vms/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新虚拟机 [name]",
|
||||||
|
"formatEN": "update VM [name]"
|
||||||
|
},
|
||||||
"/websites": {
|
"/websites": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"alias"
|
"alias"
|
||||||
@@ -5011,6 +5205,107 @@
|
|||||||
"formatZH": "更新离线告警日志 [id]",
|
"formatZH": "更新离线告警日志 [id]",
|
||||||
"formatEN": "update offline alert log [id]"
|
"formatEN": "update offline alert log [id]"
|
||||||
},
|
},
|
||||||
|
"/xpack/model/downloader/featured/sync/status": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"value"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新推荐模型自动同步 [value]",
|
||||||
|
"formatEN": "update featured model automatic synchronization [value]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/hf/download": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"repoID",
|
||||||
|
"revision"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "下载 Hugging Face 模型 [repoID]",
|
||||||
|
"formatEN": "download Hugging Face model [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/local/delete": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "删除本地模型 [name]",
|
||||||
|
"formatEN": "delete local model [name]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/modelscope/download": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"repoID",
|
||||||
|
"revision"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "下载 ModelScope 模型 [repoID]",
|
||||||
|
"formatEN": "download ModelScope model [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/settings": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"modelDir"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "更新模型下载设置 [modelDir]",
|
||||||
|
"formatEN": "update model downloader settings [modelDir]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/tasks/cancel": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "model_download_tasks",
|
||||||
|
"output_column": "repo_id",
|
||||||
|
"output_value": "repoID"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "取消模型下载任务 [repoID]",
|
||||||
|
"formatEN": "cancel model download task [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/tasks/remove": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "model_download_tasks",
|
||||||
|
"output_column": "repo_id",
|
||||||
|
"output_value": "repoID"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "移除模型下载任务 [repoID]",
|
||||||
|
"formatEN": "remove model download task [repoID]"
|
||||||
|
},
|
||||||
|
"/xpack/model/downloader/tasks/retry": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [
|
||||||
|
{
|
||||||
|
"input_column": "id",
|
||||||
|
"input_value": "id",
|
||||||
|
"isList": false,
|
||||||
|
"db": "model_download_tasks",
|
||||||
|
"output_column": "repo_id",
|
||||||
|
"output_value": "repoID"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatZH": "重试模型下载任务 [repoID]",
|
||||||
|
"formatEN": "retry model download task [repoID]"
|
||||||
|
},
|
||||||
"/xpack/monitor/config/global": {
|
"/xpack/monitor/config/global": {
|
||||||
"bodyKeys": [],
|
"bodyKeys": [],
|
||||||
"paramKeys": [],
|
"paramKeys": [],
|
||||||
@@ -5130,6 +5425,17 @@
|
|||||||
"formatZH": "创建 vLLM [name]",
|
"formatZH": "创建 vLLM [name]",
|
||||||
"formatEN": "create vLLM [name]"
|
"formatEN": "create vLLM [name]"
|
||||||
},
|
},
|
||||||
|
"/xpack/vllm/monitor/setting/update": {
|
||||||
|
"bodyKeys": [
|
||||||
|
"vllmID",
|
||||||
|
"key",
|
||||||
|
"value"
|
||||||
|
],
|
||||||
|
"paramKeys": [],
|
||||||
|
"beforeFunctions": [],
|
||||||
|
"formatZH": "修改 vLLM [vllmID] 监控设置 [key]-[value]",
|
||||||
|
"formatEN": "update vLLM [vllmID] monitor setting [key]-[value]"
|
||||||
|
},
|
||||||
"/xpack/vllm/operate": {
|
"/xpack/vllm/operate": {
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"id",
|
"id",
|
||||||
@@ -5159,282 +5465,6 @@
|
|||||||
"formatZH": "更新 vLLM [name]",
|
"formatZH": "更新 vLLM [name]",
|
||||||
"formatEN": "update vLLM [name]"
|
"formatEN": "update vLLM [name]"
|
||||||
},
|
},
|
||||||
"/vms": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机 [name]",
|
|
||||||
"formatEN": "create VM [name]"
|
|
||||||
},
|
|
||||||
"/vms/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "virtual_machines",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机 [name]",
|
|
||||||
"formatEN": "delete VM [name]"
|
|
||||||
},
|
|
||||||
"/vms/disks/resize": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"target",
|
|
||||||
"sizeGiB"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "扩容虚拟机 [name] 磁盘 [target] 至 [sizeGiB] GiB",
|
|
||||||
"formatEN": "expand VM [name] disk [target] to [sizeGiB] GiB"
|
|
||||||
},
|
|
||||||
"/vms/environment/enable": {
|
|
||||||
"bodyKeys": [],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "启用虚拟机运行环境",
|
|
||||||
"formatEN": "enable VM runtime environment"
|
|
||||||
},
|
|
||||||
"/vms/iso": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机镜像 [name] [type]",
|
|
||||||
"formatEN": "create VM ISO [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/iso/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_isos",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机镜像 [name]",
|
|
||||||
"formatEN": "delete VM ISO [name]"
|
|
||||||
},
|
|
||||||
"/vms/iso/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新虚拟机镜像 [name] [type]",
|
|
||||||
"formatEN": "update VM ISO [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/networks": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机网络 [name] [type]",
|
|
||||||
"formatEN": "create VM network [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/networks/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_networks",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机网络 [name]",
|
|
||||||
"formatEN": "delete VM network [name]"
|
|
||||||
},
|
|
||||||
"/vms/networks/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_networks",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "更新虚拟机网络 [name]",
|
|
||||||
"formatEN": "update VM network [name]"
|
|
||||||
},
|
|
||||||
"/vms/operate": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"operate"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "操作虚拟机 [name] [operate]",
|
|
||||||
"formatEN": "operate VM [name] [operate]"
|
|
||||||
},
|
|
||||||
"/vms/orphans/clean": {
|
|
||||||
"bodyKeys": [],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "清理虚拟机孤立数据",
|
|
||||||
"formatEN": "clean VM orphaned data"
|
|
||||||
},
|
|
||||||
"/vms/rename": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"newName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "重命名虚拟机 [name] 为 [newName]",
|
|
||||||
"formatEN": "rename VM [name] to [newName]"
|
|
||||||
},
|
|
||||||
"/vms/snapshots": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"snapshotName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机 [name] 快照 [snapshotName]",
|
|
||||||
"formatEN": "create VM [name] snapshot [snapshotName]"
|
|
||||||
},
|
|
||||||
"/vms/snapshots/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"snapshotName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "删除虚拟机 [name] 快照 [snapshotName]",
|
|
||||||
"formatEN": "delete VM [name] snapshot [snapshotName]"
|
|
||||||
},
|
|
||||||
"/vms/snapshots/recover": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"snapshotName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "恢复虚拟机 [name] 快照 [snapshotName]",
|
|
||||||
"formatEN": "recover VM [name] snapshot [snapshotName]"
|
|
||||||
},
|
|
||||||
"/vms/storages": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"type"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机存储 [name] [type]",
|
|
||||||
"formatEN": "create VM storage [name] [type]"
|
|
||||||
},
|
|
||||||
"/vms/storages/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_storages",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机存储 [name]",
|
|
||||||
"formatEN": "delete VM storage [name]"
|
|
||||||
},
|
|
||||||
"/vms/storages/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_storages",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "更新虚拟机存储 [name]",
|
|
||||||
"formatEN": "update VM storage [name]"
|
|
||||||
},
|
|
||||||
"/vms/sync": {
|
|
||||||
"bodyKeys": [],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "同步虚拟机",
|
|
||||||
"formatEN": "sync virtual machines"
|
|
||||||
},
|
|
||||||
"/vms/templates": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name",
|
|
||||||
"templateName"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "创建虚拟机 [name] 模板 [templateName]",
|
|
||||||
"formatEN": "create VM [name] template [templateName]"
|
|
||||||
},
|
|
||||||
"/vms/templates/del": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [
|
|
||||||
{
|
|
||||||
"input_column": "id",
|
|
||||||
"input_value": "id",
|
|
||||||
"isList": false,
|
|
||||||
"db": "vm_templates",
|
|
||||||
"output_column": "name",
|
|
||||||
"output_value": "name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatZH": "删除虚拟机模板 [name]",
|
|
||||||
"formatEN": "delete VM template [name]"
|
|
||||||
},
|
|
||||||
"/vms/update": {
|
|
||||||
"bodyKeys": [
|
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"paramKeys": [],
|
|
||||||
"beforeFunctions": [],
|
|
||||||
"formatZH": "更新虚拟机 [name]",
|
|
||||||
"formatEN": "update VM [name]"
|
|
||||||
},
|
|
||||||
"/xpack/waf/block/export": {
|
"/xpack/waf/block/export": {
|
||||||
"bodyKeys": [],
|
"bodyKeys": [],
|
||||||
"paramKeys": [],
|
"paramKeys": [],
|
||||||
|
|||||||
@@ -678,10 +678,13 @@ export namespace AI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountModelDiscoverReq {
|
export interface AgentAccountModelDiscoverReq {
|
||||||
provider: string;
|
accountId?: number;
|
||||||
baseURL: string;
|
accountType?: string;
|
||||||
apiKey: string;
|
provider?: string;
|
||||||
apiType: string;
|
baseURL?: string;
|
||||||
|
apiKey?: string;
|
||||||
|
apiType?: string;
|
||||||
|
authMode?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountModelCreateReq {
|
export interface AgentAccountModelCreateReq {
|
||||||
@@ -692,7 +695,8 @@ export namespace AI {
|
|||||||
|
|
||||||
export interface AgentAccountModelUpdateReq {
|
export interface AgentAccountModelUpdateReq {
|
||||||
accountId: number;
|
accountId: number;
|
||||||
model: AgentAccountModel;
|
models: AgentAccountModel[];
|
||||||
|
verifyModel: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountModelDeleteReq {
|
export interface AgentAccountModelDeleteReq {
|
||||||
@@ -716,7 +720,13 @@ export namespace AI {
|
|||||||
models: ProviderModelInfo[];
|
models: ProviderModelInfo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProviderAccountType {
|
||||||
|
key: string;
|
||||||
|
apiTypes: ProviderAPIInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProviderInfo {
|
export interface ProviderInfo {
|
||||||
|
accountTypes: ProviderAccountType[];
|
||||||
provider: string;
|
provider: string;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
@@ -726,6 +736,7 @@ export namespace AI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountCreateReq {
|
export interface AgentAccountCreateReq {
|
||||||
|
accountType?: string;
|
||||||
provider: string;
|
provider: string;
|
||||||
name: string;
|
name: string;
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
@@ -740,6 +751,7 @@ export namespace AI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountUpdateReq {
|
export interface AgentAccountUpdateReq {
|
||||||
|
accountType?: string;
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
@@ -755,6 +767,7 @@ export namespace AI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountSearch {
|
export interface AgentAccountSearch {
|
||||||
|
excludeCodingPlanProviders?: string[];
|
||||||
page: number;
|
page: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
provider: string;
|
provider: string;
|
||||||
@@ -764,10 +777,12 @@ export namespace AI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountProviderCountReq {
|
export interface AgentAccountProviderCountReq {
|
||||||
|
excludeCodingPlanProviders?: string[];
|
||||||
providers: string[];
|
providers: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AgentAccountItem {
|
export interface AgentAccountItem {
|
||||||
|
accountType?: string;
|
||||||
appInstallId?: number;
|
appInstallId?: number;
|
||||||
id: number;
|
id: number;
|
||||||
provider: string;
|
provider: string;
|
||||||
|
|||||||
@@ -251,7 +251,10 @@ export const updateAgentAccountVerifyModel = (req: AI.AgentAccountVerifyModelUpd
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const discoverAgentAccountModels = (req: AI.AgentAccountModelDiscoverReq) => {
|
export const discoverAgentAccountModels = (req: AI.AgentAccountModelDiscoverReq) => {
|
||||||
return http.post<AI.AgentAccountModel[]>(`/ai/accounts/models/discover`, req);
|
return http.postWithConfig<AI.AgentAccountModel[]>(`/ai/accounts/models/discover`, req, {
|
||||||
|
timeout: TimeoutEnum.T_60S,
|
||||||
|
errorMessageMode: 'manual',
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createAgentAccountModel = (req: AI.AgentAccountModelCreateReq) => {
|
export const createAgentAccountModel = (req: AI.AgentAccountModelCreateReq) => {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 908 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path
|
||||||
|
fill="#4D6BFE"
|
||||||
|
d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 0 1-.465.137 9.597 9.597 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 0 0 1.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 0 1 .415-.287.302.302 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 0 1-.254-.078.253.253 0 0 1-.114-.358c.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
@@ -1,4 +0,0 @@
|
|||||||
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M21.7202 0.939941C22.9502 0.939941 23.9502 1.93994 23.9502 3.16994C23.9502 4.39994 22.9502 5.39994 21.7202 5.39994H19.7502C19.6002 5.39994 19.4902 5.27994 19.4902 5.13994V3.16994C19.4902 1.93994 20.4902 0.939941 21.7202 0.939941Z" fill="#1783FF"/>
|
|
||||||
<path d="M9.39 13.9501L17.82 5.59012C17.98 5.43012 17.89 5.12012 17.68 5.12012H13.14C13.14 5.12012 13.04 5.14012 13 5.18012L3.92 14.1901C3.78 14.3301 3.57 14.2101 3.57 13.9801V5.39012C3.57 5.24012 3.47 5.12012 3.35 5.12012H0.219999C0.0999993 5.12012 0 5.24012 0 5.39012V23.9201C0 24.0701 0.0999993 24.1901 0.219999 24.1901H3.35C3.47 24.1901 3.57 24.0701 3.57 23.9201V20.1401C3.57 20.0601 3.6 19.9801 3.65 19.9301L6.47 17.1401C6.54 17.0701 6.63 17.0601 6.71 17.1101L14.24 22.6501C15.47 23.4801 16.85 23.9901 18.25 24.1401C18.37 24.1501 18.48 24.0301 18.48 23.8701V20.3101C18.48 20.1701 18.4 20.0601 18.29 20.0501C17.47 19.9201 16.66 19.6001 15.94 19.1101L9.42 14.3901C9.28 14.3001 9.27 14.0701 9.39 13.9501Z" fill="black"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"><title>OpenCode</title><rect width="512" height="512" rx="48" fill="#131010"/><path d="M320 224V352H192V224H320Z" fill="#5A5858"/><path fill-rule="evenodd" clip-rule="evenodd" d="M384 416H128V96H384V416ZM320 160H192V352H320V160Z" fill="white"/></svg>
|
||||||
|
After Width: | Height: | Size: 350 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Baidu Qianfan</title><path d="M11.32 1.176a1.4 1.4 0 0 1 1.36 0l8.64 4.843c.421.234.68.67.68 1.141v9.68c0 .472-.259.908-.68 1.143l-8.64 4.84a1.4 1.4 0 0 1-1.36 0l-8.64-4.84A1.31 1.31 0 0 1 2 16.84V7.159c0-.471.259-.907.68-1.142l8.64-4.84Zm7.42 13.839V8.227L12.002 12 12 19.551l6.059-3.394a1.31 1.31 0 0 0 .68-1.142ZM12.68 4.833a1.393 1.393 0 0 0-1.36 0L5.944 7.846c-.421.235-.68.67-.68 1.142v6.027c0 .47.259.905.68 1.142l2.795 1.566V11.09a1.546 1.546 0 0 0 .221.79 1.527 1.527 0 0 1-.216-.834l.004-.094.02-.15.018-.084.017-.062.039-.117.062-.142.035-.065.081-.13.094-.122.084-.091.08-.075.125-.1.071-.048.134-.076 5.87-3.29-2.796-1.566Z" fill="url(#qianfan-gradient)"/><path d="M12 11.088c0-.875-.73-1.584-1.631-1.584a1.66 1.66 0 0 0-.855.237l-.08.05-.123.093-.066.059-.048.045-.063.067-.04.048-.094.125-.042.069-.07.13-.036.081-.022.06-.028.087-.017.062-.03.16-.008.074a1.527 1.527 0 0 0 .213.929c.302.508.85.792 1.414.792.277 0 .558-.068.814-.212l.815-.457v-.914L12 11.088Z" fill="#012F8D"/><defs><linearGradient id="qianfan-gradient" x1="9.155%" x2="90.531%" y1="75.177%" y2="25.028%"><stop offset="0%" stop-color="#0A51C3"/><stop offset="100%" stop-color="#23A4FB"/></linearGradient></defs></svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>SiliconFlow</title><path clip-rule="evenodd" d="M22.956 6.521H12.522c-.577 0-1.044.468-1.044 1.044v3.13c0 .577-.466 1.044-1.043 1.044H1.044C.467 11.739 0 12.206 0 12.783v4.174C0 17.533.467 18 1.044 18h10.434c.577 0 1.044-.467 1.044-1.043v-3.13c0-.578.466-1.044 1.043-1.044h9.391c.577 0 1.044-.467 1.044-1.044V7.565c0-.576-.467-1.044-1.044-1.044Z" fill="#6E29F6" fill-rule="evenodd"/></svg>
|
||||||
|
After Width: | Height: | Size: 514 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Tencent Cloud</title><path d="M20.0483 17.1416C19.6945 17.4914 18.987 18.0161 17.7488 18.0161H10.143c2.2994-2.1863 4.2451-4.0229 4.422-4.1978.1769-.1749.6191-.6122 1.0613-.962.8844-.7871 1.5919-.8746 2.211-.8746.8844 0 1.5919.3499 2.211.8746 1.2381 1.1369 1.2381 3.1484 0 4.2853Zm1.5035-5.6846c-.8844-.962-2.211-1.5742-3.6261-1.5742-1.2382 0-2.2994.4373-3.2723 1.1369-.3537.3498-.8844.6997-1.3266 1.2244-.3537.3498-7.9596 7.696-7.9596 7.696.4422.0875.9728.0875 1.415.0875h9.64c.7076 0 1.2382 0 1.7688-.0875 1.1498-.0874 2.2995-.5247 3.2723-1.3992 2.0342-1.9241 2.0342-5.1599.0885-7.0843Z" fill="#00A3FF"/><path d="M9.1701 10.9323c-.9728-.6997-1.9457-1.0495-3.0954-1.0495-1.415 0-2.7417.6122-3.6261 1.5742-1.9456 2.0115-1.9456 5.1598.0885 7.1713.8844.7871 1.7688 1.2244 2.8301 1.3118l2.0341-1.924h-1.1497c-1.1498-.0874-1.8573-.4372-2.2995-.8745-1.2382-1.2244-1.2382-3.1484-.0884-4.3728.6191-.6122 1.3266-.8745 2.211-.8745.5306 0 1.3266.0874 2.1226.8745.3538.3498 1.3266 1.0495 1.6804 1.3993h.0884l1.3266-1.3118v-.0875c-.6191-.6122-1.5919-1.3993-2.1226-1.8365Z" fill="#00C8DC"/><path d="M18.4564 8.7454C17.4836 6.1217 14.9188 4.2852 12.0003 4.2852c-3.4492 0-6.1909 2.5361-6.7215 5.6845.2653 0 .5306-.0874.8844-.0874s.7959.0874 1.1497.0874c.4422-2.1863 2.3879-3.7605 4.6874-3.7605 1.9457 0 3.626 1.1369 4.422 2.7985 0 0 .0884.0875.0884 0 .6191-.0874 1.3266-.2623 1.9457-.2623Z" fill="#006EFF"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1119,6 +1119,33 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: 'Generates one minimal image before saving and may incur charges',
|
validateImageAvailabilityHelper: 'Generates one minimal image before saving and may incur charges',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'Fetch online or add manually. Every model in this list is editable.',
|
||||||
|
poolUnavailable: 'Online discovery is unavailable for this provider type and API. Add model IDs manually.',
|
||||||
|
poolEmpty: 'No models yet. Fetch online or add a model manually.',
|
||||||
|
poolOverwrite:
|
||||||
|
'A successful fetch will replace the entire list, including manual additions and edits. Continue?',
|
||||||
|
poolFetchEmpty: 'No models returned. Your list is unchanged. Retry or add models manually.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'Fetch failed. Your list is unchanged. Check the URL, API key and network, then retry or edit manually.',
|
||||||
|
poolSaveHelp: 'Changes take effect when saved. Models currently in use cannot be removed.',
|
||||||
|
|
||||||
|
accountType: 'Account type',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'Default',
|
||||||
|
payAsYouGo: 'Pay as you go',
|
||||||
|
chinaApi: 'China API',
|
||||||
|
globalApi: 'Global API',
|
||||||
|
chinaCodingPlan: 'China Coding Plan',
|
||||||
|
globalCodingPlan: 'Global Coding Plan',
|
||||||
|
chinaTokenPlan: 'China Token Plan',
|
||||||
|
globalTokenPlan: 'Global Token Plan',
|
||||||
|
speech: 'Speech services',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'Check and fetch',
|
externalInspect: 'Check and fetch',
|
||||||
externalHealthPassed: 'Health check passed',
|
externalHealthPassed: 'Health check passed',
|
||||||
externalHealthFailed: 'Health check failed',
|
externalHealthFailed: 'Health check failed',
|
||||||
|
|||||||
@@ -1121,6 +1121,34 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: 'Genera una imagen mínima antes de guardar y puede generar costes',
|
validateImageAvailabilityHelper: 'Genera una imagen mínima antes de guardar y puede generar costes',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'Obtenga modelos en línea o añádalos manualmente. Todos se pueden editar.',
|
||||||
|
poolUnavailable:
|
||||||
|
'Este tipo de proveedor y API no permite obtener modelos en línea. Añada los ID manualmente.',
|
||||||
|
poolEmpty: 'No hay modelos. Obténgalos en línea o añádalos manualmente.',
|
||||||
|
poolOverwrite:
|
||||||
|
'Si la consulta tiene éxito, se reemplazará toda la lista, incluidas las adiciones y ediciones manuales. ¿Continuar?',
|
||||||
|
poolFetchEmpty: 'No se recibieron modelos. La lista se conserva. Reintente o añádalos manualmente.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'Error al obtener modelos. La lista se conserva. Revise la URL, la clave API y la red, o edite manualmente.',
|
||||||
|
poolSaveHelp: 'Los cambios se aplican al guardar. No se pueden quitar modelos en uso.',
|
||||||
|
|
||||||
|
accountType: 'Tipo de cuenta',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'Predeterminado',
|
||||||
|
payAsYouGo: 'Pago por uso',
|
||||||
|
chinaApi: 'API de China',
|
||||||
|
globalApi: 'API global',
|
||||||
|
chinaCodingPlan: 'Coding Plan de China',
|
||||||
|
globalCodingPlan: 'Coding Plan global',
|
||||||
|
chinaTokenPlan: 'Token Plan de China',
|
||||||
|
globalTokenPlan: 'Token Plan global',
|
||||||
|
speech: 'Servicios de voz',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'Comprobar y obtener',
|
externalInspect: 'Comprobar y obtener',
|
||||||
externalHealthPassed: 'Comprobación de salud correcta',
|
externalHealthPassed: 'Comprobación de salud correcta',
|
||||||
externalHealthFailed: 'Falló la comprobación de salud',
|
externalHealthFailed: 'Falló la comprobación de salud',
|
||||||
|
|||||||
@@ -1103,6 +1103,34 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: 'پیش از ذخیره یک تصویر حداقلی تولید میشود و ممکن است هزینه داشته باشد',
|
validateImageAvailabilityHelper: 'پیش از ذخیره یک تصویر حداقلی تولید میشود و ممکن است هزینه داشته باشد',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'مدلها را آنلاین دریافت یا دستی اضافه کنید. همه مدلها قابل ویرایش هستند.',
|
||||||
|
poolUnavailable:
|
||||||
|
'این نوع ارائهدهنده و API از دریافت آنلاین پشتیبانی نمیکند. شناسه مدلها را دستی اضافه کنید.',
|
||||||
|
poolEmpty: 'مدلی وجود ندارد. آنلاین دریافت یا دستی اضافه کنید.',
|
||||||
|
poolOverwrite:
|
||||||
|
'دریافت موفق، کل فهرست از جمله موارد افزوده یا ویرایششده دستی را جایگزین میکند. ادامه میدهید؟',
|
||||||
|
poolFetchEmpty: 'مدلی دریافت نشد. فهرست فعلی حفظ شد. دوباره تلاش کنید یا دستی اضافه کنید.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'دریافت ناموفق بود. فهرست حفظ شد. نشانی، کلید API و شبکه را بررسی کنید یا دستی ویرایش کنید.',
|
||||||
|
poolSaveHelp: 'تغییرات پس از ذخیره اعمال میشوند. مدلهای در حال استفاده قابل حذف نیستند.',
|
||||||
|
|
||||||
|
accountType: 'نوع حساب',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'پیشفرض',
|
||||||
|
payAsYouGo: 'پرداخت بر اساس مصرف',
|
||||||
|
chinaApi: 'API چین',
|
||||||
|
globalApi: 'API جهانی',
|
||||||
|
chinaCodingPlan: 'Coding Plan چین',
|
||||||
|
globalCodingPlan: 'Coding Plan جهانی',
|
||||||
|
chinaTokenPlan: 'Token Plan چین',
|
||||||
|
globalTokenPlan: 'Token Plan جهانی',
|
||||||
|
speech: 'خدمات گفتار',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'بررسی و دریافت',
|
externalInspect: 'بررسی و دریافت',
|
||||||
externalHealthPassed: 'بررسی سلامت موفق بود',
|
externalHealthPassed: 'بررسی سلامت موفق بود',
|
||||||
externalHealthFailed: 'بررسی سلامت ناموفق بود',
|
externalHealthFailed: 'بررسی سلامت ناموفق بود',
|
||||||
|
|||||||
@@ -1104,6 +1104,33 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: '保存前に最小画像を1枚生成するため、料金が発生する場合があります',
|
validateImageAvailabilityHelper: '保存前に最小画像を1枚生成するため、料金が発生する場合があります',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'オンラインで取得するか手動で追加できます。すべてのモデルを編集できます。',
|
||||||
|
poolUnavailable:
|
||||||
|
'このプロバイダー種別と API はオンライン取得に対応していません。モデル ID を手動で追加してください。',
|
||||||
|
poolEmpty: 'モデルがありません。オンラインで取得するか手動で追加してください。',
|
||||||
|
poolOverwrite: '取得に成功すると、手動で追加・編集した内容を含む一覧全体が置き換わります。続行しますか?',
|
||||||
|
poolFetchEmpty: 'モデルが返されませんでした。一覧は保持されています。再試行するか手動で追加してください。',
|
||||||
|
poolFetchFailed:
|
||||||
|
'取得に失敗しました。一覧は保持されています。URL、API キー、ネットワークを確認して再試行するか、手動で編集してください。',
|
||||||
|
poolSaveHelp: '保存後に反映されます。使用中のモデルは削除できません。',
|
||||||
|
|
||||||
|
accountType: 'アカウント種別',
|
||||||
|
accountTypes: {
|
||||||
|
default: '既定',
|
||||||
|
payAsYouGo: '従量課金',
|
||||||
|
chinaApi: '中国 API',
|
||||||
|
globalApi: '国際 API',
|
||||||
|
chinaCodingPlan: '中国 Coding Plan',
|
||||||
|
globalCodingPlan: '国際 Coding Plan',
|
||||||
|
chinaTokenPlan: '中国 Token Plan',
|
||||||
|
globalTokenPlan: '国際 Token Plan',
|
||||||
|
speech: '音声サービス',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: '確認して取得',
|
externalInspect: '確認して取得',
|
||||||
externalHealthPassed: 'ヘルスチェック成功',
|
externalHealthPassed: 'ヘルスチェック成功',
|
||||||
externalHealthFailed: 'ヘルスチェック失敗',
|
externalHealthFailed: 'ヘルスチェック失敗',
|
||||||
|
|||||||
@@ -1096,6 +1096,32 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: '저장 전에 최소 이미지 한 장을 생성하며 비용이 발생할 수 있습니다',
|
validateImageAvailabilityHelper: '저장 전에 최소 이미지 한 장을 생성하며 비용이 발생할 수 있습니다',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: '온라인으로 가져오거나 직접 추가하세요. 모든 모델을 수정할 수 있습니다.',
|
||||||
|
poolUnavailable: '이 공급자 유형과 API는 온라인 가져오기를 지원하지 않습니다. 모델 ID를 직접 추가하세요.',
|
||||||
|
poolEmpty: '모델이 없습니다. 온라인으로 가져오거나 직접 추가하세요.',
|
||||||
|
poolOverwrite: '가져오기에 성공하면 수동 추가 및 수정 사항을 포함한 전체 목록이 교체됩니다. 계속할까요?',
|
||||||
|
poolFetchEmpty: '모델이 반환되지 않았습니다. 기존 목록은 유지됩니다. 다시 시도하거나 직접 추가하세요.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'가져오기에 실패했습니다. 기존 목록은 유지됩니다. URL, API 키, 네트워크를 확인한 후 다시 시도하거나 직접 수정하세요.',
|
||||||
|
poolSaveHelp: '저장 후 적용됩니다. 사용 중인 모델은 삭제할 수 없습니다.',
|
||||||
|
|
||||||
|
accountType: '계정 유형',
|
||||||
|
accountTypes: {
|
||||||
|
default: '기본',
|
||||||
|
payAsYouGo: '종량제',
|
||||||
|
chinaApi: '중국 API',
|
||||||
|
globalApi: '글로벌 API',
|
||||||
|
chinaCodingPlan: '중국 Coding Plan',
|
||||||
|
globalCodingPlan: '글로벌 Coding Plan',
|
||||||
|
chinaTokenPlan: '중국 Token Plan',
|
||||||
|
globalTokenPlan: '글로벌 Token Plan',
|
||||||
|
speech: '음성 서비스',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: '확인 및 가져오기',
|
externalInspect: '확인 및 가져오기',
|
||||||
externalHealthPassed: '상태 확인 성공',
|
externalHealthPassed: '상태 확인 성공',
|
||||||
externalHealthFailed: '상태 확인 실패',
|
externalHealthFailed: '상태 확인 실패',
|
||||||
|
|||||||
@@ -1091,6 +1091,31 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: 'ສ້າງຮູບຂະໜາດນ້ອຍໜຶ່ງຮູບກ່ອນບັນທຶກ ແລະ ອາດມີຄ່າໃຊ້ຈ່າຍ',
|
validateImageAvailabilityHelper: 'ສ້າງຮູບຂະໜາດນ້ອຍໜຶ່ງຮູບກ່ອນບັນທຶກ ແລະ ອາດມີຄ່າໃຊ້ຈ່າຍ',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'ດຶງແບບຈຳລອງອອນລາຍ ຫຼື ເພີ່ມເອງ. ທຸກລາຍການສາມາດແກ້ໄຂໄດ້.',
|
||||||
|
poolUnavailable: 'ປະເພດຜູ້ໃຫ້ບໍລິການ ແລະ API ນີ້ບໍ່ຮອງຮັບການດຶງອອນລາຍ. ກະລຸນາເພີ່ມ ID ເອງ.',
|
||||||
|
poolEmpty: 'ຍັງບໍ່ມີແບບຈຳລອງ. ດຶງອອນລາຍ ຫຼື ເພີ່ມເອງ.',
|
||||||
|
poolOverwrite: 'ເມື່ອດຶງສຳເລັດ ລາຍການທັງໝົດລວມທັງທີ່ເພີ່ມ ແລະ ແກ້ໄຂເອງຈະຖືກແທນທີ່. ສືບຕໍ່ບໍ?',
|
||||||
|
poolFetchEmpty: 'ບໍ່ພົບແບບຈຳລອງ. ລາຍການເດີມຍັງຢູ່. ລອງໃໝ່ ຫຼື ເພີ່ມເອງ.',
|
||||||
|
poolFetchFailed: 'ດຶງບໍ່ສຳເລັດ. ລາຍການເດີມຍັງຢູ່. ກວດ URL, API Key ແລະ ເຄືອຂ່າຍ ຫຼື ແກ້ໄຂເອງ.',
|
||||||
|
poolSaveHelp: 'ການປ່ຽນແປງມີຜົນຫຼັງບັນທຶກ. ບໍ່ສາມາດລຶບແບບຈຳລອງທີ່ກຳລັງໃຊ້.',
|
||||||
|
|
||||||
|
accountType: 'ປະເພດບັນຊີ',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'ເລີ່ມຕົ້ນ',
|
||||||
|
payAsYouGo: 'ຈ່າຍຕາມການໃຊ້',
|
||||||
|
chinaApi: 'API ຈີນ',
|
||||||
|
globalApi: 'API ສາກົນ',
|
||||||
|
chinaCodingPlan: 'Coding Plan ຈີນ',
|
||||||
|
globalCodingPlan: 'Coding Plan ສາກົນ',
|
||||||
|
chinaTokenPlan: 'Token Plan ຈີນ',
|
||||||
|
globalTokenPlan: 'Token Plan ສາກົນ',
|
||||||
|
speech: 'ບໍລິການສຽງ',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'ກວດສອບ ແລະ ດຶງຂໍ້ມູນ',
|
externalInspect: 'ກວດສອບ ແລະ ດຶງຂໍ້ມູນ',
|
||||||
externalHealthPassed: 'ກວດສອບສະຖານະຜ່ານ',
|
externalHealthPassed: 'ກວດສອບສະຖານະຜ່ານ',
|
||||||
externalHealthFailed: 'ກວດສອບສະຖານະບໍ່ຜ່ານ',
|
externalHealthFailed: 'ກວດສອບສະຖານະບໍ່ຜ່ານ',
|
||||||
|
|||||||
@@ -1130,6 +1130,34 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: 'Menjana satu imej minimum sebelum menyimpan dan mungkin dikenakan caj',
|
validateImageAvailabilityHelper: 'Menjana satu imej minimum sebelum menyimpan dan mungkin dikenakan caj',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'Dapatkan model dalam talian atau tambah secara manual. Semua model boleh disunting.',
|
||||||
|
poolUnavailable:
|
||||||
|
'Jenis pembekal dan API ini tidak menyokong pengambilan dalam talian. Tambah ID model secara manual.',
|
||||||
|
poolEmpty: 'Tiada model. Dapatkan dalam talian atau tambah secara manual.',
|
||||||
|
poolOverwrite:
|
||||||
|
'Pengambilan yang berjaya akan menggantikan seluruh senarai, termasuk tambahan dan suntingan manual. Teruskan?',
|
||||||
|
poolFetchEmpty: 'Tiada model diterima. Senarai dikekalkan. Cuba lagi atau tambah secara manual.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'Pengambilan gagal. Senarai dikekalkan. Semak URL, kunci API dan rangkaian atau sunting secara manual.',
|
||||||
|
poolSaveHelp: 'Perubahan berkuat kuasa selepas disimpan. Model yang sedang digunakan tidak boleh dibuang.',
|
||||||
|
|
||||||
|
accountType: 'Jenis akaun',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'Lalai',
|
||||||
|
payAsYouGo: 'Bayar mengikut penggunaan',
|
||||||
|
chinaApi: 'API China',
|
||||||
|
globalApi: 'API global',
|
||||||
|
chinaCodingPlan: 'Coding Plan China',
|
||||||
|
globalCodingPlan: 'Coding Plan global',
|
||||||
|
chinaTokenPlan: 'Token Plan China',
|
||||||
|
globalTokenPlan: 'Token Plan global',
|
||||||
|
speech: 'Perkhidmatan suara',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'Semak dan dapatkan',
|
externalInspect: 'Semak dan dapatkan',
|
||||||
externalHealthPassed: 'Semakan kesihatan berjaya',
|
externalHealthPassed: 'Semakan kesihatan berjaya',
|
||||||
externalHealthFailed: 'Semakan kesihatan gagal',
|
externalHealthFailed: 'Semakan kesihatan gagal',
|
||||||
|
|||||||
@@ -1125,6 +1125,34 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: 'Gera uma imagem mínima antes de salvar e pode gerar custos',
|
validateImageAvailabilityHelper: 'Gera uma imagem mínima antes de salvar e pode gerar custos',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'Busque modelos online ou adicione manualmente. Todos podem ser editados.',
|
||||||
|
poolUnavailable:
|
||||||
|
'Este tipo de provedor e API não permite buscar modelos online. Adicione os IDs manualmente.',
|
||||||
|
poolEmpty: 'Nenhum modelo. Busque online ou adicione manualmente.',
|
||||||
|
poolOverwrite:
|
||||||
|
'Uma busca bem-sucedida substituirá toda a lista, incluindo adições e edições manuais. Continuar?',
|
||||||
|
poolFetchEmpty: 'Nenhum modelo retornado. A lista foi mantida. Tente novamente ou adicione manualmente.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'Falha na busca. A lista foi mantida. Verifique a URL, a chave API e a rede ou edite manualmente.',
|
||||||
|
poolSaveHelp: 'As alterações entram em vigor ao salvar. Modelos em uso não podem ser removidos.',
|
||||||
|
|
||||||
|
accountType: 'Tipo de conta',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'Padrão',
|
||||||
|
payAsYouGo: 'Pagamento por uso',
|
||||||
|
chinaApi: 'API da China',
|
||||||
|
globalApi: 'API global',
|
||||||
|
chinaCodingPlan: 'Coding Plan da China',
|
||||||
|
globalCodingPlan: 'Coding Plan global',
|
||||||
|
chinaTokenPlan: 'Token Plan da China',
|
||||||
|
globalTokenPlan: 'Token Plan global',
|
||||||
|
speech: 'Serviços de voz',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'Verificar e obter',
|
externalInspect: 'Verificar e obter',
|
||||||
externalHealthPassed: 'Verificação de integridade aprovada',
|
externalHealthPassed: 'Verificação de integridade aprovada',
|
||||||
externalHealthFailed: 'Falha na verificação de integridade',
|
externalHealthFailed: 'Falha na verificação de integridade',
|
||||||
|
|||||||
@@ -1118,6 +1118,33 @@ const message = {
|
|||||||
'Перед сохранением создаётся одно минимальное изображение; возможна оплата',
|
'Перед сохранением создаётся одно минимальное изображение; возможна оплата',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'Загрузите модели онлайн или добавьте вручную. Все модели можно редактировать.',
|
||||||
|
poolUnavailable:
|
||||||
|
'Этот тип провайдера и API не поддерживает загрузку списка онлайн. Добавьте ID моделей вручную.',
|
||||||
|
poolEmpty: 'Моделей нет. Загрузите список онлайн или добавьте модели вручную.',
|
||||||
|
poolOverwrite: 'Успешная загрузка заменит весь список, включая ручные добавления и изменения. Продолжить?',
|
||||||
|
poolFetchEmpty: 'Модели не получены. Список сохранён. Повторите попытку или добавьте модели вручную.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'Ошибка загрузки. Список сохранён. Проверьте URL, ключ API и сеть или отредактируйте список вручную.',
|
||||||
|
poolSaveHelp: 'Изменения применяются после сохранения. Используемые модели удалить нельзя.',
|
||||||
|
|
||||||
|
accountType: 'Тип аккаунта',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'По умолчанию',
|
||||||
|
payAsYouGo: 'Оплата по использованию',
|
||||||
|
chinaApi: 'API Китая',
|
||||||
|
globalApi: 'Международный API',
|
||||||
|
chinaCodingPlan: 'Coding Plan Китая',
|
||||||
|
globalCodingPlan: 'Международный Coding Plan',
|
||||||
|
chinaTokenPlan: 'Token Plan Китая',
|
||||||
|
globalTokenPlan: 'Международный Token Plan',
|
||||||
|
speech: 'Речевые сервисы',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'Проверить и получить',
|
externalInspect: 'Проверить и получить',
|
||||||
externalHealthPassed: 'Проверка работоспособности пройдена',
|
externalHealthPassed: 'Проверка работоспособности пройдена',
|
||||||
externalHealthFailed: 'Проверка работоспособности не пройдена',
|
externalHealthFailed: 'Проверка работоспособности не пройдена',
|
||||||
|
|||||||
@@ -1128,6 +1128,34 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: 'Kaydetmeden önce bir küçük görsel üretir ve ücret doğurabilir',
|
validateImageAvailabilityHelper: 'Kaydetmeden önce bir küçük görsel üretir ve ücret doğurabilir',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: 'Modelleri çevrimiçi alın veya elle ekleyin. Tüm modeller düzenlenebilir.',
|
||||||
|
poolUnavailable:
|
||||||
|
'Bu sağlayıcı türü ve API çevrimiçi model almayı desteklemiyor. Model kimliklerini elle ekleyin.',
|
||||||
|
poolEmpty: 'Model yok. Çevrimiçi alın veya elle ekleyin.',
|
||||||
|
poolOverwrite:
|
||||||
|
'Başarılı bir alma işlemi, elle eklenenler ve düzenlenenler dahil tüm listeyi değiştirecek. Devam edilsin mi?',
|
||||||
|
poolFetchEmpty: 'Model alınamadı. Liste korundu. Yeniden deneyin veya elle ekleyin.',
|
||||||
|
poolFetchFailed:
|
||||||
|
'Alma işlemi başarısız. Liste korundu. URL, API anahtarı ve ağı kontrol edin ya da elle düzenleyin.',
|
||||||
|
poolSaveHelp: 'Değişiklikler kaydedilince uygulanır. Kullanımdaki modeller kaldırılamaz.',
|
||||||
|
|
||||||
|
accountType: 'Hesap türü',
|
||||||
|
accountTypes: {
|
||||||
|
default: 'Varsayılan',
|
||||||
|
payAsYouGo: 'Kullandıkça öde',
|
||||||
|
chinaApi: 'Çin API',
|
||||||
|
globalApi: 'Küresel API',
|
||||||
|
chinaCodingPlan: 'Çin Coding Plan',
|
||||||
|
globalCodingPlan: 'Küresel Coding Plan',
|
||||||
|
chinaTokenPlan: 'Çin Token Plan',
|
||||||
|
globalTokenPlan: 'Küresel Token Plan',
|
||||||
|
speech: 'Konuşma hizmetleri',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: 'Kontrol et ve getir',
|
externalInspect: 'Kontrol et ve getir',
|
||||||
externalHealthPassed: 'Sağlık kontrolü başarılı',
|
externalHealthPassed: 'Sağlık kontrolü başarılı',
|
||||||
externalHealthFailed: 'Sağlık kontrolü başarısız',
|
externalHealthFailed: 'Sağlık kontrolü başarısız',
|
||||||
|
|||||||
@@ -1048,6 +1048,31 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: '驗證時會實際產生一張最小圖片,可能產生費用',
|
validateImageAvailabilityHelper: '驗證時會實際產生一張最小圖片,可能產生費用',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: '線上取得或手動新增,所有模型均可直接編輯。',
|
||||||
|
poolUnavailable: '目前提供商類型和 API 暫不支援線上取得,請手動新增模型 ID。',
|
||||||
|
poolEmpty: '清單為空,可線上取得模型或手動新增。',
|
||||||
|
poolOverwrite: '取得成功後將取代整份清單,手動新增和修改的內容也會被覆蓋。是否繼續?',
|
||||||
|
poolFetchEmpty: '未取得模型,已保留目前清單。可重試或手動新增。',
|
||||||
|
poolFetchFailed: '取得失敗,已保留目前清單。請檢查網址、金鑰和網路後重試,或手動維護。',
|
||||||
|
poolSaveHelp: '儲存後生效。使用中的模型不能從清單移除。',
|
||||||
|
|
||||||
|
accountType: '帳號類型',
|
||||||
|
accountTypes: {
|
||||||
|
default: '預設',
|
||||||
|
payAsYouGo: '按量付費',
|
||||||
|
chinaApi: '國內 API',
|
||||||
|
globalApi: '國際 API',
|
||||||
|
chinaCodingPlan: '國內 Coding Plan',
|
||||||
|
globalCodingPlan: '國際 Coding Plan',
|
||||||
|
chinaTokenPlan: '國內 Token Plan',
|
||||||
|
globalTokenPlan: '國際 Token Plan',
|
||||||
|
speech: '語音服務',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: '檢查並取得',
|
externalInspect: '檢查並取得',
|
||||||
externalHealthPassed: '健康檢查通過',
|
externalHealthPassed: '健康檢查通過',
|
||||||
externalHealthFailed: '健康檢查失敗',
|
externalHealthFailed: '健康檢查失敗',
|
||||||
|
|||||||
@@ -1061,6 +1061,31 @@ const message = {
|
|||||||
validateImageAvailabilityHelper: '验证时会真实生成一张最小图片,可能产生费用',
|
validateImageAvailabilityHelper: '验证时会真实生成一张最小图片,可能产生费用',
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
poolEditHelp: '在线获取或手动添加,所有模型均可直接编辑。',
|
||||||
|
poolUnavailable: '当前提供商类型和 API 暂不支持在线获取,请手动添加模型 ID。',
|
||||||
|
poolEmpty: '列表为空,可在线获取模型或手动添加。',
|
||||||
|
poolOverwrite: '获取成功后将替换整份列表,手动新增和修改的内容也会被覆盖。是否继续?',
|
||||||
|
poolFetchEmpty: '未获取到模型,已保留当前列表。可重试或手动添加。',
|
||||||
|
poolFetchFailed: '获取失败,已保留当前列表。请检查地址、密钥和网络后重试,或手动维护。',
|
||||||
|
poolSaveHelp: '点击保存后生效。正在被使用的模型不能从列表中移除。',
|
||||||
|
|
||||||
|
accountType: '账号类型',
|
||||||
|
accountTypes: {
|
||||||
|
default: '默认',
|
||||||
|
payAsYouGo: '按量付费',
|
||||||
|
chinaApi: '国内 API',
|
||||||
|
globalApi: '国际 API',
|
||||||
|
chinaCodingPlan: '国内 Coding Plan',
|
||||||
|
globalCodingPlan: '国际 Coding Plan',
|
||||||
|
chinaTokenPlan: '国内 Token Plan',
|
||||||
|
globalTokenPlan: '国际 Token Plan',
|
||||||
|
speech: '语音服务',
|
||||||
|
codingPlan: 'Coding Plan',
|
||||||
|
tokenPlan: 'Token Plan',
|
||||||
|
agentPlan: 'Agent Plan',
|
||||||
|
go: 'Go',
|
||||||
|
zen: 'Zen',
|
||||||
|
},
|
||||||
externalInspect: '检查并获取',
|
externalInspect: '检查并获取',
|
||||||
externalHealthPassed: '健康检查通过',
|
externalHealthPassed: '健康检查通过',
|
||||||
externalHealthFailed: '健康检查失败',
|
externalHealthFailed: '健康检查失败',
|
||||||
|
|||||||
@@ -61,17 +61,49 @@ const providerLogos: Record<string, AgentProviderLogo> = {
|
|||||||
color: '#005eeb',
|
color: '#005eeb',
|
||||||
},
|
},
|
||||||
deepseek: {
|
deepseek: {
|
||||||
src: asset('deepseek.png'),
|
src: asset('deepseek.svg'),
|
||||||
mark: 'DS',
|
mark: 'DS',
|
||||||
background: '#ffffff',
|
background: '#ffffff',
|
||||||
color: '#4d6bfe',
|
color: '#4d6bfe',
|
||||||
borderColor: '#dcdfe6',
|
borderColor: '#dcdfe6',
|
||||||
source: 'https://cdn.deepseek.com/logo.png',
|
source: 'https://github.com/1Panel-dev/AI-Gateway/blob/main/frontend/src/assets/providers/deepseek.svg',
|
||||||
},
|
},
|
||||||
bailian: aliyunLogo,
|
bailian: aliyunLogo,
|
||||||
'bailian-coding-plan': aliyunLogo,
|
'bailian-coding-plan': aliyunLogo,
|
||||||
ark: volcengineLogo,
|
ark: volcengineLogo,
|
||||||
'ark-coding-plan': volcengineLogo,
|
'ark-coding-plan': volcengineLogo,
|
||||||
|
tokenhub: {
|
||||||
|
src: asset('tencentcloud.svg'),
|
||||||
|
mark: 'TH',
|
||||||
|
background: '#ffffff',
|
||||||
|
color: '#111827',
|
||||||
|
borderColor: '#dcdfe6',
|
||||||
|
source: 'https://github.com/1Panel-dev/AI-Gateway/blob/main/frontend/src/assets/providers/tencentcloud.svg',
|
||||||
|
},
|
||||||
|
qianfan: {
|
||||||
|
src: asset('qianfan.svg'),
|
||||||
|
mark: 'QF',
|
||||||
|
background: '#ffffff',
|
||||||
|
color: '#111827',
|
||||||
|
borderColor: '#dcdfe6',
|
||||||
|
source: 'https://github.com/1Panel-dev/AI-Gateway/blob/main/frontend/src/assets/providers/qianfan.svg',
|
||||||
|
},
|
||||||
|
siliconflow: {
|
||||||
|
src: asset('siliconflow.svg'),
|
||||||
|
mark: 'SF',
|
||||||
|
background: '#ffffff',
|
||||||
|
color: '#111827',
|
||||||
|
borderColor: '#dcdfe6',
|
||||||
|
source: 'https://github.com/1Panel-dev/AI-Gateway/blob/main/frontend/src/assets/providers/siliconflow.svg',
|
||||||
|
},
|
||||||
|
opencode: {
|
||||||
|
src: asset('opencode.svg'),
|
||||||
|
mark: 'OC',
|
||||||
|
background: '#ffffff',
|
||||||
|
color: '#111827',
|
||||||
|
borderColor: '#dcdfe6',
|
||||||
|
source: 'https://github.com/1Panel-dev/AI-Gateway/blob/main/frontend/src/assets/providers/opencode.svg',
|
||||||
|
},
|
||||||
zai: {
|
zai: {
|
||||||
src: asset('zai.webp'),
|
src: asset('zai.webp'),
|
||||||
mark: 'Z',
|
mark: 'Z',
|
||||||
@@ -97,7 +129,7 @@ const providerLogos: Record<string, AgentProviderLogo> = {
|
|||||||
source: 'https://www.mi.com/favicon.ico',
|
source: 'https://www.mi.com/favicon.ico',
|
||||||
},
|
},
|
||||||
kimi: {
|
kimi: {
|
||||||
src: asset('kimi.svg'),
|
src: asset('kimi.png'),
|
||||||
mark: 'KM',
|
mark: 'KM',
|
||||||
background: '#ffffff',
|
background: '#ffffff',
|
||||||
color: '#111827',
|
color: '#111827',
|
||||||
@@ -105,7 +137,7 @@ const providerLogos: Record<string, AgentProviderLogo> = {
|
|||||||
source: 'https://moonshotai.github.io/Branding-Guide/',
|
source: 'https://moonshotai.github.io/Branding-Guide/',
|
||||||
},
|
},
|
||||||
'kimi-coding': {
|
'kimi-coding': {
|
||||||
src: asset('kimi.svg'),
|
src: asset('kimi.png'),
|
||||||
mark: 'KC',
|
mark: 'KC',
|
||||||
background: '#ffffff',
|
background: '#ffffff',
|
||||||
color: '#111827',
|
color: '#111827',
|
||||||
@@ -145,7 +177,7 @@ const providerLogos: Record<string, AgentProviderLogo> = {
|
|||||||
source: 'https://gemini.google.com/',
|
source: 'https://gemini.google.com/',
|
||||||
},
|
},
|
||||||
moonshot: {
|
moonshot: {
|
||||||
src: asset('kimi.svg'),
|
src: asset('kimi.png'),
|
||||||
mark: 'MS',
|
mark: 'MS',
|
||||||
background: '#ffffff',
|
background: '#ffffff',
|
||||||
color: '#111827',
|
color: '#111827',
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ const systemIP = ref('');
|
|||||||
const lastAutoAllowedOrigins = ref('');
|
const lastAutoAllowedOrigins = ref('');
|
||||||
const allowedOriginsAutoFilled = ref(true);
|
const allowedOriginsAutoFilled = ref(true);
|
||||||
const { isIntl } = useGlobalStore();
|
const { isIntl } = useGlobalStore();
|
||||||
|
const excludeCodingPlanProviders = computed(() => (isIntl.value ? ['bailian', 'ark'] : []));
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
@@ -430,7 +431,10 @@ const loadProviderAccountCounts = async (providers: string[]) => {
|
|||||||
if (providerList.length === 0) {
|
if (providerList.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const res = await countAgentAccountsByProvider({ providers: providerList });
|
const res = await countAgentAccountsByProvider({
|
||||||
|
providers: providerList,
|
||||||
|
excludeCodingPlanProviders: excludeCodingPlanProviders.value,
|
||||||
|
});
|
||||||
const counts = res.data || {};
|
const counts = res.data || {};
|
||||||
providerList.forEach((provider) => {
|
providerList.forEach((provider) => {
|
||||||
providerAccountCount.value[provider] = counts[provider] || 0;
|
providerAccountCount.value[provider] = counts[provider] || 0;
|
||||||
@@ -451,11 +455,12 @@ const loadAccounts = async () => {
|
|||||||
pageSize: 200,
|
pageSize: 200,
|
||||||
provider: form.provider,
|
provider: form.provider,
|
||||||
textOnly: true,
|
textOnly: true,
|
||||||
|
excludeCodingPlanProviders: excludeCodingPlanProviders.value,
|
||||||
name: '',
|
name: '',
|
||||||
};
|
};
|
||||||
const res = await pageAgentAccounts(req);
|
const res = await pageAgentAccounts(req);
|
||||||
accountOptions.value = res.data.items || [];
|
accountOptions.value = res.data.items || [];
|
||||||
providerAccountCount.value[form.provider] = res.data.total || accountOptions.value.length;
|
providerAccountCount.value[form.provider] = res.data.total ?? accountOptions.value.length;
|
||||||
if (accountOptions.value.length > 0) {
|
if (accountOptions.value.length > 0) {
|
||||||
form.accountId = accountOptions.value[0].id;
|
form.accountId = accountOptions.value[0].id;
|
||||||
handleAccountChange();
|
handleAccountChange();
|
||||||
|
|||||||
@@ -172,7 +172,13 @@ const loadAccounts = async () => {
|
|||||||
name: '',
|
name: '',
|
||||||
});
|
});
|
||||||
const items = res.data.items || [];
|
const items = res.data.items || [];
|
||||||
const accountOptions = isIntl.value ? items.filter((item) => !blockedProviders.has(item.provider)) : items;
|
const accountOptions = isIntl.value
|
||||||
|
? items.filter(
|
||||||
|
(item) =>
|
||||||
|
!blockedProviders.has(item.provider) &&
|
||||||
|
!(['bailian', 'ark'].includes(item.provider) && item.accountType === 'codingPlan'),
|
||||||
|
)
|
||||||
|
: items;
|
||||||
const selected = accountOptions.find((item) => item.id === accountId.value);
|
const selected = accountOptions.find((item) => item.id === accountId.value);
|
||||||
modelOptions.value = (selected?.models || []).map((item) => ({
|
modelOptions.value = (selected?.models || []).map((item) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
|
|||||||
@@ -257,7 +257,13 @@ const load = async (params: AgentModelLoadParams) => {
|
|||||||
getAgentModelConfig({ agentId: params.agentId }),
|
getAgentModelConfig({ agentId: params.agentId }),
|
||||||
]);
|
]);
|
||||||
const items = accountsRes.data.items || [];
|
const items = accountsRes.data.items || [];
|
||||||
accountOptions.value = isIntl.value ? items.filter((item) => !blockedProviders.has(item.provider)) : items;
|
accountOptions.value = isIntl.value
|
||||||
|
? items.filter(
|
||||||
|
(item) =>
|
||||||
|
!blockedProviders.has(item.provider) &&
|
||||||
|
!(['bailian', 'ark'].includes(item.provider) && item.accountType === 'codingPlan'),
|
||||||
|
)
|
||||||
|
: items;
|
||||||
if (accountOptions.value.length === 0) {
|
if (accountOptions.value.length === 0) {
|
||||||
form.accountId = undefined as unknown as number;
|
form.accountId = undefined as unknown as number;
|
||||||
form.model = '';
|
form.model = '';
|
||||||
|
|||||||
@@ -24,6 +24,20 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="accountTypeOptions.length > 1"
|
||||||
|
:label="$t('aiTools.model.accountType')"
|
||||||
|
prop="accountType"
|
||||||
|
>
|
||||||
|
<el-select v-model="form.accountType" :disabled="form.id > 0" @change="handleAccountTypeChange">
|
||||||
|
<el-option
|
||||||
|
v-for="item in accountTypeOptions"
|
||||||
|
:key="item.key"
|
||||||
|
:label="$t(`aiTools.model.accountTypes.${item.key}`)"
|
||||||
|
:value="item.key"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item v-if="canSelectLocalEngine" :label="$t('ssh.createMode')">
|
<el-form-item v-if="canSelectLocalEngine" :label="$t('ssh.createMode')">
|
||||||
<el-radio-group v-model="connectionMode" @change="handleConnectionModeChange">
|
<el-radio-group v-model="connectionMode" @change="handleConnectionModeChange">
|
||||||
<el-radio-button value="manual">{{ $t('ssh.input') }}</el-radio-button>
|
<el-radio-button value="manual">{{ $t('ssh.input') }}</el-radio-button>
|
||||||
@@ -127,163 +141,20 @@
|
|||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<template v-if="showModelPool">
|
<ModelEditor
|
||||||
<el-divider content-position="left">{{ $t('aiTools.agents.modelPool') }}</el-divider>
|
v-if="showModelPool"
|
||||||
<div class="model-discovery">
|
ref="modelEditorRef"
|
||||||
<div class="model-discovery__header">
|
v-model="manualModels"
|
||||||
<el-radio-group v-model="modelConfigMode" size="small" @change="handleModelConfigModeChange">
|
v-model:verify-index="manualVerifyIndex"
|
||||||
<el-radio-button v-if="supportsModelDiscovery || defaultModels.length" value="discover">
|
v-model:discovering="discovering"
|
||||||
{{
|
:supports-discovery="supportsModelDiscovery"
|
||||||
$t(
|
:request="discoveryRequest"
|
||||||
supportsModelDiscovery
|
:validate-availability="form.validateAvailability"
|
||||||
? 'aiTools.agents.automaticModelDiscovery'
|
:single-model-only="singleModelOnly"
|
||||||
: 'aiTools.agents.defaultModel',
|
:local-models="localModelOptions"
|
||||||
)
|
:disabled="loading"
|
||||||
}}
|
:before-discover="validateDiscovery"
|
||||||
</el-radio-button>
|
/>
|
||||||
<el-radio-button value="manual">
|
|
||||||
{{ $t('aiTools.agents.manualModelConfiguration') }}
|
|
||||||
</el-radio-button>
|
|
||||||
</el-radio-group>
|
|
||||||
<el-button
|
|
||||||
v-if="supportsModelDiscovery && modelConfigMode === 'discover'"
|
|
||||||
v-permission="'ai_model_manage'"
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
:loading="discovering"
|
|
||||||
@click="discoverModels"
|
|
||||||
>
|
|
||||||
{{ $t('aiTools.agents.discoverModels') }}
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="supportsModelDiscovery && modelConfigMode === 'discover'"
|
|
||||||
class="input-help model-discovery__help"
|
|
||||||
>
|
|
||||||
{{ $t('aiTools.agents.discoverModelsHelper') }}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="form.validateAvailability && (modelConfigMode === 'manual' || discoveredModels.length)"
|
|
||||||
class="input-help model-discovery__help"
|
|
||||||
>
|
|
||||||
{{ $t('aiTools.agents.verifyModelHelper') }}
|
|
||||||
</div>
|
|
||||||
<el-alert
|
|
||||||
v-if="modelDiscoveryFailed"
|
|
||||||
type="warning"
|
|
||||||
:closable="false"
|
|
||||||
show-icon
|
|
||||||
:title="
|
|
||||||
$t(
|
|
||||||
defaultModels.length
|
|
||||||
? 'aiTools.agents.discoverModelsFailedUseDefaults'
|
|
||||||
: 'aiTools.agents.discoverModelsFailedFallback',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
<el-table
|
|
||||||
v-if="modelConfigMode === 'discover' && discoveredModels.length"
|
|
||||||
:data="discoveredModels"
|
|
||||||
max-height="320"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
v-if="form.validateAvailability"
|
|
||||||
:label="$t('aiTools.model.verify')"
|
|
||||||
width="90"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-radio
|
|
||||||
v-model="form.verifyModel"
|
|
||||||
class="verification-radio"
|
|
||||||
:value="row.id"
|
|
||||||
:aria-label="$t('aiTools.agents.verifyModel') + ': ' + row.id"
|
|
||||||
>
|
|
||||||
<span />
|
|
||||||
</el-radio>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="$t('aiTools.model.model')" prop="id" min-width="220" />
|
|
||||||
<el-table-column :label="$t('commons.table.name')" prop="name" min-width="180" />
|
|
||||||
</el-table>
|
|
||||||
<template v-if="modelConfigMode === 'manual'">
|
|
||||||
<el-table :data="manualModels" max-height="320">
|
|
||||||
<el-table-column
|
|
||||||
v-if="form.validateAvailability"
|
|
||||||
:label="$t('aiTools.model.verify')"
|
|
||||||
width="90"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template #default="{ row, $index }">
|
|
||||||
<el-radio
|
|
||||||
v-model="manualVerifyIndex"
|
|
||||||
class="verification-radio"
|
|
||||||
:value="$index"
|
|
||||||
:disabled="!row.id.trim()"
|
|
||||||
:aria-label="$t('aiTools.agents.verifyModel') + ': ' + row.id"
|
|
||||||
>
|
|
||||||
<span />
|
|
||||||
</el-radio>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="$t('aiTools.model.model')" min-width="220">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-select
|
|
||||||
v-if="localModelOptions.length"
|
|
||||||
v-model="row.id"
|
|
||||||
filterable
|
|
||||||
allow-create
|
|
||||||
default-first-option
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="model in localModelOptions"
|
|
||||||
:key="model"
|
|
||||||
:label="model"
|
|
||||||
:value="model"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
<el-input v-else v-model="row.id" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="$t('commons.table.name')" min-width="180">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-input v-model="row.name" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
v-if="!singleModelOnly"
|
|
||||||
:label="$t('commons.table.operate')"
|
|
||||||
width="90"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template #default="{ $index }">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
:disabled="
|
|
||||||
form.validateAvailability &&
|
|
||||||
Boolean(form.id) &&
|
|
||||||
manualVerifyIndex === $index
|
|
||||||
"
|
|
||||||
@click="removeManualModel($index)"
|
|
||||||
>
|
|
||||||
{{ $t('commons.button.delete') }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<el-button
|
|
||||||
v-if="!singleModelOnly"
|
|
||||||
class="model-discovery__add"
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
@click="addManualModel"
|
|
||||||
>
|
|
||||||
{{ $t('commons.button.add') }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="showVerifyModelSelect"
|
v-if="showVerifyModelSelect"
|
||||||
:label="$t('aiTools.agents.verifyModel')"
|
:label="$t('aiTools.agents.verifyModel')"
|
||||||
@@ -311,7 +182,7 @@
|
|||||||
<template v-if="!inline" #footer>
|
<template v-if="!inline" #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button :disabled="loading" @click="open = false">{{ $t('commons.button.cancel') }}</el-button>
|
<el-button :disabled="loading" @click="open = false">{{ $t('commons.button.cancel') }}</el-button>
|
||||||
<el-button v-permission :disabled="loading || disabled" type="primary" @click="submit">
|
<el-button v-permission :disabled="loading || disabled || discovering" type="primary" @click="submit">
|
||||||
{{ $t('commons.button.confirm') }}
|
{{ $t('commons.button.confirm') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
@@ -320,18 +191,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import ModelEditor from '../model-editor/index.vue';
|
||||||
import AiModelList from '@/components/ai-model-list/index.vue';
|
import AiModelList from '@/components/ai-model-list/index.vue';
|
||||||
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||||
import { FormInstance } from 'element-plus';
|
import { FormInstance } from 'element-plus';
|
||||||
import { AI } from '@/api/interface/ai';
|
import { AI } from '@/api/interface/ai';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules } from '@/global/form-rules';
|
||||||
import {
|
import { createAgentAccount, getAgentProviders, searchOllamaModel, updateAgentAccount } from '@/api/modules/ai';
|
||||||
createAgentAccount,
|
|
||||||
discoverAgentAccountModels,
|
|
||||||
getAgentProviders,
|
|
||||||
searchOllamaModel,
|
|
||||||
updateAgentAccount,
|
|
||||||
} from '@/api/modules/ai';
|
|
||||||
import { checkAppInstalled } from '@/api/modules/app';
|
import { checkAppInstalled } from '@/api/modules/app';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { getAgentProviderDisplayName } from '@/utils/agent';
|
import { getAgentProviderDisplayName } from '@/utils/agent';
|
||||||
@@ -362,16 +228,25 @@ const emit = defineEmits(['search', 'close']);
|
|||||||
|
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const formRef = ref<FormInstance>();
|
const formRef = ref<FormInstance>();
|
||||||
const providerOptions = ref<Array<{ label: string; value: string }>>([]);
|
const providerOptions = computed(() =>
|
||||||
|
Object.values(providers.value)
|
||||||
|
.filter(
|
||||||
|
(item) =>
|
||||||
|
!['bailian-coding-plan', 'ark-coding-plan', 'kimi-coding', 'moonshot'].includes(item.provider) ||
|
||||||
|
(form.id > 0 && item.provider === form.provider),
|
||||||
|
)
|
||||||
|
.map((item) => ({
|
||||||
|
value: item.provider,
|
||||||
|
label: getAgentProviderDisplayName(item.provider, item.displayName),
|
||||||
|
})),
|
||||||
|
);
|
||||||
const providers = ref<Record<string, AI.ProviderInfo>>({});
|
const providers = ref<Record<string, AI.ProviderInfo>>({});
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const discovering = ref(false);
|
const discovering = ref(false);
|
||||||
const discoveredModels = ref<AI.AgentAccountModel[]>([]);
|
const modelEditorRef = ref<InstanceType<typeof ModelEditor>>();
|
||||||
const manualModels = ref<AI.AgentAccountModel[]>([]);
|
const manualModels = ref<AI.AgentAccountModel[]>([]);
|
||||||
const manualVerifyIndex = ref(-1);
|
const manualVerifyIndex = ref(-1);
|
||||||
const editModels = ref<AI.AgentAccountModel[]>([]);
|
const editModels = ref<AI.AgentAccountModel[]>([]);
|
||||||
const modelConfigMode = ref<'discover' | 'manual'>('discover');
|
|
||||||
const modelDiscoveryFailed = ref(false);
|
|
||||||
const { isIntl, isProductPro } = useGlobalStore();
|
const { isIntl, isProductPro } = useGlobalStore();
|
||||||
const connectionMode = ref<'manual' | 'local'>('manual');
|
const connectionMode = ref<'manual' | 'local'>('manual');
|
||||||
const loadingEngines = ref(false);
|
const loadingEngines = ref(false);
|
||||||
@@ -383,6 +258,7 @@ const form = reactive({
|
|||||||
appInstallId: 0,
|
appInstallId: 0,
|
||||||
localEngineId: undefined as number | undefined,
|
localEngineId: undefined as number | undefined,
|
||||||
provider: 'custom',
|
provider: 'custom',
|
||||||
|
accountType: '',
|
||||||
name: '',
|
name: '',
|
||||||
baseURL: '',
|
baseURL: '',
|
||||||
apiType: 'openai-completions',
|
apiType: 'openai-completions',
|
||||||
@@ -400,6 +276,19 @@ const headerTitle = computed(() =>
|
|||||||
);
|
);
|
||||||
|
|
||||||
const selectedProvider = computed(() => providers.value[form.provider]);
|
const selectedProvider = computed(() => providers.value[form.provider]);
|
||||||
|
const accountTypeOptions = computed(() =>
|
||||||
|
(selectedProvider.value?.accountTypes || []).filter(
|
||||||
|
(item) => !isIntl.value || !['bailian', 'ark'].includes(form.provider) || item.key !== 'codingPlan',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const selectedAccountType = computed(
|
||||||
|
() =>
|
||||||
|
selectedProvider.value?.accountTypes.find((item) => item.key === form.accountType) ||
|
||||||
|
accountTypeOptions.value[0],
|
||||||
|
);
|
||||||
|
const availableAPIConfigs = computed(
|
||||||
|
() => selectedAccountType.value?.apiTypes || selectedProvider.value?.apiTypes || [],
|
||||||
|
);
|
||||||
const singleModelOnly = computed(() => !form.id && ['vllm', 'llmman'].includes(form.provider));
|
const singleModelOnly = computed(() => !form.id && ['vllm', 'llmman'].includes(form.provider));
|
||||||
const canSelectLocalEngine = computed(() => !form.id && ['ollama', 'vllm'].includes(form.provider));
|
const canSelectLocalEngine = computed(() => !form.id && ['ollama', 'vllm'].includes(form.provider));
|
||||||
const localModelOptions = computed(() =>
|
const localModelOptions = computed(() =>
|
||||||
@@ -409,26 +298,19 @@ const localModelOptions = computed(() =>
|
|||||||
);
|
);
|
||||||
const disabled = computed(
|
const disabled = computed(
|
||||||
() =>
|
() =>
|
||||||
connectionMode.value === 'local' &&
|
discovering.value ||
|
||||||
(loadingEngines.value || !localEngines.value.some((item) => item.id === form.localEngineId)),
|
(connectionMode.value === 'local' &&
|
||||||
);
|
(loadingEngines.value || !localEngines.value.some((item) => item.id === form.localEngineId))),
|
||||||
const selectedAPIConfig = computed(() =>
|
|
||||||
selectedProvider.value?.apiTypes.find((item) => item.apiType === form.apiType),
|
|
||||||
);
|
);
|
||||||
|
const selectedAPIConfig = computed(() => availableAPIConfigs.value.find((item) => item.apiType === form.apiType));
|
||||||
const isImageAPIType = computed(() => form.apiType.endsWith('-images'));
|
const isImageAPIType = computed(() => form.apiType.endsWith('-images'));
|
||||||
const supportsModelDiscovery = computed(() => Boolean(selectedAPIConfig.value?.supportsModelDiscovery));
|
const supportsModelDiscovery = computed(() => Boolean(selectedAPIConfig.value?.supportsModelDiscovery));
|
||||||
const defaultModels = computed(() => {
|
|
||||||
if (selectedAPIConfig.value?.models.length) {
|
|
||||||
return selectedAPIConfig.value.models;
|
|
||||||
}
|
|
||||||
return isImageAPIType.value ? [] : selectedProvider.value?.models || [];
|
|
||||||
});
|
|
||||||
const showModelPool = computed(() => !form.appInstallId);
|
const showModelPool = computed(() => !form.appInstallId);
|
||||||
const verifyModelOptions = computed(() => (form.id ? editModels.value : defaultModels.value));
|
const verifyModelOptions = computed(() => (form.id ? editModels.value : manualModels.value));
|
||||||
const showVerifyModelSelect = computed(
|
const showVerifyModelSelect = computed(
|
||||||
() => form.validateAvailability && verifyModelOptions.value.length > 0 && !showModelPool.value,
|
() => form.validateAvailability && verifyModelOptions.value.length > 0 && !showModelPool.value,
|
||||||
);
|
);
|
||||||
const apiTypeOptions = computed(() => selectedProvider.value?.apiTypes.map((item) => item.apiType) || []);
|
const apiTypeOptions = computed(() => availableAPIConfigs.value.map((item) => item.apiType) || []);
|
||||||
const authModeOptions = computed(() => selectedAPIConfig.value?.authModes || []);
|
const authModeOptions = computed(() => selectedAPIConfig.value?.authModes || []);
|
||||||
const apiTypeURLHints: Record<string, { requestPath: string; example: string; endpointSuffixes: string[] }> = {
|
const apiTypeURLHints: Record<string, { requestPath: string; example: string; endpointSuffixes: string[] }> = {
|
||||||
'openai-completions': {
|
'openai-completions': {
|
||||||
@@ -545,148 +427,42 @@ const resetManualModels = () => {
|
|||||||
manualVerifyIndex.value = singleModelOnly.value ? 0 : -1;
|
manualVerifyIndex.value = singleModelOnly.value ? 0 : -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadDefaultModels = () => {
|
|
||||||
discoveredModels.value = defaultModels.value.map((item) => ({
|
|
||||||
recordId: 0,
|
|
||||||
id: item.id,
|
|
||||||
name: item.name,
|
|
||||||
}));
|
|
||||||
modelDiscoveryFailed.value = false;
|
|
||||||
form.verifyModel = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const resetModelDiscovery = () => {
|
const resetModelDiscovery = () => {
|
||||||
discovering.value = false;
|
discovering.value = false;
|
||||||
modelConfigMode.value = supportsModelDiscovery.value || defaultModels.value.length ? 'discover' : 'manual';
|
|
||||||
resetManualModels();
|
resetManualModels();
|
||||||
loadDefaultModels();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleModelConfigModeChange = () => {
|
const discoveryRequest = computed(() => ({
|
||||||
modelDiscoveryFailed.value = false;
|
provider: form.provider,
|
||||||
form.verifyModel = '';
|
accountType: form.accountType,
|
||||||
};
|
apiType: form.apiType,
|
||||||
|
baseURL: form.baseURL,
|
||||||
const addManualModel = () => {
|
apiKey: form.apiKey,
|
||||||
if (singleModelOnly.value && manualModels.value.length > 0) {
|
authMode: form.authMode,
|
||||||
return;
|
}));
|
||||||
}
|
const validateDiscovery = async () => {
|
||||||
manualModels.value.push(buildInitialModel());
|
|
||||||
if (singleModelOnly.value) {
|
|
||||||
manualVerifyIndex.value = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeManualModel = (index: number) => {
|
|
||||||
manualModels.value.splice(index, 1);
|
|
||||||
if (manualVerifyIndex.value === index) {
|
|
||||||
manualVerifyIndex.value = -1;
|
|
||||||
} else if (manualVerifyIndex.value > index) {
|
|
||||||
manualVerifyIndex.value -= 1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const normalizeManualModels = () => {
|
|
||||||
const models = manualModels.value.map((item) => ({
|
|
||||||
recordId: 0,
|
|
||||||
id: String(item.id || '').trim(),
|
|
||||||
name: String(item.name || '').trim(),
|
|
||||||
}));
|
|
||||||
if (models.some((item) => !item.id)) {
|
|
||||||
MsgError(i18n.global.t('aiTools.agents.accountModelsRequired'));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (models.some((item) => item.id.includes(' '))) {
|
|
||||||
MsgError(i18n.global.t('setting.noSpace'));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (new Set(models.map((item) => item.id)).size !== models.length) {
|
|
||||||
MsgError(i18n.global.t('aiTools.agents.accountModelsDuplicate'));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return models;
|
|
||||||
};
|
|
||||||
|
|
||||||
const discoverModels = async () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
await formRef.value.validateField(['apiKey', 'baseURL']);
|
await formRef.value?.validateField(['apiKey', 'baseURL']);
|
||||||
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return false;
|
||||||
}
|
|
||||||
discovering.value = true;
|
|
||||||
try {
|
|
||||||
const res = await discoverAgentAccountModels({
|
|
||||||
provider: form.provider,
|
|
||||||
baseURL: form.baseURL,
|
|
||||||
apiKey: form.apiKey,
|
|
||||||
apiType: form.apiType,
|
|
||||||
});
|
|
||||||
discoveredModels.value = res.data || [];
|
|
||||||
form.verifyModel = '';
|
|
||||||
if (discoveredModels.value.length === 0) {
|
|
||||||
if (defaultModels.value.length > 0) {
|
|
||||||
loadDefaultModels();
|
|
||||||
} else {
|
|
||||||
modelConfigMode.value = 'manual';
|
|
||||||
}
|
|
||||||
modelDiscoveryFailed.value = true;
|
|
||||||
} else {
|
|
||||||
modelDiscoveryFailed.value = false;
|
|
||||||
}
|
|
||||||
} catch (error: any) {
|
|
||||||
if (defaultModels.value.length > 0) {
|
|
||||||
loadDefaultModels();
|
|
||||||
modelDiscoveryFailed.value = true;
|
|
||||||
} else {
|
|
||||||
discoveredModels.value = [];
|
|
||||||
modelConfigMode.value = 'manual';
|
|
||||||
}
|
|
||||||
modelDiscoveryFailed.value = true;
|
|
||||||
MsgError(String(error?.message || i18n.global.t('commons.res.commonError')));
|
|
||||||
} finally {
|
|
||||||
discovering.value = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
if (!formRef.value || disabled.value) {
|
if (!formRef.value || disabled.value || discovering.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await formRef.value.validate();
|
await formRef.value.validate();
|
||||||
let accountModels: AI.AgentAccountModel[] = [];
|
const accountModels = showModelPool.value ? modelEditorRef.value?.validate() : [];
|
||||||
if (showModelPool.value && modelConfigMode.value === 'manual') {
|
if (!accountModels) return;
|
||||||
const models = normalizeManualModels();
|
const verifyModel = showModelPool.value ? accountModels[manualVerifyIndex.value]?.id || '' : form.verifyModel;
|
||||||
if (!models) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
accountModels = models;
|
|
||||||
} else if (showModelPool.value) {
|
|
||||||
accountModels = discoveredModels.value;
|
|
||||||
}
|
|
||||||
if ((!form.id || showModelPool.value) && accountModels.length === 0) {
|
|
||||||
MsgError(i18n.global.t('aiTools.agents.accountModelsRequired'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (singleModelOnly.value && accountModels.length > 1) {
|
|
||||||
MsgError(i18n.global.t('aiTools.agents.accountModelsSingle'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let verifyModel = form.verifyModel;
|
|
||||||
if (modelConfigMode.value === 'manual' && showModelPool.value) {
|
|
||||||
verifyModel = accountModels[manualVerifyIndex.value]?.id || '';
|
|
||||||
}
|
|
||||||
if (form.validateAvailability && !verifyModel && (!form.id || editModels.value.length > 0)) {
|
|
||||||
MsgError(i18n.global.t('aiTools.agents.verifyModelRequired'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
if (form.id) {
|
if (form.id) {
|
||||||
await updateAgentAccount({
|
await updateAgentAccount({
|
||||||
id: form.id,
|
id: form.id,
|
||||||
|
accountType: form.accountType,
|
||||||
name: form.name,
|
name: form.name,
|
||||||
baseURL: form.baseURL,
|
baseURL: form.baseURL,
|
||||||
apiKey: form.apiKey,
|
apiKey: form.apiKey,
|
||||||
@@ -702,6 +478,7 @@ const submit = async () => {
|
|||||||
} else {
|
} else {
|
||||||
await createAgentAccount({
|
await createAgentAccount({
|
||||||
provider: form.provider,
|
provider: form.provider,
|
||||||
|
accountType: form.accountType,
|
||||||
name: form.name,
|
name: form.name,
|
||||||
baseURL: form.baseURL,
|
baseURL: form.baseURL,
|
||||||
apiKey: form.apiKey,
|
apiKey: form.apiKey,
|
||||||
@@ -736,6 +513,7 @@ const handleClose = () => {
|
|||||||
form.id = 0;
|
form.id = 0;
|
||||||
form.appInstallId = 0;
|
form.appInstallId = 0;
|
||||||
form.provider = 'custom';
|
form.provider = 'custom';
|
||||||
|
form.accountType = '';
|
||||||
form.name = '';
|
form.name = '';
|
||||||
form.baseURL = '';
|
form.baseURL = '';
|
||||||
form.apiType = 'openai-completions';
|
form.apiType = 'openai-completions';
|
||||||
@@ -754,6 +532,7 @@ interface OpenParams {
|
|||||||
id?: number;
|
id?: number;
|
||||||
appInstallId?: number;
|
appInstallId?: number;
|
||||||
provider?: string;
|
provider?: string;
|
||||||
|
accountType?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
baseURL?: string;
|
baseURL?: string;
|
||||||
apiKey?: string;
|
apiKey?: string;
|
||||||
@@ -778,6 +557,7 @@ const openDrawer = async (params?: OpenParams) => {
|
|||||||
form.id = params.id;
|
form.id = params.id;
|
||||||
form.appInstallId = params.appInstallId || 0;
|
form.appInstallId = params.appInstallId || 0;
|
||||||
form.provider = params.provider || '';
|
form.provider = params.provider || '';
|
||||||
|
form.accountType = params.accountType || '';
|
||||||
form.name = params.name || '';
|
form.name = params.name || '';
|
||||||
form.baseURL = params.baseURL || '';
|
form.baseURL = params.baseURL || '';
|
||||||
form.apiKey = params.apiKey || '';
|
form.apiKey = params.apiKey || '';
|
||||||
@@ -785,12 +565,14 @@ const openDrawer = async (params?: OpenParams) => {
|
|||||||
form.validateAvailability = params.validateAvailability ?? true;
|
form.validateAvailability = params.validateAvailability ?? true;
|
||||||
editModels.value = params.models || [];
|
editModels.value = params.models || [];
|
||||||
const provider = providers.value[form.provider];
|
const provider = providers.value[form.provider];
|
||||||
form.apiType = provider?.apiTypes.some((item) => item.apiType === params.apiType)
|
form.apiType = availableAPIConfigs.value.some((item) => item.apiType === params.apiType)
|
||||||
? String(params.apiType)
|
? String(params.apiType)
|
||||||
: provider?.defaultApiType || '';
|
: provider?.defaultApiType || '';
|
||||||
|
if (selectedAPIConfig.value && !selectedAPIConfig.value.editableBaseUrl) {
|
||||||
|
form.baseURL = selectedAPIConfig.value.baseUrl;
|
||||||
|
}
|
||||||
form.authMode = params.authMode || selectedAPIConfig.value?.defaultAuthMode || '';
|
form.authMode = params.authMode || selectedAPIConfig.value?.defaultAuthMode || '';
|
||||||
resetModelDiscovery();
|
resetModelDiscovery();
|
||||||
modelConfigMode.value = 'manual';
|
|
||||||
manualModels.value = editModels.value.length
|
manualModels.value = editModels.value.length
|
||||||
? editModels.value.map((item) => ({ ...item }))
|
? editModels.value.map((item) => ({ ...item }))
|
||||||
: [buildInitialModel()];
|
: [buildInitialModel()];
|
||||||
@@ -825,13 +607,7 @@ const openDrawer = async (params?: OpenParams) => {
|
|||||||
const loadProviders = async () => {
|
const loadProviders = async () => {
|
||||||
const res = await getAgentProviders();
|
const res = await getAgentProviders();
|
||||||
const data = res.data || [];
|
const data = res.data || [];
|
||||||
const blockedProviders = new Set(['ark-coding-plan', 'bailian-coding-plan']);
|
providers.value = Object.fromEntries(data.map((item) => [item.provider, item]));
|
||||||
const filteredData = isIntl.value ? data.filter((item) => !blockedProviders.has(item.provider)) : data;
|
|
||||||
providers.value = Object.fromEntries(filteredData.map((item) => [item.provider, item]));
|
|
||||||
providerOptions.value = filteredData.map((item) => ({
|
|
||||||
value: item.provider,
|
|
||||||
label: getAgentProviderDisplayName(item.provider, item.displayName),
|
|
||||||
}));
|
|
||||||
if (!form.provider && providerOptions.value.length > 0) {
|
if (!form.provider && providerOptions.value.length > 0) {
|
||||||
form.provider = providers.value.custom ? 'custom' : providerOptions.value[0].value;
|
form.provider = providers.value.custom ? 'custom' : providerOptions.value[0].value;
|
||||||
handleProviderChange();
|
handleProviderChange();
|
||||||
@@ -846,9 +622,14 @@ const handleProviderChange = () => {
|
|||||||
}
|
}
|
||||||
connectionMode.value = 'manual';
|
connectionMode.value = 'manual';
|
||||||
form.localEngineId = undefined;
|
form.localEngineId = undefined;
|
||||||
const provider = selectedProvider.value;
|
form.accountType = accountTypeOptions.value[0]?.key || '';
|
||||||
form.apiType = provider?.defaultApiType || '';
|
handleAccountTypeChange();
|
||||||
const config = provider?.apiTypes.find((item) => item.apiType === form.apiType);
|
};
|
||||||
|
|
||||||
|
const handleAccountTypeChange = () => {
|
||||||
|
const configs = availableAPIConfigs.value;
|
||||||
|
const config = configs.find((item) => item.apiType === selectedProvider.value?.defaultApiType) || configs[0];
|
||||||
|
form.apiType = config?.apiType || '';
|
||||||
form.baseURL = config?.baseUrl || '';
|
form.baseURL = config?.baseUrl || '';
|
||||||
form.authMode = config?.defaultAuthMode || '';
|
form.authMode = config?.defaultAuthMode || '';
|
||||||
resetModelDiscovery();
|
resetModelDiscovery();
|
||||||
@@ -925,19 +706,13 @@ const handleAPITypeChange = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
form.authMode = config.defaultAuthMode || '';
|
form.authMode = config.defaultAuthMode || '';
|
||||||
const providerURLs = selectedProvider.value?.apiTypes.map((item) => item.baseUrl).filter(Boolean) || [];
|
const providerURLs = availableAPIConfigs.value.map((item) => item.baseUrl).filter(Boolean) || [];
|
||||||
if (!config.editableBaseUrl || !form.baseURL || providerURLs.includes(form.baseURL)) {
|
if (!config.editableBaseUrl || !form.baseURL || providerURLs.includes(form.baseURL)) {
|
||||||
form.baseURL = config.baseUrl || '';
|
form.baseURL = config.baseUrl || '';
|
||||||
}
|
}
|
||||||
resetModelDiscovery();
|
resetModelDiscovery();
|
||||||
};
|
};
|
||||||
|
|
||||||
watch([() => form.apiKey, () => form.baseURL], () => {
|
|
||||||
if (!form.id && showModelPool.value) {
|
|
||||||
loadDefaultModels();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(open, (value) => {
|
watch(open, (value) => {
|
||||||
if (props.inline && !value) handleClose();
|
if (props.inline && !value) handleClose();
|
||||||
});
|
});
|
||||||
@@ -994,38 +769,4 @@ defineExpose({
|
|||||||
.validate-availability-label {
|
.validate-availability-label {
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-discovery {
|
|
||||||
margin-bottom: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-discovery__header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 16px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-discovery__help {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-discovery .el-alert {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-discovery__add {
|
|
||||||
display: inline-block;
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.verification-radio {
|
|
||||||
margin-right: 0;
|
|
||||||
height: 32px;
|
|
||||||
|
|
||||||
:deep(.el-radio__label) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -349,7 +349,15 @@ useSearchState(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
const apiTypeOptions = computed(() =>
|
const apiTypeOptions = computed(() =>
|
||||||
Array.from(new Set(providers.value.flatMap((item) => item.apiTypes.map((api) => api.apiType)))).sort(),
|
Array.from(
|
||||||
|
new Set(
|
||||||
|
providers.value.flatMap((item) =>
|
||||||
|
(item.accountTypes?.flatMap((accountType) => accountType.apiTypes) || item.apiTypes).map(
|
||||||
|
(api) => api.apiType,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).sort(),
|
||||||
);
|
);
|
||||||
const providerOptions = computed(() =>
|
const providerOptions = computed(() =>
|
||||||
providers.value
|
providers.value
|
||||||
|
|||||||
@@ -0,0 +1,276 @@
|
|||||||
|
<template>
|
||||||
|
<section class="model-editor" :aria-label="$t('aiTools.agents.modelPool')">
|
||||||
|
<div class="model-editor__header">
|
||||||
|
<div>
|
||||||
|
<strong>{{ $t('aiTools.agents.modelPool') }}</strong>
|
||||||
|
<el-tag size="small" type="info" round>{{ models.filter((item) => item.id.trim()).length }}</el-tag>
|
||||||
|
<p>{{ $t('aiTools.model.poolEditHelp') }}</p>
|
||||||
|
</div>
|
||||||
|
<el-button
|
||||||
|
v-permission="'ai_model_manage'"
|
||||||
|
:icon="Refresh"
|
||||||
|
:disabled="!supportsDiscovery || disabled"
|
||||||
|
:loading="discovering"
|
||||||
|
@click="discover"
|
||||||
|
>
|
||||||
|
{{ $t('aiTools.agents.discoverModels') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-alert
|
||||||
|
v-if="!supportsDiscovery"
|
||||||
|
class="model-editor__notice"
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
:title="$t('aiTools.model.poolUnavailable')"
|
||||||
|
/>
|
||||||
|
<el-alert
|
||||||
|
v-if="discoveryError"
|
||||||
|
class="model-editor__notice"
|
||||||
|
type="warning"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
:title="discoveryError"
|
||||||
|
/>
|
||||||
|
<div v-if="validateAvailability && models.length" class="model-editor__verify">
|
||||||
|
{{ $t('aiTools.agents.verifyModelHelper') }}
|
||||||
|
</div>
|
||||||
|
<el-table :data="models" max-height="360" class="model-editor__table">
|
||||||
|
<el-table-column v-if="validateAvailability" :label="$t('aiTools.model.verify')" width="72" align="center">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<el-radio
|
||||||
|
v-model="verifyIndex"
|
||||||
|
class="model-editor__radio"
|
||||||
|
:value="$index"
|
||||||
|
:disabled="disabled || discovering || !row.id.trim()"
|
||||||
|
:aria-label="$t('aiTools.agents.verifyModel') + ': ' + row.id"
|
||||||
|
>
|
||||||
|
<span />
|
||||||
|
</el-radio>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="Model ID" min-width="210">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-select
|
||||||
|
v-if="localModels.length"
|
||||||
|
v-model="row.id"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
default-first-option
|
||||||
|
:disabled="disabled || discovering"
|
||||||
|
:aria-label="'Model ID'"
|
||||||
|
>
|
||||||
|
<el-option v-for="id in localModels" :key="id" :label="id" :value="id" />
|
||||||
|
</el-select>
|
||||||
|
<el-input v-else v-model="row.id" :disabled="disabled || discovering" aria-label="Model ID" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="$t('commons.table.name')" min-width="160">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-input
|
||||||
|
v-model="row.name"
|
||||||
|
:disabled="disabled || discovering"
|
||||||
|
:placeholder="row.id"
|
||||||
|
:aria-label="$t('commons.table.name')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column width="60" align="center">
|
||||||
|
<template #default="{ $index }">
|
||||||
|
<el-button
|
||||||
|
v-permission="'ai_model_manage'"
|
||||||
|
link
|
||||||
|
:icon="Delete"
|
||||||
|
:disabled="disabled || discovering"
|
||||||
|
:aria-label="$t('commons.button.delete')"
|
||||||
|
@click="remove($index)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<template #empty>
|
||||||
|
<div class="model-editor__empty">{{ $t('aiTools.model.poolEmpty') }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table>
|
||||||
|
<el-button
|
||||||
|
v-permission="'ai_model_manage'"
|
||||||
|
class="model-editor__add"
|
||||||
|
:icon="Plus"
|
||||||
|
:disabled="disabled || discovering || (singleModelOnly && models.length > 0)"
|
||||||
|
@click="add"
|
||||||
|
>
|
||||||
|
{{ $t('commons.button.add') }}
|
||||||
|
</el-button>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onBeforeUnmount, ref, watch } from 'vue';
|
||||||
|
import { ElMessageBox } from 'element-plus';
|
||||||
|
import { Delete, Plus, Refresh } from '@element-plus/icons-vue';
|
||||||
|
import type { AI } from '@/api/interface/ai';
|
||||||
|
import { discoverAgentAccountModels } from '@/api/modules/ai';
|
||||||
|
import i18n from '@/lang';
|
||||||
|
import { MsgError } from '@/utils/message';
|
||||||
|
|
||||||
|
const models = defineModel<AI.AgentAccountModel[]>({ required: true });
|
||||||
|
const verifyIndex = defineModel<number>('verifyIndex', { default: -1 });
|
||||||
|
const discovering = defineModel<boolean>('discovering', { default: false });
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
supportsDiscovery: boolean;
|
||||||
|
request: AI.AgentAccountModelDiscoverReq;
|
||||||
|
validateAvailability: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
singleModelOnly?: boolean;
|
||||||
|
localModels?: string[];
|
||||||
|
beforeDiscover?: () => Promise<boolean>;
|
||||||
|
}>(),
|
||||||
|
{ localModels: () => [] },
|
||||||
|
);
|
||||||
|
const discoveryError = ref('');
|
||||||
|
let requestVersion = 0;
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
requestVersion++;
|
||||||
|
});
|
||||||
|
watch(
|
||||||
|
() => props.request,
|
||||||
|
() => {
|
||||||
|
requestVersion++;
|
||||||
|
discovering.value = false;
|
||||||
|
discoveryError.value = '';
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
const add = () => {
|
||||||
|
models.value = [...models.value, { recordId: 0, id: '', name: '' }];
|
||||||
|
if (props.singleModelOnly) verifyIndex.value = 0;
|
||||||
|
};
|
||||||
|
const remove = (index: number) => {
|
||||||
|
models.value = models.value.filter((_, i) => i !== index);
|
||||||
|
if (verifyIndex.value === index) verifyIndex.value = -1;
|
||||||
|
else if (verifyIndex.value > index) verifyIndex.value--;
|
||||||
|
};
|
||||||
|
const discover = async () => {
|
||||||
|
if (!props.supportsDiscovery || discovering.value || props.disabled) return;
|
||||||
|
if (props.beforeDiscover && !(await props.beforeDiscover())) return;
|
||||||
|
const version = ++requestVersion;
|
||||||
|
if (models.value.some((item) => item.id.trim() || item.name.trim())) {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
i18n.global.t('aiTools.model.poolOverwrite'),
|
||||||
|
i18n.global.t('aiTools.agents.discoverModels'),
|
||||||
|
{
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version !== requestVersion) return;
|
||||||
|
discovering.value = true;
|
||||||
|
discoveryError.value = '';
|
||||||
|
try {
|
||||||
|
const { data } = await discoverAgentAccountModels({ ...props.request });
|
||||||
|
if (version !== requestVersion) return;
|
||||||
|
if (!data?.length) {
|
||||||
|
discoveryError.value = i18n.global.t('aiTools.model.poolFetchEmpty');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (props.singleModelOnly && data.length > 1) {
|
||||||
|
discoveryError.value = i18n.global.t('aiTools.agents.accountModelsSingle');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const previousVerify = models.value[verifyIndex.value]?.id;
|
||||||
|
const nextModels = data.map((item) => ({ recordId: 0, id: item.id, name: item.name || item.id }));
|
||||||
|
models.value = nextModels;
|
||||||
|
verifyIndex.value = nextModels.findIndex((item) => item.id === previousVerify);
|
||||||
|
} catch {
|
||||||
|
if (version === requestVersion) discoveryError.value = i18n.global.t('aiTools.model.poolFetchFailed');
|
||||||
|
} finally {
|
||||||
|
if (version === requestVersion) discovering.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const validate = () => {
|
||||||
|
const rows = models.value.map((item) => ({
|
||||||
|
...item,
|
||||||
|
id: item.id.trim(),
|
||||||
|
name: item.name.trim() || item.id.trim(),
|
||||||
|
}));
|
||||||
|
let error = '';
|
||||||
|
if (!rows.length || rows.some((item) => !item.id)) error = 'aiTools.agents.accountModelsRequired';
|
||||||
|
else if (rows.some((item) => /\s/.test(item.id))) error = 'setting.noSpace';
|
||||||
|
else if (new Set(rows.map((item) => item.id)).size !== rows.length) error = 'aiTools.agents.accountModelsDuplicate';
|
||||||
|
else if (props.singleModelOnly && rows.length > 1) error = 'aiTools.agents.accountModelsSingle';
|
||||||
|
else if (props.validateAvailability && !rows[verifyIndex.value]) error = 'aiTools.agents.verifyModelRequired';
|
||||||
|
if (error) {
|
||||||
|
MsgError(i18n.global.t(error));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
};
|
||||||
|
defineExpose({ validate });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.model-editor {
|
||||||
|
border: 1px solid var(--el-border-color-lighter);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 16px 0;
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 18px 18px 14px;
|
||||||
|
background: var(--el-fill-color-light);
|
||||||
|
strong {
|
||||||
|
margin-right: 8px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 8px 0 0;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
|
.el-button {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__notice {
|
||||||
|
margin: 12px 16px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
&__verify {
|
||||||
|
padding: 12px 16px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
&__empty {
|
||||||
|
padding: 24px 16px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
&__add {
|
||||||
|
margin: 12px 16px 16px;
|
||||||
|
}
|
||||||
|
&__radio {
|
||||||
|
margin-right: 0;
|
||||||
|
:deep(.el-radio__label) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
&__header {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,77 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<DrawerPro v-model="open" :header="headerTitle" size="large" @close="handleClose">
|
<DrawerPro
|
||||||
|
v-model="open"
|
||||||
|
:header="headerTitle"
|
||||||
|
size="large"
|
||||||
|
:auto-close="!saving && !discovering"
|
||||||
|
@close="handleClose"
|
||||||
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div v-loading="loading">
|
<div v-loading="loading">
|
||||||
<div v-if="!readOnly" class="toolbar">
|
<template v-if="!account.appInstallId">
|
||||||
<el-button v-permission type="primary" @click="openCreate">
|
<ModelEditor
|
||||||
{{ $t('commons.button.add') }}
|
ref="modelEditorRef"
|
||||||
</el-button>
|
v-model="items"
|
||||||
</div>
|
v-model:verify-index="draftVerifyIndex"
|
||||||
<p v-if="account.validateAvailability && items.length" class="input-help verification-help">
|
v-model:discovering="discovering"
|
||||||
{{ $t('aiTools.agents.verifyModelHelper') }}
|
:supports-discovery="supportsDiscovery"
|
||||||
{{ $t('aiTools.model.verifyModelChangeHelper') }}
|
:request="discoveryRequest"
|
||||||
</p>
|
:validate-availability="account.validateAvailability"
|
||||||
<ComplexTable :data="items">
|
:disabled="saving"
|
||||||
<el-table-column
|
|
||||||
v-if="account.validateAvailability"
|
|
||||||
:label="$t('aiTools.model.verify')"
|
|
||||||
width="90"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-radio
|
|
||||||
v-permission
|
|
||||||
class="verification-radio"
|
|
||||||
:model-value="verifyModelRecordID"
|
|
||||||
:value="row.recordId"
|
|
||||||
:aria-label="$t('aiTools.agents.verifyModel') + ': ' + row.id"
|
|
||||||
:disabled="readOnly || selectingVerifyModel || saving"
|
|
||||||
@change="selectVerifyModel(row)"
|
|
||||||
>
|
|
||||||
<span />
|
|
||||||
</el-radio>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="$t('aiTools.model.model')" prop="id" min-width="220" />
|
|
||||||
<el-table-column :label="$t('commons.table.name')" prop="name" min-width="180" />
|
|
||||||
<fu-table-operations
|
|
||||||
v-if="!readOnly"
|
|
||||||
:buttons="buttons"
|
|
||||||
:label="$t('commons.table.operate')"
|
|
||||||
:width="localOllama ? 80 : 140"
|
|
||||||
fixed="right"
|
|
||||||
/>
|
/>
|
||||||
</ComplexTable>
|
<p class="input-help">{{ $t('aiTools.model.poolSaveHelp') }}</p>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div v-if="!readOnly" class="toolbar">
|
||||||
|
<el-button v-permission type="primary" @click="ollamaAddRef.acceptParams()">
|
||||||
|
{{ $t('commons.button.add') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<p v-if="account.validateAvailability && items.length" class="input-help verification-help">
|
||||||
|
{{ $t('aiTools.agents.verifyModelHelper') }}
|
||||||
|
{{ $t('aiTools.model.verifyModelChangeHelper') }}
|
||||||
|
</p>
|
||||||
|
<ComplexTable :data="items">
|
||||||
|
<el-table-column
|
||||||
|
v-if="account.validateAvailability"
|
||||||
|
:label="$t('aiTools.model.verify')"
|
||||||
|
width="90"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-radio
|
||||||
|
v-permission
|
||||||
|
class="verification-radio"
|
||||||
|
:model-value="verifyModelRecordID"
|
||||||
|
:value="row.recordId"
|
||||||
|
:aria-label="$t('aiTools.agents.verifyModel') + ': ' + row.id"
|
||||||
|
:disabled="readOnly || selectingVerifyModel || saving"
|
||||||
|
@change="selectVerifyModel(row)"
|
||||||
|
>
|
||||||
|
<span />
|
||||||
|
</el-radio>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="$t('aiTools.model.model')" prop="id" min-width="220" />
|
||||||
|
<el-table-column :label="$t('commons.table.name')" prop="name" min-width="180" />
|
||||||
|
<fu-table-operations
|
||||||
|
v-if="!readOnly"
|
||||||
|
:buttons="buttons"
|
||||||
|
:label="$t('commons.table.operate')"
|
||||||
|
:width="80"
|
||||||
|
fixed="right"
|
||||||
|
/>
|
||||||
|
</ComplexTable>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="open = false">{{ $t('commons.button.cancel') }}</el-button>
|
<el-button :disabled="saving || discovering" @click="open = false">
|
||||||
|
{{ $t('commons.button.cancel') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="!account.appInstallId"
|
||||||
|
v-permission
|
||||||
|
type="primary"
|
||||||
|
:loading="saving"
|
||||||
|
:disabled="loading || discovering"
|
||||||
|
@click="saveModels"
|
||||||
|
>
|
||||||
|
{{ $t('commons.button.save') }}
|
||||||
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</DrawerPro>
|
</DrawerPro>
|
||||||
|
|
||||||
<DialogPro v-model="editorOpen" :title="editorTitle" size="normal" @close="handleEditorClose">
|
|
||||||
<el-form ref="formRef" :model="form" label-position="top" class="mt-5" :rules="rules" v-loading="saving">
|
|
||||||
<el-form-item :label="$t('aiTools.model.model')" prop="id">
|
|
||||||
<el-input v-model="form.id" clearable />
|
|
||||||
<span v-if="account.provider === 'ollama'" class="input-help">
|
|
||||||
{{ $t('aiTools.agents.ollamaRegisterOnly') }}
|
|
||||||
</span>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="$t('commons.table.name')" prop="name">
|
|
||||||
<el-input v-model="form.name" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<span class="dialog-footer">
|
|
||||||
<el-button :disabled="saving" @click="editorOpen = false">{{ $t('commons.button.cancel') }}</el-button>
|
|
||||||
<el-button v-permission :disabled="saving" type="primary" @click="submit">
|
|
||||||
{{ form.recordId ? $t('commons.button.confirm') : $t('commons.button.add') }}
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</DialogPro>
|
|
||||||
<OllamaAdd ref="ollamaAddRef" :account-id="account.id" @log="onPullLog" />
|
<OllamaAdd ref="ollamaAddRef" :account-id="account.id" @log="onPullLog" />
|
||||||
<TaskLog ref="taskLogRef" width="70%" @close="refresh" />
|
<TaskLog ref="taskLogRef" width="70%" @close="refresh" />
|
||||||
<OpDialog ref="deleteRef" @search="refresh">
|
<OpDialog ref="deleteRef" @search="refresh">
|
||||||
@@ -84,40 +96,42 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import ModelEditor from '../model-editor/index.vue';
|
||||||
import { computed, reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import type { FormInstance } from 'element-plus';
|
|
||||||
import OllamaAdd from '@/views/ai/ollama/add/index.vue';
|
import OllamaAdd from '@/views/ai/ollama/add/index.vue';
|
||||||
import TaskLog from '@/components/log/task/index.vue';
|
import TaskLog from '@/components/log/task/index.vue';
|
||||||
import OpDialog from '@/components/del-dialog/index.vue';
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import {
|
import {
|
||||||
createAgentAccountModel,
|
getAgentProviders,
|
||||||
|
updateAgentAccountModel,
|
||||||
deleteAgentAccountModel,
|
deleteAgentAccountModel,
|
||||||
getAgentAccountModels,
|
getAgentAccountModels,
|
||||||
updateAgentAccountModel,
|
|
||||||
updateAgentAccountVerifyModel,
|
updateAgentAccountVerifyModel,
|
||||||
} from '@/api/modules/ai';
|
} from '@/api/modules/ai';
|
||||||
import { AI } from '@/api/interface/ai';
|
import { AI } from '@/api/interface/ai';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import { getAgentProviderDisplayName } from '@/utils/agent';
|
import { getAgentProviderDisplayName } from '@/utils/agent';
|
||||||
import { Rules } from '@/global/form-rules';
|
|
||||||
|
|
||||||
const emit = defineEmits(['updated']);
|
const emit = defineEmits(['updated']);
|
||||||
|
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const readOnly = ref(false);
|
const readOnly = ref(false);
|
||||||
const editorOpen = ref(false);
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
const selectingVerifyModel = ref(false);
|
const selectingVerifyModel = ref(false);
|
||||||
const formRef = ref<FormInstance>();
|
const discovering = ref(false);
|
||||||
|
const supportsDiscovery = ref(false);
|
||||||
|
const draftVerifyIndex = ref(-1);
|
||||||
|
const modelEditorRef = ref<InstanceType<typeof ModelEditor>>();
|
||||||
|
const discoveryRequest = computed(() => ({ accountId: account.id }));
|
||||||
|
let openVersion = 0;
|
||||||
const items = ref<AI.AgentAccountModel[]>([]);
|
const items = ref<AI.AgentAccountModel[]>([]);
|
||||||
const verifyModelRecordID = computed(() => items.value.find((item) => item.isVerifyModel)?.recordId);
|
const verifyModelRecordID = computed(() => items.value.find((item) => item.isVerifyModel)?.recordId);
|
||||||
const ollamaAddRef = ref();
|
const ollamaAddRef = ref();
|
||||||
const taskLogRef = ref();
|
const taskLogRef = ref();
|
||||||
const deleteRef = ref();
|
const deleteRef = ref();
|
||||||
const deleteFiles = ref(false);
|
const deleteFiles = ref(false);
|
||||||
const localOllama = computed(() => account.provider === 'ollama' && account.appInstallId > 0);
|
|
||||||
|
|
||||||
const account = reactive({
|
const account = reactive({
|
||||||
id: 0,
|
id: 0,
|
||||||
@@ -127,33 +141,12 @@ const account = reactive({
|
|||||||
validateAvailability: true,
|
validateAvailability: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const form = reactive<AI.AgentAccountModel>({
|
|
||||||
recordId: 0,
|
|
||||||
id: '',
|
|
||||||
name: '',
|
|
||||||
});
|
|
||||||
|
|
||||||
const headerTitle = computed(() => {
|
const headerTitle = computed(() => {
|
||||||
const accountName = account.name || getAgentProviderDisplayName(account.provider, account.provider);
|
const accountName = account.name || getAgentProviderDisplayName(account.provider, account.provider);
|
||||||
return `${accountName} · ${i18n.global.t('aiTools.agents.modelPool')}`;
|
return `${accountName} · ${i18n.global.t('aiTools.agents.modelPool')}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const editorTitle = computed(() =>
|
|
||||||
form.recordId ? i18n.global.t('commons.button.edit') : i18n.global.t('commons.button.add'),
|
|
||||||
);
|
|
||||||
|
|
||||||
const rules = reactive({
|
|
||||||
id: [Rules.requiredInput, Rules.noSpace],
|
|
||||||
});
|
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
|
||||||
label: i18n.global.t('commons.button.edit'),
|
|
||||||
permission: true,
|
|
||||||
disabled: () => selectingVerifyModel.value,
|
|
||||||
click: (row: AI.AgentAccountModel) => openEdit(row),
|
|
||||||
show: () => !localOllama.value,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: i18n.global.t('commons.button.delete'),
|
label: i18n.global.t('commons.button.delete'),
|
||||||
permission: true,
|
permission: true,
|
||||||
@@ -189,70 +182,15 @@ const search = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
const requestedAccountID = account.id;
|
||||||
|
const version = openVersion;
|
||||||
try {
|
try {
|
||||||
const res = await getAgentAccountModels({ accountId: account.id });
|
const res = await getAgentAccountModels({ accountId: requestedAccountID });
|
||||||
|
if (!open.value || requestedAccountID !== account.id || version !== openVersion) return;
|
||||||
items.value = (res.data || []).map((item) => buildModelItem(item));
|
items.value = (res.data || []).map((item) => buildModelItem(item));
|
||||||
|
draftVerifyIndex.value = items.value.findIndex((item) => item.isVerifyModel);
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
if (version === openVersion) loading.value = false;
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const resetForm = () => {
|
|
||||||
form.recordId = 0;
|
|
||||||
form.id = '';
|
|
||||||
form.name = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const openCreate = () => {
|
|
||||||
if (localOllama.value) {
|
|
||||||
ollamaAddRef.value.acceptParams();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
resetForm();
|
|
||||||
editorOpen.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const openEdit = (row: AI.AgentAccountModel) => {
|
|
||||||
Object.assign(form, buildModelItem(row));
|
|
||||||
editorOpen.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const submit = async () => {
|
|
||||||
if (!account.id || !formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await formRef.value.validate();
|
|
||||||
const duplicate = items.value.some((item) => item.id === form.id && item.recordId !== form.recordId);
|
|
||||||
if (duplicate) {
|
|
||||||
MsgError(i18n.global.t('aiTools.agents.accountModelsDuplicate'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
saving.value = true;
|
|
||||||
try {
|
|
||||||
if (form.recordId) {
|
|
||||||
await updateAgentAccountModel({
|
|
||||||
accountId: account.id,
|
|
||||||
model: buildModelItem(form),
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await createAgentAccountModel({
|
|
||||||
accountId: account.id,
|
|
||||||
model: buildModelItem(form),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
editorOpen.value = false;
|
|
||||||
await search();
|
|
||||||
emit('updated');
|
|
||||||
} catch (error: any) {
|
|
||||||
MsgError(
|
|
||||||
String(
|
|
||||||
error?.response?.data?.message ||
|
|
||||||
(error?.code === 'ECONNABORTED' ? i18n.global.t('commons.msg.requestTimeout') : error?.message) ||
|
|
||||||
i18n.global.t('commons.res.commonError'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} finally {
|
|
||||||
saving.value = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -281,21 +219,16 @@ const onDelete = (row: AI.AgentAccountModel) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditorClose = () => {
|
|
||||||
formRef.value?.resetFields();
|
|
||||||
resetForm();
|
|
||||||
saving.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
openVersion++;
|
||||||
|
saving.value = false;
|
||||||
|
discovering.value = false;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
account.id = 0;
|
account.id = 0;
|
||||||
account.name = '';
|
account.name = '';
|
||||||
account.provider = '';
|
account.provider = '';
|
||||||
account.appInstallId = 0;
|
account.appInstallId = 0;
|
||||||
items.value = [];
|
items.value = [];
|
||||||
editorOpen.value = false;
|
|
||||||
handleEditorClose();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openDrawer = async (row: AI.AgentAccountItem) => {
|
const openDrawer = async (row: AI.AgentAccountItem) => {
|
||||||
@@ -306,7 +239,46 @@ const openDrawer = async (row: AI.AgentAccountItem) => {
|
|||||||
account.provider = row.provider;
|
account.provider = row.provider;
|
||||||
account.validateAvailability = row.validateAvailability;
|
account.validateAvailability = row.validateAvailability;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
|
supportsDiscovery.value = false;
|
||||||
|
items.value = [];
|
||||||
|
draftVerifyIndex.value = -1;
|
||||||
|
const version = ++openVersion;
|
||||||
await search();
|
await search();
|
||||||
|
if (row.appInstallId || version !== openVersion) return;
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const { data } = await getAgentProviders();
|
||||||
|
if (version !== openVersion) return;
|
||||||
|
const provider = data.find((item) => item.provider === row.provider);
|
||||||
|
const preset = provider?.accountTypes.find((item) => item.key === row.accountType);
|
||||||
|
supportsDiscovery.value = Boolean(
|
||||||
|
(preset?.apiTypes || provider?.apiTypes)?.find((item) => item.apiType === row.apiType)
|
||||||
|
?.supportsModelDiscovery,
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
if (version === openVersion) loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveModels = async () => {
|
||||||
|
if (saving.value || discovering.value) return;
|
||||||
|
const models = modelEditorRef.value?.validate();
|
||||||
|
if (!models) return;
|
||||||
|
const version = openVersion;
|
||||||
|
saving.value = true;
|
||||||
|
try {
|
||||||
|
await updateAgentAccountModel({
|
||||||
|
accountId: account.id,
|
||||||
|
models,
|
||||||
|
verifyModel: models[draftVerifyIndex.value]?.id || '',
|
||||||
|
});
|
||||||
|
emit('updated');
|
||||||
|
if (version !== openVersion) return;
|
||||||
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
|
open.value = false;
|
||||||
|
} finally {
|
||||||
|
if (version === openVersion) saving.value = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|||||||