rafaldembski commited on
Commit
8b6fefc
verified
1 Parent(s): 8045dc1

Update utils/functions.py

Browse files
Files changed (1) hide show
  1. utils/functions.py +24 -2
utils/functions.py CHANGED
@@ -6,8 +6,8 @@ import os
6
  from datetime import datetime
7
  import logging
8
  import json
9
- from PIL import Image
10
- import pytesseract
11
 
12
  # Konfiguracja logowania
13
  logging.basicConfig(
@@ -86,6 +86,21 @@ 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 update_stats(fraud_detected=False):
90
  """Aktualizuje statystyki analiz w pliku stats.json."""
91
  stats = load_json(STATS_FILE)
@@ -101,6 +116,11 @@ def get_stats():
101
  logging.info("Statystyki zosta艂y pobrane pomy艣lnie.")
102
  return stats
103
 
 
 
 
 
 
104
  def get_phone_info(phone_number):
105
  """Weryfikuje numer telefonu i zwraca informacje o kraju i operatorze."""
106
  try:
@@ -275,6 +295,8 @@ You are an advanced AI assistant specializing in identifying fake SMS messages.
275
  - Do you have access to other tools that can help you assess this message?
276
  - What actions can you take to enhance your security in the future?
277
  </recommendations>
 
 
278
  """
279
  }
280
 
 
6
  from datetime import datetime
7
  import logging
8
  import json
9
+ from PIL import Image # Upewnij si臋, 偶e zainstalowa艂e艣 t臋 bibliotek臋: pip install pillow
10
+ import pytesseract # Upewnij si臋, 偶e zainstalowa艂e艣 t臋 bibliotek臋: pip install pytesseract
11
 
12
  # Konfiguracja logowania
13
  logging.basicConfig(
 
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)
 
116
  logging.info("Statystyki zosta艂y pobrane pomy艣lnie.")
117
  return stats
118
 
119
+ def get_statistics():
120
+ """Zwraca szczeg贸艂owe statystyki analiz z pliku stats.json."""
121
+ stats = load_json(STATS_FILE)
122
+ return stats
123
+
124
  def get_phone_info(phone_number):
125
  """Weryfikuje numer telefonu i zwraca informacje o kraju i operatorze."""
126
  try:
 
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