ux(chat): tune silent-loop status nudge threshold to 6 rounds and strip leaked tool trace payloads from UI
This commit is contained in:
@@ -837,16 +837,16 @@ export async function POST(request: Request) {
|
||||
// guide the model to respond in plain text for conversational inputs.
|
||||
const toolDefs = activeMcpToken ? VIBN_TOOL_DEFINITIONS : [];
|
||||
|
||||
// Every 8 silent rounds or 12 tool calls, gently nudge the model to surface a one-liner
|
||||
// Every 6 silent rounds or 8 tool calls, gently nudge the model to surface a one-liner
|
||||
// status before continuing. This is the user's only signal of
|
||||
// life when a tool chain runs long, but we keep the threshold high so it doesn't distract.
|
||||
const isSilent = roundsSinceText >= 30 || toolCallsSinceText >= 12;
|
||||
// life when a tool chain runs long.
|
||||
const isSilent = roundsSinceText >= 6 || toolCallsSinceText >= 8;
|
||||
let extraSystem = isSilent
|
||||
? "\n\n[STATUS NUDGE] You have run " +
|
||||
`${toolCallsSinceText} tool call(s) over ${roundsSinceText} round(s) ` +
|
||||
"without sending the user any text. Before any more tool calls, " +
|
||||
"send ONE short sentence describing what you are currently working " +
|
||||
"on and why. The user is staring at silent tool pills."
|
||||
"on and why. The user is staring at a silent screen."
|
||||
: "";
|
||||
|
||||
// When withholding tools on round 1 (conversational guard), add a
|
||||
|
||||
@@ -479,6 +479,13 @@ function ThinkingBubble({ thoughts }: { thoughts: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function stripRawToolLogs(text: string): string {
|
||||
if (!text) return text;
|
||||
return text
|
||||
.replace(/(?:\r?\n)*\[tools executed this turn:[\s\S]*?\]/g, "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
const MessageBubble = React.memo(function MessageBubble({
|
||||
msg,
|
||||
}: {
|
||||
@@ -573,7 +580,7 @@ const MessageBubble = React.memo(function MessageBubble({
|
||||
<span
|
||||
style={proseWrap}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: renderMarkdown(msg.content),
|
||||
__html: renderMarkdown(stripRawToolLogs(msg.content)),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -666,7 +673,9 @@ function TimelineText({ text }: { text: string }) {
|
||||
>
|
||||
<span
|
||||
style={proseWrap}
|
||||
dangerouslySetInnerHTML={{ __html: renderMarkdown(text) }}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: renderMarkdown(stripRawToolLogs(text)),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user