Skip to content

Conversation

dreamsafari
Copy link
Contributor

@dreamsafari dreamsafari commented Jul 31, 2025

add Grok 4

πŸ’» ε˜ζ›΄η±»εž‹ | Change Type

  • feat
  • fix
  • refactor
  • perf
  • style
  • test
  • docs
  • ci
  • chore
  • build

πŸ”€ ε˜ζ›΄θ―΄ζ˜Ž | Description of Change

πŸ“ θ‘₯充俑息 | Additional Information

Summary by CodeRabbit

  • New Features
    • Refreshed the available xAI model selection with several new and renamed model options for users.
  • Chores
    • Removed obsolete model variants and reorganized the model list for clearer, more consistent choices.

Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The internal xAIModes array in app/constant.ts was replaced with a reorganized list of Grok model identifiers: legacy Grok entries were removed and multiple Grok-2, Grok-3, and Grok-4 variants (including vision/image and mini/fast variants) were added or repositioned. No exported APIs changed.

Changes

Cohort / File(s) Change Summary
xAI Model List Update
app/constant.ts
Replaced the internal xAIModes constant: removed legacy Grok entries and added/reorganized Grok groups (grok-4-0709, grok-4*, grok-3*, grok-3-mini*, grok-3-fast*, grok-2-vision*, grok-2-image*, etc.). No public/exported declarations were modified.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Constants

    User->>App: Request available xAI models
    App->>Constants: Read xAIModes array
    Constants-->>App: Return updated Grok model identifiers
    App-->>User: Present refreshed model list
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Poem

I hopped through constants, tidy and bright,
Swapped out old names for models that light,
Grok-3, Grok-4, compact and spry,
A rabbit's small cheer as the list hops by. πŸ‡βœ¨

✨ Finishing Touches
  • πŸ“ Generate Docstrings
πŸ§ͺ Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
  • 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.

Support

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

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 generate unit tests to generate unit tests for 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
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: 0

🧹 Nitpick comments (2)
app/constant.ts (2)

649-656: Consider preserving a predictable ordering strategy for new Grok-4 variants

The list now mixes date-suffixed (grok-4-0709) and generic (grok-4, grok-4-latest) identifiers, but no clear ordering rule (e.g. newest β†’ oldest or stable β†’ preview) is evident. When this array is surfaced in a UI drop-down the order becomes the implicit recommendation. A deterministic sort (version β‡’ latest β‡’ dated β‡’ beta) keeps the UX predictable and reduces future merge conflicts on later insertions.


662-671: Unify β€œfast” vs β€œmini-fast” naming to avoid user confusion

Both grok-3-fast* and grok-3-mini-fast* variants are present. Unless xAI officially distinguishes these as separate model families, this split complicates search-by-prefix logic and increases the maintenance burden when bumping versions.

If they are aliases to the same underlying model, keep only one canonical prefix and document the mapping in a lookup table; otherwise clarify the semantic difference in comments.

πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 557a2cc and d8f44b9.

πŸ“’ Files selected for processing (1)
  • app/constant.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
πŸ““ Common learnings
Learnt from: gq97a6
PR: ChatGPTNextWeb/NextChat#6465
File: app/components/chat.tsx:1362-1386
Timestamp: 2025-04-25T03:07:22.602Z
Learning: In the NextChat repo, the `useEffect` without deps for chat auto-scrolling was a pre-existing pattern before PR #6465, and wasn't introduced in that PR.
πŸ”‡ Additional comments (1)
app/constant.ts (1)

657-665: Potential duplicate names across providers may bloat the final DEFAULT_MODELS

xAIModes now contains grok-3-beta and grok-3-mini-beta, which are also listed in ai302Models (Lines 719-721).
When DEFAULT_MODELS is built, these two names will appear twice with different provider.id values (xai and ai302). If the frontend deduplicates only by model name (ignoring provider) this will create collisions or undefined behaviour.

Verify that the consumer code treats (name, provider.id) as the compound key; otherwise, remove the duplicates or namespace them (e.g. "ai302/grok-3-beta").

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

🧹 Nitpick comments (1)
app/constant.ts (1)

656-677: Optional: naming consistency

Variable name xAIModes is inconsistent with other arrays (openaiModels, anthropicModels, etc.). Consider renaming to xAIModels in a follow-up cleanup PR for consistency.

πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between d8f44b9 and 3557289.

πŸ“’ Files selected for processing (1)
  • app/constant.ts (1 hunks)
πŸ”‡ Additional comments (2)
app/constant.ts (2)

656-661: Grok 4 additions look good

The new grok-4 variants (including dated and latest aliases) are correctly added and will surface under the XAI provider as intended.


656-677: Confirmed: No XAI Image-Generation Support – Safe to Remove grok-2-image Models

I checked the XAI integration in app/constant.ts and across the codebase:

  • XAI constant only defines ChatPath (no ImagePath).
  • No /api/xai route handlers or providerType: 'xai' references for image generation.
  • No ApiPath.XAI usages tied to images.

Since XAI doesn’t support image generations, removing the grok-2-image* entries is correct.

Comment on lines +674 to +676
"grok-2-image-1212",
"grok-2-image",
"grok-2-image-latest",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Likely unsupported: grok-2-image will be routed to chat endpoint and fail*

These appear to be image-generation models, but XAI currently has only ChatPath configured ("v1/chat/completions"). Without an XAI ImagePath and corresponding image-generation flow, selecting these models will likely produce 4xx errors at runtime.

Recommend either:

  • Minimal scope (safe): remove the image-only models until XAI image generation is supported.
  • Or implement XAI image generation first, then keep these entries.

Apply this minimal diff to remove the unsupported entries now:

   "grok-2-vision-latest",
-  "grok-2-image-1212",
-  "grok-2-image",
-  "grok-2-image-latest",
 ];

Alternatively, if you plan to support XAI images in this PR, add an ImagePath and integrate the image-generation request path for XAI. For example (outside this hunk, illustrative only β€” verify against xAI docs before using):

// constants (augment XAI)
export const XAI = {
  ExampleEndpoint: XAI_BASE_URL,
  ChatPath: "v1/chat/completions",
  // TODO: Verify actual XAI images endpoint name and payload
  ImagePath: "v1/images/generations",
};

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.

2 participants