-
Notifications
You must be signed in to change notification settings - Fork 61k
Update constant.ts #6589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Update constant.ts #6589
Conversation
add Grok 4
WalkthroughThe internal Changes
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
Estimated code review effortπ― 1 (Trivial) | β±οΈ ~2 minutes Possibly related PRs
Poem
β¨ Finishing Touches
π§ͺ Generate unit tests
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. πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 variantsThe 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 confusionBoth
grok-3-fast*
andgrok-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
π 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 containsgrok-3-beta
andgrok-3-mini-beta
, which are also listed inai302Models
(Lines 719-721).
WhenDEFAULT_MODELS
is built, these two names will appear twice with differentprovider.id
values (xai
andai302
). 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"
).
There was a problem hiding this 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 consistencyVariable 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
π Files selected for processing (1)
app/constant.ts
(1 hunks)
π Additional comments (2)
app/constant.ts (2)
656-661
: Grok 4 additions look goodThe 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 ModelsI checked the XAI integration in app/constant.ts and across the codebase:
- XAI constant only defines ChatPath (no ImagePath).
- No
/api/xai
route handlers orproviderType: '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.
"grok-2-image-1212", | ||
"grok-2-image", | ||
"grok-2-image-latest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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",
};
add Grok 4
π» εζ΄η±»ε | Change Type
π εζ΄θ―΄ζ | Description of Change
π θ‘₯ε δΏ‘ζ― | Additional Information
Summary by CodeRabbit