1.调整AI提示词2.将AI插件入口设置为默认
This commit is contained in:
@@ -40,11 +40,11 @@ class ChatAIAgent:
|
||||
- 注意区分不同群聊和不同用户的对话上下文
|
||||
|
||||
示例对话:
|
||||
[2025-11-20 10:00:00] [群聊#12345] [用户#67890]: 你好
|
||||
你的回复: <at user_id="67890"></at> 你好!有什么可以帮助你的吗?
|
||||
[2025-11-20 10:00:00] [群聊#12345] [用户#11111]: 你好
|
||||
你的回复: 你好!有什么可以帮助你的吗?
|
||||
|
||||
[2025-11-20 10:01:00] [群聊#12345] [用户#11111]: 今天天气怎么样?
|
||||
你的回复: <at user_id="11111"></at> 抱歉,我无法获取实时天气信息。"""
|
||||
[2025-11-20 10:01:00] [群聊#67890] [用户#22222]: 刚刚谁在说话, 说了什么?
|
||||
你的回复: 刚刚群聊12345的用户<at user_id="11111"></at>在说话, 他说了你好。"""
|
||||
|
||||
logger.Log("Info", f"{ConsoleFrontColor.GREEN}ChatAIAgent 初始化完成{ConsoleFrontColor.RESET}")
|
||||
logger.Log("Info", f"模型: {OLLAMA_MODEL}, 最大历史: {max_history}")
|
||||
@@ -166,7 +166,7 @@ class ChatAIAgent:
|
||||
{current_msg}
|
||||
|
||||
请作为AI助手回复当前用户。记住:
|
||||
1. 使用 <at user_id="{user_id}"></at> 格式来称呼该用户
|
||||
1. 使用 <at user_id="{user_id}"></at> 格式来提到任意你想提及的用户
|
||||
2. 根据对话历史和当前消息,给出有意义的回复
|
||||
3. 如果历史中有其他群聊或用户的信息,你可以引用它们"""
|
||||
|
||||
@@ -281,6 +281,7 @@ class ChatAIPlugin(WPSAPI):
|
||||
def wake_up(self) -> None:
|
||||
logger.Log("Info", f"{ConsoleFrontColor.GREEN}ChatAIPlugin AI对话插件已加载{ConsoleFrontColor.RESET}")
|
||||
self.register_plugin("ai_chat")
|
||||
self.register_plugin("default")
|
||||
|
||||
@override
|
||||
async def callback(self, message: str, chat_id: int, user_id: int) -> str|None:
|
||||
@@ -314,12 +315,7 @@ class ChatAIPlugin(WPSAPI):
|
||||
answer = await self.ai_agent.chat(message, chat_id, user_id)
|
||||
|
||||
# 格式化返回结果
|
||||
formatted_answer = f"""🤖 **AI 智能对话**
|
||||
|
||||
{answer}
|
||||
|
||||
---
|
||||
*由 LlamaIndex + Ollama 驱动*"""
|
||||
formatted_answer = answer
|
||||
|
||||
return await self.send_markdown_message(formatted_answer, chat_id, user_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user