Spaces:
Running
Running
Update utils/functions.py
Browse files- utils/functions.py +2 -17
utils/functions.py
CHANGED
@@ -86,21 +86,6 @@ def add_to_history(message, phone_number, analysis, risk, recommendations):
|
|
86 |
save_json(HISTORY_FILE, history)
|
87 |
logging.info(f"Dodano wpis do history.json dla numeru {phone_number}.")
|
88 |
|
89 |
-
def get_history():
|
90 |
-
"""Pobiera histori臋 analiz z pliku history.json jako list臋 s艂ownik贸w."""
|
91 |
-
history = load_json(HISTORY_FILE)
|
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)
|
@@ -295,8 +280,6 @@ You are an advanced AI assistant specializing in identifying fake SMS messages.
|
|
295 |
- Do you have access to other tools that can help you assess this message?
|
296 |
- What actions can you take to enhance your security in the future?
|
297 |
</recommendations>
|
298 |
-
|
299 |
-
Your response should be formatted exactly as specified above, using the <analysis>, <risk_assessment>, and <recommendations> tags. Ensure that each section is thoroughly and comprehensively filled out.
|
300 |
"""
|
301 |
}
|
302 |
|
@@ -325,7 +308,9 @@ Provide your analysis and conclusions following the guidelines above."""
|
|
325 |
}
|
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']
|
|
|
86 |
save_json(HISTORY_FILE, history)
|
87 |
logging.info(f"Dodano wpis do history.json dla numeru {phone_number}.")
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
def update_stats(fraud_detected=False):
|
90 |
"""Aktualizuje statystyki analiz w pliku stats.json."""
|
91 |
stats = load_json(STATS_FILE)
|
|
|
280 |
- Do you have access to other tools that can help you assess this message?
|
281 |
- What actions can you take to enhance your security in the future?
|
282 |
</recommendations>
|
|
|
|
|
283 |
"""
|
284 |
}
|
285 |
|
|
|
308 |
}
|
309 |
|
310 |
try:
|
311 |
+
logging.info(f"Wysy艂anie 偶膮dania do API z payload: {payload}")
|
312 |
response = requests.post(url, headers=headers, json=payload)
|
313 |
+
logging.info(f"Odpowied藕 API: {response.status_code} - {response.text}")
|
314 |
if response.status_code == 200:
|
315 |
data = response.json()
|
316 |
ai_response = data['choices'][0]['message']['content']
|