Context
Discovered during code review of #3167 (PR #3180). Pre-existing issue not introduced by that PR.
Problem
In src/views/tools/admin/VoiceTool.vue line 168:
aiResponse.value = (response.response as string) || (response.text as string) || 'No response received'
api.voiceSpeak() returns Promise<Record<string, unknown>>. The as string casts are unsafe — if the property is actually an object, number, or undefined, the value will be [object Object], "0", or silently pass through to the fallback.
Solution
Use proper type narrowing:
const text = typeof response.response === 'string' ? response.response
: typeof response.text === 'string' ? response.text
: 'No response received'
aiResponse.value = text
Or define a proper VoiceSpeakResponse interface (related to #3196).
Files
src/views/tools/admin/VoiceTool.vue:168
src/composables/useAutobotApi.ts:587 — voiceSpeak return type
Discovered During
Code review of PR #3180 (implementation of #3167)
Context
Discovered during code review of #3167 (PR #3180). Pre-existing issue not introduced by that PR.
Problem
In
src/views/tools/admin/VoiceTool.vueline 168:api.voiceSpeak()returnsPromise<Record<string, unknown>>. Theas stringcasts are unsafe — if the property is actually an object, number, or undefined, the value will be[object Object],"0", or silently pass through to the fallback.Solution
Use proper type narrowing:
Or define a proper
VoiceSpeakResponseinterface (related to #3196).Files
src/views/tools/admin/VoiceTool.vue:168src/composables/useAutobotApi.ts:587—voiceSpeakreturn typeDiscovered During
Code review of PR #3180 (implementation of #3167)