Skip to content

Commit a43bc88

Browse files
committed
Revert "Fix boolean logic for cost, apiReqCancelReason (they are never null)"
This reverts commit b534091.
1 parent d78da19 commit a43bc88

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,28 +183,26 @@ export const ChatRowContent = ({
183183
</div>
184184
)
185185
return [
186-
apiReqCancelReason ? (
186+
apiReqCancelReason !== null ? (
187187
apiReqCancelReason === "user_cancelled" ? (
188188
getIconSpan("error", cancelledColor)
189189
) : (
190190
getIconSpan("error", errorColor)
191191
)
192-
) : cost ? (
192+
) : cost !== null ? (
193193
getIconSpan("check", successColor)
194194
) : apiRequestFailedMessage ? (
195195
getIconSpan("error", errorColor)
196196
) : (
197197
<ProgressIndicator />
198198
),
199-
apiReqCancelReason ? (
199+
apiReqCancelReason !== null ? (
200200
apiReqCancelReason === "user_cancelled" ? (
201201
<span style={{ color: normalColor, fontWeight: "bold" }}>API Request Cancelled</span>
202202
) : (
203-
<span style={{ color: errorColor, fontWeight: "bold" }}>
204-
API Streaming Failed ({JSON.stringify(apiReqCancelReason)})
205-
</span>
203+
<span style={{ color: errorColor, fontWeight: "bold" }}>API Streaming Failed</span>
206204
)
207-
) : cost ? (
205+
) : cost !== null ? (
208206
<span style={{ color: normalColor, fontWeight: "bold" }}>API Request</span>
209207
) : apiRequestFailedMessage ? (
210208
<span style={{ color: errorColor, fontWeight: "bold" }}>API Request Failed</span>
@@ -512,7 +510,9 @@ export const ChatRowContent = ({
512510
style={{
513511
...headerStyle,
514512
marginBottom:
515-
(!cost && apiRequestFailedMessage) || apiReqStreamingFailedMessage ? 10 : 0,
513+
(cost === null && apiRequestFailedMessage) || apiReqStreamingFailedMessage
514+
? 10
515+
: 0,
516516
justifyContent: "space-between",
517517
cursor: "pointer",
518518
userSelect: "none",
@@ -530,7 +530,7 @@ export const ChatRowContent = ({
530530
</div>
531531
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
532532
</div>
533-
{((!cost && apiRequestFailedMessage) || apiReqStreamingFailedMessage) && (
533+
{((cost === null && apiRequestFailedMessage) || apiReqStreamingFailedMessage) && (
534534
<>
535535
<p style={{ ...pStyle, color: "var(--vscode-errorForeground)" }}>
536536
{apiRequestFailedMessage || apiReqStreamingFailedMessage}

0 commit comments

Comments
 (0)