mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Cut the Google requests the HUD summary makes on its own
The HUD builds place context for its AI summary whenever the camera settles, and each build paid for up to four reverse geocodes plus a Nearby Places search, even when no OpenAI key was configured to use them. - Ask GET /api/openai/hud-summary/status once; with no summary configured, or after an unconfigured reply, make no place lookups for the page. - Reverse-geocode at most two points: the view center and one viewport point. - Reuse a lookup until the view center moves a quarter of the visible width, the camera's distance to it doubles or halves, or the camera crosses a lookup height. The reused points are asked again, so only a timeout, failure or empty answer spends. - Repaint the last AI reply when a small pan leaves the context unchanged. Cached-only hosts and voice context lookups are unchanged.
This commit is contained in:
1 parent
e608fee793
commit
c1f60cb7e7
13 files changed
+855
-15
No files matched your search
@@ -729,6 +729,29 @@ test('Realtime service configuration selects compatible endpoint/model without f
|
||||
assert.doesNotMatch(response.body, /server-fixture|voice\.example/);
|
||||
});
|
||||
|
||||
test('the HUD summary status says whether a summary is configured, without calling OpenAI', async (t) => {
|
||||
t.mock.method(globalThis, 'fetch', async () => {
|
||||
throw new Error('the status probe must not reach OpenAI');
|
||||
});
|
||||
const handler = install(openAiRealtimeProxy()).get('/api/openai/hud-summary');
|
||||
for (const [key, configured] of [
|
||||
[undefined, false],
|
||||
[' ', false],
|
||||
['fixture-key', true],
|
||||
]) {
|
||||
env(t, 'OPENAI_API_KEY', key);
|
||||
const response = await request(handler, { url: '/status' });
|
||||
assert.equal(response.status, 200);
|
||||
assert.deepEqual(response.json(), { configured });
|
||||
assert.equal(response.headers['cache-control'], 'no-store');
|
||||
}
|
||||
assert.equal(
|
||||
(await request(handler, { url: '/' })).status,
|
||||
405,
|
||||
'only the status path answers GET',
|
||||
);
|
||||
});
|
||||
|
||||
test('OpenAI routes answer generically when the upstream or the request fails', async (t) => {
|
||||
env(t, 'OPENAI_API_KEY', 'fixture-upstream-secret');
|
||||
env(t, 'GEV_RATELIMIT_OPENAI_PER_MIN', undefined);
|
||||
|
||||
Reference in new issue
Block a user