mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-27 01:11:40 +00:00
refactor: enhance error handling in user prompts
- Updated exception handling in multiple prompt functions to catch NotImplementedError alongside ImportError, improving robustness across the application. - Ensured fallback mechanisms are clearly documented for better understanding of platform limitations.
This commit is contained in:
parent
cd66546e24
commit
3c5bf5b9d8
4 changed files with 8 additions and 8 deletions
|
|
@ -99,8 +99,8 @@ def prompt_choice(question: str, choices: list, default: int = 0) -> int:
|
|||
print() # Add newline after selection
|
||||
return idx
|
||||
|
||||
except ImportError:
|
||||
# Fallback to number-based selection
|
||||
except (ImportError, NotImplementedError):
|
||||
# Fallback to number-based selection (simple_term_menu doesn't support Windows)
|
||||
for i, choice in enumerate(choices):
|
||||
marker = "●" if i == default else "○"
|
||||
if i == default:
|
||||
|
|
@ -192,8 +192,8 @@ def prompt_checklist(title: str, items: list, pre_selected: list = None) -> list
|
|||
selected = list(terminal_menu.chosen_menu_indices or [])
|
||||
return selected
|
||||
|
||||
except ImportError:
|
||||
# Fallback: numbered toggle interface
|
||||
except (ImportError, NotImplementedError):
|
||||
# Fallback: numbered toggle interface (simple_term_menu doesn't support Windows)
|
||||
selected = set(pre_selected)
|
||||
|
||||
while True:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue