mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-26 23:51:14 +02:00
feat: map run citation to run_<uuid> payload
This commit is contained in:
parent
609adea006
commit
81f2d694bd
1 changed files with 8 additions and 4 deletions
|
|
@ -1,10 +1,11 @@
|
|||
"""Map a registered citation to the frontend ``[citation:<payload>]`` payload.
|
||||
|
||||
The citation renderer understands a chunk id (``42``), a negative chunk id for
|
||||
anonymous uploads (``-3``), and a URL. This is the seam that turns a server-side
|
||||
source into one the renderer can resolve; it grows as more source kinds become
|
||||
renderable. Kinds with no renderable form yet return ``None`` so the marker is
|
||||
dropped rather than emitted broken.
|
||||
anonymous uploads (``-3``), a URL, and a scraper-run handle (``run_<uuid>``).
|
||||
This is the seam that turns a server-side source into one the renderer can
|
||||
resolve; it grows as more source kinds become renderable. Kinds with no
|
||||
renderable form yet return ``None`` so the marker is dropped rather than
|
||||
emitted broken.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
@ -22,6 +23,9 @@ def to_frontend_payload(entry: CitationEntry) -> str | None:
|
|||
case CitationSourceType.WEB_RESULT:
|
||||
url = locator.get("url")
|
||||
return url or None
|
||||
case CitationSourceType.RUN:
|
||||
run_id = locator.get("run_id")
|
||||
return str(run_id) if run_id else None
|
||||
case _:
|
||||
# Connector items and chat turns have no client-side renderer yet
|
||||
# (the frontend resolves only chunk ids and URLs), so they stay
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue