
    jn                     t   d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	m
Z
 d dlmZ d dlmZ d dlmZmZmZ d dlmZ  e            Z eej        	            ee          Zed
efd            Z eej        ej        de          Ze                    e            eed           e                    eg dddgdg           e                    e
j        ddg           e                    ej        ddg           e                    e	j        ddg           e                    ej        ddg           e                     d          d             Z!e                     d          d             Z"ed k    r7d d!l#Z# e#j$        d"d#d$ej%        ej        &                                %           d!S d!S )&    )asynccontextmanager)FastAPI)CORSMiddleware)	documentssourcesstatstasks)get_settings)init_db)LoggingMiddleware
get_loggersetup_logging)setup_metrics)levelappc                   K   t                               dt          j         dt          j                    t                       t                               d           d W V  t                               d           d S )Nz	Starting z vzDatabase initializedzShutting down application)loggerinfosettingsapp_nameapp_versionr   )r   s    6/lsinfo/ai/hellotax_ai/data_center/backend/app/main.pylifespanr      so      
KKGH-GG1EGGHHHIII
KK&'''	EEEE
KK+,,,,,    u!   税务数据采集和处理服务)titleversiondescriptionr   zdata-center)zhttp://localhost:8500zhttp://localhost:8888zhttp://localhost:8890zhttp://ai.leshuiyun.comzhttps://ai.leshuiyun.comzhttp://data.leshuiyun.comzhttps://data.leshuiyun.comT*)allow_originsallow_credentialsallow_methodsallow_headersz/api/v1/tasksu   任务管理)prefixtagsz/api/v1/documentsu   文档管理z/api/v1/statsu   统计信息z/api/v1r   /c                  :   K   t           j        t           j        ddS )Nrunning)namer   status)r   r   r    r   r   rootr+       s      %(2FQZ[[[r   z/healthc                     K   ddiS )Nr)   healthyr*   r*   r   r   health_checkr.   $   s      i  r   __main__Nzapp.main:appz0.0.0.0iB  )hostportreload	log_level)'
contextlibr   fastapir   fastapi.middleware.corsr   
app.api.v1r   r   r   r	   
app.configr
   app.databaser   common_loggingr   r   r   common_metricsr   r   r3   __name__r   r   r   r   r   add_middlewareinclude_routerroutergetr+   r.   uvicornrundebuglowerr*   r   r   <module>rE      s   * * * * * *       2 2 2 2 2 2 7 7 7 7 7 7 7 7 7 7 7 7 # # # # # #             G G G G G G G G G G ( ( ( ( ( (<>> H& ' ' ' '	H		- - - - - gH%x/CQt  @H  I  I  I   $ % % % c= ! ! !   >  2o  2o  2o  CG  X[  W\  mp  lq   r  r  r   5<~>N  O O O   9#,?~FV  W W W   5<~>N  O O O   7>)9+  F F F\ \ \ ! ! !zNNNGKYT(.\d\n\t\t\v\vwwwwww r   