Skip to content

feat: Add Modes#2734

Merged
asvishnyakov merged 15 commits intomainfrom
feat/model_picker
Dec 22, 2025
Merged

feat: Add Modes#2734
asvishnyakov merged 15 commits intomainfrom
feat/model_picker

Conversation

@hayescode
Copy link
Contributor

@hayescode hayescode commented Dec 19, 2025

Adds modes to the chat interface. It functions kinda like commands do.

Docs added here: Chainlit/docs#274

image

Users will need to add a new column modes to the steps table like they did for commands. Here's the SQL command for postgresql.

ALTER TABLE steps ADD COLUMN IF NOT EXISTS modes JSONB;

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request frontend Pertains to the frontend. labels Dec 19, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 19 files

Prompt for AI agents (all 4 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="cypress/e2e/llm_picker/spec.cy.ts">

<violation number="1" location="cypress/e2e/llm_picker/spec.cy.ts:104">
P2: Test name contradicts its implementation. The test claims to verify the picker is NOT displayed when no LLMs are available, but actually asserts that it DOES exist. Consider either renaming the test to match what it actually tests, or skip/remove it until a proper test fixture without LLMs is available.</violation>
</file>

<file name="cypress/e2e/llm_picker/main.py">

<violation number="1" location="cypress/e2e/llm_picker/main.py:39">
P2: Using `\\n` produces literal backslash-n characters instead of actual newlines. If you want actual line breaks in the message output, use `\n` instead.</violation>
</file>

<file name="libs/react-client/src/useConfig.ts">

<violation number="1" location="libs/react-client/src/useConfig.ts:32">
P2: When `data.llms` is falsy (undefined or null), the LLMs state is not cleared, potentially leaving stale LLM data from a previous chat profile. Consider always updating the state to ensure consistency when switching profiles.</violation>
</file>

<file name="frontend/src/components/chat/MessageComposer/index.tsx">

<violation number="1" location="frontend/src/components/chat/MessageComposer/index.tsx:127">
P1: Missing `selectedLLM` in `useCallback` dependency array causes stale closure. The `selectedLLM?.id` is used inside `onSubmit` but `selectedLLM` isn&#39;t listed as a dependency, so changing the LLM selection won&#39;t update the callback, and messages will be sent with the wrong LLM.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@hayescode hayescode marked this pull request as draft December 19, 2025 14:21
@hayescode
Copy link
Contributor Author

I've decided to refactor this to enable multiple dropdown pickers, so we can have things like "approach" (Plan, Chat, Design) and "effort" (high/medium/low), in addition to LLMs. That way this will be more flexible for developers needs. I also want to add image support instead of limiting to lucide icons. Converting this to a draft for now.

- Add Mode and ModeOption dataclasses (backend/chainlit/mode.py)
- Replace llm field with modes dict in messages and steps
- Replace set_llms decorator with set_modes emitter pattern
- Add ModePicker component, remove LLMPicker
- Update react-client state and socket handling
- Add tests for Mode and ModeOption dataclasses
- Add tests for Message.modes field
- Add tests for emitter.set_modes()
- Add tests for chainlit exports
- Add cypress/e2e/modes/ with main.py and spec.cy.ts
- Use emitter pattern for set_modes in on_chat_start
- Test both model and reasoning mode pickers
- Remove deprecated llm_picker E2E tests
@hayescode hayescode changed the title feat: Add LLM picker with inline dropdown feat: Add Modes Dec 19, 2025
@hayescode hayescode marked this pull request as ready for review December 19, 2025 16:49
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Dec 19, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 18 files

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Dec 19, 2025
@hayescode
Copy link
Contributor Author

I have completed the updates. This is ready now.

@asvishnyakov asvishnyakov added this pull request to the merge queue Dec 22, 2025
Merged via the queue into main with commit 299181d Dec 22, 2025
10 checks passed
@asvishnyakov asvishnyakov deleted the feat/model_picker branch December 22, 2025 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend Pertains to the frontend. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants