feat(video): update ASR terminology and file type labels for improved clarity
- Changed 'Audio Processing' to 'Audio & Video' in English, Korean, Russian, and Chinese translations to reflect expanded functionality. - Updated ASR configuration titles and descriptions to include video processing capabilities, enhancing user understanding of the feature. - Renamed file type labels from 'Audio Files' to 'Audio & Video' across multiple languages for consistency and clarity. - Enhanced document upload handling in the KnowledgeBase to filter unsupported file types, providing user feedback for filtered images, videos, and audio files. This update improves the internationalization of the application and clarifies the capabilities of the ASR feature.
This commit is contained in:
@@ -1490,6 +1490,25 @@ type ProcessChunksOptions struct {
|
||||
ParentChunks []types.ParsedParentChunk
|
||||
}
|
||||
|
||||
// buildSplitterConfig creates a SplitterConfig with fallbacks from a KnowledgeBase.
|
||||
func buildSplitterConfig(kb *types.KnowledgeBase) chunker.SplitterConfig {
|
||||
chunkCfg := chunker.SplitterConfig{
|
||||
ChunkSize: kb.ChunkingConfig.ChunkSize,
|
||||
ChunkOverlap: kb.ChunkingConfig.ChunkOverlap,
|
||||
Separators: kb.ChunkingConfig.Separators,
|
||||
}
|
||||
if chunkCfg.ChunkSize <= 0 {
|
||||
chunkCfg.ChunkSize = 512
|
||||
}
|
||||
if chunkCfg.ChunkOverlap <= 0 {
|
||||
chunkCfg.ChunkOverlap = 50
|
||||
}
|
||||
if len(chunkCfg.Separators) == 0 {
|
||||
chunkCfg.Separators = []string{"\n\n", "\n", "。"}
|
||||
}
|
||||
return chunkCfg
|
||||
}
|
||||
|
||||
// buildParentChildConfigs derives parent and child SplitterConfig from ChunkingConfig.
|
||||
// The base config (already validated with defaults) is used for separators.
|
||||
func buildParentChildConfigs(cc types.ChunkingConfig, base chunker.SplitterConfig) (parent, child chunker.SplitterConfig) {
|
||||
@@ -7089,20 +7108,7 @@ func (s *knowledgeService) triggerManualProcessing(ctx context.Context,
|
||||
}
|
||||
|
||||
// Manual content is markdown - chunk directly with Go chunker
|
||||
chunkCfg := chunker.SplitterConfig{
|
||||
ChunkSize: kb.ChunkingConfig.ChunkSize,
|
||||
ChunkOverlap: kb.ChunkingConfig.ChunkOverlap,
|
||||
Separators: kb.ChunkingConfig.Separators,
|
||||
}
|
||||
if chunkCfg.ChunkSize <= 0 {
|
||||
chunkCfg.ChunkSize = 512
|
||||
}
|
||||
if chunkCfg.ChunkOverlap <= 0 {
|
||||
chunkCfg.ChunkOverlap = 50
|
||||
}
|
||||
if len(chunkCfg.Separators) == 0 {
|
||||
chunkCfg.Separators = []string{"\n\n", "\n", "。"}
|
||||
}
|
||||
chunkCfg := buildSplitterConfig(kb)
|
||||
|
||||
var parsed []types.ParsedChunk
|
||||
opts := ProcessChunksOptions{
|
||||
@@ -7847,7 +7853,7 @@ func (s *knowledgeService) ProcessDocument(ctx context.Context, t *asynq.Task) e
|
||||
return nil
|
||||
}
|
||||
|
||||
transcribedText, err := asrModel.Transcribe(ctx, convertResult.AudioData, knowledge.FileName)
|
||||
transcriptionResult, err := asrModel.Transcribe(ctx, convertResult.AudioData, knowledge.FileName)
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "[ASR] Transcription failed: %v", err)
|
||||
if isLastRetry {
|
||||
@@ -7859,6 +7865,11 @@ func (s *knowledgeService) ProcessDocument(ctx context.Context, t *asynq.Task) e
|
||||
return fmt.Errorf("audio transcription failed: %w", err)
|
||||
}
|
||||
|
||||
var transcribedText string
|
||||
if transcriptionResult != nil {
|
||||
transcribedText = transcriptionResult.Text
|
||||
}
|
||||
|
||||
if transcribedText == "" {
|
||||
logger.Warn(ctx, "[ASR] Transcription returned empty text")
|
||||
transcribedText = "[No speech detected in audio file]"
|
||||
@@ -7902,20 +7913,7 @@ func (s *knowledgeService) ProcessDocument(ctx context.Context, t *asynq.Task) e
|
||||
}
|
||||
|
||||
// Step 3: Split into chunks using Go chunker
|
||||
chunkCfg := chunker.SplitterConfig{
|
||||
ChunkSize: kb.ChunkingConfig.ChunkSize,
|
||||
ChunkOverlap: kb.ChunkingConfig.ChunkOverlap,
|
||||
Separators: kb.ChunkingConfig.Separators,
|
||||
}
|
||||
if chunkCfg.ChunkSize <= 0 {
|
||||
chunkCfg.ChunkSize = 512
|
||||
}
|
||||
if chunkCfg.ChunkOverlap <= 0 {
|
||||
chunkCfg.ChunkOverlap = 50
|
||||
}
|
||||
if len(chunkCfg.Separators) == 0 {
|
||||
chunkCfg.Separators = []string{"\n\n", "\n", "。"}
|
||||
}
|
||||
chunkCfg := buildSplitterConfig(kb)
|
||||
|
||||
processOpts := ProcessChunksOptions{
|
||||
EnableQuestionGeneration: payload.EnableQuestionGeneration,
|
||||
|
||||
Reference in New Issue
Block a user