Revert "Fix boolean logic for cost, apiReqCancelReason (they are never null)"

This reverts commit b5340915f7.
This commit is contained in:
Matt Rubens
2025-01-31 09:45:41 -05:00
parent d78da19a4a
commit a43bc8877e

View File

@@ -183,28 +183,26 @@ export const ChatRowContent = ({
</div>
)
return [
apiReqCancelReason ? (
apiReqCancelReason !== null ? (
apiReqCancelReason === "user_cancelled" ? (
getIconSpan("error", cancelledColor)
) : (
getIconSpan("error", errorColor)
)
) : cost ? (
) : cost !== null ? (
getIconSpan("check", successColor)
) : apiRequestFailedMessage ? (
getIconSpan("error", errorColor)
) : (
<ProgressIndicator />
),
apiReqCancelReason ? (
apiReqCancelReason !== null ? (
apiReqCancelReason === "user_cancelled" ? (
<span style={{ color: normalColor, fontWeight: "bold" }}>API Request Cancelled</span>
) : (
<span style={{ color: errorColor, fontWeight: "bold" }}>
API Streaming Failed ({JSON.stringify(apiReqCancelReason)})
</span>
<span style={{ color: errorColor, fontWeight: "bold" }}>API Streaming Failed</span>
)
) : cost ? (
) : cost !== null ? (
<span style={{ color: normalColor, fontWeight: "bold" }}>API Request</span>
) : apiRequestFailedMessage ? (
<span style={{ color: errorColor, fontWeight: "bold" }}>API Request Failed</span>
@@ -512,7 +510,9 @@ export const ChatRowContent = ({
style={{
...headerStyle,
marginBottom:
(!cost && apiRequestFailedMessage) || apiReqStreamingFailedMessage ? 10 : 0,
(cost === null && apiRequestFailedMessage) || apiReqStreamingFailedMessage
? 10
: 0,
justifyContent: "space-between",
cursor: "pointer",
userSelect: "none",
@@ -530,7 +530,7 @@ export const ChatRowContent = ({
</div>
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
</div>
{((!cost && apiRequestFailedMessage) || apiReqStreamingFailedMessage) && (
{((cost === null && apiRequestFailedMessage) || apiReqStreamingFailedMessage) && (
<>
<p style={{ ...pStyle, color: "var(--vscode-errorForeground)" }}>
{apiRequestFailedMessage || apiReqStreamingFailedMessage}