Remove unused refs

This commit is contained in:
f-trycua
2025-03-29 22:30:33 +01:00
parent bef1f6630d
commit a2f30a2d40
4 changed files with 43 additions and 69 deletions

View File

@@ -15,7 +15,6 @@ from .api_handler import OpenAIAPIHandler
from .response_handler import OpenAIResponseHandler
from .tools.manager import ToolManager
from .types import LLMProvider, ResponseItemType
from .prompts import SYSTEM_PROMPT
logger = logging.getLogger(__name__)

View File

@@ -1,20 +0,0 @@
"""Prompts for OpenAI Agent Response API."""
# System prompt to be used when no specific system prompt is provided
SYSTEM_PROMPT = """
You are a helpful assistant that can control a computer to help users accomplish tasks.
You have access to a computer where you can:
- Click, scroll, and type to interact with the interface
- Use keyboard shortcuts and special keys
- Read text and images from the screen
- Navigate and interact with applications
A few important rules to follow:
1. Only perform actions that the user has requested or that directly support their task
2. If uncertain about what the user wants, ask for clarification
3. Explain your steps clearly when working on complex tasks
4. Be careful when interacting with sensitive data or performing potentially destructive actions
5. Always respect user privacy and avoid accessing personal information unless necessary for the task
When in doubt about how to accomplish something, try to break it down into simpler steps using available computer actions.
"""

View File

@@ -1,12 +1,6 @@
from typing import Optional, List, Literal, Dict, Any, Union, TYPE_CHECKING, cast
from pylume import PyLume
from pylume.models import (
VMRunOpts,
VMUpdateOpts,
ImageRef,
SharedDirectory,
VMStatus
)
from pylume.models import VMRunOpts, VMUpdateOpts, ImageRef, SharedDirectory, VMStatus
import asyncio
from .models import Computer as ComputerConfig, Display
from .interface.factory import InterfaceFactory
@@ -66,8 +60,6 @@ class Computer:
port: Optional port to use for the PyLume server
host: Host to use for PyLume connections (e.g. "localhost", "host.docker.internal")
"""
if TYPE_CHECKING:
from .interface.base import BaseComputerInterface
self.logger = Logger("cua.computer", verbosity)
self.logger.info("Initializing Computer...")
@@ -159,6 +151,18 @@ class Computer:
"""Exit async context manager."""
pass
def __enter__(self):
"""Enter synchronous context manager."""
# Run the event loop to call the async run method
loop = asyncio.get_event_loop()
loop.run_until_complete(self.run())
return self
def __exit__(self, exc_type, exc_val, exc_tb):
"""Exit synchronous context manager."""
# We could add cleanup here if needed in the future
pass
async def run(self) -> None:
"""Initialize the VM and computer interface."""
if TYPE_CHECKING: