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