From 0db580fde4955a1e6aa1730b4f9af2b7c6483a0b Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 21 Sep 2025 20:49:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E8=AF=8D=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E5=B9=B6=E4=BC=98=E5=8C=96=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=20UI=20=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes: #2782 --- astrbot/core/db/sqlite.py | 18 +- .../locales/zh-CN/features/conversation.json | 6 +- .../zh-CN/features/session-management.json | 14 +- dashboard/src/views/ConversationPage.vue | 159 +-- dashboard/src/views/SessionManagementPage.vue | 1016 ++++++----------- 5 files changed, 455 insertions(+), 758 deletions(-) diff --git a/astrbot/core/db/sqlite.py b/astrbot/core/db/sqlite.py index 418b35761..5b3d1da79 100644 --- a/astrbot/core/db/sqlite.py +++ b/astrbot/core/db/sqlite.py @@ -18,6 +18,7 @@ from sqlalchemy import select, update, delete, text from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.sql import func +from sqlalchemy import or_ NOT_GIVEN = T.TypeVar("NOT_GIVEN") @@ -153,12 +154,26 @@ async def get_filtered_conversations( ConversationV2.platform_id.in_(platform_ids) ) if search_query: + search_query = search_query.encode("unicode_escape").decode("utf-8") base_query = base_query.where( - ConversationV2.title.ilike(f"%{search_query}%") + or_( + ConversationV2.title.ilike(f"%{search_query}%"), + ConversationV2.content.ilike(f"%{search_query}%") + ) + ) + if "message_types" in kwargs and len(kwargs["message_types"]) > 0: + for msg_type in kwargs["message_types"]: + base_query = base_query.where( + ConversationV2.user_id.ilike(f"%:{msg_type}:%") + ) + if "platforms" in kwargs and len(kwargs["platforms"]) > 0: + base_query = base_query.where( + ConversationV2.platform_id.in_(kwargs["platforms"]) ) # Get total count matching the filters count_query = select(func.count()).select_from(base_query.subquery()) + print(count_query) total_count = await session.execute(count_query) total = total_count.scalar_one() @@ -169,6 +184,7 @@ async def get_filtered_conversations( .offset(offset) .limit(page_size) ) + print(result_query) result = await session.execute(result_query) conversations = result.scalars().all() diff --git a/dashboard/src/i18n/locales/zh-CN/features/conversation.json b/dashboard/src/i18n/locales/zh-CN/features/conversation.json index 1b8039fbc..17c2e1245 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/conversation.json +++ b/dashboard/src/i18n/locales/zh-CN/features/conversation.json @@ -3,7 +3,7 @@ "subtitle": "管理和查看用户对话历史记录", "filters": { "title": "筛选条件", - "platform": "平台", + "platform": "消息平台 ID", "type": "类型", "search": "搜索关键词", "reset": "重置" @@ -15,9 +15,9 @@ "table": { "headers": { "title": "对话标题", - "platform": "平台", + "platform": "消息平台 ID", "type": "类型", - "sessionId": "ID", + "sessionId": "ID (UMO)", "createdAt": "创建时间", "updatedAt": "更新时间", "actions": "操作" diff --git a/dashboard/src/i18n/locales/zh-CN/features/session-management.json b/dashboard/src/i18n/locales/zh-CN/features/session-management.json index 4639117f4..c3364c5b0 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/session-management.json +++ b/dashboard/src/i18n/locales/zh-CN/features/session-management.json @@ -5,7 +5,7 @@ "refresh": "刷新", "edit": "编辑", "apply": "应用批量设置", - "editName": "编辑会话名称", + "editName": "备注", "save": "保存", "cancel": "取消" }, @@ -22,13 +22,13 @@ "table": { "headers": { "sessionStatus": "会话状态", - "sessionInfo": "会话信息", + "sessionInfo": "ID (UMO)", "persona": "人格", - "chatProvider": "Chat Provider", - "sttProvider": "STT Provider", - "ttsProvider": "TTS Provider", - "llmStatus": "LLM启停", - "ttsStatus": "TTS启停", + "chatProvider": "聊天模型", + "sttProvider": "语音识别模型", + "ttsProvider": "语音合成模型", + "llmStatus": "启用 LLM", + "ttsStatus": "启用 TTS", "pluginManagement": "插件管理" } }, diff --git a/dashboard/src/views/ConversationPage.vue b/dashboard/src/views/ConversationPage.vue index 3f35d91d2..9d93bb279 100644 --- a/dashboard/src/views/ConversationPage.vue +++ b/dashboard/src/views/ConversationPage.vue @@ -1,50 +1,29 @@