This commit is contained in:
seb
2026-10-05 14:54:23 +02:00
parent 5f9231f8fd
commit f55990c25e
5 changed files with 17 additions and 10 deletions

View File

@@ -381,7 +381,10 @@ export function createAnalyzeImageTool({ googleAuthId, model }) {
role: 'user',
content: [
{ type: 'text', text },
{ type: 'image_url', imageUrl: { url: `data:image/webp;base64,${webp.toString('base64')}` } },
{
type: 'image_url',
image_url: { url: `data:image/webp;base64,${webp.toString('base64')}` },
},
],
},
],

View File

@@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import sharp from 'sharp';
import { defineTool, ToolError } from 'libllmorbiter';
import env from '../config/env.js';
import * as dbCompanySetting from '../db/companysetting.js';
import { prepareVfs, syncVfsToDb } from './vfs.js';
const SERPER_ENDPOINT = 'https://google.serper.dev/images';
@@ -175,10 +175,17 @@ export function createSearchImagesTool({ googleAuthId }) {
}
const wanted = Math.min(count, MAX_COUNT);
const apiKey = env.serperApiKey?.trim();
let apiKey = null;
try {
const setting = await dbCompanySetting.getByKey(googleAuthId, 'keys.serper', { maskWriteonly: false });
apiKey = setting?.value?.trim() || null;
} catch (err) {
console.warn('search_images: failed to read company setting keys.serper:', err?.message || err);
}
if (!apiKey) {
throw new ToolError(
'search_images is unavailable: SERPER_API_KEY is not configured on the server. ' +
'search_images is unavailable: Serper API key not configured (companysetting: keys.serper). ' +
'Use a direct image URL with javascript_execute instead.'
);
}