mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
refactor(hud): share the warning line and trim the summary helpers
One provenanceLine() builds STATE | text | LAYERS for the HUD and get_hud_caption. hasWord is one lookaround regex, capAtWord one grapheme pass. Feed-state helpers are imported from layerSnapshot.js directly, and the kept-whole sanitizer cases are one table.
This commit is contained in:
1 parent
ab8691383b
commit
03c168d7c9
6 files changed
+93
-117
No files matched your search
@@ -4,6 +4,7 @@ import { suggestView } from '../views.js';
|
||||
import {
|
||||
feedProvenanceEnvelope,
|
||||
hudSummaryMatchesProvenance,
|
||||
provenanceLine,
|
||||
provenanceTag,
|
||||
} from '../../data/layerSnapshot.js';
|
||||
import { defineTool, ToolError } from '../catalog.js';
|
||||
@@ -258,15 +259,12 @@ export const getHudCaption = defineTool({
|
||||
throw new ToolError('unavailable', 'The caption service did not answer');
|
||||
// As on the HUD: the app's own state leads and its layers trail, and a
|
||||
// reply that names another state than the app's keeps only the place.
|
||||
const tag = provenanceTag(feedProvenance);
|
||||
const text = hudSummaryMatchesProvenance(response.data, feedProvenance)
|
||||
? words
|
||||
: area.label;
|
||||
const caption = tag
|
||||
? [tag.state.toUpperCase(), text, tag.names.join('/').toUpperCase()]
|
||||
.filter(Boolean)
|
||||
.join(' | ')
|
||||
: text;
|
||||
const caption = provenanceLine(
|
||||
hudSummaryMatchesProvenance(response.data, feedProvenance)
|
||||
? words
|
||||
: area.label,
|
||||
provenanceTag(feedProvenance),
|
||||
);
|
||||
return {
|
||||
summary: caption,
|
||||
data: {
|
||||
|
||||
Reference in new issue
Block a user