Skip to content

Commit

Permalink
fix: async bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hyacinthus committed Feb 4, 2025
1 parent 8363c23 commit ec08240
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ async def execute_agent(
)

# cold start or needs reinitialization
if aid not in agents or needs_reinit:
await initialize_agent(aid)
if (aid not in agents) or needs_reinit:
resp_debug.append(
"[ Agent cold start ... ]"
if aid not in agents
else "[ Agent reinitialized ... ]"
)
await initialize_agent(aid)
resp_debug.append(
f"\n------------------- start cost: {time.perf_counter() - last:.3f} seconds\n"
)
Expand All @@ -371,7 +371,7 @@ async def execute_agent(
try:
resp_debug_append = "\n===================\n\n[ system ]\n"
resp_debug_append += agent_prompt(agent)
snap = executor.get_state(stream_config)
snap = await executor.aget_state(stream_config)
if snap.values and "messages" in snap.values:
for msg in snap.values["messages"]:
resp_debug_append += f"[ {msg.type} ]\n{str(msg.content)}\n\n"
Expand Down
4 changes: 2 additions & 2 deletions models/skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def save(self) -> None:
db.add(existing)
else:
db.add(self)
db.commit()
await db.commit()

@classmethod
async def clean_data(cls, agent_id: str):
Expand Down Expand Up @@ -175,7 +175,7 @@ async def save(self) -> None:
db.add(existing)
else:
db.add(self)
db.commit()
await db.commit()

@classmethod
async def clean_data(cls, agent_id: str, thread_id: str):
Expand Down

0 comments on commit ec08240

Please sign in to comment.