
    g                      D    d dl Z d dlZd dlZd dlZd Zd ZddZd Zd Z	y)    Nc                      i ddddddddd	d
dddddddddt        j                  dd      dddt        j                  dd      j                         dk(  ddddddd dd!d"d#d$d%d&d'd(S ))z!Prepare the default configuration
agent_typecustom	max_stepsd   max_actions_per_step
   
use_visionTtool_calling_methodautollm_providerollamallm_model_nameztinydolphin:1.1bllm_num_ctxi   llm_temperatureg333333?llm_base_urlOLLAMA_ENDPOINTzhttp://localhost:11434llm_api_key use_own_browserCHROME_PERSISTENT_SESSIONfalsetruekeep_browser_openFheadlessdisable_securityenable_recordingwindow_w   L  ./tmp/record_videos./tmp/traces./tmp/agent_historyzIgo to google.com and type 'OpenAI' click search and give me the first urlwindow_hsave_recording_pathsave_trace_pathsave_agent_history_pathtask)osgetenvlower     Q/Users/kosar/src/browser-use-projects/web-ui/src/utils/default_config_settings.pydefault_configr0      s   hS 	 	d	
 	v 	 	, 	t 	3 			"35MN 	r 	299%@'JPPRV\\ 	U 	E 	D  	D!" 	D#$ 4)#8[- r.   c                     	 t        | d      5 }t        j                  |      }ddd       |S # 1 sw Y   S xY w# t        $ r}dt	        |       cY d}~S d}~ww xY w)z#Load settings from a UUID.pkl file.rbNzError loading configuration: )openpickleload	Exceptionstr)config_filefsettingses       r/   load_config_from_filer<   #   sZ    8+t$ 	&{{1~H	&	& 8.s1vh778s/   ; .	; 8; ; 	AAAAc                    t        j                  |d       t         j                  j                  |t	        j
                          d      }t        |d      5 }t        j                  | |       ddd       d| S # 1 sw Y   xY w)z>Save the current settings to a UUID.pkl file with a UUID name.T)exist_okz.pklwbNzConfiguration saved to )	r*   makedirspathjoinuuiduuid4r3   r4   dump)r:   save_dirr8   r9   s       r/   save_config_to_filerG   -   sm    KK4('',,xDJJL>)>?K	k4	  !AHa !$[M22! !s   A==Bc                     i d| d   d| d   d| d   d| d   d	| d
   d| d   d| d   d| d   d| d   d| d   d| d   d| d   d| d   d| d   d| d   d| d    d!| d"   | d#   | d$   | d%   | d&   | d'   d(}t        |      S ))Nr   r   r      r      r
      r      r      r      r      r      r   	   r   r	   r      r      r      r      r      r                     r$   )rG   )argscurrent_configs     r/   save_current_configr_   6   sL   d1gT!W 	Q 	d1g	
 	tAw 	Q 	$q' 	tAw 	47 	Q 	tBx 	48 	T"X 	DH 	DH  	DH!" 	DH#$ H#Bx8#'8R-N0 ~..r.   c                    | t        | j                        }t        |t              r1t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd	            t	        j
                  |j                  d
d	            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  dd	            t	        j
                  |j                  dd	            t	        j
                  |j                  dd            t	        j
                  |j                  dd            t	        j
                  |j                  d d!            t	        j
                  |j                  d"d#            t	        j
                  |j                  d$d%            t	        j
                  |j                  d&d            d'fS t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         d(fS t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         t	        j
                         d)fS )*Nr   r   )valuer   r   r   r	   r
   Tr   r   openair   zgpt-4or   i }  r   g      ?r   r   r   r   Fr   r   r   r   r   r   r%   r    r&   r!   r'   r"   r(   r#   r)   z"Configuration loaded successfully.z"Error: Invalid configuration file.zNo file selected.)r<   name
isinstancedictgrupdateget)r8   loaded_configs     r/   update_ui_from_configrj   R   s   -k.>.>?mT*		 1 1, IJ		 1 1+s CD		 1 12H" MN		 1 1, EF		 1 12G NO		 1 1.( KL		 1 12BH MN		 1 1- GH		 1 12CS IJ		 1 1." EF		 1 1- DE		 1 12CU KL		 1 12Eu MN		 1 1*e DE		 1 12Dd KL		 1 12Dd KL		 1 1*d CD		 1 1*d CD		 1 12GI^ _`		 1 12C^ TU		 1 12KMb cd		 1 1&" =>4/ 6 		RYY["))+ryy{BIIK		RYY["))+ryy{BIIK		RYY["))+ryy{BIIK		RYY["))+ryy{BIIK		A  			RYY["))+ryy{BIIK
		RYY["))+ryy{BIIK
		RYY["))+ryy{BIIK
		RYY["))+ryy{BIIK
		( r.   )z./tmp/webui_settings)
r*   r4   rC   gradiorf   r0   r<   rG   r_   rj   r-   r.   r/   <module>rl      s*    	   883/8+r.   