-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: 修复对话管理页面的关键词搜索功能失效的问题并优化一些 UI 样式 #2837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
大家好 - 我已经审阅了你的更改 - 这里有一些反馈:
- 在合并之前,请从 sqlite.py 中删除调试打印语句 (
print(count_query)和print(result_query))。 - 此 PR 将搜索修复逻辑与广泛的 UI 变体/样式重构混合在一起——考虑将 UI 更改拆分到单独的 PR 中,以便可以单独审查关键字搜索修复。
- 仔细检查
get_filtered_conversations中的message_types过滤器,因为它目前使用ConversationV2.user_id.ilike,这可能无法正确地定位消息类型数据。
供 AI 代理参考的提示
请处理此代码审查中的注释:
## 总体评论
- 在合并之前,请从 sqlite.py 中删除调试打印语句 (`print(count_query)` 和 `print(result_query)`)。
- 此 PR 将搜索修复逻辑与广泛的 UI 变体/样式重构混合在一起——考虑将 UI 更改拆分到单独的 PR 中,以便可以单独审查关键字搜索修复。
- 仔细检查 `get_filtered_conversations` 中的 `message_types` 过滤器,因为它目前使用 `ConversationV2.user_id.ilike`,这可能无法正确地定位消息类型数据。
## 单独评论
### 评论 1
<location> `dashboard/src/views/SessionManagementPage.vue:806-808` </location>
<code_context>
-}
-.v-data-table >>> .v-data-table__td {
+.v-data-table>>>.v-data-table__td {
padding: 8px 16px !important;
vertical-align: middle !important;
}
</code_context>
<issue_to_address>
**issue (bug_risk):** 深度选择器从 '>>>' 更改为 '>>>',这可能是一个拼写错误。
'>>>' 不是标准的 CSS 组合器。如果你想使用 Vue 深度选择器,请使用 '::v-deep' 或 '/deep/'。请确认这在你的构建设置中有效。
</issue_to_address>
### 评论 2
<location> `astrbot/core/db/sqlite.py:164-158` </location>
<code_context>
+ 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}:%")
+ )
</code_context>
<issue_to_address>
**issue:** 消息类型过滤使用 user_id ilike 和消息类型子字符串。
使用 user_id 上的 ilike 进行消息类型过滤不可靠,可能会产生不正确的匹配。最好在有专用 message_type 字段时通过该字段进行过滤。
</issue_to_address>
### 评论 3
<location> `astrbot/core/db/sqlite.py:176-177` </location>
<code_context>
# 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()
</code_context>
<issue_to_address>
**issue:** 调试打印语句留在生产代码中。
请在合并之前删除打印语句或使用适当的日志记录。
</issue_to_address>帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用反馈来改进您的评论。
Original comment in English
Hey there - I've reviewed your changes - here's some feedback:
- Please remove the debugging print statements (
print(count_query)andprint(result_query)) from sqlite.py before merging. - This PR mixes the search-fix logic with extensive UI variant/style refactors—consider splitting the UI changes into a separate PR so the keyword search fix can be reviewed in isolation.
- Double-check the
message_typesfilter in get_filtered_conversations, as it currently usesConversationV2.user_id.ilikewhich may not correctly target message type data.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Please remove the debugging print statements (`print(count_query)` and `print(result_query)`) from sqlite.py before merging.
- This PR mixes the search-fix logic with extensive UI variant/style refactors—consider splitting the UI changes into a separate PR so the keyword search fix can be reviewed in isolation.
- Double-check the `message_types` filter in get_filtered_conversations, as it currently uses `ConversationV2.user_id.ilike` which may not correctly target message type data.
## Individual Comments
### Comment 1
<location> `dashboard/src/views/SessionManagementPage.vue:806-808` </location>
<code_context>
-}
-.v-data-table >>> .v-data-table__td {
+.v-data-table>>>.v-data-table__td {
padding: 8px 16px !important;
vertical-align: middle !important;
}
</code_context>
<issue_to_address>
**issue (bug_risk):** Deep selector changed from '>>>' to '>>>', which may be a typo.
'>>>' is not a standard CSS combinator. If you meant to use a Vue deep selector, use '::v-deep' or '/deep/' instead. Please confirm this works in your build setup.
</issue_to_address>
### Comment 2
<location> `astrbot/core/db/sqlite.py:164-158` </location>
<code_context>
+ 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}:%")
+ )
</code_context>
<issue_to_address>
**issue:** Message type filtering uses user_id ilike with message type substring.
Using ilike on user_id for message type filtering is unreliable and may produce incorrect matches. It's better to filter by a dedicated message_type field if available.
</issue_to_address>
### Comment 3
<location> `astrbot/core/db/sqlite.py:176-177` </location>
<code_context>
# 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()
</code_context>
<issue_to_address>
**issue:** Debug print statements left in production code.
Please remove the print statement or use appropriate logging before merging.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes: #2782
Motivation / 动机
修复 278
Modifications / 改动点
修改了 sqlite.py,导致 2782 问题的原因和 89d3fd5 类似。
Verification Steps / 验证步骤
参考 2782
Screenshots or Test Results / 运行截图或测试结果
Compatibility & Breaking Changes / 兼容性与破坏性变更
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Sourcery 摘要
修复对话管理中损坏的关键词搜索,方法是扩展 SQL 过滤器以覆盖内容并处理 Unicode;并在会话管理和对话页面上应用广泛的 UI 样式改进,以简化布局、更新表单控件变体并提高密度和一致性。
Bug 修复:
功能增强:
Original summary in English
Summary by Sourcery
Fix broken keyword search in conversation management by extending the SQL filter to cover content and handle unicode, and apply wide UI style refinements across the Session Management and Conversation pages to simplify layouts, update form control variants, and improve density and consistency.
Bug Fixes:
Enhancements: