Merge remote-tracking branch 'origin/master' into dev

# Conflicts:
#	backend/app/transcriber/transcriber_provider.py
This commit is contained in:
思诺特
2025-04-26 11:19:34 +08:00
7 changed files with 210 additions and 20 deletions

View File

@@ -18,7 +18,7 @@ from app.models.notes_model import AudioDownloadResult
from app.enmus.note_enums import DownloadQuality
from app.models.transcriber_model import TranscriptResult
from app.transcriber.base import Transcriber
from app.transcriber.transcriber_provider import get_transcriber
from app.transcriber.transcriber_provider import get_transcriber,_transcribers
from app.transcriber.whisper import WhisperTranscriber
import re
@@ -43,7 +43,7 @@ class NoteGenerator:
def __init__(self):
self.model_size: str = 'base'
self.device: Union[str, None] = None
self.transcriber_type = 'fast-whisper'
self.transcriber_type = os.getenv('TRANSCRIBER_TYPE','fast-whisper')
self.transcriber = self.get_transcriber()
# TODO 需要更换为可调节
@@ -86,9 +86,9 @@ class NoteGenerator:
:param transcriber: 选择的转义器
:return:
'''
if self.transcriber_type == 'fast-whisper':
logger.info("使用Whisper")
return get_transcriber()
if self.transcriber_type in _transcribers.keys():
logger.info(f"使用{self.transcriber_type}转义器")
return get_transcriber(transcriber_type=self.transcriber_type)
else:
logger.warning("不支持的转义器")
raise ValueError(f"不支持的转义器:{self.transcriber}")