Skip to content

Commit 6711d26

Browse files
authored
Add GPT 5 support (#34)
This PR adds support for GPT-5 models to the AI chat panel by introducing new GPT-5 model variants and updating the codebase to handle them. - Adds GPT-5, GPT-5 Mini, and GPT-5 Nano models with August 2025 release dates
1 parent a5840c9 commit 6711d26

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

front_end/panels/ai_chat/LLM/OpenAIProvider.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export class OpenAIProvider extends LLMBaseProvider {
5454
if (modelName.startsWith('o')) {
5555
return ModelFamily.O;
5656
}
57+
// GPT-5 models also don't support temperature parameter, treat them like O-series
58+
if (modelName.includes('gpt-5')) {
59+
return ModelFamily.O; // Treat GPT-5 like O-series for parameter compatibility
60+
}
5761
// Otherwise, assume it's a GPT model (gpt-3.5-turbo, gpt-4, etc.)
5862
return ModelFamily.GPT;
5963
}
@@ -470,6 +474,39 @@ export class OpenAIProvider extends LLMBaseProvider {
470474
vision: false,
471475
structured: true
472476
}
477+
},
478+
{
479+
id: 'gpt-5-2025-08-07',
480+
name: 'GPT-5',
481+
provider: 'openai',
482+
capabilities: {
483+
functionCalling: true,
484+
reasoning: true,
485+
vision: true,
486+
structured: true
487+
}
488+
},
489+
{
490+
id: 'gpt-5-mini-2025-08-07',
491+
name: 'GPT-5 Mini',
492+
provider: 'openai',
493+
capabilities: {
494+
functionCalling: true,
495+
reasoning: true,
496+
vision: true,
497+
structured: true
498+
}
499+
},
500+
{
501+
id: 'gpt-5-nano-2025-08-07',
502+
name: 'GPT-5 Nano',
503+
provider: 'openai',
504+
capabilities: {
505+
functionCalling: true,
506+
reasoning: true,
507+
vision: true,
508+
structured: true
509+
}
473510
}
474511
];
475512
}

front_end/panels/ai_chat/core/Version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// found in the LICENSE file.
44

55
export const VERSION_INFO = {
6-
version: '0.3.0',
6+
version: '0.3.1',
77
buildDate: '2025-08-07',
88
channel: 'stable'
99
} as const;

front_end/panels/ai_chat/ui/AIChatPanel.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ export interface ModelOption {
100100
// Add model options constant - these are the default OpenAI models
101101
const DEFAULT_OPENAI_MODELS: ModelOption[] = [
102102
{value: 'o4-mini-2025-04-16', label: 'O4 Mini', type: 'openai'},
103+
{value: 'o3-mini-2025-01-31', label: 'O3 Mini', type: 'openai'},
104+
{value: 'gpt-5-2025-08-07', label: 'GPT-5', type: 'openai'},
105+
{value: 'gpt-5-mini-2025-08-07', label: 'GPT-5 Mini', type: 'openai'},
106+
{value: 'gpt-5-nano-2025-08-07', label: 'GPT-5 Nano', type: 'openai'},
107+
{value: 'gpt-4.1-2025-04-14', label: 'GPT-4.1', type: 'openai'},
103108
{value: 'gpt-4.1-mini-2025-04-14', label: 'GPT-4.1 Mini', type: 'openai'},
104109
{value: 'gpt-4.1-nano-2025-04-14', label: 'GPT-4.1 Nano', type: 'openai'},
105-
{value: 'gpt-4.1-2025-04-14', label: 'GPT-4.1', type: 'openai'},
106110
];
107111

108112
// Default model selections for each provider
@@ -516,7 +520,8 @@ export class AIChatPanel extends UI.Panel.Panel {
516520
const existingOpenRouterModels = existingAllModels.filter((m: ModelOption) => m.type === 'openrouter');
517521

518522
// Update models based on what type of models we're adding
519-
let updatedOpenAIModels = existingOpenAIModels.length > 0 ? existingOpenAIModels : DEFAULT_OPENAI_MODELS;
523+
// Always use DEFAULT_OPENAI_MODELS for OpenAI to ensure we have the latest hardcoded list
524+
let updatedOpenAIModels = DEFAULT_OPENAI_MODELS;
520525
let updatedLiteLLMModels = existingLiteLLMModels;
521526
let updatedGroqModels = existingGroqModels;
522527
let updatedOpenRouterModels = existingOpenRouterModels;
@@ -651,6 +656,15 @@ export class AIChatPanel extends UI.Panel.Panel {
651656
return updatedOptions;
652657
}
653658

659+
/**
660+
* Clears cached model data to force refresh from defaults
661+
*/
662+
static clearModelCache(): void {
663+
localStorage.removeItem('ai_chat_all_model_options');
664+
localStorage.removeItem('ai_chat_model_options');
665+
logger.info('Cleared model cache - will use DEFAULT_OPENAI_MODELS on next refresh');
666+
}
667+
654668
/**
655669
* Removes a custom model from the options
656670
* @param modelName Name of the model to remove

0 commit comments

Comments
 (0)