
    љi                         S SK r S SKJrJrJrJr  S SKJrJrJ	r	  S SK
JrJr  SSKJr  \ R                  " \5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S5      rg)    N)DictAnyOptionalList)	APIRouterHTTPExceptionstatus)	BaseModelField   )SpeechRecognizerc                       \ rS rSr% Sr\" SSS9r\\   \	S'   \" SSS9r
\\\      \	S'   \" SS	S9r\\   \	S
'   \" SSS9r\\   \	S'   \" SSS9r\\   \	S'    " S S5      rSrg)	SttConfig
   z
SttConfig is a data model that holds configuration settings for Speech-to-Text (STT) components.

All fields are optional and default to None if not provided.
NzIThe primary language for speech recognition, e.g., 'en-US', 'ja-JP', etc.)defaultdescriptionlanguagez7A list of alternative languages for speech recognition.alternative_languagesz7The timeout for speech recognition requests in seconds.timeoutz5Maximum number of retry attempts for failed requests.max_retrieszPFlag indicating whether to enable debug mode. If True, detailed logs are output.debugc                       \ rS rSrSrSrg)SttConfig.Config%   allow N)__name__
__module____qualname____firstlineno__extra__static_attributes__r       S/home/james-whalen/.local/lib/python3.13/site-packages/aiavatar/admin/config/stt.pyConfigr   %   s    r#   r%   r   )r   r   r   r    __doc__r   r   r   str__annotations__r   r   r   floatr   intr   boolr%   r"   r   r#   r$   r   r   
   s    
 $_Hhsm  27M28DI.   %M GXe_  "'K"K#  "fE8D> 
 r#   r   c                   B    \ rS rSr% \" SS9r\\S'   \" SS9r\	\S'   Sr
g)	SttConfigResponse)   zType of STT componentr   typeConfiguration of STT componentconfigr   N)r   r   r   r    r   r0   r'   r(   r2   r   r"   r   r#   r$   r-   r-   )   s,    +D#  4FI r#   r-   c                   ,    \ rS rSr% \" SS9r\\S'   Srg)UpdateSttConfigRequest2   r1   r/   r2   r   N)	r   r   r   r    r   r2   r   r(   r"   r   r#   r$   r4   r4   2   s    4FI r#   r4   c                   (    \ rS rSrS\4S jrS rSrg)SttConfigAPI8   sttc                     Xl         g )Nr9   )selfr9   s     r$   __init__SttConfigAPI.__init__9   s	     r#   c                    ^  [        5       nUR                  SS/SSSSS0SS0S	.S
9S[        4U 4S jj5       nUR                  SS/SSSSS0SS0SS0S.S
9S[        S[
        [        [        4   4U 4S jj5       nU$ )Nz/config/sttr%   zGet STT configurationzLRetrieve the current configuration settings for the Speech-to-Text componentzICurrent STT configuration including language, timeout, and debug settingsr   z(Successfully retrieved STT configurationzInternal server error)     )tagssummaryr   response_description	responsesreturnc            	        >#     TR                   n [        U R                  R                  [	        S0 U R                  5       D6S9$ ! [         a5  n[        R                  SU 35        [        [        R                  SS9eS nAff = f7f)N)r0   r2   z$Error retrieving STT configuration: z8Internal server error while retrieving STT configurationstatus_codedetailr   )r9   r-   	__class__r   r   
get_config	Exceptionloggererrorr   r	   HTTP_500_INTERNAL_SERVER_ERROR)r9   exr<   s     r$   get_config_stt/SttConfigAPI.get_router.<locals>.get_config_sttB   s~     hh(//$8s~~'78 
  CB4HI# & E EU s)   BA A B
B0B  BBzUpdate STT configurationzZUpdate configuration settings for the STT component. Only non-null values will be updated.z;Dictionary of successfully updated configuration parametersz&Successfully updated STT configurationz Invalid configuration parameters)r@   i  rA   requestc                    >#     TR                   nUR                  U R                  R                  5       5      $ ! [         a5  n[
        R                  SU 35        [        [        R                  SS9eS nAff = f7f)Nz"Error updating STT configuration: z6Internal server error while updating STT configurationrH   )
r9   
set_configr2   
model_dumprM   rN   rO   r   r	   rP   )rT   r9   rQ   r<   s      r$   post_config_stt0SttConfigAPI.get_router.<locals>.post_config_stt]   sl     	hh~~gnn&?&?&ABB A"FG# & E ES s%   A<4: A<
A90A44A99A<)r   getr-   postr4   r   r'   r   )r<   routerrR   rX   s   `   r$   
get_routerSttConfigAPI.get_router?   s    	+f!l#%OP#%<= 
 


	&7 	


	  
.t!^#%MN#%GH#%<= 
 


	+A 
	d3PS8n 
	


	 r#   r;   N)r   r   r   r    r   r=   r]   r"   r   r#   r$   r7   r7   8   s    6r#   r7   )loggingtypingr   r   r   r   fastapir   r   r	   pydanticr
   r   sts.sttr   	getLoggerr   rN   r   r-   r4   r7   r   r#   r$   <module>re      sX     , , 4 4 % '			8	$	 >	 Y = =r#   