fix: bug when cancelling tasks, tool call message subkind
This commit is contained in:
1 parent
248146056a
commit
7e68348368
2 files changed
+7
-3
No files matched your search
@@ -358,8 +358,7 @@ async def openrouter_chat_completion(app, messages, model, tools=[], opts={}, ag
|
||||
|
||||
async for event in stream_response:
|
||||
if agent_run and agent_run.cancelled:
|
||||
print(f"Cancelling openrouter inference for run {agent_run.id}")
|
||||
# TODO: Need to cancell?
|
||||
stream_response.cancel()
|
||||
break
|
||||
|
||||
if event.choices and len(event.choices) > 0:
|
||||
@@ -402,6 +401,8 @@ async def openrouter_chat_completion(app, messages, model, tools=[], opts={}, ag
|
||||
def handle_done(task):
|
||||
try:
|
||||
task.result()
|
||||
except asyncio.CancelledError:
|
||||
print("[openrouter] inference cancelled")
|
||||
except Exception as e:
|
||||
print(f"[openrouter] Worker error: {e}")
|
||||
print(traceback.format_exc())
|
||||
|
||||
Reference in new issue
Block a user