feat(asr): add ASR model connection check and update related components

- Implemented a new function to check ASR model connectivity via the /v1/audio/transcriptions endpoint.
- Updated ModelEditorDialog.vue to integrate ASR model checks and adjust UI elements accordingly.
- Enhanced localization files to reflect changes in ASR terminology and descriptions.
- Added ASR configuration options to the knowledge base and updated related migration scripts.
- Refactored model handling to support ASR as a distinct model type in the application.
This commit is contained in:
wizardchen
2026-04-02 20:53:44 +08:00
committed by lyingbug
parent d3c4992e01
commit c93f4e94ae
17 changed files with 231 additions and 83 deletions
+8 -20
View File
@@ -2,8 +2,6 @@ package asr
import (
"context"
"fmt"
"strings"
"github.com/Tencent/WeKnora/internal/types"
)
@@ -19,26 +17,16 @@ type ASR interface {
// Config holds the configuration needed to create an ASR instance.
type Config struct {
Source types.ModelSource
BaseURL string
ModelName string
APIKey string
ModelID string
InterfaceType string // "openai" (default)
Language string // optional: specify language for transcription
Source types.ModelSource
BaseURL string
ModelName string
APIKey string
ModelID string
Language string // optional: specify language for transcription
}
// NewASR creates an ASR instance based on the provided configuration.
// All ASR vendors use the OpenAI-compatible /v1/audio/transcriptions API.
func NewASR(config *Config) (ASR, error) {
ifType := strings.ToLower(config.InterfaceType)
if ifType == "" {
ifType = "openai"
}
switch ifType {
case "openai":
return NewOpenAIASR(config)
default:
return nil, fmt.Errorf("unsupported ASR interface type: %s", ifType)
}
return NewOpenAIASR(config)
}
-2
View File
@@ -32,14 +32,12 @@ func (p *AliyunProvider) Info() ProviderInfo {
types.ModelTypeEmbedding: AliyunChatBaseURL,
types.ModelTypeRerank: AliyunRerankBaseURL,
types.ModelTypeVLLM: AliyunChatBaseURL,
types.ModelTypeASR: AliyunChatBaseURL,
},
ModelTypes: []types.ModelType{
types.ModelTypeKnowledgeQA,
types.ModelTypeEmbedding,
types.ModelTypeRerank,
types.ModelTypeVLLM,
types.ModelTypeASR,
},
RequiresAuth: true,
}