Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put default values for response json in mechscriptbot #47

Merged
merged 3 commits into from
Jan 28, 2025
Merged
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
10 changes: 6 additions & 4 deletions src/allie/flowkit/endpoints/mechscriptbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@ async def triggermechscriptbot(request: MechScriptBotRequest, api_key: str = Hea

response_dict = requests.get(url=url, json=request_dict_copy).json()

output = f"```{response_dict['output']}"
output = f"```{response_dict.get('output', '')}"

human_new_mem, ai_new_mem = tuple(response_dict["new_memory"])
human_new_mem, ai_new_mem = tuple(response_dict.get("new_memory", []))
updated_human_memory = request.full_human_memory + [human_new_mem]
updated_ai_memory = request.full_ai_memory + [ai_new_mem]

new_variables_list = [f"{var_name}:{var_type}" for var_name, var_type in (response_dict["new_variables"]).items()]
new_variables_list = [
f"{var_name}:{var_type}" for var_name, var_type in (response_dict.get("new_variables", {})).items()
]
updated_variables = request.full_variables + new_variables_list

updated_mechanical_objects = request.full_mechanical_objects + response_dict["new_mechanical_objects"]
updated_mechanical_objects = request.full_mechanical_objects + response_dict.get("new_mechanical_objects", [])

return MechScriptBotResponse(
output=output,
Expand Down