mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-13 15:14:50 -06:00
feat: add toolset cleanup logic to run_cli
PiperOrigin-RevId: 762638389
This commit is contained in:
parent
7067c0319d
commit
a134ba6f7a
@ -96,6 +96,7 @@ async def run_interactively(
|
||||
if event.content and event.content.parts:
|
||||
if text := ''.join(part.text or '' for part in event.content.parts):
|
||||
click.echo(f'[{event.author}]: {text}')
|
||||
await runner.close()
|
||||
|
||||
|
||||
async def run_cli(
|
||||
@ -145,7 +146,7 @@ async def run_cli(
|
||||
input_path=input_file,
|
||||
)
|
||||
elif saved_session_file:
|
||||
with open(saved_session_file, 'r') as f:
|
||||
with open(saved_session_file, 'r', encoding='utf-8') as f:
|
||||
loaded_session = Session.model_validate_json(f.read())
|
||||
|
||||
if loaded_session:
|
||||
@ -184,7 +185,7 @@ async def run_cli(
|
||||
user_id=session.user_id,
|
||||
session_id=session.id,
|
||||
)
|
||||
with open(session_path, 'w') as f:
|
||||
with open(session_path, 'w', encoding='utf-8') as f:
|
||||
f.write(session.model_dump_json(indent=2, exclude_none=True))
|
||||
|
||||
print('Session saved to', session_path)
|
||||
|
Loading…
Reference in New Issue
Block a user