mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-08-30 16:53:21 +08:00
877a6ebf9d
API responses reference stored files as opaque resource:// handles, so an integrating app had to make a second authenticated call to /files for every image before it could render anything. Add an opt-in that resolves those references server-side into time-limited HTTP(S) URLs, using the same mechanism the IM channels already rely on: - per request: ?resource_urls=public (default: handle, unchanged) - per deployment: RESOURCE_URL_MODE=public Applied to the chat SSE endpoints (knowledge-chat, agent-chat, continue-stream), message history load, and knowledge-search. Streamed answers buffer a trailing incomplete reference so a handle split across two deltas is still rewritten. References that cannot become an HTTP URL (for example local storage with no APP_EXTERNAL_URL) stay handles, so clients keep the /files fallback. Embed channels are deliberately excluded: their visitors are anonymous. SSE payloads share SearchResult pointers and metadata maps with the stream replay buffer and the message being persisted, so those are rewritten as copies. Co-authored-by: lyingbug <lyingbug@users.noreply.github.com>