sync update from LAN repo (source dhk-1 @ 3b1ec5b4)
This commit is contained in:
1 parent
da6521b6cb
commit
264e2200d6
995 files changed
+148105
-13399
No files matched your search
@@ -1,19 +1,18 @@
|
||||
"""Fast taskId + goPath history lookup for single-agent deep-link workspaces.
|
||||
|
||||
Messages and execution state remain canonical LangGraph threads. This API reads
|
||||
the dedicated ``task_deeplink_threads`` index and joins each hit to its thread
|
||||
metadata by primary key, avoiding a global metadata JSON scan/filter.
|
||||
Messages and execution state remain canonical LangGraph threads. This API
|
||||
reads only the dedicated ``task_deeplink_threads`` cards and never joins or
|
||||
scans the generic ``threads_meta`` catalogue.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal
|
||||
|
||||
from fastapi import APIRouter, Query, Request
|
||||
from fastapi import APIRouter, HTTPException, Query, Request
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.gateway.deps import get_task_deeplink_thread_store
|
||||
from app.gateway.routers.threads import ThreadResponse
|
||||
from deerflow.persistence.task_deeplink_threads.base import is_valid_task_deeplink_go_path
|
||||
from deerflow.utils.time import coerce_iso
|
||||
|
||||
router = APIRouter(
|
||||
@@ -30,13 +29,24 @@ class TaskDeeplinkThreadListResponse(BaseModel):
|
||||
async def list_task_deeplink_threads(
|
||||
request: Request,
|
||||
task_id: str = Query(min_length=1, max_length=128),
|
||||
go_path: Literal["3qfx", "rwfx", "xdfx", "b5-1"] = Query(),
|
||||
go_path: str = Query(min_length=1, max_length=32),
|
||||
limit: int = Query(default=100, ge=1, le=500),
|
||||
# b5-1 ?type= partition. Provided (even empty) → only that sub-type;
|
||||
# omitted → every sub-type of the task/goPath partition (legacy callers).
|
||||
sub_type: str | None = Query(default=None, max_length=64),
|
||||
) -> TaskDeeplinkThreadListResponse:
|
||||
"""Return one shared deep-link history partition, newest first."""
|
||||
|
||||
normalized_go_path = go_path.strip().lower()
|
||||
if not is_valid_task_deeplink_go_path(normalized_go_path):
|
||||
raise HTTPException(status_code=422, detail="Invalid task deep-link goPath")
|
||||
store = get_task_deeplink_thread_store(request)
|
||||
rows = await store.list_threads(task_id.strip(), go_path, limit=limit)
|
||||
rows = await store.list_threads(
|
||||
task_id.strip(),
|
||||
normalized_go_path,
|
||||
limit=limit,
|
||||
sub_type=sub_type.strip() if sub_type is not None else None,
|
||||
)
|
||||
return TaskDeeplinkThreadListResponse(
|
||||
threads=[
|
||||
ThreadResponse(
|
||||
|
||||
Reference in new issue
Block a user