Files
agent_alpha/backend/schemas/sync_source.py
T
furyhawk bb4b614711 feat: Implement RAG document and sync services with vector store integration
- Added `vectorstore.py` for managing vector storage operations using Milvus.
- Introduced `rag_document.py` for handling RAG document lifecycle, including ingestion and status updates.
- Created `rag_status.py` for streaming RAG ingestion status via Redis pub/sub.
- Developed `rag_sync.py` for managing synchronization operations and logs.
- Implemented `sync_source.py` for managing sync source configurations and triggering syncs.
- Established a lightweight task dispatcher in `dispatcher.py` for background task execution.
- Registered task functions for RAG ingestion and sync operations in `rag_tasks.py`.
- Configured task dispatcher settings in `arq_settings.py`.
- Added necessary database models and schemas for RAG document and sync operations.
2026-06-13 21:52:27 +08:00

78 lines
2.2 KiB
Python

"""Sync source API schemas."""
from __future__ import annotations
from typing import Any
from pydantic import BaseModel, Field
class ConnectorConfigField(BaseModel):
"""Schema for a single connector configuration field."""
type: str = "string"
description: str = ""
required: bool = False
default: Any = None
class ConnectorInfo(BaseModel):
"""Information about an available connector."""
type: str
name: str
config_schema: dict[str, ConnectorConfigField]
enabled: bool = True
class ConnectorList(BaseModel):
"""List of available connectors."""
items: list[ConnectorInfo]
class SyncSourceCreate(BaseModel):
"""Request to create a sync source."""
name: str = Field(..., description="Human-readable name")
connector_type: str = Field(..., description="Connector type identifier")
collection_name: str = Field("documents", description="Target RAG collection")
config: dict[str, Any] = Field(default_factory=dict)
sync_mode: str = Field("full", description="Sync mode: full, new_only, update_only")
schedule_minutes: int | None = Field(None, description="Auto-sync interval in minutes")
class SyncSourceUpdate(BaseModel):
"""Request to update a sync source."""
name: str | None = Field(None, description="Human-readable name")
collection_name: str | None = Field(None, description="Target RAG collection")
config: dict[str, Any] | None = Field(None)
sync_mode: str | None = Field(None, description="Sync mode")
schedule_minutes: int | None = Field(None, description="Auto-sync interval")
is_active: bool | None = Field(None, description="Whether the source is active")
class SyncSourceRead(BaseModel):
"""Sync source read model returned by the API."""
id: str
name: str
connector_type: str
collection_name: str
config: dict[str, Any] = Field(default_factory=dict)
sync_mode: str = "full"
schedule_minutes: int | None = None
is_active: bool = True
last_sync_at: str | None = None
last_sync_status: str | None = None
last_error: str | None = None
created_at: str | None = None
class SyncSourceList(BaseModel):
"""List of sync sources."""
items: list[SyncSourceRead]
total: int