Skip to content

Commit

Permalink
Fix windows bug where llm doesn't run <<llm chat>> on Windows issue #495
Browse files Browse the repository at this point in the history
 (#646)

* Fix windows bug where llm doesn't run <<llm chat>> on Windows issue #495

* Applied Black

---------

Co-authored-by: Sukhbinder Singh <sukhbindersingh@gmail.com>
Co-authored-by: Simon Willison <swillison@gmail.com>
  • Loading branch information
3 people authored Dec 1, 2024
1 parent f9af563 commit ac3d008
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,12 @@ def chat(
Hold an ongoing chat with a model.
"""
# Left and right arrow keys to move cursor:
readline.parse_and_bind("\\e[D: backward-char")
readline.parse_and_bind("\\e[C: forward-char")
if sys.platform != "win32":
readline.parse_and_bind("\\e[D: backward-char")
readline.parse_and_bind("\\e[C: forward-char")
else:
readline.parse_and_bind("bind -x '\\e[D: backward-char'")
readline.parse_and_bind("bind -x '\\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 ac3d008

Please sign in to comment.