wangzhibo
2026-10-08 220e4fab27b7f419b3e89e2f2d28ae789aac09d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
o
äÖ8jB    ã@sxddlZddlmZddlmZddlmZddlmZddl    m
Z
ddl m Z ddl mZdd    lmZdd
lmZmZmZmZdd lmZdd lmZdd lmZddlmZejejdde  e!¡Z"edefdd„ƒZ#eddde#dZ$e$j%edgddgdgde$ &ej'¡e$ &ej'¡e$ &ej'¡e$ &ej'¡ee j(ƒZ)e) *¡r±e$j+de
e,e)ƒddde$ -d¡d d!„ƒZ.dS)"éN)Úasynccontextmanager)ÚPath)ÚFastAPI)ÚCORSMiddleware)Ú StaticFiles)Úsettings)Ú MqttService)ÚInitTaskDispatcher)ÚcoursesÚdevicesÚdialogueÚscene)ÚAutoInitService)Ú CourseService)Ú DeviceStore)Ú InitRegistryz/%(asctime)s %(levelname)s %(name)s: %(message)s)ÚlevelÚformatÚappcCsށtƒ}tƒ}tƒ}t|ƒ}t||ƒ}t|||ƒ}||_||j_||j_    ||j_
||j_ ||j_|  ¡t  d¡dV| ¡t  d¡dS)NzSmartLearning server startedzSmartLearning server stopped)rrrrr    rÚ    auto_initÚstateÚ device_storeÚ init_registryÚmqttÚinit_dispatcherÚstartÚloggerÚinfoÚstop)rrrZcourse_serviceZ mqtt_servicerr©rú(D:\apps\smartlearning\server\app\main.pyÚlifespans$€
 
r!zSmartLearning Serveru0情境感知智能英语学习系统 - æœåŠ¡ç«¯z1.0.0)ÚtitleÚ descriptionÚversionr!Ú*T)Z allow_originsZallow_credentialsZ allow_methodsZ allow_headersz/static)Ú    directoryZstatic)Únamez/healthcÃs2ttjdƒr tjjnd}d|r|jdœSddœS)NrÚokF)ÚstatusZmqtt_connected)ÚhasattrrrrÚ    connected)rrrr ÚhealthFs€þþr,)/ÚloggingÚ
contextlibrÚpathlibrÚfastapirZfastapi.middleware.corsrZfastapi.staticfilesrÚ
app.configrZapp.mqtt.clientrZapp.mqtt.init_dispatcherr    Z
app.routesr
r r r Zapp.services.auto_initrZapp.services.course_servicerZapp.services.device_storerZapp.services.init_registryrÚ basicConfigÚINFOÚ    getLoggerÚ__name__rr!rZadd_middlewareZinclude_routerZrouterÚdata_dirZ    data_pathÚexistsZmountÚstrÚgetr,rrrr Ú<module>sP            
üû