mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-01 01:51:44 +00:00
fix(ui-tui): harden TUI error handling, model validation, command UX parity, and gateway lifecycle
This commit is contained in:
parent
783c6b6ed6
commit
aeb53131f3
15 changed files with 1303 additions and 309 deletions
|
|
@ -2,7 +2,7 @@ import { startTransition, useEffect, useRef, useState } from 'react'
|
|||
|
||||
import type { GatewayClient } from '../gatewayClient.js'
|
||||
|
||||
const TAB_PATH_RE = /((?:\.\.?\/|~\/|\/|@)[^\s]*)$/
|
||||
const TAB_PATH_RE = /((?:["']?(?:[A-Za-z]:[\\/]|\.{1,2}\/|~\/|\/|@|[^"'`\s]+\/))[^\s]*)$/
|
||||
|
||||
export function useCompletion(input: string, blocked: boolean, gw: GatewayClient) {
|
||||
const [completions, setCompletions] = useState<{ text: string; display: string; meta: string }[]>([])
|
||||
|
|
@ -59,7 +59,18 @@ export function useCompletion(input: string, blocked: boolean, gw: GatewayClient
|
|||
setCompReplace(isSlash ? (r?.replace_from ?? 1) : input.length - (pathWord?.length ?? 0))
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch((e: unknown) => {
|
||||
if (ref.current !== input) {
|
||||
return
|
||||
}
|
||||
|
||||
const meta = e instanceof Error && e.message ? e.message : 'unavailable'
|
||||
startTransition(() => {
|
||||
setCompletions([{ text: '', display: 'completion unavailable', meta }])
|
||||
setCompIdx(0)
|
||||
setCompReplace(isSlash ? 1 : input.length - (pathWord?.length ?? 0))
|
||||
})
|
||||
})
|
||||
}, 60)
|
||||
|
||||
return () => clearTimeout(t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue