-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix/#8426 知识库文档列表加载不全 #8455
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
Open
M1LKT
wants to merge
2
commits into
AstrBotDevs:master
Choose a base branch
from
M1LKT:fix/#8426
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+22
−3
Open
Fix/#8426 知识库文档列表加载不全 #8455
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
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.
问题分析\n1. 当文档上传完成时,系统会先调用
loadDocuments()(第 602 行),然后调用emit('refresh')(第 603 行)。\n2. 在调用loadDocuments()的瞬间,props.kb?.doc_count还没有被更新,依然是旧的文档数量(例如100)。\n3. 由于100是真值(truthy),page_size会被设置为100。此时后端只会返回前 100 条文档,导致新上传的文档被截断。\n4. 虽然随后调用了emit('refresh')来更新父组件的状态,但由于DocumentsTab.vue中没有对props.kb的watch监听器,loadDocuments()不会再次触发。因此,新上传的文档在列表里将无法显示,直到用户手动刷新页面或重新挂载组件。\n\n### 解决方案\n为了确保在props.kb?.doc_count临时不同步的情况下,依然能请求到足够大的page_size以包含新上传的文档,建议使用Math.max(props.kb?.doc_count || 0, 10000)。这样可以保证最小请求大小为10000,同时在文档总数超过10000时也能自动向上扩展。