feat: enhance run_coact.py with logging and configuration options

- Added logging configuration to capture runtime logs in both file and console with adjustable log levels.
- Introduced new command-line arguments for provider name, region, and client password to improve flexibility and security.
- Updated process_task function to accommodate new parameters, ensuring compatibility with existing logic.
- Modified prompt templates in coding_agent.py and cua_agent.py to use the client password placeholder for enhanced security.
This commit is contained in:
yuanmengqi
2025-07-31 05:47:58 +00:00
parent a5b51e8010
commit 84f407afdd
3 changed files with 75 additions and 22 deletions

View File

@@ -18,8 +18,8 @@ PROMPT_TEMPLATE = """# Task
{instruction}
# Hints
- Sudo password is "password".
- If you meet "Authentication required" dialog, enter the "password" to continue.
- Sudo password is "{CLIENT_PASSWORD}".
- If you meet "Authentication required" dialog, enter the "{CLIENT_PASSWORD}" to continue.
- Do not close the any application or window or tab that is already opened.
- Do not close the window at the end of the task.
- If you have completed the user task, reply with the information you want the user to know along with 'TERMINATE'.
@@ -154,6 +154,7 @@ def run_cua(
screen_height: int = 1080,
sleep_after_execution: float = 0.3,
truncate_history_inputs: int = 100,
client_password: str = "",
) -> Tuple[str, float]:
client = OpenAI()
@@ -166,7 +167,7 @@ def run_cua(
history_inputs = [{
"role": "user",
"content": [
{"type": "input_text", "text": PROMPT_TEMPLATE.format(instruction=instruction)},
{"type": "input_text", "text": PROMPT_TEMPLATE.format(instruction=instruction, CLIENT_PASSWORD=client_password)},
{"type": "input_image", "image_url": f"data:image/png;base64,{screenshot_b64}"},
],
}]