55import traceback
66from datetime import datetime
77from pathlib import Path
8- from typing import Any
8+ from typing import Any , Optional
99
1010import pyperclip # type: ignore[import-untyped]
11+ from pydantic import BaseModel
1112from rich .traceback import Traceback
1213from textual import on
1314from textual .app import App , ComposeResult
@@ -128,7 +129,7 @@ async def handle_chat_input(self, event: Input.Submitted) -> None:
128129 )
129130 return
130131 if details_panel .current_run .status == "suspended" :
131- details_panel .current_run .resume_data = user_text
132+ details_panel .current_run .resume_data = { "message" : user_text }
132133 asyncio .create_task (self ._execute_runtime (details_panel .current_run ))
133134 event .input .clear ()
134135
@@ -190,7 +191,7 @@ def action_copy(self) -> None:
190191 async def _execute_runtime (self , run : ExecutionRun ):
191192 """Execute the script using UiPath runtime."""
192193 try :
193- execution_input : dict [str , Any ] = {}
194+ execution_input : Optional [ dict [str , Any ] ] = {}
194195 execution_options : UiPathExecuteOptions = UiPathExecuteOptions ()
195196 if run .status == "suspended" :
196197 execution_input = run .resume_data
@@ -216,7 +217,12 @@ async def _execute_runtime(self, run: ExecutionRun):
216217 ):
217218 run .status = "suspended"
218219 else :
219- run .output_data = result .output
220+ if result .output is None :
221+ run .output_data = {}
222+ elif isinstance (result .output , BaseModel ):
223+ run .output_data = result .output .model_dump ()
224+ else :
225+ run .output_data = result .output
220226 run .status = "completed"
221227 if run .output_data :
222228 self ._add_info_log (run , f"Execution result: { run .output_data } " )
0 commit comments