@@ -15,3 +15,13 @@ export function parseHudSidecar(text) {
|
||||
try { hud = JSON.parse(match[1]); } catch { hud = { error: 'invalid hud sidecar' }; }
|
||||
return { spoken: source.replace(match[0], '').trim(), hud };
|
||||
}
|
||||
|
||||
export function spokenReply(reply) {
|
||||
if (reply == null) return '';
|
||||
const text = typeof reply === 'string' ? reply
|
||||
: typeof reply.text === 'string' ? reply.text
|
||||
: typeof reply.message === 'string' ? reply.message
|
||||
: '';
|
||||
if (!text || text === '[object Object]') return '';
|
||||
return parseHudSidecar(text).spoken;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user