mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
Issues Fixed - Missing pagination fields in API response schemas (page, page_size, has_more) - NOTE enum missing from frontend Zod schema - Missing fields in DocumentRead response construction (content_hash, updated_at) - BlockNote slash menu clipped by overflow-hidden CSS - Sidebar click conflicts - hidden action buttons intercepting clicks - Rewrote All Notes sidebar - replaced fragile custom portal with shadcn Sheet - Missing translation keys for new UI strings - Missing NOTE retrieval logic in researcher agent - Added search to All Notes sidebar - Removed frontend logging - was causing toasters on every page refresh - Added backend logging to document reindex Celery task
69 lines
1.5 KiB
Python
69 lines
1.5 KiB
Python
from datetime import datetime
|
|
from typing import TypeVar
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.db import DocumentType
|
|
|
|
from .chunks import ChunkRead
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class ExtensionDocumentMetadata(BaseModel):
|
|
BrowsingSessionId: str
|
|
VisitedWebPageURL: str
|
|
VisitedWebPageTitle: str
|
|
VisitedWebPageDateWithTimeInISOString: str
|
|
VisitedWebPageReffererURL: str
|
|
VisitedWebPageVisitDurationInMilliseconds: str
|
|
|
|
|
|
class ExtensionDocumentContent(BaseModel):
|
|
metadata: ExtensionDocumentMetadata
|
|
pageContent: str # noqa: N815
|
|
|
|
|
|
class DocumentBase(BaseModel):
|
|
document_type: DocumentType
|
|
content: (
|
|
list[ExtensionDocumentContent] | list[str] | str
|
|
) # Updated to allow string content
|
|
search_space_id: int
|
|
|
|
|
|
class DocumentsCreate(DocumentBase):
|
|
pass
|
|
|
|
|
|
class DocumentUpdate(DocumentBase):
|
|
pass
|
|
|
|
|
|
class DocumentRead(BaseModel):
|
|
id: int
|
|
title: str
|
|
document_type: DocumentType
|
|
document_metadata: dict
|
|
content: str # Changed to string to match frontend
|
|
content_hash: str
|
|
unique_identifier_hash: str | None
|
|
created_at: datetime
|
|
updated_at: datetime | None
|
|
search_space_id: int
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class DocumentWithChunksRead(DocumentRead):
|
|
chunks: list[ChunkRead] = []
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class PaginatedResponse[T](BaseModel):
|
|
items: list[T]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
has_more: bool
|