from abc import ABC, abstractmethod #------ 抽象 ASR, LLM, TTS 类 ------ # class ASR(ABC): def __init__(self): self.is_slience = False @abstractmethod async def stream_recognize(self, chunk): pass class LLM(ABC): @abstractmethod def chat(self, assistant, prompt, db): pass class TTS(ABC): @abstractmethod def synthetize(self, assistant, text): pass # --------------------------------- # # ----------- 抽象服务类 ----------- # class UserAudioService(ABC): @abstractmethod def user_audio_process(self, audio:str, **kwargs) -> str: pass class PromptService(ABC): @abstractmethod def prompt_process(self, prompt:str, **kwargs) -> str: pass class LLMMsgService(ABC): @abstractmethod def llm_msg_process(self, llm_chunks:list, **kwargs) -> list: pass class TTSAudioService(ABC): @abstractmethod def tts_audio_process(self, audio:bytes, **kwargs) -> bytes: pass # --------------------------------- #