Skip to content

Commit

Permalink
readline bindings only on mac and windows
Browse files Browse the repository at this point in the history
  • Loading branch information
grota committed Dec 2, 2024
1 parent e78fea1 commit d800b5e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,12 @@ def chat(
Hold an ongoing chat with a model.
"""
# Left and right arrow keys to move cursor:
if sys.platform != "win32":
readline.parse_and_bind("\\e[D: backward-char")
readline.parse_and_bind("\\e[C: forward-char")
else:
if sys.platform == "win32":
readline.parse_and_bind("bind -x '\\e[D: backward-char'")
readline.parse_and_bind("bind -x '\\e[C: forward-char'")
elif sys.platform == "darwin":
readline.parse_and_bind("\\e[D: backward-char")
readline.parse_and_bind("\\e[C: forward-char")
log_path = logs_db_path()
(log_path.parent).mkdir(parents=True, exist_ok=True)
db = sqlite_utils.Database(log_path)
Expand Down

0 comments on commit d800b5e

Please sign in to comment.