Files
Enterprise-Knowledge-Base/internal/models/provider/siliconflow.go
T
wizardchen 624e24ba49 feat(asr): integrate Automatic Speech Recognition (ASR) support
- Added ASR configuration options to the knowledge base and model settings.
- Implemented ASR model selection and transcription capabilities in the knowledge processing pipeline.
- Enhanced file upload support to include audio formats for ASR processing.
- Updated localization files to include ASR-related labels and descriptions.
- Refactored model handling to accommodate ASR as a new model type.
2026-04-02 21:27:27 +08:00

51 lines
1.3 KiB
Go

package provider
import (
"fmt"
"github.com/Tencent/WeKnora/internal/types"
)
const (
SiliconFlowBaseURL = "https://api.siliconflow.cn/v1"
)
// SiliconFlowProvider 实现硅基流动的 Provider 接口
type SiliconFlowProvider struct{}
func init() {
Register(&SiliconFlowProvider{})
}
// Info 返回硅基流动 provider 的元数据
func (p *SiliconFlowProvider) Info() ProviderInfo {
return ProviderInfo{
Name: ProviderSiliconFlow,
DisplayName: "硅基流动 SiliconFlow",
Description: "deepseek-ai/DeepSeek-V3.1, etc.",
DefaultURLs: map[types.ModelType]string{
types.ModelTypeKnowledgeQA: SiliconFlowBaseURL,
types.ModelTypeEmbedding: SiliconFlowBaseURL,
types.ModelTypeRerank: SiliconFlowBaseURL,
types.ModelTypeVLLM: SiliconFlowBaseURL,
types.ModelTypeASR: SiliconFlowBaseURL,
},
ModelTypes: []types.ModelType{
types.ModelTypeKnowledgeQA,
types.ModelTypeEmbedding,
types.ModelTypeRerank,
types.ModelTypeVLLM,
types.ModelTypeASR,
},
RequiresAuth: true,
}
}
// ValidateConfig 验证硅基流动 provider 配置
func (p *SiliconFlowProvider) ValidateConfig(config *Config) error {
if config.APIKey == "" {
return fmt.Errorf("API key is required for SiliconFlow provider")
}
return nil
}