feat: controlBrowser 'search' action + one-sentence voice replies
- Add a one-shot `search` action (site=naver/google/daum/youtube/bing) that navigates the on-screen browser straight to the results page, so a small model can satisfy "search X on Naver" in a single tool call instead of a fragile navigate->type->enter chain. - Sharpen the tool description to steer the router to controlBrowser (not webSearch) for anything that should happen IN the visible browser. - System prompt: answer in one short sentence (voice assistant) — also cuts TTS time. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -97,6 +97,32 @@ try {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'search': {
|
||||
// One-shot "search on a site": build the engine's results URL so a small
|
||||
// model doesn't have to chain navigate->type->enter. Visible on screen.
|
||||
const q = String(cmd.query || '').trim();
|
||||
if (!q) throw new Error('search: no query');
|
||||
const site = String(cmd.site || 'google').toLowerCase();
|
||||
const engines = {
|
||||
naver: 'https://search.naver.com/search.naver?query=',
|
||||
google: 'https://www.google.com/search?q=',
|
||||
daum: 'https://search.daum.net/search?q=',
|
||||
youtube: 'https://www.youtube.com/results?search_query=',
|
||||
bing: 'https://www.bing.com/search?q=',
|
||||
};
|
||||
const base = engines[site] || engines.google;
|
||||
const target = base + encodeURIComponent(q);
|
||||
await front(page);
|
||||
if (HAS_XDOTOOL && cmd.human !== false) {
|
||||
try { await human.navigateOmnibox(target); await page.waitForLoadState('domcontentloaded').catch(() => {}); }
|
||||
catch { await page.goto(target, { waitUntil: 'domcontentloaded' }); }
|
||||
} else {
|
||||
await page.goto(target, { waitUntil: 'domcontentloaded' });
|
||||
}
|
||||
out({ ok: true, site: engines[site] ? site : 'google', query: q, url: page.url(), title: await page.title().catch(() => '') });
|
||||
break;
|
||||
}
|
||||
|
||||
case 'back': await front(page); await page.goBack({ waitUntil: 'domcontentloaded' }).catch(() => {}); out({ ok: true, url: page.url() }); break;
|
||||
case 'forward': await front(page); await page.goForward({ waitUntil: 'domcontentloaded' }).catch(() => {}); out({ ok: true, url: page.url() }); break;
|
||||
case 'refresh': await front(page); await reload(); out({ ok: true, url: page.url() }); break;
|
||||
|
||||
Reference in New Issue
Block a user