johannoriel commited on
Commit
a497607
1 Parent(s): 9c791eb

Change "reset database" button location for more security

Browse files
plugins/__pycache__/common.cpython-310.pyc CHANGED
Binary files a/plugins/__pycache__/common.cpython-310.pyc and b/plugins/__pycache__/common.cpython-310.pyc differ
 
plugins/__pycache__/ragllm.cpython-310.pyc CHANGED
Binary files a/plugins/__pycache__/ragllm.cpython-310.pyc and b/plugins/__pycache__/ragllm.cpython-310.pyc differ
 
plugins/__pycache__/scansite.cpython-310.pyc CHANGED
Binary files a/plugins/__pycache__/scansite.cpython-310.pyc and b/plugins/__pycache__/scansite.cpython-310.pyc differ
 
plugins/__pycache__/webrankings.cpython-310.pyc CHANGED
Binary files a/plugins/__pycache__/webrankings.cpython-310.pyc and b/plugins/__pycache__/webrankings.cpython-310.pyc differ
 
plugins/common.py CHANGED
@@ -2,18 +2,25 @@ from global_vars import t, translations
2
  from app import Plugin
3
  import streamlit as st
4
  import torch
 
5
 
6
  # Ajout des traductions spécifiques à ce plugin
7
  translations["en"].update({
8
  "work_directory": "Work Directory",
9
  "page_title": "News watcher",
 
10
  })
11
  translations["fr"].update({
12
  "work_directory": "Répertoire de travail",
13
  "page_title": "Outil de veille",
 
14
  })
15
 
16
  class CommonPlugin(Plugin):
 
 
 
 
17
  def get_config_fields(self):
18
  return {
19
  "work_directory": {
@@ -38,6 +45,10 @@ class CommonPlugin(Plugin):
38
  torch.cuda.empty_cache()
39
  st.write("CUDA memory reset")
40
 
 
 
 
 
41
  def remove_quotes(s):
42
  if s.startswith('"') and s.endswith('"'):
43
  return s[1:-1]
 
2
  from app import Plugin
3
  import streamlit as st
4
  import torch
5
+ from plugins.scansite import ScansitePlugin
6
 
7
  # Ajout des traductions spécifiques à ce plugin
8
  translations["en"].update({
9
  "work_directory": "Work Directory",
10
  "page_title": "News watcher",
11
+ "reset_database": "Reset database",
12
  })
13
  translations["fr"].update({
14
  "work_directory": "Répertoire de travail",
15
  "page_title": "Outil de veille",
16
+ "reset_database": "Réinitialiser la base de données",
17
  })
18
 
19
  class CommonPlugin(Plugin):
20
+ def __init__(self, name, plugin_manager):
21
+ super().__init__(name, plugin_manager)
22
+ self.scansite_plugin = ScansitePlugin('scansite', plugin_manager)
23
+
24
  def get_config_fields(self):
25
  return {
26
  "work_directory": {
 
45
  torch.cuda.empty_cache()
46
  st.write("CUDA memory reset")
47
 
48
+ if st.button(t("reset_database")):
49
+ self.scansite_plugin.reset_database()
50
+ st.success(t("database_reset_success"))
51
+
52
  def remove_quotes(s):
53
  if s.startswith('"') and s.endswith('"'):
54
  return s[1:-1]
plugins/scansite.py CHANGED
@@ -13,7 +13,6 @@ translations["en"].update({
13
  "total_links": "Total number of links",
14
  "annotated_links": "Number of annotated links",
15
  "known_tags": "Known tags",
16
- "reset_database": "Reset database",
17
  "database_reset_success": "Database reset successfully",
18
  "launch_scan": "Launch scan",
19
  "scan_complete": "Scan complete",
@@ -46,7 +45,6 @@ translations["fr"].update({
46
  "total_links": "Nombre total de liens",
47
  "annotated_links": "Nombre de liens annotés",
48
  "known_tags": "Tags connus",
49
- "reset_database": "Réinitialiser la base de données",
50
  "database_reset_success": "Base de données réinitialisée",
51
  "launch_scan": "Lancer le scan",
52
  "scan_complete": "Scan terminé",
@@ -128,10 +126,6 @@ class ScansitePlugin(Plugin):
128
  all_tags = self.get_all_tags()
129
  st.write(f"{t('known_tags')} :", ", ".join(all_tags))
130
 
131
- if st.button(t("reset_database")):
132
- self.reset_database()
133
- st.success(t("database_reset_success"))
134
-
135
  if st.button(t("launch_scan")):
136
  self.launch_scan()
137
  st.success(t("scan_complete"))
 
13
  "total_links": "Total number of links",
14
  "annotated_links": "Number of annotated links",
15
  "known_tags": "Known tags",
 
16
  "database_reset_success": "Database reset successfully",
17
  "launch_scan": "Launch scan",
18
  "scan_complete": "Scan complete",
 
45
  "total_links": "Nombre total de liens",
46
  "annotated_links": "Nombre de liens annotés",
47
  "known_tags": "Tags connus",
 
48
  "database_reset_success": "Base de données réinitialisée",
49
  "launch_scan": "Lancer le scan",
50
  "scan_complete": "Scan terminé",
 
126
  all_tags = self.get_all_tags()
127
  st.write(f"{t('known_tags')} :", ", ".join(all_tags))
128
 
 
 
 
 
129
  if st.button(t("launch_scan")):
130
  self.launch_scan()
131
  st.success(t("scan_complete"))