소스 검색

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

This reverts commit b5340915f73ed7340c33a0c9b03c9648a88e73a4.
Matt Rubens 11 달 전
부모
커밋
a43bc8877e
1개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. 9 9
      webview-ui/src/components/chat/ChatRow.tsx

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

@@ -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" }}>
-								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>
 						<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}