diff --git a/main/xiaozhi-server/config/assets/wakeup_words_short.wav b/main/xiaozhi-server/config/assets/wakeup_words_short.wav new file mode 100644 index 00000000..7a9fb826 Binary files /dev/null and b/main/xiaozhi-server/config/assets/wakeup_words_short.wav differ diff --git a/main/xiaozhi-server/core/handle/helloHandle.py b/main/xiaozhi-server/core/handle/helloHandle.py index 75b9fcb2..df8376b6 100644 --- a/main/xiaozhi-server/core/handle/helloHandle.py +++ b/main/xiaozhi-server/core/handle/helloHandle.py @@ -19,6 +19,10 @@ TAG = __name__ WAKEUP_CONFIG = { "refresh_time": 5, "words": ["你好", "你好啊", "嘿,你好", "嗨"], + "responses": [ + "我在", "在的呢", "在的哦", "来啦", "你说", "请讲", + "听着呢", "请说", "需要我做些什么", "请指示" + ], } # 创建全局的唤醒词配置管理器 @@ -85,9 +89,9 @@ async def checkWakeupWords(conn, text): if not response or not response.get("file_path"): response = { "voice": "default", - "file_path": "config/assets/wakeup_words.wav", + "file_path": "config/assets/wakeup_words_short.wav", "time": 0, - "text": "哈啰啊,我是小智啦,声音好听的台湾女孩一枚,超开心认识你耶,最近在忙啥,别忘了给我来点有趣的料哦,我超爱听八卦的啦", + "text": "我在这里哦!", } # 获取音频数据 @@ -110,7 +114,7 @@ async def checkWakeupWords(conn, text): async def wakeupWordsResponse(conn): - if not conn.tts or not conn.llm or not conn.llm.response_no_stream: + if not conn.tts: return try: @@ -118,16 +122,8 @@ async def wakeupWordsResponse(conn): if not await _wakeup_response_lock.acquire(): return - # 生成唤醒词回复 - wakeup_word = random.choice(WAKEUP_CONFIG["words"]) - question = ( - "此刻用户正在和你说```" - + wakeup_word - + "```。\n请你根据以上用户的内容进行20-30字回复。要符合系统设置的角色情感和态度,不要像机器人一样说话。\n" - + "请勿对这条内容本身进行任何解释和回应,请勿返回表情符号,仅返回对用户的内容的回复。" - ) - - result = conn.llm.response_no_stream(conn.config["prompt"], question) + # 从预定义回复列表中随机选择一个回复 + result = random.choice(WAKEUP_CONFIG["responses"]) if not result or len(result) == 0: return