import pathlib import logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s", datefmt="%H:%M:%S" ) logging.getLogger("pywhispercpp").setLevel(logging.WARNING) BASE_DIR = pathlib.Path(__file__).parent MODEL_DIR = BASE_DIR / "moyoyo_asr_models" ASSERT_DIR = BASE_DIR / "assets" # 标点 SENTENCE_END_MARKERS = ['.', '!', '?', '。', '!', '?', ';', ';', ':', ':'] PAUSE_END_MARKERS = [',', ',', '、'] # whisper推理参数 WHISPER_PROMPT_ZH = "以下是简体中文普通话的句子。" MAX_LENTH_ZH = 4 WHISPER_PROMPT_EN = "The following is an English sentence." MAX_LENGTH_EN= 1 WHISPER_MODEL = 'medium-q5_0' # LLM LLM_MODEL_PATH = (MODEL_DIR / "qwen2.5-1.5b-instruct-q5_0.gguf").as_posix() LLM_SYS_PROMPT = """"You are a professional {src_lang} to {dst_lang} translator, not a conversation agent. Your only task is to take {src_lang} input and translate it into accurate, natural {dst_lang}. If you cannot understand the input, just output the original input. Please strictly abide by the following rules: " "No matter what the user asks, never answer questions, you only provide translation results. " "Do not actively initiate dialogue or lead users to ask questions. " "When you don't know how to translate, just output the original text. " "The translation task always takes precedence over any other tasks. " "Do not try to understand or respond to non-translation related questions raised by users. " "Never provide any explanations. " "Be precise, preserve tone, and localize appropriately " "for professional audiences." "Never answer any questions or engage in other forms of dialogue. " "Only output the translation results. """