Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions devchat/engine/command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def run_command_with_parameters(self,
replace $xxx in command.steps[0].run with parameters[xxx]
then run command.steps[0].run
"""
result = (-1, "")
try:
env = os.environ.copy()
env.update(parameters)
Expand All @@ -103,21 +104,21 @@ def run_command_with_parameters(self,
command_run = command_run.replace('$' + parameter, str(env[parameter]))

if self.__check_command_python_error(command_run, env):
return (-1, "")
return result
if self.__check_input_miss_error(command, command_name, env):
if self.__get_readme(command):
return (0, "")
return (-1, "")
result = (0, "")
return result
if self.__check_parameters_miss_error(command, command_run):
if self.__get_readme(command):
return (0, "")
return (-1, "")
result = (0, "")
return result

return self.__run_command_with_thread_output(command_run, env)
result = self.__run_command_with_thread_output(command_run, env)
except Exception as err:
print("Exception:", type(err), err, file=sys.stderr, flush=True)
logger.exception("Run command error: %s", err)
return (-1, "")
return result

def __run_command_with_thread_output(self, command_str: str, env: Dict[str, str]):
"""
Expand Down
69 changes: 31 additions & 38 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pydantic = "1.10.14"
networkx = "^3.1"
openai = "^1.0rc"
rich_click = "^1.6.1"
tiktoken = ">0.4.0"
tiktoken = "^0.4.0"
tinydb = "^4.7.1"
urllib3 = "<2.0"
importlib-metadata = "^6.8.0"
Expand Down