From f7f78bd320354ccf5aa4deded26647b68f1f9816 Mon Sep 17 00:00:00 2001 From: Kedar Swami Date: Sat, 25 Jul 2026 16:46:04 +0530 Subject: [PATCH 1/2] feat(ai): add responses api format support for custom chat models --- .../src/components/AiChatSidebar/index.js | 17 +++++-- .../Preferences/AI/CompatEndpointCard.js | 15 +++++- .../src/components/Preferences/AI/index.js | 3 +- .../src/providers/ReduxStore/slices/chat.js | 2 + packages/bruno-electron/src/ipc/ai/chat.js | 15 +++++- packages/bruno-electron/src/ipc/ai/index.js | 5 +- .../bruno-electron/src/ipc/ai/providers.js | 49 +++++++++++++------ .../bruno-electron/src/store/preferences.js | 20 +++++++- 8 files changed, 99 insertions(+), 27 deletions(-) diff --git a/packages/bruno-app/src/components/AiChatSidebar/index.js b/packages/bruno-app/src/components/AiChatSidebar/index.js index e0120488c20..f64e12469a9 100644 --- a/packages/bruno-app/src/components/AiChatSidebar/index.js +++ b/packages/bruno-app/src/components/AiChatSidebar/index.js @@ -555,7 +555,8 @@ const AiChatSidebar = ({ collection, variant = 'sidebar' }) => { if (textareaRef.current) textareaRef.current.style.height = 'auto'; try { - await dispatch(sendAiMessage(activeTabUid, text, allContent, requestContext, selectedModel, contentType, aiVariables, appEnabled, aiRequests)); + const modelFormat = selectedModelEntry?.apiFormat || null; + await dispatch(sendAiMessage(activeTabUid, text, allContent, requestContext, selectedModel, modelFormat, contentType, aiVariables, appEnabled, aiRequests)); setProcessingStage('applying'); setTimeout(() => setProcessingStage(null), 500); } catch (err) { @@ -667,11 +668,17 @@ const AiChatSidebar = ({ collection, variant = 'sidebar' }) => { try { localStorage.setItem(SELECTED_MODEL_LS_KEY, modelId); } catch {} }; - const selectedModelLabel = useMemo(() => { - if (selectedModel === AUTO_MODEL_ID) return 'Auto'; - return availableModels.find((m) => m.id === selectedModel)?.label || 'Auto'; + const selectedModelEntry = useMemo(() => { + if (selectedModel === AUTO_MODEL_ID) return null; + return availableModels.find((m) => m.id === selectedModel) || null; }, [availableModels, selectedModel]); + const selectedModelLabel = useMemo(() => { + if (!selectedModelEntry) return 'Auto'; + const suffix = selectedModelEntry.apiFormat === 'responses' ? ' · Responses API' : ''; + return `${selectedModelEntry.label}${suffix}`; + }, [selectedModelEntry]); + const ModelSelectorTrigger = forwardRef((props, ref) => (
@@ -686,7 +693,7 @@ const AiChatSidebar = ({ collection, variant = 'sidebar' }) => { { id: AUTO_MODEL_ID, label: 'Auto', onClick: () => handleModelSelect(AUTO_MODEL_ID) }, ...availableModels.map((model) => ({ id: model.id, - label: model.label, + label: `${model.label}${model.apiFormat === 'responses' ? ' · Responses API' : ''}`, onClick: () => handleModelSelect(model.id) })) ], diff --git a/packages/bruno-app/src/components/Preferences/AI/CompatEndpointCard.js b/packages/bruno-app/src/components/Preferences/AI/CompatEndpointCard.js index 70fd64c4766..3bea07cb548 100644 --- a/packages/bruno-app/src/components/Preferences/AI/CompatEndpointCard.js +++ b/packages/bruno-app/src/components/Preferences/AI/CompatEndpointCard.js @@ -137,7 +137,8 @@ const CompatEndpointCard = ({ onAddModel({ id: uuid(), modelId: id, - label: newModelLabel.trim() || id + label: newModelLabel.trim() || id, + apiFormat: 'chat-completions' }); setNewModelId(''); setNewModelLabel(''); @@ -375,6 +376,7 @@ const CompatEndpointCard = ({ {models.map((model) => { const enabled = isModelEnabled(model.id); const disabled = !provider.configured || !providerEnabled; + const apiFormat = model.apiFormat || 'chat-completions'; return (
onUpdateModel(model.id, { modelId: e.target.value })} /> +