feat: add default config to load from hard-code instead of a file

This commit is contained in:
meshkatshb
2025-01-22 11:58:49 +03:30
parent 704ea646ca
commit 2d2aa0d689
3 changed files with 29 additions and 2 deletions

Binary file not shown.

View File

@@ -3,6 +3,33 @@ import pickle
import uuid
def default_config():
"""Prepare the default configuration"""
return {
"agent_type": "custom",
"max_steps": 100,
"max_actions_per_step": 10,
"use_vision": True,
"tool_call_in_content": True,
"llm_provider": "openai",
"llm_model_name": "gpt-4o",
"llm_temperature": 1.0,
"llm_base_url": "",
"llm_api_key": "",
"use_own_browser": False,
"keep_browser_open": False,
"headless": False,
"disable_security": True,
"enable_recording": True,
"window_w": 1280,
"window_h": 1100,
"save_recording_path": "./tmp/record_videos",
"save_trace_path": "./tmp/traces",
"save_agent_history_path": "./tmp/agent_history",
"task": "go to google.com and type 'OpenAI' click search and give me the first url",
}
def load_config_from_file(config_file):
"""Load settings from a UUID.pkl file."""
try:

View File

@@ -39,7 +39,7 @@ from src.browser.config import BrowserPersistenceConfig
from src.browser.custom_context import BrowserContextConfig, CustomBrowserContext
from src.controller.custom_controller import CustomController
from gradio.themes import Citrus, Default, Glass, Monochrome, Ocean, Origin, Soft, Base
from src.utils.default_config_settings import load_config_from_file, save_config_to_file
from src.utils.default_config_settings import default_config, load_config_from_file, save_config_to_file
from src.utils.utils import update_model_dropdown, get_latest_files, capture_screenshot
from dotenv import load_dotenv
@@ -1024,7 +1024,7 @@ def main():
parser.add_argument("--dark-mode", action="store_true", help="Enable dark mode")
args = parser.parse_args()
config_dict = load_config_from_file("./default_config.pkl") or {}
config_dict = default_config()
demo = create_ui(config_dict, theme_name=args.theme)
demo.launch(server_name=args.ip, server_port=args.port)