refactor: use unified NVIDIA API for both chat and VLM
This commit is contained in:
@@ -373,7 +373,7 @@ const fallbackProviderOptions = computed(() => [
|
||||
value: 'nvidia',
|
||||
label: t('model.editor.providers.nvidia.label'),
|
||||
defaultUrls: {
|
||||
chat: 'https://integrate.api.nvidia.com/v1/chat/completions',
|
||||
chat: 'https://integrate.api.nvidia.com/v1',
|
||||
embedding: 'https://integrate.api.nvidia.com/v1',
|
||||
rerank: 'https://ai.api.nvidia.com/v1/retrieval/nvidia/reranking',
|
||||
vllm: 'https://integrate.api.nvidia.com/v1',
|
||||
|
||||
@@ -53,8 +53,8 @@ var chatProviderSpecs = []ProviderSpec{
|
||||
},
|
||||
// NVIDIA
|
||||
{
|
||||
Provider: provider.ProviderNvidia,
|
||||
EndpointCustomizer: nvidiaEndpointCustomizer,
|
||||
Provider: provider.ProviderNvidia,
|
||||
RequestCustomizer: genericRequestCustomizer,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -183,9 +183,3 @@ func volcengineRequestCustomizer(
|
||||
|
||||
return vcReq, true
|
||||
}
|
||||
|
||||
// nvidiaEndpointCustomizer 自定义 NVIDIA 请求地址
|
||||
// NVIDIA 模型使用 BaseURL 作为完整请求地址
|
||||
func nvidiaEndpointCustomizer(baseURL string, _ string, _ bool) string {
|
||||
return baseURL
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ import (
|
||||
|
||||
const (
|
||||
// NvidiaChatBaseURL NVIDIA Chat 的默认 BaseURL
|
||||
NvidiaChatBaseURL = "https://integrate.api.nvidia.com/v1/chat/completions"
|
||||
// NvidiaVLMBaseURL NVIDIA VLM 的默认 BaseURL
|
||||
NvidiaVLMBaseURL = "https://integrate.api.nvidia.com/v1"
|
||||
NvidiaChatBaseURL = "https://integrate.api.nvidia.com/v1"
|
||||
// NvidiaRerankBaseURL NVIDIA Rerank 的默认 BaseURL
|
||||
NvidiaRerankBaseURL = "https://ai.api.nvidia.com/v1/retrieval/nvidia/reranking"
|
||||
)
|
||||
@@ -32,7 +30,7 @@ func (p *NvidiaProvider) Info() ProviderInfo {
|
||||
types.ModelTypeKnowledgeQA: NvidiaChatBaseURL,
|
||||
types.ModelTypeEmbedding: NvidiaChatBaseURL,
|
||||
types.ModelTypeRerank: NvidiaRerankBaseURL,
|
||||
types.ModelTypeVLLM: NvidiaVLMBaseURL,
|
||||
types.ModelTypeVLLM: NvidiaChatBaseURL,
|
||||
},
|
||||
ModelTypes: []types.ModelType{
|
||||
types.ModelTypeKnowledgeQA,
|
||||
|
||||
@@ -47,7 +47,8 @@ const (
|
||||
ModelSourceSiliconFlow ModelSource = "siliconflow" // SiliconFlow model
|
||||
ModelSourceJina ModelSource = "jina" // Jina AI model
|
||||
ModelSourceOpenRouter ModelSource = "openrouter" // OpenRouter model
|
||||
ModelSourceNovita ModelSource = "novita" // Novita AI model
|
||||
ModelSourceNvidia ModelSource = "nvidia" // NVIDIA model
|
||||
ModelSourceNovita ModelSource = "novita" // Novita AI model
|
||||
)
|
||||
|
||||
// EmbeddingParameters represents the embedding parameters for a model
|
||||
@@ -61,9 +62,9 @@ type ModelParameters struct {
|
||||
APIKey string `yaml:"api_key" json:"api_key"`
|
||||
InterfaceType string `yaml:"interface_type" json:"interface_type"`
|
||||
EmbeddingParameters EmbeddingParameters `yaml:"embedding_parameters" json:"embedding_parameters"`
|
||||
ParameterSize string `yaml:"parameter_size" json:"parameter_size"` // Ollama model parameter size (e.g., "7B", "13B", "70B")
|
||||
Provider string `yaml:"provider" json:"provider"` // Provider identifier: openai, aliyun, zhipu, generic
|
||||
ExtraConfig map[string]string `yaml:"extra_config" json:"extra_config"` // Provider-specific configuration
|
||||
ParameterSize string `yaml:"parameter_size" json:"parameter_size"` // Ollama model parameter size (e.g., "7B", "13B", "70B")
|
||||
Provider string `yaml:"provider" json:"provider"` // Provider identifier: openai, aliyun, zhipu, generic
|
||||
ExtraConfig map[string]string `yaml:"extra_config" json:"extra_config"` // Provider-specific configuration
|
||||
SupportsVision bool `yaml:"supports_vision" json:"supports_vision"` // Whether the model accepts image/multimodal input
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user