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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user