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.
This commit is contained in:
parent
c30334edc9
commit
2b17c0c7a2
1 changed files with 5 additions and 2 deletions
|
|
@ -93,7 +93,6 @@ Stores chat metadata and session information.
|
||||||
| `assistant_id` | string(200) | No | Yes | Associated assistant ID |
|
| `assistant_id` | string(200) | No | Yes | Associated assistant ID |
|
||||||
| `mode` | string(50) | No | - | Chat mode (default: "chat") |
|
| `mode` | string(50) | No | - | Chat mode (default: "chat") |
|
||||||
| `status` | enum | No | Yes | Status: `active`, `archived` |
|
| `status` | enum | No | Yes | Status: `active`, `archived` |
|
||||||
| `preset` | boolean | No | - | Whether this is a preset chat |
|
|
||||||
| `public` | boolean | No | - | Whether shared across all teams |
|
| `public` | boolean | No | - | Whether shared across all teams |
|
||||||
| `share` | enum | No | Yes | Sharing scope: `private`, `team` |
|
| `share` | enum | No | Yes | Sharing scope: `private`, `team` |
|
||||||
| `sort` | integer | No | - | Sort order for display |
|
| `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_chat_seq` | `chat_id`, `sequence` | index |
|
||||||
| `idx_msg_request` | `request_id` | index |
|
| `idx_msg_request` | `request_id` | index |
|
||||||
|
| `idx_msg_role` | `role` | index |
|
||||||
| `idx_msg_block` | `block_id` | index |
|
| `idx_msg_block` | `block_id` | index |
|
||||||
|
| `idx_msg_thread` | `thread_id` | index |
|
||||||
| `idx_msg_assistant` | `assistant_id` | index |
|
| `idx_msg_assistant` | `assistant_id` | index |
|
||||||
|
|
||||||
**Message Types:**
|
**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_chat` | `chat_id` | index |
|
||||||
| `idx_resume_request` | `request_id`, `sequence` | index |
|
| `idx_resume_request` | `request_id`, `sequence` | index |
|
||||||
|
| `idx_resume_type` | `type` | index |
|
||||||
| `idx_resume_status` | `status` | index |
|
| `idx_resume_status` | `status` | index |
|
||||||
| `idx_resume_stack` | `stack_id` | index |
|
| `idx_resume_stack` | `stack_id` | index |
|
||||||
| `idx_resume_parent` | `stack_parent_id` | index |
|
| `idx_resume_parent` | `stack_parent_id` | index |
|
||||||
|
|
@ -735,7 +737,6 @@ type Chat struct {
|
||||||
AssistantID string `json:"assistant_id"`
|
AssistantID string `json:"assistant_id"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Preset bool `json:"preset"`
|
|
||||||
Public bool `json:"public"`
|
Public bool `json:"public"`
|
||||||
Share string `json:"share"` // "private" or "team"
|
Share string `json:"share"` // "private" or "team"
|
||||||
Sort int `json:"sort"`
|
Sort int `json:"sort"`
|
||||||
|
|
@ -803,6 +804,8 @@ type MessageFilter struct {
|
||||||
RequestID string `json:"request_id,omitempty"`
|
RequestID string `json:"request_id,omitempty"`
|
||||||
Role string `json:"role,omitempty"`
|
Role string `json:"role,omitempty"`
|
||||||
BlockID string `json:"block_id,omitempty"`
|
BlockID string `json:"block_id,omitempty"`
|
||||||
|
ThreadID string `json:"thread_id,omitempty"`
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
Limit int `json:"limit,omitempty"`
|
Limit int `json:"limit,omitempty"`
|
||||||
Offset int `json:"offset,omitempty"`
|
Offset int `json:"offset,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue