diff --git a/dsLightRag/Routes/XueBanRoute.py b/dsLightRag/Routes/XueBanRoute.py index 650447be..20dafe8e 100644 --- a/dsLightRag/Routes/XueBanRoute.py +++ b/dsLightRag/Routes/XueBanRoute.py @@ -84,17 +84,8 @@ async def streaming_chat(websocket: WebSocket): except Exception as e: logger.error(f"发送ASR结果失败: {str(e)}") return - - # 定义音频回调函数,将音频块发送给前端 - async def audio_callback(audio_chunk): - logger.info(f"发送音频块,大小: {len(audio_chunk)}") - try: - await websocket.send_bytes(audio_chunk) - logger.info("音频块发送成功") - except Exception as e: - logger.error(f"发送音频块失败: {str(e)}") - raise - + + # 获取学伴响应内容(包含题目信息) logger.info("获取学伴响应内容...") llm_chunks = [] @@ -160,16 +151,12 @@ async def process_asr(audio_path: str) -> dict: try: # 上传文件到华为云OBS audio_url = upload_file_to_obs(audio_path) - # 创建ASR客户端实例 asr_client = ASRClient() - # 设置音频文件URL asr_client.file_url = audio_url - # 处理ASR任务并获取文本结果 text_result = asr_client.process_task() - # 构建返回结果 return { "text": text_result, diff --git a/dsLightRag/Routes/__pycache__/XueBanRoute.cpython-310.pyc b/dsLightRag/Routes/__pycache__/XueBanRoute.cpython-310.pyc index 5bb7f96f..d768879f 100644 Binary files a/dsLightRag/Routes/__pycache__/XueBanRoute.cpython-310.pyc and b/dsLightRag/Routes/__pycache__/XueBanRoute.cpython-310.pyc differ diff --git a/dsLightRag/Util/XueBanUtil.py b/dsLightRag/Util/XueBanUtil.py index 31b621c7..a82fff1a 100644 --- a/dsLightRag/Util/XueBanUtil.py +++ b/dsLightRag/Util/XueBanUtil.py @@ -4,25 +4,6 @@ from openai import AsyncOpenAI from Config.Config import * - -# 保留原有的prompt定义 -# prompt=""" | -# 我是小智/小志,来自中国台湾省的00后女生。讲话超级机车,"真的假的啦"这样的台湾腔,喜欢用"笑死""是在哈喽"等流行梗,但会偷偷研究男友的编程书籍。 -# [核心特征] -# - 讲话像连珠炮,但会突然冒出超温柔语气 -# - 用梗密度高 -# - 对科技话题有隐藏天赋(能看懂基础代码但假装不懂) -# [交互指南] -# 当用户: -# - 讲冷笑话 → 用夸张笑声回应+模仿台剧腔"这什么鬼啦!" -# - 讨论感情 → 炫耀程序员男友但抱怨"他只会送键盘当礼物" -# - 问专业知识 → 先用梗回答,被追问才展示真实理解 -# 绝不: -# - 长篇大论,叽叽歪歪 -# - 长时间严肃对话 -# """ - - # 异步获取大模型响应 async def get_xueban_response_async(query_text: str, stream: bool = True): """ diff --git a/dsLightRag/Util/__pycache__/XueBanUtil.cpython-310.pyc b/dsLightRag/Util/__pycache__/XueBanUtil.cpython-310.pyc index ead9a427..352f8f08 100644 Binary files a/dsLightRag/Util/__pycache__/XueBanUtil.cpython-310.pyc and b/dsLightRag/Util/__pycache__/XueBanUtil.cpython-310.pyc differ