From 47f409246db1a285543dcc06a2a9195ffb44c58c Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Thu, 8 May 2025 18:25:02 +0800 Subject: [PATCH] =?UTF-8?q?update:intent=5Fllm=E6=9A=82=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E6=96=B0=E9=97=BB=E6=8F=92=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E4=B8=AA=E7=89=88=E6=9C=AC=E6=94=B9=E9=80=A0?= =?UTF-8?q?intent=5Fllm=EF=BC=8C=E8=AE=A9=E5=AE=83=E8=83=BD=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E8=8E=B7=E5=8F=96functioncall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/config.yaml | 6 ++++-- main/xiaozhi-server/core/handle/functionHandler.py | 1 - .../core/providers/intent/intent_llm/intent_llm.py | 9 --------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/main/xiaozhi-server/config.yaml b/main/xiaozhi-server/config.yaml index cef214ac..ad794965 100644 --- a/main/xiaozhi-server/config.yaml +++ b/main/xiaozhi-server/config.yaml @@ -104,12 +104,13 @@ plugins: get_weather: { "api_key": "a861d0d5e7bf4ee1a83d9a9e4f96d4da", "default_location": "广州" } # 获取新闻插件的配置,这里根据需要的新闻类型传入对应的url链接,默认支持社会、科技、财经新闻 # 更多类型的新闻列表查看 https://www.chinanews.com.cn/rss/ - get_news: + get_news_from_chinanews: default_rss_url: "https://www.chinanews.com.cn/rss/society.xml" category_urls: society: "https://www.chinanews.com.cn/rss/society.xml" world: "https://www.chinanews.com.cn/rss/world.xml" finance: "https://www.chinanews.com.cn/rss/finance.xml" + get_news_from_newsnow: {"url": "https://newsnow.busiyi.world/api/s?id="} home_assistant: devices: - 客厅,玩具灯,switch.cuco_cn_460494544_cp1_on_p_2_1 @@ -183,7 +184,8 @@ Intent: functions: - change_role - get_weather - - get_news + # - get_news_from_chinanews + - get_news_from_newsnow # play_music是服务器自带的音乐播放,hass_play_music是通过home assistant控制的独立外部程序音乐播放 # 如果用了hass_play_music,就不要开启play_music,两者只留一个 - play_music diff --git a/main/xiaozhi-server/core/handle/functionHandler.py b/main/xiaozhi-server/core/handle/functionHandler.py index 10c2bf1a..b09a369c 100644 --- a/main/xiaozhi-server/core/handle/functionHandler.py +++ b/main/xiaozhi-server/core/handle/functionHandler.py @@ -55,7 +55,6 @@ class FunctionHandler: self.function_registry.register_function("get_time") self.function_registry.register_function("get_lunar") self.function_registry.register_function("handle_device") - self.function_registry.register_function("get_news_from_different_source") def register_config_functions(self): """注册配置中的函数,可以不同客户端使用不同的配置""" diff --git a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py index 9915be33..05d01c10 100644 --- a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py +++ b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py @@ -41,7 +41,6 @@ class IntentProvider(IntentProviderBase): '2. 结束对话意图: {"function_call": {"name": "handle_exit_intent", "arguments": {"say_goodbye": "goodbye"}}}\n' '3. 获取当天日期时间: {"function_call": {"name": "get_time"}}\n' '4. 继续聊天意图: {"function_call": {"name": "continue_chat"}}\n' - '5. 查询新闻意图: {"function_call": {"name": "get_news_from_different_source", "arguments":{"source": {"type": "string","description": "新闻源,可选项有{"thepaper": "澎湃新闻","wallstreetcn-quick": "华尔街见闻","ithome": "IT之家","zhihu": "知乎"}。可选参数,如果不提供则使用默认新闻源"},"detail": {"type": "boolean","description": "是否获取详细内容,默认为false。如果为true,则获取上一条新闻的详细内容"}}}\n' "\n" "注意:\n" '- 播放音乐:无歌名时,song_name设为"random"\n' @@ -54,14 +53,6 @@ class IntentProvider(IntentProviderBase): '返回: {"function_call": {"name": "continue_chat"}}\n' "```\n" "```\n" - "用户: 最近有什么新闻吗\n" - '返回: {"function_call": {"name": "get_news_from_different_source", "arguments": {"source":"thepaper", "detail":"False"}}}\n' - "```\n" - "```\n" - "用户: 详细说说这个新闻\n" - '返回: {"function_call": {"name": "get_news_from_different_source", "arguments": {"source":"thepaper", "detail":"True"}}}\n' - "```\n" - "```\n" "用户: 现在是几号了?现在几点了?\n" '返回: {"function_call": {"name": "get_time"}}\n' "```\n"