diff --git a/src/shared/combineCommandSequences.ts b/src/shared/combineCommandSequences.ts index 3e41cd2df9..6d1878149c 100644 --- a/src/shared/combineCommandSequences.ts +++ b/src/shared/combineCommandSequences.ts @@ -25,13 +25,13 @@ export function combineCommandSequences(messages: ClineMessage[]): ClineMessage[ // First pass: combine commands with their outputs for (let i = 0; i < messages.length; i++) { - if (messages[i].type === "ask" && (messages[i].ask === "command" || messages[i].say === "command")) { + if (messages[i].ask === "command" || messages[i].say === "command") { let combinedText = messages[i].text || "" let didAddOutput = false let j = i + 1 while (j < messages.length) { - if (messages[j].type === "ask" && (messages[j].ask === "command" || messages[j].say === "command")) { + if (messages[j].ask === "command" || messages[j].say === "command") { // Stop if we encounter the next command break } @@ -63,7 +63,7 @@ export function combineCommandSequences(messages: ClineMessage[]): ClineMessage[ return messages .filter((msg) => !(msg.ask === "command_output" || msg.say === "command_output")) .map((msg) => { - if (msg.type === "ask" && (msg.ask === "command" || msg.say === "command")) { + if (msg.ask === "command" || msg.say === "command") { const combinedCommand = combinedCommands.find((cmd) => cmd.ts === msg.ts) return combinedCommand || msg } diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index b9fbcbd2aa..0f11b0a677 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -3,17 +3,8 @@ import React, { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, us import DynamicTextArea from "react-textarea-autosize" import { useClickAway, useWindowSize } from "react-use" import styled from "styled-components" -import { - anthropicDefaultModelId, - bedrockDefaultModelId, - deepSeekDefaultModelId, - geminiDefaultModelId, - mistralDefaultModelId, - openAiNativeDefaultModelId, - openRouterDefaultModelId, - vertexDefaultModelId, -} from "../../../../src/shared/api" import { mentionRegex, mentionRegexGlobal } from "../../../../src/shared/context-mentions" +import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage" import { useExtensionState } from "../../context/ExtensionStateContext" import { ContextMenuOptionType, @@ -26,7 +17,7 @@ import { validateApiConfiguration, validateModelId } from "../../utils/validate" import { vscode } from "../../utils/vscode" import { CODE_BLOCK_BG_COLOR } from "../common/CodeBlock" import Thumbnails from "../common/Thumbnails" -import ApiOptions from "../settings/ApiOptions" +import ApiOptions, { normalizeApiConfiguration } from "../settings/ApiOptions" import { MAX_IMAGES_PER_MESSAGE } from "./ChatView" import ContextMenu from "./ContextMenu" @@ -686,35 +677,19 @@ const ChatTextArea = forwardRef( // Get model display name const modelDisplayName = useMemo(() => { + const { selectedProvider, selectedModelId } = normalizeApiConfiguration(apiConfiguration) const unknownModel = "unknown" if (!apiConfiguration) return unknownModel - switch (apiConfiguration.apiProvider) { + switch (selectedProvider) { case "anthropic": - return `anthropic:${apiConfiguration.apiModelId || anthropicDefaultModelId}` - case "openai": - return `openai:${apiConfiguration.openAiModelId || unknownModel}` case "openrouter": - return `openrouter:${apiConfiguration.openRouterModelId || openRouterDefaultModelId}` - case "bedrock": - return `bedrock:${apiConfiguration.apiModelId || bedrockDefaultModelId}` - case "vertex": - return `vertex:${apiConfiguration.apiModelId || vertexDefaultModelId}` - case "ollama": - return `ollama:${apiConfiguration.ollamaModelId || unknownModel}` - case "lmstudio": - return `lmstudio:${apiConfiguration.lmStudioModelId || unknownModel}` - case "gemini": - return `gemini:${apiConfiguration.apiModelId || geminiDefaultModelId}` - case "openai-native": - return `openai-native:${apiConfiguration.apiModelId || openAiNativeDefaultModelId}` - case "deepseek": - return `deepseek:${apiConfiguration.apiModelId || deepSeekDefaultModelId}` - case "mistral": - return `mistral:${apiConfiguration.apiModelId || mistralDefaultModelId}` + return `${selectedProvider}:${selectedModelId}` + case "openai": + return `openai-compat:${selectedModelId}` case "vscode-lm": return `vscode-lm:${apiConfiguration.vsCodeLmModelSelector ? `${apiConfiguration.vsCodeLmModelSelector.vendor ?? ""}/${apiConfiguration.vsCodeLmModelSelector.family ?? ""}` : unknownModel}` default: - return unknownModel + return `${selectedProvider}:${selectedModelId}` } }, [apiConfiguration])