@@ -91,10 +91,7 @@ async def get_log(
9191 log = await log_service .get_log_by_id (log_id )
9292
9393 if not log :
94- raise HTTPException (
95- status_code = status .HTTP_404_NOT_FOUND ,
96- detail = "Log entry not found"
97- )
94+ raise HTTPException (status_code = status .HTTP_404_NOT_FOUND , detail = "Log entry not found" )
9895
9996 return LogEntryResponse .model_validate (log )
10097
@@ -114,18 +111,18 @@ async def get_ai_status(
114111 Note: When AI fails, system automatically falls back to basic analysis.
115112 """
116113 settings = get_settings ()
117- ai_enabled = getattr (settings , ' ai_analysis_enabled' , True )
114+ ai_enabled = getattr (settings , " ai_analysis_enabled" , True )
118115
119116 return APIResponse (
120117 data = {
121118 "ai_enabled" : ai_enabled ,
122119 "processing_mode" : (
123120 "AI with automatic fallback" if ai_enabled else "Basic analysis only"
124121 ),
125- "ai_timeout_seconds" : getattr (settings , ' ai_timeout_seconds' , 10 ),
126- "ai_retry_attempts" : getattr (settings , ' ai_retry_attempts' , 2 ),
127- "ai_confidence_threshold" : getattr (settings , ' ai_confidence_threshold' , 0.5 ),
128- "real_time_processing" : getattr (settings , ' enable_real_time_processing' , True ),
122+ "ai_timeout_seconds" : getattr (settings , " ai_timeout_seconds" , 10 ),
123+ "ai_retry_attempts" : getattr (settings , " ai_retry_attempts" , 2 ),
124+ "ai_confidence_threshold" : getattr (settings , " ai_confidence_threshold" , 0.5 ),
125+ "real_time_processing" : getattr (settings , " enable_real_time_processing" , True ),
129126 "note" : "When AI fails, system automatically uses basic analysis as fallback" ,
130127 },
131128 status_code = 200 ,
@@ -157,9 +154,7 @@ async def toggle_ai_processing(
157154 logger .info (
158155 "ai_processing_toggled" ,
159156 ai_enabled = enable_ai ,
160- processing_mode = (
161- "AI with automatic fallback" if enable_ai else "Basic analysis only"
162- ),
157+ processing_mode = ("AI with automatic fallback" if enable_ai else "Basic analysis only" ),
163158 user = current_user .get ("sub" , "unknown" ),
164159 )
165160
@@ -204,24 +199,15 @@ async def get_processing_stats(
204199 start_date = end_date - timedelta (hours = 24 )
205200
206201 _ , error_count = await log_service .get_logs (
207- log_level = "ERROR" ,
208- start_date = start_date ,
209- end_date = end_date ,
210- limit = 1
202+ log_level = "ERROR" , start_date = start_date , end_date = end_date , limit = 1
211203 )
212204
213205 _ , warning_count = await log_service .get_logs (
214- log_level = "WARNING" ,
215- start_date = start_date ,
216- end_date = end_date ,
217- limit = 1
206+ log_level = "WARNING" , start_date = start_date , end_date = end_date , limit = 1
218207 )
219208
220209 _ , info_count = await log_service .get_logs (
221- log_level = "INFO" ,
222- start_date = start_date ,
223- end_date = end_date ,
224- limit = 1
210+ log_level = "INFO" , start_date = start_date , end_date = end_date , limit = 1
225211 )
226212
227213 total_24h = error_count + warning_count + info_count
@@ -238,9 +224,9 @@ async def get_processing_stats(
238224 "error_rate" : round (error_rate , 2 ),
239225 },
240226 "processing_status" : {
241- "ai_enabled" : getattr (get_settings (), ' ai_analysis_enabled' , True ),
227+ "ai_enabled" : getattr (get_settings (), " ai_analysis_enabled" , True ),
242228 "real_time_processing" : getattr (
243- get_settings (), ' enable_real_time_processing' , True
229+ get_settings (), " enable_real_time_processing" , True
244230 ),
245231 },
246232 },
0 commit comments