Test prompt (#305)

* fix: 退出指令无法识别 (#302)

修复指令text包含标点的情况下,无法正确识别退出指令的问题

* 优化提示词 (#303)

* 添加 使用 coze 会话。 (#282)

历史消息在coze 上可配置历史消息的轮次。
同个会话id,coze 上自动带历史上下文。

会话和当前session关联。一次连接一个会话,断开后,重连是新会话无历史消息。

* update:去除无用代码

---------

Co-authored-by: Jad <journey.adc@gmail.com>
Co-authored-by: Jiao Haoyang <108573524+XuSenfeng@users.noreply.github.com>
Co-authored-by: xu <494462498@qq.com>
Co-authored-by: hrz <1710360675@qq.com>
This commit is contained in:
欣南科技
2025-03-13 00:54:01 +08:00
committed by GitHub
co-authored by Jad Jiao Haoyang xu hrz
parent c458a1b59a
commit a8f06f5718
6 changed files with 92 additions and 28 deletions
@@ -2,6 +2,7 @@ from config.logger import setup_logging
import json
from core.handle.sendAudioHandle import send_stt_message
from core.utils.dialogue import Message
from core.utils.util import remove_punctuation_and_length
from config.functionCallConfig import FunctionCallConfig
import asyncio
from enum import Enum
@@ -105,6 +106,7 @@ async def handle_user_intent(conn, text):
async def check_direct_exit(conn, text):
"""检查是否有明确的退出命令"""
_, text = remove_punctuation_and_length(text)
cmd_exit = conn.cmd_exit
for cmd in cmd_exit:
if text == cmd:
@@ -123,7 +125,7 @@ async def analyze_intent_with_llm(conn, text):
# 对话历史记录
dialogue = conn.dialogue
try:
intent_result = await conn.intent.detect_intent(dialogue.dialogue, text)
intent_result = await conn.intent.detect_intent(conn, dialogue.dialogue, text)
# 尝试解析JSON结果
try: