From 2b17c0c7a2413bab562e1a2763c9def9dc468147 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 9 Dec 2025 09:44:28 +0800 Subject: [PATCH] Refactor CHAT_STORAGE_DESIGN.md to streamline chat metadata and message indexing - Removed the `preset` field from the chat metadata structure to simplify the design. - Added new indices for `role` and `thread_id` in the message storage section to enhance query performance and organization. - Introduced a new index for `type` in the resume functionality to improve retrieval efficiency during chat state restoration. --- agent/store/CHAT_STORAGE_DESIGN.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/agent/store/CHAT_STORAGE_DESIGN.md b/agent/store/CHAT_STORAGE_DESIGN.md index e23cd882..ce4521b5 100644 --- a/agent/store/CHAT_STORAGE_DESIGN.md +++ b/agent/store/CHAT_STORAGE_DESIGN.md @@ -93,7 +93,6 @@ Stores chat metadata and session information. | `assistant_id` | string(200) | No | Yes | Associated assistant ID | | `mode` | string(50) | No | - | Chat mode (default: "chat") | | `status` | enum | No | Yes | Status: `active`, `archived` | -| `preset` | boolean | No | - | Whether this is a preset chat | | `public` | boolean | No | - | Whether shared across all teams | | `share` | enum | No | Yes | Sharing scope: `private`, `team` | | `sort` | integer | No | - | Sort order for display | @@ -163,7 +162,9 @@ Stores user-visible messages (both user input and assistant responses). | ------------------- | --------------------- | ----- | | `idx_msg_chat_seq` | `chat_id`, `sequence` | index | | `idx_msg_request` | `request_id` | index | +| `idx_msg_role` | `role` | index | | `idx_msg_block` | `block_id` | index | +| `idx_msg_thread` | `thread_id` | index | | `idx_msg_assistant` | `assistant_id` | index | **Message Types:** @@ -499,6 +500,7 @@ If interrupted during delegate, the `space_snapshot` allows restoring `ctx.Space | ---------------------- | ------------------------ | ----- | | `idx_resume_chat` | `chat_id` | index | | `idx_resume_request` | `request_id`, `sequence` | index | +| `idx_resume_type` | `type` | index | | `idx_resume_status` | `status` | index | | `idx_resume_stack` | `stack_id` | index | | `idx_resume_parent` | `stack_parent_id` | index | @@ -735,7 +737,6 @@ type Chat struct { AssistantID string `json:"assistant_id"` Mode string `json:"mode"` Status string `json:"status"` - Preset bool `json:"preset"` Public bool `json:"public"` Share string `json:"share"` // "private" or "team" Sort int `json:"sort"` @@ -803,6 +804,8 @@ type MessageFilter struct { RequestID string `json:"request_id,omitempty"` Role string `json:"role,omitempty"` BlockID string `json:"block_id,omitempty"` + ThreadID string `json:"thread_id,omitempty"` + Type string `json:"type,omitempty"` Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` }