mirror of
https://github.com/wavetermdev/waveterm
synced 2026-04-21 14:37:16 +00:00
Merge fd319e032d into 3e4fe8cf51
This commit is contained in:
commit
772ea57e54
4 changed files with 19 additions and 1 deletions
|
|
@ -32,6 +32,7 @@ const (
|
|||
AIProvider_OpenAI = "openai"
|
||||
AIProvider_Azure = "azure"
|
||||
AIProvider_AzureLegacy = "azure-legacy"
|
||||
AIProvider_Novita = "novita"
|
||||
AIProvider_Custom = "custom"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ const (
|
|||
OpenRouterChatEndpoint = "https://openrouter.ai/api/v1/chat/completions"
|
||||
NanoGPTChatEndpoint = "https://nano-gpt.com/api/v1/chat/completions"
|
||||
GroqChatEndpoint = "https://api.groq.com/openai/v1/chat/completions"
|
||||
NovitaChatEndpoint = "https://api.novita.ai/openai/v1/chat/completions"
|
||||
AzureLegacyEndpointTemplate = "https://%s.openai.azure.com/openai/deployments/%s/chat/completions?api-version=%s"
|
||||
AzureResponsesEndpointTemplate = "https://%s.openai.azure.com/openai/v1/responses"
|
||||
AzureChatEndpointTemplate = "https://%s.openai.azure.com/openai/v1/chat/completions"
|
||||
|
|
@ -36,6 +37,7 @@ const (
|
|||
GroqAPITokenSecretName = "GROQ_KEY"
|
||||
AzureOpenAIAPITokenSecretName = "AZURE_OPENAI_KEY"
|
||||
GoogleAIAPITokenSecretName = "GOOGLE_AI_KEY"
|
||||
NovitaAPITokenSecretName = "NOVITA_API_KEY"
|
||||
)
|
||||
|
||||
func resolveAIMode(requestedMode string, premium bool) (string, *wconfig.AIModeConfigType, error) {
|
||||
|
|
@ -125,6 +127,20 @@ func applyProviderDefaults(config *wconfig.AIModeConfigType) {
|
|||
config.APITokenSecretName = GroqAPITokenSecretName
|
||||
}
|
||||
}
|
||||
if config.Provider == uctypes.AIProvider_Novita {
|
||||
if config.APIType == "" {
|
||||
config.APIType = uctypes.APIType_OpenAIChat
|
||||
}
|
||||
if config.Endpoint == "" {
|
||||
config.Endpoint = NovitaChatEndpoint
|
||||
}
|
||||
if config.APITokenSecretName == "" {
|
||||
config.APITokenSecretName = NovitaAPITokenSecretName
|
||||
}
|
||||
if len(config.Capabilities) == 0 {
|
||||
config.Capabilities = []string{uctypes.AICapabilityTools, uctypes.AICapabilityImages}
|
||||
}
|
||||
}
|
||||
if config.Provider == uctypes.AIProvider_AzureLegacy {
|
||||
if config.AzureAPIVersion == "" {
|
||||
config.AzureAPIVersion = AzureLegacyDefaultAPIVersion
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ type AIModeConfigType struct {
|
|||
DisplayOrder float64 `json:"display:order,omitempty"`
|
||||
DisplayIcon string `json:"display:icon,omitempty"`
|
||||
DisplayDescription string `json:"display:description,omitempty"`
|
||||
Provider string `json:"ai:provider,omitempty" jsonschema:"enum=wave,enum=google,enum=groq,enum=openrouter,enum=nanogpt,enum=openai,enum=azure,enum=azure-legacy,enum=custom"`
|
||||
Provider string `json:"ai:provider,omitempty" jsonschema:"enum=wave,enum=google,enum=groq,enum=openrouter,enum=nanogpt,enum=openai,enum=azure,enum=azure-legacy,enum=novita,enum=custom"`
|
||||
APIType string `json:"ai:apitype,omitempty" jsonschema:"enum=google-gemini,enum=openai-responses,enum=openai-chat"`
|
||||
Model string `json:"ai:model,omitempty"`
|
||||
ThinkingLevel string `json:"ai:thinkinglevel,omitempty" jsonschema:"enum=low,enum=medium,enum=high"`
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
"openai",
|
||||
"azure",
|
||||
"azure-legacy",
|
||||
"novita",
|
||||
"custom"
|
||||
]
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue