Repository navigation
feat(knowledge): 文件上传支持自定义元数据 - #6224
Open
Shinku-Chen wants to merge 2 commits into
Open
Shinku-Chen wants to merge 2 commits into
Shinku-Chen wants to merge 2 commits into
Conversation
Assisted-by: Cindy (https://cindy.app)
Assisted-by: Cindy (https://cindy.app)
This branch has not been deployed
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
文件上传支持一个可选的 multipart 表单字段
custom_metadata。当请求同时携带file、metadata和custom_metadata时,服务在创建知识记录时一起保存两类元数据,然后提交解析任务。既有上传请求可继续省略新字段。metadata继续接收字符串值的 JSON 对象。新字段复用知识编辑接口的字段数量、长度和标量值校验。非法输入返回 HTTP 400,且不创建知识记录。Swagger 和 API 文档已补充请求示例。Type of Change
Related Issue
Addresses #2090 的文件上传元数据部分。该 Issue 还包含知识库级元数据、检索过滤及文件搜索需求。
Testing
go test ./internal/handler ./internal/application/service -run 'TestCreateKnowledgeFromFile|Test.*CustomMetadata' -count=1通过,覆盖同时保存两类元数据、省略字段的兼容性,以及非法字段拦截。make docs和go test ./docs -count=1通过。go build ./...通过。golangci-lint run --new-from-rev=upstream/main ./...通过(0 issues)。go test ./internal/types/... ./internal/handler ./internal/application/service -count=1后,types 和 handler 通过,service 全包运行停在TestDeleteAllSessionsReclaimsBeforeDirectoryCleanup,诊断后停止。该用例单独在本分支和上游基线上均通过。Checklist
git diff --check upstream/main...HEADpassesgolangci-lint run --new-from-rev=origin/main ./...)website-docs/, Swagger annotations, etc.)Screenshots / Recordings
API 变更,无 UI 截图。
Assisted-by: Cindy (https://cindy.app)