memory isolation fix and session grouping in client
This commit is contained in:
@@ -92,14 +92,14 @@ src/
|
||||
│ └── useContextMenu.js # Right-click context menu position and visibility
|
||||
├── components/
|
||||
│ ├── App.jsx # Root component — layout, shared state, view routing
|
||||
│ ├── Sidebar.jsx # Left sidebar — projects, recent chats, navigation
|
||||
│ ├── Sidebar.jsx # Left sidebar — projects, grouped recent chats, navigation
|
||||
│ ├── HomeView.jsx # Landing screen — greeting, centred input, quick actions
|
||||
│ ├── ChatWindow.jsx # Centre panel — message thread and input bar
|
||||
│ ├── ChatWindow.jsx # Centre panel — message thread, back button, model pill
|
||||
│ ├── MessageBubble.jsx # Individual message bubble — renders markdown via react-markdown
|
||||
│ ├── InfoPanel.jsx # Right panel — model selector and session metadata (slide-in)
|
||||
│ ├── SessionModal.jsx # Modal for session rename, project assignment, delete
|
||||
│ ├── ProjectModal.jsx # Modal for project create, edit, delete
|
||||
│ ├── AllChatsView.jsx # Full paginated session list with multi-select bulk delete
|
||||
│ ├── AllChatsView.jsx # Paginated session list with project indicator column
|
||||
│ ├── AllProjectsView.jsx # Project tile grid with create/edit/delete; tile click navigates to ProjectView
|
||||
│ ├── ProjectView.jsx # Individual project — conversations, new chat input, memory
|
||||
│ │ # placeholder, user notes, ⋮ edit/delete menu
|
||||
@@ -129,8 +129,13 @@ panel are persistent across all views.
|
||||
│ All Projects → │ memory → MemoryView │
|
||||
│ │ │
|
||||
│ RECENT CHATS ▾ │ │
|
||||
│ Session 1 │ │
|
||||
│ Session 2 │ │
|
||||
│ ● Project A │ │
|
||||
│ Session 1 │ │
|
||||
│ Session 2 │ │
|
||||
│ ● Project B │ │
|
||||
│ Session 3 │ │
|
||||
│ Other │ │
|
||||
│ Session 4 │ │
|
||||
│ All Chats → │ │
|
||||
│ │ │
|
||||
│ ⚙ Settings │ │
|
||||
@@ -167,13 +172,17 @@ leaving `'home'` expands it.
|
||||
|
||||
## Home View
|
||||
|
||||
`HomeView` is the landing screen shown on initial load and when there are no
|
||||
active sessions. It displays:
|
||||
`HomeView` is the landing screen shown on initial load. It displays:
|
||||
- Time-based greeting ("Morning / Afternoon / Evening, Tim")
|
||||
- Currently loaded model name (from `modelProps.modelAlias`, stripped of `.gguf`)
|
||||
- Centred textarea input — sending creates a new session and navigates to chat
|
||||
- Quick action pills that populate the input without auto-sending
|
||||
|
||||
Sending from HomeView uses `handleHomeSend` in `App.jsx`, which calls
|
||||
`createSession()` (returns the new session object), then immediately calls
|
||||
`sendMessage` with the session passed directly as a parameter — avoiding the
|
||||
React state settling race condition that would cause the message to be dropped.
|
||||
|
||||
## CSS Architecture
|
||||
|
||||
Styles follow a hybrid approach — CSS utility classes for static reusable
|
||||
@@ -225,6 +234,11 @@ are written into the active assistant bubble token by token via
|
||||
`updateLastMessage`. The blinking cursor in `MessageBubble` is shown while
|
||||
`message.streaming === true`.
|
||||
|
||||
`useChat.sendMessage` accepts an optional `session` parameter (4th arg) that
|
||||
overrides the closed-over `activeSession`. This is used by `handleHomeSend`
|
||||
and `handleNewProjectChat` in `App.jsx` to pass the newly created session
|
||||
object directly, avoiding React state settling races.
|
||||
|
||||
`useChat` accepts an optional `projectId` parameter in `sendMessage`. After
|
||||
the first message completes in a new session, if `projectId` is set,
|
||||
`updateSession` is called to write the project assignment to the backend.
|
||||
@@ -236,6 +250,9 @@ the `uuid` package. New sessions are created locally and auto-registered in
|
||||
the memory service on the first message. The session list refreshes after
|
||||
each completed response to surface newly created sessions.
|
||||
|
||||
`useSession.createSession` returns the new session object — callers can pass
|
||||
it directly to `sendMessage` rather than waiting for React state to update.
|
||||
|
||||
`useSession.selectSession` skips the history fetch for new (`isNew: true`)
|
||||
sessions — fetching history for an unsaved session would 404 since it doesn't
|
||||
exist in the backend yet.
|
||||
@@ -267,6 +284,16 @@ mode, and delete confirmation in `confirm-delete` mode.
|
||||
- Dynamic `updateSession` SQL builds `SET` clause from only the fields passed — prevents accidental overwrites
|
||||
- `AllChatsView` pagination uses `CLIENT_DEFAULTS.PAGE_SIZE` (not `API_DEFAULTS.PAGE_SIZE` which doesn't exist)
|
||||
|
||||
## Sidebar — Session Grouping
|
||||
|
||||
Recent sessions in the sidebar are grouped by project under a colour dot +
|
||||
project name label. Unassigned sessions appear under "Other" if any project
|
||||
groups are present. The grouping is computed client-side from the `sessions`
|
||||
array and `projects` list already available in `App.jsx` — no extra API call.
|
||||
|
||||
`AllChatsView` receives `projects` as a prop from `App.jsx` and displays a
|
||||
project indicator column (colour dot + truncated name) in each session row.
|
||||
|
||||
## Project Management
|
||||
|
||||
All projects are isolated by default (`isolated: 1` hardcoded on create).
|
||||
|
||||
Reference in New Issue
Block a user