Spaces:
Running
Running
Update utils/functions.py
Browse files- utils/functions.py +9 -1
utils/functions.py
CHANGED
@@ -92,6 +92,15 @@ def get_history():
|
|
92 |
logging.info("Historia analiz zosta艂a pobrana pomy艣lnie.")
|
93 |
return history
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
def update_stats(fraud_detected=False):
|
96 |
"""Aktualizuje statystyki analiz w pliku stats.json."""
|
97 |
stats = load_json(STATS_FILE)
|
@@ -317,7 +326,6 @@ Provide your analysis and conclusions following the guidelines above."""
|
|
317 |
|
318 |
try:
|
319 |
response = requests.post(url, headers=headers, json=payload)
|
320 |
-
logging.info(f"Response from API: {response.status_code}, {response.text}") # Logowanie odpowiedzi API
|
321 |
if response.status_code == 200:
|
322 |
data = response.json()
|
323 |
ai_response = data['choices'][0]['message']['content']
|
|
|
92 |
logging.info("Historia analiz zosta艂a pobrana pomy艣lnie.")
|
93 |
return history
|
94 |
|
95 |
+
def get_analysis_history():
|
96 |
+
"""Zwraca szczeg贸艂ow膮 histori臋 analiz z pliku history.json."""
|
97 |
+
history = load_json(HISTORY_FILE)
|
98 |
+
if history:
|
99 |
+
return history
|
100 |
+
else:
|
101 |
+
logging.info("Brak zapisanej historii analiz.")
|
102 |
+
return []
|
103 |
+
|
104 |
def update_stats(fraud_detected=False):
|
105 |
"""Aktualizuje statystyki analiz w pliku stats.json."""
|
106 |
stats = load_json(STATS_FILE)
|
|
|
326 |
|
327 |
try:
|
328 |
response = requests.post(url, headers=headers, json=payload)
|
|
|
329 |
if response.status_code == 200:
|
330 |
data = response.json()
|
331 |
ai_response = data['choices'][0]['message']['content']
|