feat: Jan supports multiple assistants #5024
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
This pull request introduces functionality to manage and utilize a "current assistant" across various parts of the application. Key changes include updates to the assistant and thread state management, integration of assistant-specific instructions in chat messages, and enhancements to the
CompletionMessagesBuilder
class.CleanShot.2025-05-20.at.00.18.48.mp4
Closes #2845
Assistant State Management
currentAssistant
property and correspondingsetCurrentAssistant
method to theuseAssistant
hook for tracking and updating the currently selected assistant. (web-app/src/hooks/useAssistant.ts
, [1] [2] [3]Thread State Management
updateCurrentThreadAssistant
method in theuseThreads
hook to associate the current assistant with the active thread. (web-app/src/hooks/useThreads.ts
, [1] [2]Chat Integration
useChat
hook to include assistant-specific instructions in chat messages by leveraging thecurrentAssistant
property. (web-app/src/hooks/useChat.ts
, [1] [2] [3]UI Updates
DropdownAssistant
component to usecurrentAssistant
for selection and ensure thread updates when switching assistants. (web-app/src/containers/DropdownAssistant.tsx
, [1] [2]Index
andThreadDetail
components to synchronize the current assistant with the active thread and reset the thread ID when navigating. (web-app/src/routes/index.tsx
, [1] [2] [3];web-app/src/routes/threads/$threadId.tsx
, [4] [5] [6]Code Enhancements
CompletionMessagesBuilder
class with a newaddSystemMessage
method and improved documentation for better maintainability. (web-app/src/lib/messages.ts
, [1] [2]Self Checklist