fix: readline error on Windows (#139)
With this change, `pyreadline3` is automatically installed on OS `win32` only. Linux/Mac doesn't need it.
This commit is contained in:
parent
efee9589fa
commit
aff7350eec
2 changed files with 9 additions and 1 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import readline
|
|
||||||
import threading
|
import threading
|
||||||
import uuid
|
import uuid
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
@ -234,6 +233,14 @@ def chat(
|
||||||
"""
|
"""
|
||||||
Chat with a language model.
|
Chat with a language model.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
import readline
|
||||||
|
except ImportError:
|
||||||
|
console.print(
|
||||||
|
"Readline is not available on this platform. Command history will be limited.",
|
||||||
|
style="dim",
|
||||||
|
)
|
||||||
|
|
||||||
config = validate_and_get_config()
|
config = validate_and_get_config()
|
||||||
base_url = compute_base_url(force_tls, force_no_tls, host, port)
|
base_url = compute_base_url(force_tls, force_no_tls, host, port)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ scikit-learn = {version = "^1.5.0", optional = true}
|
||||||
pytz = {version = "^2024.1", optional = true}
|
pytz = {version = "^2024.1", optional = true}
|
||||||
python-dateutil = {version = "^2.8.2", optional = true}
|
python-dateutil = {version = "^2.8.2", optional = true}
|
||||||
|
|
||||||
|
pyreadline3 = {version = "^3.5.4", platform = "win32"}
|
||||||
[tool.poetry.extras]
|
[tool.poetry.extras]
|
||||||
fastapi = ["fastapi", "uvicorn", "opentelemetry-instrumentation-fastapi", "opentelemetry-exporter-otlp-proto-http", "opentelemetry-exporter-otlp-proto-common"]
|
fastapi = ["fastapi", "uvicorn", "opentelemetry-instrumentation-fastapi", "opentelemetry-exporter-otlp-proto-http", "opentelemetry-exporter-otlp-proto-common"]
|
||||||
evals = ["scipy", "numpy", "scikit-learn", "pytz", "python-dateutil"]
|
evals = ["scipy", "numpy", "scikit-learn", "pytz", "python-dateutil"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue