feat(weknoracloud): implement WeKnoraCloud VLM integration

- Added WeKnoraCloudVLM struct to handle interactions with the WeKnoraCloud API, including image and text processing capabilities.
- Enhanced model configuration to include AppID and AppSecret for secure API access.
- Updated modelService to resolve WeKnoraCloud credentials and pass them to the VLM configuration.
- Implemented Predict method for sending requests to the WeKnoraCloud API and processing responses.

This update introduces a new integration with WeKnoraCloud, expanding the application's capabilities in handling multimedia content.
This commit is contained in:
wizardchen
2026-04-15 14:55:10 +08:00
committed by lyingbug
parent 3fcfa89062
commit 9ba8582f70
3 changed files with 200 additions and 0 deletions
+12
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"strings"
"github.com/Tencent/WeKnora/internal/models/provider"
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
"github.com/Tencent/WeKnora/internal/types"
)
@@ -28,6 +29,8 @@ type Config struct {
InterfaceType string // "ollama" or "openai" (default)
Provider string
Extra map[string]any
AppID string
AppSecret string
}
// NewVLM creates a VLM instance based on the provided configuration.
@@ -37,6 +40,15 @@ func NewVLM(config *Config, ollamaService *ollama.OllamaService) (VLM, error) {
if ifType == "ollama" || config.Source == types.ModelSourceLocal {
return NewOllamaVLM(config, ollamaService)
}
providerName := provider.ProviderName(config.Provider)
if providerName == "" {
providerName = provider.DetectProvider(config.BaseURL)
}
if providerName == provider.ProviderWeKnoraCloud {
return NewWeKnoraCloudVLM(config)
}
return NewRemoteAPIVLM(config)
}