-
-
Notifications
You must be signed in to change notification settings - Fork 6
Update Gemini 3.1 Pro Integration #584
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,19 +43,19 @@ const models = [ | |
| badgeVariant: "secondary" as const, | ||
| }, | ||
| { | ||
| id: "Gemini 3", | ||
| name: "Gemini 3", | ||
| description: "Google's next-generation multimodal model, excelling at understanding and processing diverse information.", | ||
| id: "Gemini 3.1 Pro", | ||
| name: "Gemini 3.1 Pro", | ||
| description: "Google's latest reasoning model, excelling at multimodal understanding and complex agentic tasks.", | ||
| icon: Sparkles, | ||
| badge: "Multimodal", | ||
| badge: "Advanced", | ||
| badgeVariant: "outline" as const, | ||
| }, | ||
| { | ||
| id: "GPT-5.1", | ||
| name: "GPT-5.1", | ||
| description: "The cutting-edge of language models, offering unparalleled performance in creative and analytical tasks.", | ||
| icon: Zap, | ||
| badge: "Advanced", | ||
| badge: "Expert", | ||
|
Comment on lines
+46
to
+58
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normalize legacy Line 46 removes the old option id, so existing saved values of Suggested patch+const normalizeModelValue = (value?: string) =>
+ value === "Gemini 3" ? "Gemini 3.1 Pro" : value;
+
export function ModelSelectionForm({ form }: ModelSelectionFormProps) {
return (
@@
- <Select onValueChange={field.onChange} value={field.value}>
+ <Select onValueChange={field.onChange} value={normalizeModelValue(field.value)}>
@@
<RadioGroup
onValueChange={field.onChange}
- value={field.value}
+ value={normalizeModelValue(field.value)}
className="space-y-3"
>🤖 Prompt for AI Agents |
||
| badgeVariant: "outline" as const, | ||
| }, | ||
| ]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,18 +51,19 @@ export async function getModel(requireVision: boolean = false) { | |
| throw new Error('Selected model is not configured.'); | ||
| } | ||
| case 'Gemini 3': | ||
| case 'Gemini 3.1 Pro': | ||
| if (gemini3ProApiKey) { | ||
| const google = createGoogleGenerativeAI({ | ||
| apiKey: gemini3ProApiKey, | ||
| }); | ||
| try { | ||
| return google('gemini-3-pro-preview'); | ||
| return google('gemini-3.1-pro-preview'); | ||
| } catch (error) { | ||
| console.error('Selected model "Gemini 3" is configured but failed to initialize.', error); | ||
| console.error('Selected model "Gemini 3.1 Pro" is configured but failed to initialize.', error); | ||
| throw new Error('Failed to initialize selected model.'); | ||
| } | ||
| } else { | ||
| console.error('User selected "Gemini 3" but GEMINI_3_PRO_API_KEY is not set.'); | ||
| console.error('User selected "Gemini 3.1 Pro" but GEMINI_3_PRO_API_KEY is not set.'); | ||
| throw new Error('Selected model is not configured.'); | ||
|
Comment on lines
53
to
67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the requested model label in Gemini error logs. Line 62 and Line 66 always log Suggested patch- console.error('Selected model "Gemini 3.1 Pro" is configured but failed to initialize.', error);
+ console.error(
+ `Selected model "${selectedModel}" (resolved to "Gemini 3.1 Pro") is configured but failed to initialize.`,
+ error
+ );
throw new Error('Failed to initialize selected model.');
}
} else {
- console.error('User selected "Gemini 3.1 Pro" but GEMINI_3_PRO_API_KEY is not set.');
+ console.error(
+ `User selected "${selectedModel}" (resolved to "Gemini 3.1 Pro") but GEMINI_3_PRO_API_KEY is not set.`
+ );
throw new Error('Selected model is not configured.');
}🤖 Prompt for AI Agents |
||
| } | ||
| case 'GPT-5.1': | ||
|
|
@@ -78,27 +79,27 @@ export async function getModel(requireVision: boolean = false) { | |
| } | ||
| } | ||
|
|
||
| // Default behavior: Grok -> Gemini -> Bedrock -> OpenAI | ||
| if (xaiApiKey) { | ||
| const xai = createXai({ | ||
| apiKey: xaiApiKey, | ||
| baseURL: 'https://api.x.ai/v1', | ||
| // Default behavior: Gemini -> Grok -> Bedrock -> OpenAI | ||
| if (gemini3ProApiKey) { | ||
| const google = createGoogleGenerativeAI({ | ||
| apiKey: gemini3ProApiKey, | ||
| }); | ||
| try { | ||
| return xai('grok-4-fast-non-reasoning'); | ||
| return google('gemini-3.1-pro-preview'); | ||
| } catch (error) { | ||
| console.warn('xAI API unavailable, falling back to next provider:'); | ||
| console.warn('Gemini 3.1 Pro API unavailable, falling back to next provider:', error); | ||
| } | ||
| } | ||
|
|
||
| if (gemini3ProApiKey) { | ||
| const google = createGoogleGenerativeAI({ | ||
| apiKey: gemini3ProApiKey, | ||
| if (xaiApiKey) { | ||
| const xai = createXai({ | ||
| apiKey: xaiApiKey, | ||
| baseURL: 'https://api.x.ai/v1', | ||
| }); | ||
| try { | ||
| return google('gemini-3-pro-preview'); | ||
| return xai('grok-4-fast-non-reasoning'); | ||
| } catch (error) { | ||
| console.warn('Gemini 3 Pro API unavailable, falling back to next provider:', error); | ||
| console.warn('xAI API unavailable, falling back to next provider:'); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
1. Legacy model not migrated
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools