ó
     :hã  ã                   ó¶   • S SK JrJrJr  S SKJrJr  S SKJr  \" 5       r	 " S S\5      r
 " S S\5      r\	R                  S\S	S
9\" S5      4S\
4S jj5       rg)é    )Ú	APIRouterÚHTTPExceptionÚBody)Ú	BaseModelÚField)Úprocess_voice_command_aic                   óJ   • \ rS rSr% \" SSSS9r\\S'   \" SSS	S
9r\\S'   Sr	g)ÚVoiceCommandInputé   .é   z,The transcribed text from the user's speech.)Ú
min_lengthÚdescriptionÚ
transcriptÚenz^(en|hi|mr)$z&Language code (e.g., 'en', 'hi', 'mr'))ÚdefaultÚpatternr   Úlanguage© N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   ÚstrÚ__annotations__r   Ú__static_attributes__r   ó    ÚE/home/sneha/Desktop/shweta/404/404/backend/app/api/endpoints/voice.pyr
   r
      s*   ‡ Ù˜C¨AÐ;iÑj€J�Ójá $°ÐLtÑu€HˆcÖur   r
   c                   ó    • \ rS rSr% \\S'   Srg)ÚVoiceCommandResponseé   Úresponse_textr   N)r   r   r   r   r   r   r   r   r   r   r   r      s   ‡ ØÖr   r   z/commandéÈ   )Úresponse_modelÚstatus_code.Úcommand_inputc              ƒ   ó   #   •  [        U R                  U R                  S9I Sh  v•N nUR                  S5      (       a
  [	        SUS9e[        US9$  N-! [         a  nUeSnAf[         a  n[        SU 35        [	        SS	S9eSnAff = f7f)
zs
Receives transcribed text, processes the command using AI,
and returns a text response in the specified language.
)r   r   NzError:i÷  )r$   Údetail)r!   z'Unexpected error in /command endpoint: iô  zEAn internal server error occurred while processing the voice command.)r   r   r   Ú
startswithr   r   Ú	ExceptionÚprint)r%   r!   Úhttp_excÚes       r   Úhandle_voice_commandr-      s›   é € ð}ä6Ø$×/Ñ/Ø"×+Ñ+ñ
÷ 
ˆð ×#Ñ# H×-Ñ-ä¨C¸ÑFÐFä#°-Ñ@Ð@ñ
øô ó àˆûÜó }äÐ7¸°sÐ;Ô<Ü¨Ð4{Ñ|Ð|ûð}üsD   ‚B„!A ¥A¦,A ÁBÁA Á
BÁA!Á!BÁ.BÂBÂBN)Úfastapir   r   r   Úpydanticr   r   Úapp.core.ai_servicesr   Úrouterr
   r   Úpostr-   r   r   r   Ú<module>r3      si   ðß 2Ñ 2ß %Ý 9á	‹€ôv˜	ô vô
˜9ô ð ‡�ˆZÐ(<È#€ÐNá'+¨C£yñ}Ø$ô}ó Oñ}r   