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