Revert "Enable AI to see images when using the read tool"

This reverts commit 2641252c6a.
This commit is contained in:
Alex Gleason committed 2026-03-28 22:21:17 -05:00
1 parent 2641252c6a
commit 34bfbb971b
3 files changed
+3 -38

No files matched your search

+1 -25
View File
@@ -4,7 +4,7 @@ import type { JSRuntimeFS } from './JSRuntime';
import { DotAI } from './DotAI';
import { parseProviderModel } from './parseProviderModel';
import { createAIClient } from './ai-client';
import type { Tool, ToolResultImage } from './tools/Tool';
import type { Tool } from './tools/Tool';
import type { NUser } from '@nostrify/react/login';
import type { AIProvider } from '@/contexts/AISettingsContext';
import { makeSystemPrompt } from './system';
@@ -656,11 +656,6 @@ export class SessionManager {
const result = await tool.execute(toolArgs);
await this.addToolMessage(projectId, functionToolCall.id, result.content);
// If tool returned images, inject a user message so the AI can "see" them
if (result.images?.length) {
await this.addToolImageMessage(projectId, result.images);
}
// Update session cost if tool returned a cost
if (result.cost !== undefined) {
const updatedSession = this.sessions.get(projectId);
@@ -804,25 +799,6 @@ export class SessionManager {
await this.addMessage(projectId, toolMessage);
}
/**
* Helper to inject a user message with images from tool results.
* Since tool messages only support text content, images are sent
* as a follow-up user message so vision models can actually see them.
*/
private async addToolImageMessage(projectId: string, images: ToolResultImage[]): Promise<void> {
const content: OpenAI.Chat.Completions.ChatCompletionContentPart[] = images.map((img) => ({
type: 'image_url' as const,
image_url: { url: img.url },
}));
const imageMessage: AIMessage = {
role: 'user',
content,
};
await this.addMessage(projectId, imageMessage);
}
/**
* Update session cost and context usage based on usage data
*/