mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(tui): yolo toggle only reports on/off for strict '0'/'1' values
Copilot on #14145 flagged that the shift+tab yolo handler treated any non-null RPC result as valid, so a response shape like {value: undefined} or {value: 'weird'} would incorrectly echo 'yolo off'. Now only '1' and '0' map to on/off; anything else (including missing value) surfaces as 'failed to toggle yolo', matching the null/catch branches.
This commit is contained in:
parent
b641639e42
commit
e0d698cfb3
1 changed files with 5 additions and 1 deletions
|
|
@ -386,7 +386,11 @@ export function useInputHandlers(ctx: InputHandlerContext): InputHandlerResult {
|
|||
|
||||
return void gateway
|
||||
.rpc<ConfigSetResponse>('config.set', { key: 'yolo', session_id: live.sid })
|
||||
.then(r => actions.sys(r ? `yolo ${r.value === '1' ? 'on' : 'off'}` : 'failed to toggle yolo'))
|
||||
.then(r =>
|
||||
actions.sys(
|
||||
r?.value === '1' ? 'yolo on' : r?.value === '0' ? 'yolo off' : 'failed to toggle yolo'
|
||||
)
|
||||
)
|
||||
.catch(() => actions.sys('failed to toggle yolo'))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue