fix: f-string expression part cannot include a backslash

long_term_memory.py, line 69
This commit is contained in:
Soulter
2025-01-27 21:01:50 +08:00
parent 4275cea82b
commit 3f8c68bbca
3 changed files with 9 additions and 6 deletions
+4 -4
View File
@@ -63,10 +63,10 @@ class LongTermMemory:
async def on_req_llm(self, event: AstrMessageEvent, req: ProviderRequest):
if event.unified_msg_origin not in self.session_chats:
return
req.system_prompt += f"""You are now in a chatroom. The chat history is as follows.:
{'\n---\n'.join(self.session_chats[event.unified_msg_origin])}
"""
chats_str = '\n---\n'.join(self.session_chats[event.unified_msg_origin])
req.system_prompt += "You are now in a chatroom. The chat history is as follows: \n"
req.system_prompt += chats_str
if self.image_caption:
req.system_prompt += (
"The images sent by the members are displayed in text form above."
+5 -1
View File
@@ -11,6 +11,7 @@ from astrbot.core.utils.io import download_dashboard, get_dashboard_version
from astrbot.core.config.default import VERSION
from collections import defaultdict
from .long_term_memory import LongTermMemory
from astrbot.core import logger
from typing import Union
@@ -25,7 +26,10 @@ class Main(star.Star):
self.ltm = None
if self.context.get_config()['provider_ltm_settings']['group_icl_enable']:
self.ltm = LongTermMemory(self.context.get_config()['provider_ltm_settings'], self.context)
try:
self.ltm = LongTermMemory(self.context.get_config()['provider_ltm_settings'], self.context)
except BaseException as e:
logger.error(f"聊天增强 err: {e}")
async def _query_astrbot_notice(self):
try:
-1
View File
@@ -1,5 +1,4 @@
pydantic~=2.10.3
vchat
aiohttp
openai
qq-botpy