Skip to content

Commit 9a40cde

Browse files
committed
add condense_context_error ClineMessage
1 parent 381196e commit 9a40cde

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

packages/types/src/message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const clineSays = [
5050
"rooignore_error",
5151
"diff_error",
5252
"condense_context",
53+
"condense_context_error",
5354
"codebase_search_result",
5455
] as const
5556

src/core/task/Task.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ export class Task extends EventEmitter<ClineEvents> {
528528
)
529529
if (error) {
530530
this.say(
531-
"error",
531+
"condense_context_error",
532532
error,
533533
undefined /* images */,
534534
false /* partial */,
@@ -1610,7 +1610,7 @@ export class Task extends EventEmitter<ClineEvents> {
16101610
await this.overwriteApiConversationHistory(truncateResult.messages)
16111611
}
16121612
if (truncateResult.error) {
1613-
await this.say("error", truncateResult.error)
1613+
await this.say("condense_context_error", truncateResult.error)
16141614
} else if (truncateResult.summary) {
16151615
const { summary, cost, prevContextTokens, newContextTokens = 0 } = truncateResult
16161616
const contextCondense: ContextCondense = { summary, cost, newContextTokens, prevContextTokens }

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { Markdown } from "./Markdown"
3535
import { CommandExecution } from "./CommandExecution"
3636
import { CommandExecutionError } from "./CommandExecutionError"
3737
import { AutoApprovedRequestLimitWarning } from "./AutoApprovedRequestLimitWarning"
38-
import { CondensingContextRow, ContextCondenseRow } from "./ContextCondenseRow"
38+
import { CondenseContextErrorRow, CondensingContextRow, ContextCondenseRow } from "./ContextCondenseRow"
3939
import CodebaseSearchResultsDisplay from "./CodebaseSearchResultsDisplay"
4040

4141
interface ChatRowProps {
@@ -969,6 +969,8 @@ export const ChatRowContent = ({
969969
return <CondensingContextRow />
970970
}
971971
return message.contextCondense ? <ContextCondenseRow {...message.contextCondense} /> : null
972+
case "condense_context_error":
973+
return <CondenseContextErrorRow errorText={message.text} />
972974
case "codebase_search_result":
973975
let parsed: {
974976
content: {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,14 @@ export const CondensingContextRow = () => {
5959
</div>
6060
)
6161
}
62+
63+
export const CondenseContextErrorRow = ({ errorText }: { errorText?: string }) => {
64+
const { t } = useTranslation()
65+
return (
66+
<div className="flex items-center gap-2">
67+
<span className="text-sm text-vscode-editorWarning-foreground opacity-80 mb-[0.125rem]"></span>
68+
<span className="font-bold text-vscode-foreground">{t("common:contextCondense.errorHeader")}</span>
69+
<span className="text-vscode-descriptionForeground text-sm">{errorText}</span>
70+
</div>
71+
)
72+
}

0 commit comments

Comments
 (0)