Skip to content

Allow setting any model#479

Merged
elie222 merged 2 commits intomainfrom
feat/custom-model
Jun 4, 2025
Merged

Allow setting any model#479
elie222 merged 2 commits intomainfrom
feat/custom-model

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Jun 4, 2025

Summary by CodeRabbit

  • New Features

    • The success message after updating AI model settings now includes a prompt to verify functionality on the Assistant page.
  • Bug Fixes

    • Improved validation for API key requirements based on the selected AI provider.
  • Refactor

    • Simplified AI model selection options and logic, now only showing models for supported providers with valid API keys.
  • Chores

    • Updated application version to v1.3.9.

@vercel
Copy link

vercel bot commented Jun 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
inbox-zero ✅ Ready (Inspect) Visit Preview Jun 4, 2025 8:55pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

Walkthrough

This change removes the modelOptions export and related default model logic from the codebase. Model selection is now limited to only fetched models for the OPEN_AI provider, and the default model fallback logic is removed. Validation for API keys is also updated to require them unless the provider is DEFAULT_PROVIDER. The version is incremented.

Changes

File(s) Summary
apps/web/app/(app)/[emailAccountId]/settings/ModelSection.tsx Removed modelOptions and getDefaultModel usage; simplified model selection to only OPEN_AI; updated toast message.
apps/web/utils/llms/config.ts Removed the export of modelOptions.
apps/web/utils/actions/settings.validation.ts Changed API key validation to require it unless provider is DEFAULT_PROVIDER instead of ANTHROPIC.
version.txt Updated version from v1.3.8 to v1.3.9.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsForm
    participant ModelFetcher

    User->>SettingsForm: Open AI settings page
    SettingsForm->>ModelFetcher: Fetch models (if provider is OPEN_AI)
    ModelFetcher-->>SettingsForm: Return models (OPEN_AI only)
    User->>SettingsForm: Select model (from fetched list or none)
    User->>SettingsForm: Submit settings
    SettingsForm->>SettingsForm: Validate (API key required unless DEFAULT_PROVIDER)
    SettingsForm-->>User: Show success toast with Assistant page prompt
Loading

Possibly related PRs

  • elie222/inbox-zero#269: Both PRs modify or remove modelOptions in apps/web/utils/llms/config.ts, but in opposite directions.
  • elie222/inbox-zero#215: Both PRs alter model selection logic in ModelSection.tsx, one simplifying and the other expanding provider support.
  • elie222/inbox-zero#298: Both PRs focus on adding or removing model options, directly affecting how models are managed.

Poem

A hop and a skip, the models are gone,
Only OpenAI’s list lingers on.
No more defaults for models to choose,
Simpler selection—less to lose!
With a toast and a cheer,
Version bumps near,
This bunny codes on, with nothing to fear! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/app/(app)/[emailAccountId]/settings/ModelSection.tsx

Oops! Something went wrong! :(

ESLint: 9.28.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

apps/web/utils/actions/settings.validation.ts

Oops! Something went wrong! :(

ESLint: 9.28.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ BugBot reviewed your changes and found no bugs!


BugBot free trial expires on June 9, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55b081a and 13703a8.

📒 Files selected for processing (4)
  • apps/web/app/(app)/[emailAccountId]/settings/ModelSection.tsx (3 hunks)
  • apps/web/utils/actions/settings.validation.ts (1 hunks)
  • apps/web/utils/llms/config.ts (0 hunks)
  • version.txt (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/utils/llms/config.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/web/utils/actions/settings.validation.ts (1)
apps/web/utils/llms/config.ts (1)
  • DEFAULT_PROVIDER (5-5)
🔇 Additional comments (4)
version.txt (1)

1-1: LGTM: Version increment follows semantic versioning.

The version bump from v1.3.8 to v1.3.9 appropriately reflects the minor feature changes in this PR.

apps/web/utils/actions/settings.validation.ts (1)

28-28:

Details

❓ Verification inconclusive

Verify this breaking change and its impact on existing users.

The API key requirement logic has changed from exempting Provider.ANTHROPIC to only exempting DEFAULT_PROVIDER. This means Anthropic users will now be required to provide an API key, which is a breaking change.

Please confirm:

  1. This breaking change is intentional and aligns with the new model selection approach
  2. Existing users with Anthropic provider but no API key have been properly migrated or notified
  3. Documentation has been updated to reflect this change

🏁 Script executed:

#!/bin/bash
# Search for any remaining references to the old Anthropic exemption logic
rg -A 3 -B 3 "Provider\.ANTHROPIC.*apikey|apikey.*Provider\.ANTHROPIC" --ignore-case

Length of output: 86


To be safe, let’s double-check how DEFAULT_PROVIDER is defined and whether there are any other references to Anthropic in docs or code paths:


🏁 Script executed:

#!/bin/bash
# 1. Locate DEFAULT_PROVIDER constant
rg -n "DEFAULT_PROVIDER" .

# 2. Confirm the aiProvider validation logic in settings.validation.ts
rg -C3 "if (!val.aiApiKey" -n apps/web/utils/actions/settings.validation.ts

# 3. Search for any Anthropic mentions (docs, comments, migrations, etc.)
rg -i "Anthropic" -n .

Length of output: 8674


Verify the Anthropic API-key requirement change

The condition in apps/web/utils/actions/settings.validation.ts now only exempts DEFAULT_PROVIDER, so users selecting Provider.ANTHROPIC will be forced to provide an API key. Please confirm:

  • This behavioral change is intentional and aligns with the new default‐model approach
  • All existing Anthropic users without an API key are being migrated or notified
  • Documentation and onboarding guides have been updated (e.g., README.md, ARCHITECTURE.md) to reflect that Anthropic now requires a key

Files to review:

  • apps/web/utils/actions/settings.validation.ts (line 28)
  • README.md
  • ARCHITECTURE.md
apps/web/app/(app)/[emailAccountId]/settings/ModelSection.tsx (2)

93-96: Good UX improvement: prompting users to verify functionality.

The expanded success message appropriately guides users to test their configuration on the Assistant page, which is helpful given the significant changes to model selection logic.


77-77:

Details

✅ Verification successful

Ensure empty string default doesn't cause validation issues.

The default aiModel value is now an empty string instead of a computed default. Verify that this doesn't cause validation errors when users haven't selected a model yet, especially if the model field is required in the schema.


🏁 Script executed:

#!/bin/bash
# Check if aiModel field has required validation in the schema
ast-grep --pattern 'aiModel: z.string()$_'

Length of output: 44


I couldn’t locate a Zod schema for aiModel with the initial pattern. Let’s search for all occurrences of aiModel in the repo to find where it’s defined or validated:


🏁 Script executed:

#!/bin/bash
# Find all occurrences of aiModel to locate its validation/schema
rg "aiModel" -n -C 3

Length of output: 31317


🏁 Script executed:

#!/bin/bash
sed -n '1,100p' apps/web/utils/actions/settings.validation.ts

Length of output: 1169


Empty-string default for aiModel will not break validation

The saveAiSettingsBody schema declares aiModel as z.string(), which accepts empty strings—so defaulting to "" won’t trigger any Zod errors at submit time. At runtime, selectModel treats an empty string as falsy and falls back to its built-in default model.

If you intend to force users to make an explicit selection, consider changing the schema to:

aiModel: z.string().nonempty("Please select a model"),

• apps/web/app/(app)/[emailAccountId]/settings/ModelSection.tsx: defaultValues ▶ aiModel: props.aiModel ?? ""
• apps/web/utils/actions/settings.validation.ts: aiModel: z.string()

value: m.id,
})) || []
: modelOptions[aiProvider];
: [];
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the impact of restricting model options to OpenAI only.

The model selection logic now only provides dropdown options for OpenAI with a valid API key, while other providers require manual model name entry. This supports the "allow setting any model" objective but represents a significant UX change.

Please confirm:

  1. Users of other providers (Anthropic, Google, Groq, etc.) understand they need to manually enter model names
  2. There's adequate documentation or UI guidance for valid model names for each provider
  3. The manual entry approach doesn't introduce potential for typos or invalid model names

🏁 Script executed:

#!/bin/bash
# Search for any documentation or help text about valid model names
rg -A 5 -B 5 "model.*name|valid.*model" --type tsx --type ts

Length of output: 90


🏁 Script executed:

#!/bin/bash
# Search code and markdown docs for any guidance on valid model names or related UI text
rg -A5 -B5 "model.*name|valid.*model" -g "*.ts*" -g "*.md"
rg -A5 -B5 "Enter.*model" -g "*.ts*" -g "*.md"

Length of output: 814


Add UI guidance and documentation for manual model entry for non-OpenAI providers

I didn’t find any existing placeholder text, tooltips, or docs explaining how to enter model names for Anthropic, Google, Groq, etc. Without this, users may be confused or prone to typos. Please:

• In apps/web/app/(app)/[emailAccountId]/settings/ModelSection.tsx (around line 112), add a placeholder or helper text on the model-name input for non-OpenAI providers (e.g. placeholder="e.g. anthropic-model-v1" or a tooltip icon).
• Update your user documentation (e.g. in docs/ or README.md) with a “Model name conventions” section listing valid example names per provider.
• Optionally, implement simple validation or a dropdown of common models per provider to reduce errors.

🤖 Prompt for AI Agents
In apps/web/app/(app)/[emailAccountId]/settings/ModelSection.tsx around line
112, add a placeholder or helper text to the model-name input field for
non-OpenAI providers to guide users on valid model name formats (e.g.,
placeholder="e.g. anthropic-model-v1" or a tooltip). Additionally, update the
user documentation in docs/ or README.md to include a “Model name conventions”
section with example valid model names for each provider. Optionally, consider
adding simple validation or a dropdown of common models per provider to minimize
user errors.

@elie222 elie222 merged commit 8fdaeb8 into main Jun 4, 2025
10 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 25, 2025
@elie222 elie222 deleted the feat/custom-model branch December 18, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments