Skip to content

Commit b4db88c

Browse files
committed
feat: show retired-provider message as inline chat response
1 parent 4882da7 commit b4db88c

1 file changed

Lines changed: 42 additions & 7 deletions

File tree

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { appendImages } from "@src/utils/imageUtils"
1313
import { getCostBreakdownIfNeeded } from "@src/utils/costFormatting"
1414

1515
import type { ClineAsk, ClineSayTool, ClineMessage, ExtensionMessage, AudioType } from "@roo-code/types"
16+
import { isRetiredProvider } from "@roo-code/types"
1617

1718
import { findLast } from "@roo/array"
1819
import { SuggestionItem } from "@roo-code/types"
@@ -39,11 +40,11 @@ import Announcement from "./Announcement"
3940
import BrowserActionRow from "./BrowserActionRow"
4041
import BrowserSessionStatusRow from "./BrowserSessionStatusRow"
4142
import ChatRow from "./ChatRow"
43+
import WarningRow from "./WarningRow"
4244
import { ChatTextArea } from "./ChatTextArea"
4345
import TaskHeader from "./TaskHeader"
4446
import SystemPromptWarning from "./SystemPromptWarning"
4547
import ProfileViolationWarning from "./ProfileViolationWarning"
46-
import RetiredProviderWarning from "./RetiredProviderWarning"
4748
import { CheckpointWarning } from "./CheckpointWarning"
4849
import { QueuedMessages } from "./QueuedMessages"
4950
import { WorktreeSelector } from "./WorktreeSelector"
@@ -100,6 +101,15 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
100101
showWorktreesInHomeScreen,
101102
} = useExtensionState()
102103

104+
// Show a WarningRow when the user sends a message with a retired provider.
105+
const [showRetiredProviderWarning, setShowRetiredProviderWarning] = useState(false)
106+
107+
// When the provider changes, clear the retired-provider warning.
108+
const providerName = apiConfiguration?.apiProvider
109+
useEffect(() => {
110+
setShowRetiredProviderWarning(false)
111+
}, [providerName])
112+
103113
const messagesRef = useRef(messages)
104114

105115
useEffect(() => {
@@ -609,6 +619,15 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
609619
text = text.trim()
610620

611621
if (text || images.length > 0) {
622+
// Intercept when the active provider is retired — show a
623+
// WarningRow instead of sending anything to the backend.
624+
if (apiConfiguration?.apiProvider && isRetiredProvider(apiConfiguration.apiProvider)) {
625+
setShowRetiredProviderWarning(true)
626+
setInputValue("")
627+
setSelectedImages([])
628+
return
629+
}
630+
612631
// Queue message if:
613632
// - Task is busy (sendingDisabled)
614633
// - API request in progress (isStreaming)
@@ -674,7 +693,14 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
674693
handleChatReset()
675694
}
676695
},
677-
[handleChatReset, markFollowUpAsAnswered, sendingDisabled, isStreaming, messageQueue.length], // messagesRef and clineAskRef are stable
696+
[
697+
handleChatReset,
698+
markFollowUpAsAnswered,
699+
sendingDisabled,
700+
isStreaming,
701+
messageQueue.length,
702+
apiConfiguration?.apiProvider,
703+
], // messagesRef and clineAskRef are stable
678704
)
679705

680706
const handleSetChatBoxMessage = useCallback(
@@ -692,7 +718,10 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
692718
[inputValue, selectedImages],
693719
)
694720

695-
const startNewTask = useCallback(() => vscode.postMessage({ type: "clearTask" }), [])
721+
const startNewTask = useCallback(() => {
722+
setShowRetiredProviderWarning(false)
723+
vscode.postMessage({ type: "clearTask" })
724+
}, [])
696725

697726
// Handle stop button click from textarea
698727
const handleStopTask = useCallback(() => {
@@ -1653,6 +1682,16 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
16531682
initialTopMostItemIndex={groupedMessages.length - 1}
16541683
/>
16551684
</div>
1685+
{showRetiredProviderWarning && (
1686+
<div className="px-[15px] py-1">
1687+
<WarningRow
1688+
title="Provider no longer supported"
1689+
message="Sorry, this provider is no longer supported. We saw very few Roo users actually using it and we need to reduce the surface area of our codebase so we can keep shipping fast and serving our community well in this space. It was a really hard decision but it lets us focus on what matters most to you. It sucks, we know."
1690+
actionText="Open Settings"
1691+
onAction={() => vscode.postMessage({ type: "switchTab", tab: "settings" })}
1692+
/>
1693+
</div>
1694+
)}
16561695
{areButtonsVisible && (
16571696
<div
16581697
className={`flex h-9 items-center mb-1 px-[15px] ${
@@ -1780,10 +1819,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
17801819
onEnqueueMessage={handleEnqueueCurrentMessage}
17811820
/>
17821821

1783-
<div className="px-3">
1784-
<RetiredProviderWarning />
1785-
</div>
1786-
17871822
{isProfileDisabled && (
17881823
<div className="px-3">
17891824
<ProfileViolationWarning />

0 commit comments

Comments
 (0)