feat: 对话列表显示总数,SOUL 编辑区高度自适应收敛

- 新增 POST /threads/count:与 /threads/search 同一套过滤(标题搜索、
  系统会话排除),仅返回 {total};ThreadMetaStore 增加 count 方法
  (SQL 走 COUNT(*),JSON 过滤分批扫描计数)
- 对话页面搜索框下常驻显示「共 N 条对话」,分页条显示 当前页/总页数
  (useThreadsCount,仅随筛选条件变化,翻页不重复请求)
- 智能体右侧 SOUL 预览改为 40vh 上限自适应展开(不再全部展开);
  详情面板/卡片编辑/创建页的 SOUL 输入框统一为适中高度 + 可拖拽

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
吉鑫升andClaude Fable 5 committed 2026-06-11 20:26:44 +08:00
1 parent f107ebc46d
commit 3d6f35391e
10 files changed
+204 -8

No files matched your search

@@ -692,6 +692,32 @@ async def search_threads(body: ThreadSearchRequest, request: Request) -> list[Th
]
class ThreadCountResponse(BaseModel):
"""Response model for the thread count endpoint."""
total: int = Field(description="Number of threads matching the filters")
@router.post("/count", response_model=ThreadCountResponse)
async def count_threads(body: ThreadSearchRequest, request: Request) -> ThreadCountResponse:
"""Count threads matching the same filters as ``/threads/search``.
``limit``/``offset`` in the body are ignored. Backs the chats page
pagination total ("共 N 条 / X 页") without fetching any rows.
"""
from app.gateway.deps import get_thread_store
repo = get_thread_store(request)
explicit_system_filter = bool(body.metadata) and ("thread_type" in body.metadata or "system" in body.metadata)
total = await repo.count(
metadata=body.metadata or None,
status=body.status,
exclude_system=not explicit_system_filter,
query=body.query,
)
return ThreadCountResponse(total=total)
@router.patch("/{thread_id}", response_model=ThreadResponse)
@require_permission("threads", "write", owner_check=True, require_existing=True)
async def patch_thread(thread_id: str, body: ThreadPatchRequest, request: Request) -> ThreadResponse: