Commit Graph

1 Commits

Author SHA1 Message Date
hongjr03 33de8901e7 fix(hub): docmind client uses stream upload + correct API response parsing
Two fixes discovered by real end-to-end smoke test against Aliyun docmind:

1. fileUrlObject must be a ReadStream, not a Buffer. The SDK serializes
   Buffers as JSON {type:'Buffer',data:[...]} which the API can't read;
   a Stream is uploaded as multipart form data. Switched readFile → createReadStream.

2. QueryDocParserStatus returns data.status (not top-level completed/status).
   The markdown output URL is in data.outputFormatResult[].outputFileUrl,
   not in a separate GetDocParserResult call. Rewrote polling to check
   data.status === 'success', then download markdown from the OSS URL.

Also added image download: markdown contains ![alt](oss-url) references;
the client now downloads those images and rewrites paths to local filenames.

Smoke test verified: prime_sieve.pdf → 15s → markdown with image refs downloaded.

AliyunDocmindClient is now production-ready given an AccessKey.
2026-07-18 17:25:03 +08:00