fix(ai): use "(no tool output)" placeholder for empty tool results without images (#6290)
OpenAI Completions and Responses providers unconditionally replaced empty tool result text with "(see attached image)", even when the result had no image content. This caused the model to hallucinate image attachments for commands that produce no output (e.g. curl -s with SSL errors, grep with no matches, true/false). Now matches the Google provider behavior: "(see attached image)" is only used when images are actually present; empty results get "(no tool output)". Co-authored-by: tzwm <tzwm@users.noreply.github.com> Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
This commit is contained in:
@@ -251,7 +251,7 @@ export function convertResponsesMessages<TApi extends Api>(
|
||||
|
||||
output = contentParts;
|
||||
} else {
|
||||
output = sanitizeSurrogates(hasText ? textResult : "(see attached image)");
|
||||
output = sanitizeSurrogates(hasText ? textResult : hasImages ? "(see attached image)" : "(no tool output)");
|
||||
}
|
||||
|
||||
messages.push({
|
||||
|
||||
Reference in New Issue
Block a user