6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
74 lines
1.7 KiB
Python
74 lines
1.7 KiB
Python
"""Data shapes for resolved ``@``-references.
|
|
|
|
One type per kind so each carries exactly the fields it needs: documents and
|
|
folders have a path, connectors have a provider, chats have neither. ``kind`` is
|
|
a class-level discriminator used by the renderer and scope builder.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from enum import StrEnum
|
|
from typing import ClassVar
|
|
|
|
|
|
class ReferenceKind(StrEnum):
|
|
"""What the user pointed at; the value is the label shown to the model."""
|
|
|
|
DOCUMENT = "document"
|
|
FOLDER = "folder"
|
|
CONNECTOR = "connector"
|
|
CHAT = "chat"
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class _Reference:
|
|
"""Identity shared by every reference kind."""
|
|
|
|
entity_id: int
|
|
label: str
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class DocumentReference(_Reference):
|
|
"""A referenced document, reachable by its virtual path."""
|
|
|
|
path: str
|
|
kind: ClassVar[ReferenceKind] = ReferenceKind.DOCUMENT
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class FolderReference(_Reference):
|
|
"""A referenced folder, reachable by its virtual path."""
|
|
|
|
path: str
|
|
kind: ClassVar[ReferenceKind] = ReferenceKind.FOLDER
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ConnectorReference(_Reference):
|
|
"""A referenced connector account; ``provider`` is its type label."""
|
|
|
|
provider: str | None = None
|
|
kind: ClassVar[ReferenceKind] = ReferenceKind.CONNECTOR
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ChatReference(_Reference):
|
|
"""A referenced chat thread; its turns are read on demand, not here."""
|
|
|
|
kind: ClassVar[ReferenceKind] = ReferenceKind.CHAT
|
|
|
|
|
|
Reference = DocumentReference | FolderReference | ConnectorReference | ChatReference
|
|
|
|
|
|
__all__ = [
|
|
"ChatReference",
|
|
"ConnectorReference",
|
|
"DocumentReference",
|
|
"FolderReference",
|
|
"Reference",
|
|
"ReferenceKind",
|
|
]
|