🤖 自动格式化代码 [skip ci]
This commit is contained in:
@@ -293,7 +293,15 @@ block_and_ignore: 更加极端的结束对话方式,直接结束对话并在
|
|||||||
reason = result.get("reason", "LLM未提供原因,默认等待")
|
reason = result.get("reason", "LLM未提供原因,默认等待")
|
||||||
|
|
||||||
# 验证action类型
|
# 验证action类型
|
||||||
valid_actions = ["direct_reply", "fetch_knowledge", "wait", "listening", "rethink_goal", "end_conversation", "block_and_ignore"]
|
valid_actions = [
|
||||||
|
"direct_reply",
|
||||||
|
"fetch_knowledge",
|
||||||
|
"wait",
|
||||||
|
"listening",
|
||||||
|
"rethink_goal",
|
||||||
|
"end_conversation",
|
||||||
|
"block_and_ignore",
|
||||||
|
]
|
||||||
if action not in valid_actions:
|
if action not in valid_actions:
|
||||||
logger.warning(f"LLM返回了未知的行动类型: '{action}',强制改为 wait")
|
logger.warning(f"LLM返回了未知的行动类型: '{action}',强制改为 wait")
|
||||||
reason = f"(原始行动'{action}'无效,已强制改为wait) {reason}"
|
reason = f"(原始行动'{action}'无效,已强制改为wait) {reason}"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import time
|
import time
|
||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
# from .message_storage import MongoDBMessageStorage
|
# from .message_storage import MongoDBMessageStorage
|
||||||
from src.plugins.utils.chat_message_builder import build_readable_messages, get_raw_msg_before_timestamp_with_chat
|
from src.plugins.utils.chat_message_builder import build_readable_messages, get_raw_msg_before_timestamp_with_chat
|
||||||
|
|
||||||
# from ...config.config import global_config
|
# from ...config.config import global_config
|
||||||
from typing import Dict, Any, Optional
|
from typing import Dict, Any, Optional
|
||||||
from ..chat.message import Message
|
from ..chat.message import Message
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ class PFCManager:
|
|||||||
return self._instances[stream_id]
|
return self._instances[stream_id]
|
||||||
if stream_id in self._instances:
|
if stream_id in self._instances:
|
||||||
instance = self._instances[stream_id]
|
instance = self._instances[stream_id]
|
||||||
if hasattr(instance, 'ignore_until_timestamp') and \
|
if (
|
||||||
instance.ignore_until_timestamp and \
|
hasattr(instance, "ignore_until_timestamp")
|
||||||
time.time() < instance.ignore_until_timestamp:
|
and instance.ignore_until_timestamp
|
||||||
|
and time.time() < instance.ignore_until_timestamp
|
||||||
|
):
|
||||||
logger.debug(f"会话实例当前处于忽略状态: {stream_id}")
|
logger.debug(f"会话实例当前处于忽略状态: {stream_id}")
|
||||||
# 返回 None 阻止交互。或者可以返回实例但标记它被忽略了喵?
|
# 返回 None 阻止交互。或者可以返回实例但标记它被忽略了喵?
|
||||||
# 还是返回 None 吧喵。
|
# 还是返回 None 吧喵。
|
||||||
|
|||||||
Reference in New Issue
Block a user