From 0d524f7c367249ef60d5c1e4d115be853c514efe Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 7 Dec 2025 20:52:38 -0600 Subject: [PATCH] Revert "Use currently-selected model to generate images if it supports image output modality" This reverts commit c2ccc3e60bf710db1a1f2d0a6e12cfb11e7f84e6. --- src/components/Shakespeare/ChatPane.tsx | 56 ++++++------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/src/components/Shakespeare/ChatPane.tsx b/src/components/Shakespeare/ChatPane.tsx index 2d2351d4..cf268a52 100644 --- a/src/components/Shakespeare/ChatPane.tsx +++ b/src/components/Shakespeare/ChatPane.tsx @@ -186,60 +186,30 @@ export const ChatPane = forwardRef(({ tools.deploy_project = new DeployProjectTool(fs, cwd, user.signer, projectId); } - // Add generate_image tool if: - // 1. The currently selected model supports image output modality, OR - // 2. An imageModel is configured (as fallback) - const currentModelData = models.find(m => m.fullId === providerModel.trim()); - const currentModelSupportsImageOutput = currentModelData?.modalities?.includes('image'); - - let imageModelToUse: string | undefined; - let imageProviderData: { provider: ReturnType['provider']; model: string; modalities?: string[] } | undefined; - - // Prefer currently selected model if it supports image output - if (currentModelSupportsImageOutput && providerModel.trim()) { - imageModelToUse = providerModel.trim(); - try { - const { provider, model } = parseProviderModel(imageModelToUse, settings.providers); - imageProviderData = { - provider, - model, - modalities: currentModelData?.modalities, - }; - } catch (error) { - console.warn('Failed to parse current model for image generation:', error); - } - } - // Fallback to configured imageModel if available - else if (settings.imageModel) { - imageModelToUse = settings.imageModel; + // Add generate_image tool if imageModel is configured + if (settings.imageModel) { try { const { provider, model } = parseProviderModel(settings.imageModel, settings.providers); + + // Find the model data to get modalities const providerModel = models.find(m => m.fullId === settings.imageModel); - imageProviderData = { + + tools.generate_image = new GenerateImageTool( + fs, + tmpPath, provider, model, - modalities: providerModel?.modalities, - }; + providerModel?.modalities, + user, + config.corsProxy + ); } catch (error) { console.warn('Failed to parse imageModel:', error); } } - // Add the tool if we have a valid image model - if (imageProviderData) { - tools.generate_image = new GenerateImageTool( - fs, - tmpPath, - imageProviderData.provider, - imageProviderData.model, - imageProviderData.modalities, - user, - config.corsProxy - ); - } - return tools; - }, [fs, git, cwd, user, projectId, projectsPath, tmpPath, pluginsPath, config.corsProxy, settings.imageModel, settings.providers, models, providerModel, handleFileChanged]); + }, [fs, git, cwd, user, projectId, projectsPath, tmpPath, pluginsPath, config.corsProxy, settings.imageModel, settings.providers, models, handleFileChanged]); // MCP tools wrapped for execution const mcpToolWrappers = useMemo(() => createMCPTools(mcpClients), [mcpClients]);