mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-16 04:02:55 -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 event.content and event.content.parts:
|
||||||
if text := ''.join(part.text or '' for part in event.content.parts):
|
if text := ''.join(part.text or '' for part in event.content.parts):
|
||||||
click.echo(f'[{event.author}]: {text}')
|
click.echo(f'[{event.author}]: {text}')
|
||||||
|
await runner.close()
|
||||||
|
|
||||||
|
|
||||||
async def run_cli(
|
async def run_cli(
|
||||||
@ -145,7 +146,7 @@ async def run_cli(
|
|||||||
input_path=input_file,
|
input_path=input_file,
|
||||||
)
|
)
|
||||||
elif saved_session_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())
|
loaded_session = Session.model_validate_json(f.read())
|
||||||
|
|
||||||
if loaded_session:
|
if loaded_session:
|
||||||
@ -184,7 +185,7 @@ async def run_cli(
|
|||||||
user_id=session.user_id,
|
user_id=session.user_id,
|
||||||
session_id=session.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))
|
f.write(session.model_dump_json(indent=2, exclude_none=True))
|
||||||
|
|
||||||
print('Session saved to', session_path)
|
print('Session saved to', session_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user