mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
- Introduced slow callback logging in FastAPI to identify blocking calls. - Added performance logging for agent creation and tool loading processes. - Implemented caching for MCP tools to reduce redundant server calls. - Enhanced sandbox management with in-process caching for improved efficiency. - Refactored several functions for better readability and performance tracking. - Updated tests to ensure proper functionality of new features and optimizations.
26 lines
835 B
Python
26 lines
835 B
Python
from pydantic import BaseModel, Field, field_validator
|
|
|
|
from app.db import DocumentType
|
|
|
|
|
|
class ConnectorDocument(BaseModel):
|
|
"""Canonical data transfer object produced by connector adapters and consumed by the indexing pipeline."""
|
|
|
|
title: str
|
|
source_markdown: str
|
|
unique_id: str
|
|
document_type: DocumentType
|
|
search_space_id: int = Field(gt=0)
|
|
should_summarize: bool = True
|
|
should_use_code_chunker: bool = False
|
|
fallback_summary: str | None = None
|
|
metadata: dict = {}
|
|
connector_id: int | None = None
|
|
created_by_id: str
|
|
|
|
@field_validator("title", "source_markdown", "unique_id", "created_by_id")
|
|
@classmethod
|
|
def not_empty(cls, v: str, info) -> str:
|
|
if not v.strip():
|
|
raise ValueError(f"{info.field_name} must not be empty or whitespace")
|
|
return v
|