feat: perf optimizations

- improved search_knowledgebase_tool
- Added new endpoint to batch-fetch comments for multiple messages, reducing the number of API calls.
- Introduced CommentBatchRequest and CommentBatchResponse schemas for handling batch requests and responses.
- Updated chat_comments_service to validate message existence and permissions before fetching comments.
- Enhanced frontend with useBatchCommentsPreload hook to optimize comment loading for assistant messages.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-02-27 17:19:25 -08:00
parent a43956bdce
commit 0e723a5b8b
13 changed files with 424 additions and 67 deletions

View file

@ -87,6 +87,18 @@ class CommentListResponse(BaseModel):
total_count: int
class CommentBatchRequest(BaseModel):
"""Request for batch-fetching comments for multiple messages."""
message_ids: list[int] = Field(..., min_length=1, max_length=200)
class CommentBatchResponse(BaseModel):
"""Batch response keyed by message_id."""
comments_by_message: dict[int, CommentListResponse]
# =============================================================================
# Mention Schemas
# =============================================================================