added error catching for review

This commit is contained in:
2026-02-02 17:57:42 +01:00
parent ca27132485
commit cf5fd87db3

View File

@@ -12,7 +12,10 @@ def RunCommand(command) -> str:
Returns:
Output of command
"""
try:
return os.popen(command).read()
except Exception as e:
return f"Error occourd while processing: {e}"
class review:
@@ -58,6 +61,7 @@ class review:
if response.message.tool_calls:
print("attempted tool calling")
for tool in response.message.tool_calls:
try:
print("-- TOOL CALLING RAN --")
print(
"- The LLM is currently running tests on your computer in order to generate a review -"
@@ -74,5 +78,19 @@ class review:
}
)
print("-- END OF TOOL CALL --")
except Exception as e:
print("-- TOOL CALLING ERROR --")
print("- Error occourd while using tool calling -")
print(f"Result: {e}")
messageHistory.append(
{
"role": "tool",
"tool_name": tool.function.name,
"content": str(e),
}
)
print("-- END OF TOOL ERROR --")
else:
return response["message"]["content"]