From 60e510b7abf867e35065018b75738f0a0eee51c7 Mon Sep 17 00:00:00 2001 From: Tyson Thomas Date: Thu, 7 Aug 2025 08:03:48 -0700 Subject: [PATCH 1/5] fix the schema extractor and bump version --- front_end/panels/ai_chat/core/Version.ts | 4 +- .../ai_chat/tools/SchemaBasedExtractorTool.ts | 40 ++++--------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/front_end/panels/ai_chat/core/Version.ts b/front_end/panels/ai_chat/core/Version.ts index 20e26400e78..fc354cd7101 100644 --- a/front_end/panels/ai_chat/core/Version.ts +++ b/front_end/panels/ai_chat/core/Version.ts @@ -3,8 +3,8 @@ // found in the LICENSE file. export const VERSION_INFO = { - version: '0.2.2', - buildDate: '2025-08-06', + version: '0.3.0', + buildDate: '2025-08-07', channel: 'stable' } as const; diff --git a/front_end/panels/ai_chat/tools/SchemaBasedExtractorTool.ts b/front_end/panels/ai_chat/tools/SchemaBasedExtractorTool.ts index 63085f97dbb..0e1eee92351 100644 --- a/front_end/panels/ai_chat/tools/SchemaBasedExtractorTool.ts +++ b/front_end/panels/ai_chat/tools/SchemaBasedExtractorTool.ts @@ -77,7 +77,7 @@ Schema Examples: async execute(args: SchemaExtractionArgs): Promise { logger.debug('Executing with args', args); - const { instruction, reasoning } = args; + const { schema, instruction, reasoning } = args; const agentService = AgentService.getInstance(); const apiKey = agentService.getApiKey(); @@ -89,30 +89,8 @@ Schema Examples: }; } - // Handle both old format (schema as string) and new format (schema as object) - let actualSchema: SchemaDefinition; - - if (typeof args.schema === 'string') { - // Old format: reconstruct the schema from separate fields - if (!args.properties) { - return { - success: false, - data: null, - error: 'Schema is required. When using string format, properties field is required. Please provide a JSON Schema definition. Example: {"type": "object", "properties": {"title": {"type": "string"}}}' - }; - } - - actualSchema = { - type: args.schema, - properties: args.properties, - ...(args.required && { required: args.required }) - }; - - logger.debug('Converted old format schema to new format:', actualSchema); - } else if (typeof args.schema === 'object' && args.schema !== null) { - // New format: use schema as-is - actualSchema = args.schema; - } else { + // Enhanced schema validation with helpful error messages + if (!schema) { return { success: false, data: null, @@ -149,7 +127,7 @@ Schema Examples: const rootNodeId: Protocol.DOM.NodeId | undefined = undefined; // 2. Transform schema to replace URL fields with numeric AX Node IDs (strings) - const [transformedSchema, urlPaths] = this.transformUrlFieldsToIds(actualSchema); + const [transformedSchema, urlPaths] = this.transformUrlFieldsToIds(schema); logger.debug('Transformed Schema:', JSON.stringify(transformedSchema, null, 2)); logger.debug('URL Paths:', urlPaths); @@ -227,7 +205,7 @@ Schema Examples: const finalData = await this.resolveUrlsWithLLM({ data: refinedData, apiKey, - schema: actualSchema, // Original schema to understand what fields are URLs + schema, // Original schema to understand what fields are URLs }); logger.debug('Data after URL resolution:', @@ -247,7 +225,7 @@ Schema Examples: instruction: instruction || 'Assess extraction completion', extractedData: finalData, // Use the final data with URLs for assessment domContent: treeText, // Pass the DOM content for context - schema: actualSchema, // Pass the schema to understand what was requested + schema, // Pass the schema to understand what was requested apiKey, }); @@ -878,13 +856,9 @@ Return ONLY a valid JSON object conforming to the required metadata schema.`; * Arguments for schema extraction */ export interface SchemaExtractionArgs { - schema: SchemaDefinition | string; // Support both object and string formats + schema: SchemaDefinition; instruction?: string; reasoning?: string; - // Support old format fields - properties?: Record; - required?: string[]; - type?: string; } /** From 40b04dff22733de3f8426626a1cc46bd31b8c167 Mon Sep 17 00:00:00 2001 From: Tyson Thomas Date: Thu, 7 Aug 2025 11:18:50 -0700 Subject: [PATCH 2/5] Add GPT 5 --- .../panels/ai_chat/LLM/OpenAIProvider.ts | 43 +++++++++++++++++-- front_end/panels/ai_chat/ui/AIChatPanel.ts | 18 +++++++- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts index ace7cfac2be..40470d04856 100644 --- a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts +++ b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts @@ -54,6 +54,10 @@ export class OpenAIProvider extends LLMBaseProvider { if (modelName.startsWith('o')) { return ModelFamily.O; } + // GPT-5 models also don't support temperature parameter, treat them like O-series + if (modelName.includes('gpt-5')) { + return ModelFamily.O; // Treat GPT-5 like O-series for parameter compatibility + } // Otherwise, assume it's a GPT model (gpt-3.5-turbo, gpt-4, etc.) return ModelFamily.GPT; } @@ -417,7 +421,7 @@ export class OpenAIProvider extends LLMBaseProvider { // Return hardcoded OpenAI models with their capabilities return [ { - id: 'gpt-4.1-2025-04-14', + id: 'gpt-5-2025-04-14', name: 'GPT-4.1', provider: 'openai', capabilities: { @@ -428,7 +432,7 @@ export class OpenAIProvider extends LLMBaseProvider { } }, { - id: 'gpt-4.1-mini-2025-04-14', + id: 'gpt-5-mini-2025-04-14', name: 'GPT-4.1 Mini', provider: 'openai', capabilities: { @@ -439,7 +443,7 @@ export class OpenAIProvider extends LLMBaseProvider { } }, { - id: 'gpt-4.1-nano-2025-04-14', + id: 'gpt-5-nano-2025-04-14', name: 'GPT-4.1 Nano', provider: 'openai', capabilities: { @@ -470,6 +474,39 @@ export class OpenAIProvider extends LLMBaseProvider { vision: false, structured: true } + }, + { + id: 'gpt-5-2025-08-07', + name: 'GPT-5', + provider: 'openai', + capabilities: { + functionCalling: true, + reasoning: true, + vision: true, + structured: true + } + }, + { + id: 'gpt-5-mini-2025-08-07', + name: 'GPT-5 Mini', + provider: 'openai', + capabilities: { + functionCalling: true, + reasoning: true, + vision: true, + structured: true + } + }, + { + id: 'gpt-5-nano-2025-08-07', + name: 'GPT-5 Nano', + provider: 'openai', + capabilities: { + functionCalling: true, + reasoning: true, + vision: true, + structured: true + } } ]; } diff --git a/front_end/panels/ai_chat/ui/AIChatPanel.ts b/front_end/panels/ai_chat/ui/AIChatPanel.ts index c5b76e3c2ab..97e412ae9f6 100644 --- a/front_end/panels/ai_chat/ui/AIChatPanel.ts +++ b/front_end/panels/ai_chat/ui/AIChatPanel.ts @@ -100,9 +100,13 @@ export interface ModelOption { // Add model options constant - these are the default OpenAI models const DEFAULT_OPENAI_MODELS: ModelOption[] = [ {value: 'o4-mini-2025-04-16', label: 'O4 Mini', type: 'openai'}, + {value: 'o3-mini-2025-01-31', label: 'O3 Mini', type: 'openai'}, + {value: 'gpt-5-2025-08-07', label: 'GPT-5', type: 'openai'}, + {value: 'gpt-5-mini-2025-08-07', label: 'GPT-5 Mini', type: 'openai'}, + {value: 'gpt-5-nano-2025-08-07', label: 'GPT-5 Nano', type: 'openai'}, + {value: 'gpt-4.1-2025-04-14', label: 'GPT-4.1', type: 'openai'}, {value: 'gpt-4.1-mini-2025-04-14', label: 'GPT-4.1 Mini', type: 'openai'}, {value: 'gpt-4.1-nano-2025-04-14', label: 'GPT-4.1 Nano', type: 'openai'}, - {value: 'gpt-4.1-2025-04-14', label: 'GPT-4.1', type: 'openai'}, ]; // Default model selections for each provider @@ -516,7 +520,8 @@ export class AIChatPanel extends UI.Panel.Panel { const existingOpenRouterModels = existingAllModels.filter((m: ModelOption) => m.type === 'openrouter'); // Update models based on what type of models we're adding - let updatedOpenAIModels = existingOpenAIModels.length > 0 ? existingOpenAIModels : DEFAULT_OPENAI_MODELS; + // Always use DEFAULT_OPENAI_MODELS for OpenAI to ensure we have the latest hardcoded list + let updatedOpenAIModels = DEFAULT_OPENAI_MODELS; let updatedLiteLLMModels = existingLiteLLMModels; let updatedGroqModels = existingGroqModels; let updatedOpenRouterModels = existingOpenRouterModels; @@ -651,6 +656,15 @@ export class AIChatPanel extends UI.Panel.Panel { return updatedOptions; } + /** + * Clears cached model data to force refresh from defaults + */ + static clearModelCache(): void { + localStorage.removeItem('ai_chat_all_model_options'); + localStorage.removeItem('ai_chat_model_options'); + logger.info('Cleared model cache - will use DEFAULT_OPENAI_MODELS on next refresh'); + } + /** * Removes a custom model from the options * @param modelName Name of the model to remove From 2e9b5b34419c3c6da05263d57b0544b45388e8d9 Mon Sep 17 00:00:00 2001 From: Tyson Thomas Date: Thu, 7 Aug 2025 11:21:57 -0700 Subject: [PATCH 3/5] bump version --- front_end/panels/ai_chat/core/Version.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front_end/panels/ai_chat/core/Version.ts b/front_end/panels/ai_chat/core/Version.ts index fc354cd7101..d2bcc5f2142 100644 --- a/front_end/panels/ai_chat/core/Version.ts +++ b/front_end/panels/ai_chat/core/Version.ts @@ -3,7 +3,7 @@ // found in the LICENSE file. export const VERSION_INFO = { - version: '0.3.0', + version: '0.3.1', buildDate: '2025-08-07', channel: 'stable' } as const; From 01a0bf9f95070f6447a86b9afc399f96c5d32fe5 Mon Sep 17 00:00:00 2001 From: Tyson Thomas Date: Thu, 7 Aug 2025 11:23:48 -0700 Subject: [PATCH 4/5] fix naming --- front_end/panels/ai_chat/LLM/OpenAIProvider.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts index 40470d04856..556a6bc13aa 100644 --- a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts +++ b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts @@ -421,7 +421,7 @@ export class OpenAIProvider extends LLMBaseProvider { // Return hardcoded OpenAI models with their capabilities return [ { - id: 'gpt-5-2025-04-14', + id: 'gpt-4-2025-04-14', name: 'GPT-4.1', provider: 'openai', capabilities: { @@ -432,7 +432,7 @@ export class OpenAIProvider extends LLMBaseProvider { } }, { - id: 'gpt-5-mini-2025-04-14', + id: 'gpt-4.1-mini-2025-04-14', name: 'GPT-4.1 Mini', provider: 'openai', capabilities: { @@ -443,7 +443,7 @@ export class OpenAIProvider extends LLMBaseProvider { } }, { - id: 'gpt-5-nano-2025-04-14', + id: 'gpt-4.1-nano-2025-04-14', name: 'GPT-4.1 Nano', provider: 'openai', capabilities: { From 6ba610337cec20c1ae02dacdc856ee2f91d84eea Mon Sep 17 00:00:00 2001 From: Tyson Thomas Date: Thu, 7 Aug 2025 11:26:26 -0700 Subject: [PATCH 5/5] fix naming --- front_end/panels/ai_chat/LLM/OpenAIProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts index 556a6bc13aa..b8c30ad3239 100644 --- a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts +++ b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts @@ -421,7 +421,7 @@ export class OpenAIProvider extends LLMBaseProvider { // Return hardcoded OpenAI models with their capabilities return [ { - id: 'gpt-4-2025-04-14', + id: 'gpt-4.1-2025-04-14', name: 'GPT-4.1', provider: 'openai', capabilities: {