From 2bb20faa557ef5968ea78ac955f7fa0c239c11e2 Mon Sep 17 00:00:00 2001 From: Steven Enamakel <31011319+senamakel@users.noreply.github.com> Date: Thu, 16 Apr 2026 10:16:04 -0700 Subject: [PATCH] feat(threads): dedicated threads controller with per-thread session scoping (#590) * feat(conversations): implement thread management features including creation and deletion - Added functionality to create new conversation threads with unique IDs and titles based on the current date and time. - Introduced a deleteThread action to remove existing threads, updating the selected thread accordingly. - Enhanced the UI to display threads in a sidebar, allowing users to select and delete threads easily. - Updated the Conversations component to handle thread loading and selection more efficiently, ensuring a smoother user experience. Also updated the OpenHuman package version to 0.52.15 in Cargo.lock files. * refactor(conversations): rename createThreadLocal to createNewThread and streamline thread creation logic - Updated the function name from `createThreadLocal` to `createNewThread` for clarity and consistency. - Simplified the thread creation process by removing the manual ID and title generation, leveraging the new API method for automatic thread creation. - Adjusted the Conversations component to utilize the new `handleCreateNewThread` function, enhancing readability and maintainability. - Removed unused thread ID and title generation functions to clean up the codebase. This refactor improves the overall structure and clarity of the thread management functionality. * refactor(memory): remove deprecated conversation thread management functions - Eliminated unused functions related to listing, creating, updating, appending, and deleting conversation threads in memory operations. - This cleanup enhances code maintainability and reduces complexity in the memory module. - The refactor focuses on streamlining the conversation management logic, aligning with recent changes in the thread handling API. * refactor(api): update thread API method names and remove deprecated functions - Renamed thread-related API methods to align with the new naming convention, improving clarity and consistency. - Removed deprecated functions related to thread creation, streamlining the API and enhancing maintainability. - Adjusted the implementation of existing methods to reflect the updated API structure, ensuring proper functionality. * refactor(thread): simplify thread state management and remove unused properties - Streamlined the thread state by removing the lastViewedAt property and related logic, enhancing clarity in unread message counting. - Updated the BottomTabBar component to reflect the new unread count logic, which now simply returns the length of threads. - Removed the setLastViewed action from the Conversations component, further simplifying the thread management logic. - Introduced a new deleteThread action to handle thread deletion, ensuring proper state updates and selection handling. - Overall, these changes improve maintainability and reduce complexity in the thread management system. * style(threads): apply cargo fmt * refactor(tabbar): remove conversations unread badge * update(Cargo.lock): bump OpenHuman package version to 0.52.15 * test(threadApi): update RPC method names to threads namespace * refactor(conversations): update model ID for chat functionality - Changed the model ID used in the chatSend function from `agentic-v1` to `reasoning-v1`, clarifying the purpose of each model. - Added comments to explain the distinction between the reasoning model and the agentic model, enhancing code readability and maintainability. --- app/src/components/BottomTabBar.tsx | 19 - app/src/pages/Conversations.tsx | 174 +++++++-- app/src/services/api/threadApi.test.ts | 8 +- app/src/services/api/threadApi.ts | 31 +- app/src/store/threadSlice.ts | 185 +++------ src/core/all.rs | 4 + .../agent/harness/session/runtime.rs | 8 + src/openhuman/channels/providers/web.rs | 32 ++ src/openhuman/memory/ops.rs | 174 +-------- src/openhuman/memory/schemas.rs | 243 +----------- src/openhuman/mod.rs | 1 + src/openhuman/threads/mod.rs | 13 + src/openhuman/threads/ops.rs | 237 ++++++++++++ src/openhuman/threads/schemas.rs | 360 ++++++++++++++++++ 14 files changed, 883 insertions(+), 606 deletions(-) create mode 100644 src/openhuman/threads/mod.rs create mode 100644 src/openhuman/threads/ops.rs create mode 100644 src/openhuman/threads/schemas.rs diff --git a/app/src/components/BottomTabBar.tsx b/app/src/components/BottomTabBar.tsx index 9f10feaac..205de87e5 100644 --- a/app/src/components/BottomTabBar.tsx +++ b/app/src/components/BottomTabBar.tsx @@ -1,7 +1,6 @@ import { useLocation, useNavigate } from 'react-router-dom'; import { useCoreState } from '../providers/CoreStateProvider'; -import { useAppSelector } from '../store/hooks'; const tabs = [ { @@ -108,16 +107,6 @@ const BottomTabBar = () => { const { snapshot } = useCoreState(); const token = snapshot.sessionToken; - const conversationsUnreadCount = useAppSelector(state => { - const { threads, lastViewedAt } = state.thread; - if (threads.length === 0) return 0; - return threads.filter(t => { - const viewed = lastViewedAt[t.id]; - const lastMsg = new Date(t.lastMessageAt || t.createdAt).getTime(); - return viewed == null || lastMsg > viewed; - }).length; - }); - const hiddenPaths = ['/', '/login']; if ( !token || @@ -146,7 +135,6 @@ const BottomTabBar = () => {