openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Make autocomplete debounce / max-chars / overlay-timeout editable in Settings

Open obchain opened this issue 6 months ago • 1 comments

Summary

Surface the autocomplete tuning fields — debounce (ms), max context characters, and overlay timeout (ms) — as editable inputs in Settings → Features → Autocomplete. The core config and autocomplete.set_style RPC already support all three; the main panel loads them but only passes them through on save, so today they can only be viewed (in the debug panel), never changed from the normal settings UI.

Problem

AutocompleteConfig (src/openhuman/config/schema/autocomplete.rs) defines debounce_ms, max_chars, and overlay_ttl_ms, and openhuman.autocomplete_set_style persists them. AutocompletePanel.tsx reads them into fullConfigRef and re-sends the loaded values on every save — but renders no input for them. A user who wants snappier suggestions (lower debounce) or a longer-lived overlay has no way to change these without editing config files by hand.

Solution (optional)

  • Add three number inputs to AutocompletePanel, seeded from the loaded config and bound to local state.
  • saveConfig already sends debounce_ms / max_chars / overlay_ttl_ms through autocomplete_set_style; point them at the new state instead of the passthrough ref.
  • Clamp to safe minimums (max_chars >= 1, others >= 0). i18n keys for the labels across all locale chunks.
  • App-only change; no Rust/RPC change needed.

Acceptance criteria

  • [ ] Inputs visible + seeded — the three tuning fields render in the Autocomplete settings panel, pre-filled from the saved config.
  • [ ] Edits persist — changing a value and saving calls autocomplete_set_style with the edited number and it round-trips on reload.
  • [ ] Clamped — non-positive / empty entries fall back to safe minimums.
  • [ ] Tests added — Vitest covers seeding, edit-and-save, and clamping.
  • [ ] Diff coverage >= 80% — the implementing PR meets the changed-lines coverage gate.

Related

  • Config schema: src/openhuman/config/schema/autocomplete.rs
  • RPC: openhuman.autocomplete_set_style (src/openhuman/autocomplete/schemas.rs)

obchain avatar May 29 '26 18:05 obchain

Picking this one up. The config + set_style RPC already support these three fields; the panel just never rendered them, so I'll add the inputs wired to the existing save path plus tests.

obchain avatar May 29 '26 18:05 obchain