This commit is contained in:
seb
2026-10-07 19:47:19 +02:00
parent 4cc8c49cf1
commit 79e67f2be6

View File

@@ -104,7 +104,7 @@ function parseMessagePayload(raw) {
try {
const parsed = JSON.parse(raw);
if (parsed && typeof parsed === 'object') return parsed;
} catch {}
} catch { }
return { content: raw };
}
@@ -119,7 +119,7 @@ function formatUsageText(usage) {
return `${fmt(input)} Prompt${cachedPart} · ${fmt(output)} Antwort${cost}`;
}
function formatToolTooltip(content, result, parameters, prefix) {
function formatToolTooltip(content, result, parameters, prefix, error) {
const parts = [];
if (prefix) {
@@ -150,13 +150,32 @@ function formatToolTooltip(content, result, parameters, prefix) {
}
}
if (result !== undefined && result !== null) {
if (result !== undefined && result !== null && result !== '') {
try {
const resStr = typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result);
if (!parts.some((p) => p.includes(resStr))) {
if (!parts.includes(resStr)) {
parts.push(resStr);
}
} catch {}
} catch {
const resStr = String(result);
if (!parts.includes(resStr)) {
parts.push(resStr);
}
}
}
if (error !== undefined && error !== null && error !== '') {
try {
const errStr = typeof error === 'object' ? JSON.stringify(error, null, 2) : String(error);
if (!parts.includes(errStr)) {
parts.push(errStr);
}
} catch {
const errStr = String(error);
if (!parts.includes(errStr)) {
parts.push(errStr);
}
}
}
return parts.join('\n\n') || '';
@@ -188,7 +207,6 @@ class ClickTooltip extends PureComponent {
enterDelay={0}
leaveDelay={0}
TransitionProps={{ timeout: 0 }}
slotProps={{ transition: { timeout: 0 } }}
title={title}
arrow
placement="top"
@@ -256,7 +274,7 @@ function extractReasoningText(msg, payload) {
if (inner.plain && typeof inner.plain === 'string' && inner.plain.trim()) {
return inner.plain.trim();
}
} catch {}
} catch { }
return '';
}
return trimmed;
@@ -271,7 +289,7 @@ function extractReasoningText(msg, payload) {
if (parsed.plain && typeof parsed.plain === 'string' && parsed.plain.trim()) {
return parsed.plain.trim();
}
} catch {}
} catch { }
return '';
}
if (!raw.startsWith('{')) {
@@ -798,7 +816,7 @@ export function normalizeChatMessages(rawMessages = []) {
let args = {};
try {
args = typeof tc.function?.arguments === 'string' ? JSON.parse(tc.function.arguments) : (tc.function?.arguments || {});
} catch {}
} catch { }
const isAskUser = tc.function?.name === 'ask_user';
const existing = !isAskUser && tc.id ? findExistingTool(tc.id) : null;
@@ -854,7 +872,7 @@ function MessageRow({ msg, showTime = true }) {
if (nested && typeof nested === 'object' && nested.content !== undefined) {
textContent = nested.content;
}
} catch {}
} catch { }
}
const { attachments: vfsAttachments, cleanText } = parseAttachmentsFromText(textContent);
@@ -1055,8 +1073,8 @@ export default class ChatFlowList extends PureComponent {
{/* Live streaming turns */}
{activeTurns && activeTurns.length > 0
? activeTurns.map((turn, idx) => (
<TurnRow key={turn.id || idx} turn={turn} isLive={true} />
))
<TurnRow key={turn.id || idx} turn={turn} isLive={true} />
))
: null}
<div ref={this.bottomRef} style={{ height: 1, flexShrink: 0 }} />