From 9f39140987504665f58e7d1078213acbdef73231 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 23 Nov 2025 19:59:21 +0800 Subject: [PATCH 1/2] fix(conversation): update session configuration retrieval to use unified message origin --- packages/astrbot/commands/conversation.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/astrbot/commands/conversation.py b/packages/astrbot/commands/conversation.py index 9538d8f53..67402c660 100644 --- a/packages/astrbot/commands/conversation.py +++ b/packages/astrbot/commands/conversation.py @@ -38,9 +38,8 @@ class ConversationCommands: async def reset(self, message: AstrMessageEvent): """重置 LLM 会话""" - is_unique_session = self.context.get_config()["platform_settings"][ - "unique_session" - ] + cfg = self.context.get_config(umo=message.unified_msg_origin) + is_unique_session = cfg["platform_settings"]["unique_session"] is_group = bool(message.get_group_id()) scene = RstScene.get_scene(is_group, is_unique_session) @@ -227,9 +226,8 @@ class ConversationCommands: else: ret += "\n当前对话: 无" - unique_session = self.context.get_config()["platform_settings"][ - "unique_session" - ] + cfg = self.context.get_config(umo=message.unified_msg_origin) + unique_session = cfg["platform_settings"]["unique_session"] if unique_session: ret += "\n会话隔离粒度: 个人" else: @@ -399,9 +397,8 @@ class ConversationCommands: async def del_conv(self, message: AstrMessageEvent): """删除当前对话""" - is_unique_session = self.context.get_config()["platform_settings"][ - "unique_session" - ] + cfg = self.context.get_config(umo=message.unified_msg_origin) + is_unique_session = cfg["platform_settings"]["unique_session"] if message.get_group_id() and not is_unique_session and message.role != "admin": # 群聊,没开独立会话,发送人不是管理员 message.set_result( From 95e9da42d6adac01260bfcfb13d44f5baacc4d2f Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Sun, 23 Nov 2025 22:03:07 +0800 Subject: [PATCH 2/2] fix(webchat): webchat session cannot be deleted (#3759) --- astrbot/core/db/po.py | 2 +- astrbot/core/db/sqlite.py | 4 ++-- .../src/components/chat/ConversationSidebar.vue | 13 ++++++++++--- dashboard/src/i18n/locales/en-US/features/chat.json | 3 ++- dashboard/src/i18n/locales/zh-CN/features/chat.json | 3 ++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/astrbot/core/db/po.py b/astrbot/core/db/po.py index d6621d072..3d9947413 100644 --- a/astrbot/core/db/po.py +++ b/astrbot/core/db/po.py @@ -173,7 +173,7 @@ class PlatformSession(SQLModel, table=True): max_length=100, nullable=False, unique=True, - default_factory=lambda: f"webchat_{uuid.uuid4()}", + default_factory=lambda: str(uuid.uuid4()), ) platform_id: str = Field(default="webchat", nullable=False) """Platform identifier (e.g., 'webchat', 'qq', 'discord')""" diff --git a/astrbot/core/db/sqlite.py b/astrbot/core/db/sqlite.py index 194618612..276f5821f 100644 --- a/astrbot/core/db/sqlite.py +++ b/astrbot/core/db/sqlite.py @@ -794,7 +794,7 @@ class SQLiteDatabase(BaseDatabase): await session.execute( update(PlatformSession) - .where(col(PlatformSession.session_id == session_id)) + .where(col(PlatformSession.session_id) == session_id) .values(**values), ) @@ -805,6 +805,6 @@ class SQLiteDatabase(BaseDatabase): async with session.begin(): await session.execute( delete(PlatformSession).where( - col(PlatformSession.session_id == session_id), + col(PlatformSession.session_id) == session_id, ), ) diff --git a/dashboard/src/components/chat/ConversationSidebar.vue b/dashboard/src/components/chat/ConversationSidebar.vue index 5abc1bed8..062588854 100644 --- a/dashboard/src/components/chat/ConversationSidebar.vue +++ b/dashboard/src/components/chat/ConversationSidebar.vue @@ -64,7 +64,7 @@ @click.stop="$emit('editTitle', item.session_id, item.display_name)" /> + @click.stop="handleDeleteConversation(item)" /> @@ -85,7 +85,7 @@