Add project registration proposal preview
This commit is contained in:
@@ -34,6 +34,7 @@ from atocore.memory.service import (
|
||||
)
|
||||
from atocore.observability.logger import get_logger
|
||||
from atocore.projects.registry import (
|
||||
build_project_registration_proposal,
|
||||
get_project_registry_template,
|
||||
list_registered_projects,
|
||||
refresh_registered_project,
|
||||
@@ -68,6 +69,13 @@ class ProjectRefreshResponse(BaseModel):
|
||||
roots: list[dict]
|
||||
|
||||
|
||||
class ProjectRegistrationProposalRequest(BaseModel):
|
||||
project_id: str
|
||||
aliases: list[str] = []
|
||||
description: str = ""
|
||||
ingest_roots: list[dict]
|
||||
|
||||
|
||||
class QueryRequest(BaseModel):
|
||||
prompt: str
|
||||
top_k: int = 10
|
||||
@@ -180,6 +188,20 @@ def api_projects_template() -> dict:
|
||||
}
|
||||
|
||||
|
||||
@router.post("/projects/proposal")
|
||||
def api_project_registration_proposal(req: ProjectRegistrationProposalRequest) -> dict:
|
||||
"""Return a normalized project registration proposal without writing it."""
|
||||
try:
|
||||
return build_project_registration_proposal(
|
||||
project_id=req.project_id,
|
||||
aliases=req.aliases,
|
||||
description=req.description,
|
||||
ingest_roots=req.ingest_roots,
|
||||
)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
|
||||
|
||||
@router.post("/projects/{project_name}/refresh", response_model=ProjectRefreshResponse)
|
||||
def api_refresh_project(project_name: str, purge_deleted: bool = False) -> ProjectRefreshResponse:
|
||||
"""Refresh one registered project from its configured ingest roots."""
|
||||
|
||||
Reference in New Issue
Block a user