mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04:35:00 +00:00
handle failed install of hf-embed
This commit is contained in:
parent
ea89ca6eb5
commit
504a72b5cb
2 changed files with 14 additions and 7 deletions
|
@ -75,7 +75,7 @@ class Commands:
|
||||||
if instructions:
|
if instructions:
|
||||||
self.io.tool_error(instructions)
|
self.io.tool_error(instructions)
|
||||||
|
|
||||||
content = f"{url}:\n\n" + content
|
content = f"{url}:\n\n" + content # noqa: E231
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
@ -275,10 +275,10 @@ class Commands:
|
||||||
cost = tk * self.coder.main_model.info.get("input_cost_per_token", 0)
|
cost = tk * self.coder.main_model.info.get("input_cost_per_token", 0)
|
||||||
total_cost += cost
|
total_cost += cost
|
||||||
msg = msg.ljust(col_width)
|
msg = msg.ljust(col_width)
|
||||||
self.io.tool_output(f"${cost:7.4f} {fmt(tk)} {msg} {tip}")
|
self.io.tool_output(f"${cost:7.4f} {fmt(tk)} {msg} {tip}") # noqa: E231
|
||||||
|
|
||||||
self.io.tool_output("=" * (width + cost_width + 1))
|
self.io.tool_output("=" * (width + cost_width + 1))
|
||||||
self.io.tool_output(f"${total_cost:7.4f} {fmt(total)} tokens total")
|
self.io.tool_output(f"${total_cost:7.4f} {fmt(total)} tokens total") # noqa: E231
|
||||||
|
|
||||||
limit = self.coder.main_model.info.get("max_input_tokens", 0)
|
limit = self.coder.main_model.info.get("max_input_tokens", 0)
|
||||||
if not limit:
|
if not limit:
|
||||||
|
@ -659,9 +659,14 @@ class Commands:
|
||||||
except PipInstallHF as err:
|
except PipInstallHF as err:
|
||||||
self.io.tool_error(str(err))
|
self.io.tool_error(str(err))
|
||||||
if self.io.confirm_ask("Run pip install?", default="y"):
|
if self.io.confirm_ask("Run pip install?", default="y"):
|
||||||
self.help = Help(pip_install=True)
|
try:
|
||||||
else:
|
self.help = Help(pip_install=True)
|
||||||
return
|
except PipInstallHF:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not self.help:
|
||||||
|
self.io.tool_error("Unable to initialize interactive help.")
|
||||||
|
return
|
||||||
|
|
||||||
coder = Coder.create(
|
coder = Coder.create(
|
||||||
main_model=self.coder.main_model,
|
main_model=self.coder.main_model,
|
||||||
|
|
|
@ -190,6 +190,8 @@ def pip_install(args):
|
||||||
cmd += args
|
cmd += args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.run(cmd)
|
res = subprocess.run(cmd)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error running pip download: {e}")
|
print(f"Error running pip download: {e}")
|
||||||
|
|
||||||
|
return res.returncode == 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue