Skip to content

Commit

Permalink
fix: wikidata tool bug and task management hanging bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chenweize1998 committed Jul 23, 2024
1 parent 5af991b commit b5244e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion im_client/agents/tools/wikidata.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _item_to_document(self, qid: str) -> Optional[str]:
doc_lines.append(f"Aliases: {', '.join(resp.aliases)}")
for prop, values in resp.statements.items():
if values:
doc_lines.append(f"{prop.label}: {', '.join(values)}")
doc_lines.append(f"{prop.label}: {', '.join(map(str, values))}")

return "\n".join(doc_lines)[: self.doc_content_chars_max]
# return Document(
Expand Down
8 changes: 4 additions & 4 deletions im_client/communication/task_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def set_triggers(self, task_identifiers: list[int] | list[str], trigger_setter:

if task:
if task.status.priority < TaskStatus.COMPLETED.priority:
logger.info(f"Set {task.task_id}'s trigger")
logger.info(f"Task status: {task.status.priority}. Set {task.task_id}'s trigger")
self.triggers[task.task_id] = False
else:
logger.info(f"{task.task_id} is in terminated status. Skip setting trigger.")
Expand Down Expand Up @@ -360,7 +360,7 @@ def update_triggers(self, task_identifiers: list[int] | list[str], trigger_sette
if task:
if task.status.priority < TaskStatus.COMPLETED.priority:
# not in terminated status
logger.info(f"Set {task_id}'s trigger")
logger.info(f"Task status: {task.status.priority}. Set {task_id}'s trigger")
self.triggers[task.task_id] = False
else:
logger.info(f"{task_id} is in terminated status. Skip setting trigger.")
Expand Down Expand Up @@ -448,12 +448,12 @@ def from_dict(data: dict) -> TaskManager:
for task_id, (task_index, task_entry_dict) in data["tasks"].items()
}
manager.taskIndex2tasks = {
index: TaskEntry.from_dict(task_entry_dict) for index, task_entry_dict in data["taskIndex2tasks"].items()
index: entry for _, (index, entry) in manager.tasks.items()
}
manager.triggers = data["triggers"]
manager.trigger_setter = data["trigger_setter"]
manager.msg2task = {
LLMResult.model_validate_json(result_json): TaskEntry.from_dict(task_dict)
LLMResult.model_validate_json(result_json): manager.tasks[TaskEntry.from_dict(task_dict).task_id][1]
for result_json, task_dict in data["msg2task"].items()
}
manager.dynamic_collaborative_planner = data["dynamic_collaborative_planner"]
Expand Down

0 comments on commit b5244e6

Please sign in to comment.