fix(voice): offer typed chat the same Overpass tools as voice

Main now offers osm_query, and names it in the prompt, only when Overpass
is configured. Typed chat follows the same switch on both providers: its
prompt, the tools it offers and the calls it accepts.
This commit is contained in:
manjunath22466 committed 2026-11-04 00:17:54 +05:30
1 parent fe78b3ebc9
commit 39165bb199
4 files changed
+59 -13

No files matched your search

+22
View File
@@ -4,6 +4,7 @@ import http from 'node:http';
import { once } from 'node:events';
import { createGeminiChatHandler } from '../server/providers/gemini/chat.js';
import { createOpenAiChatHandler } from '../server/providers/openai/chat.js';
import { GEV_REALTIME_TOOLS } from '../server/providers/openai/tools.js';
import {
realtimeDirectives,
realtimeInstructions,
@@ -514,6 +515,27 @@ for (const [name, provider] of Object.entries(providers)) {
assert.equal((await (await unread.send()).json()).code, 'API_KEY_REJECTED');
assert.equal(cancelled, true);
});
test(`${name} offers osm_query, and names it, only with Overpass, as voice does`, async (t) => {
for (const overpass of [false, true]) {
const f = await fixture(t, provider, undefined, {
tools: GEV_REALTIME_TOOLS,
overpassConfigured: () => overpass,
});
assert.equal((await f.send()).status, 200);
const { body } = f.calls[0];
const offered =
name === 'openai'
? body.tools.map((tool) => tool.function.name)
: body.tools[0].functionDeclarations.map((tool) => tool.name);
const prompt =
name === 'openai'
? body.messages[0].content
: body.systemInstruction.parts[0].text;
assert.equal(offered.includes('osm_query'), overpass);
assert.equal(prompt.includes('osm_query'), overpass);
assert.ok(offered.includes('resolve_area'));
}
});
test(`${name} throttled replies say they are rate limited`, async (t) => {
const local = await fixture(t, provider, undefined, {
resolveRateLimit: () => '1',