feat(knowledge): add create-or-update file workflow - #2613
Open
hanxiantao wants to merge 17 commits into
Open
Conversation
Collaborator
|
是否把本PR拆开,感觉内容有些重,耦合了三个接口,是否有必然联系? |
…te-knowledge-file # Conflicts: # frontend/src/views/knowledge/KnowledgeBase.vue # frontend/src/views/knowledge/components/DocumentActionMenu.vue # frontend/src/views/knowledge/components/DocumentCardView.vue # frontend/src/views/knowledge/components/DocumentListView.vue
…file' into feat/create-or-update-knowledge-file
Contributor
Author
已拆分,可以再帮忙review下 |
…-knowledge-file # Conflicts: # internal/router/task.go
…file' into feat/create-or-update-knowledge-file
…te-knowledge-file # Conflicts: # internal/application/service/knowledge_housekeeping_test.go
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
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.
Description
This PR adds
POST /api/v1/knowledge-bases/{id}/knowledge/file/create-or-update, a unified multipart API for creating or replacing file knowledge.The endpoint:
knowledge_idor unique file name;apichannel;High-frequency updates use a durable latest-wins coordinator. Each knowledge has at most one active replacement and one pending replacement. New requests atomically replace the previous pending payload, so obsolete intermediate revisions are not parsed or indexed.
The implementation includes:
000084and SQLite migration000004, plus MySQL and SQLite bootstrap schemas;active,pending,failed, andidleupdate states in knowledge responses;This PR intentionally exposes only the create-or-update endpoint. Retry and discard recovery APIs will be submitted separately.
Breaking changes: none. Existing file-create and knowledge APIs remain unchanged.
Type of Change
Related Issue
Fixes #2615
Testing
Automated repository, service, handler, router, migration, frontend polling, i18n, type-checking, and Swagger validation passed for the changed workflow.
End-to-end verification covered:
knowledge_idwhile preserving the ID;knowledge_id;idle;action=unchangedfor identical content without increasing the version;knowledge_file_update_slotsrow.The database was inspected during the burst and confirmed that the active version remained stable while the pending slot was repeatedly replaced by the latest accepted version.
Checklist
Screenshots / Recordings
Not included. The user-visible change is limited to transient update-state indicators.