-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: implement knowledge update functionality for bots #547
base: main
Are you sure you want to change the base?
Conversation
- Added a new hook `useKnowledgeUpdate` to manage knowledge updates. - Integrated knowledge update feature in `BotCard` component with loading state. - Created `updateKnowledge` API in `BotsController` to handle knowledge updates. - Updated FastAPI router to include endpoint for knowledge updates, validating bot existence. - Refactored retrieval logic to check and update knowledge based on document changes.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis PR introduces a knowledge update functionality for bots. It includes a new hook Changes
|
class UpdateKnowledgeRequest(BaseModel): | ||
bot_id: str | ||
|
||
@router.post("/rag/update_knowledge", dependencies=[Depends(verify_rate_limit)]) |
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.
Consider adding authentication checks to ensure that only authorized users can update the knowledge of a bot. This will prevent unauthorized access and potential misuse of the update functionality.
existing_docs = ( | ||
client.table(TABLE_NAME) | ||
.select("id, file_sha") | ||
.eq("repo_name", config.repo_name) | ||
.eq("file_path", config.file_path) | ||
.execute() | ||
) |
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.
我本地跑这里总超时, 不知道为啥, 还没能解决
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.
'canceling statement due to statement timeout'
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.
see this issue #531
export function useKnowledgeUpdate() { | ||
return useMutation({ | ||
mutationKey: ['updateKnowledge'], | ||
mutationFn: updateKnowledge |
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.
在完成更新后,可以将 useGetBotRagTask
client 重刷一遍,更新下 taskInfo,这样可以让 BotCard 组件下的 任务状态 ICON 转起来
useKnowledgeUpdate
to manage knowledge updates.BotCard
component with loading state.updateKnowledge
API inBotsController
to handle knowledge updates.close #547