WeKnora/internal/handler/session
lyingbug 877a6ebf9d feat(api): add resource_urls=public to return directly loadable file URLs
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>
2026-08-05 14:42:51 +08:00
..
agent_stream_handler.go fix(chunks): retain questions across content edits 2026-07-28 20:23:48 +08:00
attachment_processor.go feat: add EPUB and MHTML document support 2026-06-16 11:25:27 +08:00
handler.go feat(session): gate IM/embed/API channel sessions behind admin 2026-07-20 20:31:54 +08:00
helpers.go fix(chunks): retain questions across content edits 2026-07-28 20:23:48 +08:00
helpers_test.go fix(search): harden tag scope resolution after #1907 2026-07-08 10:55:42 +08:00
image_upload.go feat(storage): add multi-instance storage backends per workspace 2026-07-15 14:54:39 +08:00
qa.go feat(api): add resource_urls=public to return directly loadable file URLs 2026-08-05 14:42:51 +08:00
resolve_agent_test.go fix: harden shared agent source selector validation 2026-07-30 12:28:23 +08:00
resource_urls.go feat(api): add resource_urls=public to return directly loadable file URLs 2026-08-05 14:42:51 +08:00
stream.go feat(api): add resource_urls=public to return directly loadable file URLs 2026-08-05 14:42:51 +08:00
temporary_attachment_persist_test.go feat(attachments): implement normalization and limits for temporary attachment IDs 2026-07-16 17:41:27 +08:00
temporary_document.go fix: harden shared agent source selector validation 2026-07-30 12:28:23 +08:00
title.go feat(session): implement strict owner scope for API-key sessions 2026-07-20 19:31:02 +08:00
types.go fix: harden shared agent source permissions 2026-07-30 12:28:23 +08:00
wiki_fixer_scope.go fix(session): scope wiki fixer to shared KB tenant 2026-05-21 11:19:19 +08:00
wiki_fixer_scope_test.go fix(session): scope wiki fixer to shared KB tenant 2026-05-21 11:19:19 +08:00