mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
fix(voice): leave aliases a layer id already spells out of the alias hint
The set_layer_visibility layerId hint listed aliases such as "dams" for local-dams and "weather radar" for weather-radar, which the id in the enum already says. Leaving those out, and a layer with no other alias, cuts the Realtime prompt from 52,000 to 51,695 characters. Aliases the id does not spell (aqhi, hurricanes, clouds) stay, and the runner still accepts every alias. Refs #1363. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f2c6ff082d
commit
45ae1095da
4 files changed
+38
-7
No files matched your search
@@ -529,18 +529,29 @@ const SELF_EVIDENT_IDS = new Set([
|
||||
's2-ghostmaps',
|
||||
]);
|
||||
|
||||
/** Lower case with spaces and hyphens removed: "Data centers" → "datacenters". */
|
||||
const spelled = (text) => text.toLowerCase().replace(/[\s-]+/g, '');
|
||||
|
||||
/**
|
||||
* Compact model-facing alias hint: "alias/alias→id; …" for toggleable layers
|
||||
* whose id is not already the spoken word. At most two aliases per layer keep
|
||||
* the tool JSON small; the runner accepts the full alias list.
|
||||
* the tool JSON small; the runner accepts the full alias list. An alias the id
|
||||
* already spells ("dams"→local-dams, "weather radar"→weather-radar) is left
|
||||
* out, and so is a layer with no other alias.
|
||||
* @returns {string} One line for the layerId description.
|
||||
*/
|
||||
export function voiceLayerAliasHint() {
|
||||
return VOICE_LAYER_MANIFEST.filter(
|
||||
(entry) =>
|
||||
entry.toggle && entry.aliases.length && !SELF_EVIDENT_IDS.has(entry.id),
|
||||
(entry) => entry.toggle && !SELF_EVIDENT_IDS.has(entry.id),
|
||||
)
|
||||
.map((entry) => `${entry.aliases.slice(0, 2).join('/')}→${entry.id}`)
|
||||
.map((entry) => ({
|
||||
id: entry.id,
|
||||
aliases: entry.aliases
|
||||
.slice(0, 2)
|
||||
.filter((alias) => !spelled(entry.id).includes(spelled(alias))),
|
||||
}))
|
||||
.filter((entry) => entry.aliases.length)
|
||||
.map((entry) => `${entry.aliases.join('/')}→${entry.id}`)
|
||||
.join(';');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user