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] 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 @@