|
@@ -89,7 +89,7 @@ export const ChatRowContent = ({
|
|
|
}
|
|
}
|
|
|
}, [isLast, message.say])
|
|
}, [isLast, message.say])
|
|
|
const [cost, apiReqCancelReason, apiReqStreamingFailedMessage] = useMemo(() => {
|
|
const [cost, apiReqCancelReason, apiReqStreamingFailedMessage] = useMemo(() => {
|
|
|
- if (message.text != null && message.say === "api_req_started") {
|
|
|
|
|
|
|
+ if (message.text !== null && message.text !== undefined && message.say === "api_req_started") {
|
|
|
const info: ClineApiReqInfo = JSON.parse(message.text)
|
|
const info: ClineApiReqInfo = JSON.parse(message.text)
|
|
|
return [info.cost, info.cancelReason, info.streamingFailedMessage]
|
|
return [info.cost, info.cancelReason, info.streamingFailedMessage]
|
|
|
}
|
|
}
|
|
@@ -183,26 +183,26 @@ export const ChatRowContent = ({
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
return [
|
|
return [
|
|
|
- apiReqCancelReason != null ? (
|
|
|
|
|
|
|
+ apiReqCancelReason !== null && apiReqCancelReason !== undefined ? (
|
|
|
apiReqCancelReason === "user_cancelled" ? (
|
|
apiReqCancelReason === "user_cancelled" ? (
|
|
|
getIconSpan("error", cancelledColor)
|
|
getIconSpan("error", cancelledColor)
|
|
|
) : (
|
|
) : (
|
|
|
getIconSpan("error", errorColor)
|
|
getIconSpan("error", errorColor)
|
|
|
)
|
|
)
|
|
|
- ) : cost != null ? (
|
|
|
|
|
|
|
+ ) : cost !== null && cost !== undefined ? (
|
|
|
getIconSpan("check", successColor)
|
|
getIconSpan("check", successColor)
|
|
|
) : apiRequestFailedMessage ? (
|
|
) : apiRequestFailedMessage ? (
|
|
|
getIconSpan("error", errorColor)
|
|
getIconSpan("error", errorColor)
|
|
|
) : (
|
|
) : (
|
|
|
<ProgressIndicator />
|
|
<ProgressIndicator />
|
|
|
),
|
|
),
|
|
|
- apiReqCancelReason != null ? (
|
|
|
|
|
|
|
+ apiReqCancelReason !== null && apiReqCancelReason !== undefined ? (
|
|
|
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</span>
|
|
<span style={{ color: errorColor, fontWeight: "bold" }}>API Streaming Failed</span>
|
|
|
)
|
|
)
|
|
|
- ) : cost != null ? (
|
|
|
|
|
|
|
+ ) : cost !== null && cost !== undefined ? (
|
|
|
<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>
|
|
@@ -510,7 +510,8 @@ export const ChatRowContent = ({
|
|
|
style={{
|
|
style={{
|
|
|
...headerStyle,
|
|
...headerStyle,
|
|
|
marginBottom:
|
|
marginBottom:
|
|
|
- (cost == null && apiRequestFailedMessage) || apiReqStreamingFailedMessage
|
|
|
|
|
|
|
+ ((cost === null || cost === undefined) && apiRequestFailedMessage) ||
|
|
|
|
|
+ apiReqStreamingFailedMessage
|
|
|
? 10
|
|
? 10
|
|
|
: 0,
|
|
: 0,
|
|
|
justifyContent: "space-between",
|
|
justifyContent: "space-between",
|
|
@@ -524,13 +525,15 @@ export const ChatRowContent = ({
|
|
|
<div style={{ display: "flex", alignItems: "center", gap: "10px", flexGrow: 1 }}>
|
|
<div style={{ display: "flex", alignItems: "center", gap: "10px", flexGrow: 1 }}>
|
|
|
{icon}
|
|
{icon}
|
|
|
{title}
|
|
{title}
|
|
|
- <VSCodeBadge style={{ opacity: cost != null && cost > 0 ? 1 : 0 }}>
|
|
|
|
|
|
|
+ <VSCodeBadge
|
|
|
|
|
+ style={{ opacity: cost !== null && cost !== undefined && cost > 0 ? 1 : 0 }}>
|
|
|
${Number(cost || 0)?.toFixed(4)}
|
|
${Number(cost || 0)?.toFixed(4)}
|
|
|
</VSCodeBadge>
|
|
</VSCodeBadge>
|
|
|
</div>
|
|
</div>
|
|
|
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
|
|
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
|
|
|
</div>
|
|
</div>
|
|
|
- {((cost == null && apiRequestFailedMessage) || apiReqStreamingFailedMessage) && (
|
|
|
|
|
|
|
+ {(((cost === null || cost === undefined) && apiRequestFailedMessage) ||
|
|
|
|
|
+ apiReqStreamingFailedMessage) && (
|
|
|
<>
|
|
<>
|
|
|
<p style={{ ...pStyle, color: "var(--vscode-errorForeground)" }}>
|
|
<p style={{ ...pStyle, color: "var(--vscode-errorForeground)" }}>
|
|
|
{apiRequestFailedMessage || apiReqStreamingFailedMessage}
|
|
{apiRequestFailedMessage || apiReqStreamingFailedMessage}
|