
    Ri                         S r SSKrSSKr\R                  R	                  S\R                  R                  \R                  R                  \5      5      5        SSKJ	r	  SSK
Jr  S r\S:X  a  \" 5         gg)z$
Test upload functionality directly
    N)	RAGSystem)Pathc                     [        S5        [        5       n [        S5      nUR                  5       (       d  [        SU 35        g[        SU 35        [        SUR	                  5       R
                   S35         [        S5        U R                  5       n[        S	U 35        S
SKJn  [        UR                  S5      5      n[        UR                  S5      5      n[        S[        U5       35        [        S[        U5       35        [        S[        U5      [        U5      -    35        g! [         a8  nS
SKn[        SU 35        [        SUR                  5        35         SnAgSnAff = f)z#Test the upload processing directlyzTesting upload processing...z_/home/dmtnaga/Documents/work/airagagent/pdf_directory/H._P._Blavatsky_-_The_Secret_Doctrine.pdfzPDF file not found: NzPDF file exists: zFile size: z byteszCalling setup_system()...z!Setup complete. Total documents: r   )PDF_DIRz*.pdfz*.txtzPDF files found: zTXT files found: zTotal files: zError during processing: zFull traceback: )printr   r   existsstatst_sizesetup_systemconfigr   listgloblen	Exception	traceback
format_exc)
rag_systempdf_file	doc_countr   	pdf_files	txt_fileser   s           test_upload.pytest_upload_processingr      sM   	
() J uvH??$XJ/0	hZ
()	K//0
78;)*++-	1)=> 	#g./	g./	!#i.!123!#i.!123c)ns9~=>?@ ;)!-. !5!5!7 89::;s   ;B4D0 0
E2:.E--E2__main__)__doc__sysospathinsertdirnameabspath__file__mainr   pathlibr   r   __name__     r   <module>r)      sa     	 277??277??8#<= >  ";H z r(   