mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-26 21:39:43 +02:00
feat(chat): add citation entry data shapes
This commit is contained in:
parent
7f09c8a290
commit
98b164c2d3
1 changed files with 31 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
"""Data shapes for the citation registry."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class CitationSourceType(str, Enum):
|
||||
"""Source kind of a citable unit; the value is the stable wire/dedup form."""
|
||||
|
||||
KB_CHUNK = "kb_chunk"
|
||||
KB_DOCUMENT = "kb_document"
|
||||
CONNECTOR_ITEM = "connector_item"
|
||||
WEB_RESULT = "web_result"
|
||||
CHAT_TURN = "chat_turn"
|
||||
ANON_CHUNK = "anon_chunk"
|
||||
|
||||
|
||||
class CitationEntry(BaseModel):
|
||||
"""A registered unit: ``n`` (the label), ``locator`` (identity), ``display`` (UI only)."""
|
||||
|
||||
n: int
|
||||
source_type: CitationSourceType
|
||||
locator: dict[str, Any]
|
||||
display: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
__all__ = ["CitationEntry", "CitationSourceType"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue