fix(go-document): keep upload partial success data as array (#16661)

### Summary

Keep `data` as the uploaded document array when dataset document upload
partially succeeds.

This matches the Python API behavior and allows parse-on-creation to run
for successfully uploaded files when other files in the same folder are
unsupported.
This commit is contained in:
Hz_
2026-07-06 19:15:29 +08:00
committed by GitHub
parent 7e0ccee7e2
commit 8ee3f097b9
2 changed files with 9 additions and 9 deletions

View File

@@ -912,7 +912,7 @@ func (h *DocumentHandler) uploadLocalDocuments(c *gin.Context, kb *entity.Knowle
if strings.ToLower(c.DefaultQuery("return_raw_files", "false")) == "true" {
if len(errMsgs) > 0 {
common.SuccessNoMessage(c, gin.H{"documents": data, "errors": errMsgs})
common.ResponseWithCodeData(c, common.CodeServerError, data, strings.Join(errMsgs, "\n"))
return
}
common.SuccessNoMessage(c, data)
@@ -923,7 +923,7 @@ func (h *DocumentHandler) uploadLocalDocuments(c *gin.Context, kb *entity.Knowle
mapped[i] = mapDocKeysWithRunStatus(d)
}
if len(errMsgs) > 0 {
common.SuccessNoMessage(c, gin.H{"documents": mapped, "errors": errMsgs})
common.ResponseWithCodeData(c, common.CodeServerError, mapped, strings.Join(errMsgs, "\n"))
return
}
common.SuccessNoMessage(c, mapped)