fix(ragflow): accept numeric update_time from RAGFlow /documents - #114
Closed
Ruidooww wants to merge 1 commit into
Closed
fix(ragflow): accept numeric update_time from RAGFlow /documents#114Ruidooww wants to merge 1 commit into
Ruidooww wants to merge 1 commit into
Conversation
RAGFlow returns update_time as a unix timestamp number (some deployments in seconds, some in ms). The zod schema in listDocs response only allowed z.string(), so parsing failed for every doc, KB sync recorded 0/0/0 and D1 knowledge view fell back to the hard-coded rows. Widen the schema to z.union([string, number]) for updatedAt / updated_at / update_time, and normalize numeric timestamps to ISO strings in the mapper (auto-detecting seconds vs ms via 1e12 threshold) so downstream code that expects RagflowDocument.updatedAt: string keeps working unchanged. Regression test in ragflow.real.spec.ts covers both s and ms inputs.
Owner
Author
|
Closing as superseded by #115, which merged the demo polish work and includes the broader RAGFlow date parsing, pagination, and chunk_count handling. This PR is now dirty against main and should not be merged separately. |
Owner
Author
|
Superseded by #115 — same |
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.
Summary
updatedAt/updated_at/update_timeinRagflowClientImpl.listDocsto accept bothstringandnumber— the running RAGFlow instance returnsupdate_timeas a unix timestamp (seconds or ms), which previously failed validation for every doc.RagflowDocument.updatedAtstays typed asstringand no downstream consumer changes.ragflow.real.spec.tscovering both seconds and milliseconds inputs.Why
On the demo branch (#113) the D1 knowledge view was silently rendering the 3-row
KNOWLEDGE_FALLBACK_ROWSbecauseKbSyncService.runOncerecordedadded:0 / status:failedfor every run — the RAGFlow/datasets/:id/documentspayload was rejected by zod. Fix unblocks D1 real 204-doc data for the sprint demo.Test plan
pnpm --filter api exec vitest run test/ragflow.real.spec.ts test/kb-sync.service.spec.ts— 19 passed (existing 18 + new regression case)POST /api/internal/admin/kb-sync/runreturnsstatus:successandkb_documentspopulates to ~204 rows🤖 Generated with Claude Code