adding another prototype fonctionalite
Browse files- req.txt +7 -0
- satellites/atlasSat/atlas.py +117 -9
- satellites/base_satellite.py +4 -0
- satellites/edisonSat/edison.py +94 -142
- satellites/lilithSat/lilith.py +103 -7
- satellites/pythagorasSat/pythagoras.py +117 -8
- satellites/shakaSat/shaka.py +2 -0
- satellites/yorkSat/york.py +99 -8
- tests/atlas_test.py +35 -0
- tests/edison_test.py +23 -29
- tests/lilith_test.py +26 -0
- tests/pythagoras_test.py +74 -0
- tests/york_test.py +29 -0
req.txt
CHANGED
@@ -3,3 +3,10 @@ openai>=0.27.0
|
|
3 |
python-dotenv>=0.19.0
|
4 |
nltk>=3.9.1
|
5 |
huggingface-hub>=0.25.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
python-dotenv>=0.19.0
|
4 |
nltk>=3.9.1
|
5 |
huggingface-hub>=0.25.0
|
6 |
+
numpy
|
7 |
+
scipy
|
8 |
+
scikit-learn
|
9 |
+
pandas
|
10 |
+
psutil
|
11 |
+
|
12 |
+
|
satellites/atlasSat/atlas.py
CHANGED
@@ -1,17 +1,125 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
3 |
from satellites.base_satellite import VegapunkSatellite
|
|
|
|
|
|
|
4 |
|
5 |
|
|
|
|
|
6 |
class Atlas(VegapunkSatellite):
|
7 |
def __init__(self):
|
8 |
-
super().__init__(name="Atlas", specialty=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
def
|
11 |
-
|
|
|
|
|
|
|
12 |
|
13 |
-
def
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
def
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import smtplib
|
3 |
+
from email.mime.text import MIMEText
|
4 |
+
from typing import Dict, Any, List
|
5 |
from satellites.base_satellite import VegapunkSatellite
|
6 |
+
import logging
|
7 |
+
import subprocess
|
8 |
+
import time
|
9 |
|
10 |
|
11 |
+
role = "Sécurité et Automatisation"
|
12 |
+
fonction = "Exécuter des tâches spécifiques ,Sécurité et Automatisation"
|
13 |
class Atlas(VegapunkSatellite):
|
14 |
def __init__(self):
|
15 |
+
super().__init__(name="Atlas", specialty=role)
|
16 |
+
self.monitored_directories = []
|
17 |
+
self.email_config ={}
|
18 |
+
self.external_systems = {}
|
19 |
+
logging.basicConfig(filename='atlas.log', level=logging.INFO)
|
20 |
+
|
21 |
+
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
22 |
+
task_type = task.get("type")
|
23 |
+
if task_type == "monitor_directory":
|
24 |
+
result = self.monitor_directory(task["directory"])
|
25 |
+
elif task_type == "check_changes":
|
26 |
+
result = self.check_directory_changes()
|
27 |
+
elif task_type == "send_email":
|
28 |
+
result = self.send_email(task["to"], task["subject"], task["body"])
|
29 |
+
elif task_type == "manage_file":
|
30 |
+
result = self.manage_files(task["action"], task["file_path"])
|
31 |
+
elif task_type == "execute_command":
|
32 |
+
result = self.execute_system_command(task["command"])
|
33 |
+
else:
|
34 |
+
result = f"Tâche non reconnue : {task_type}"
|
35 |
+
|
36 |
+
self.log_activity(f"Tâche traitée : {task_type}, Résultat : {result}")
|
37 |
+
return {"result": result}
|
38 |
+
|
39 |
+
|
40 |
+
def monitor_directory(self,directory:str) -> str:
|
41 |
+
if os.path.exists(directory):
|
42 |
+
self.monitored_directories.append(directory)
|
43 |
+
return f"Répertoire {directory} ajouté à la liste de surveillance"
|
44 |
+
else:
|
45 |
+
return f"Répertoire {directory} inexistant"
|
46 |
+
|
47 |
+
def check_directory_changes(self) -> List[str]:
|
48 |
+
changes = []
|
49 |
+
for directory in self.monitored_directories:
|
50 |
+
try:
|
51 |
+
for filename in os.listdir(directory):
|
52 |
+
file_path = os.path.join(directory, filename)
|
53 |
+
if os.path.getmtime(file_path) > self.get_from_knowledge_base("last_check_time"):
|
54 |
+
changes.append(f"Fichier modifié : {file_path}")
|
55 |
+
except Exception as e:
|
56 |
+
changes.append(f"Erreur lors de la vérification de {directory}: {str(e)}")
|
57 |
+
self.add_to_knowledge_base("last_check_time", time.time())
|
58 |
+
return changes
|
59 |
+
|
60 |
+
def send_email(self, to: str, subject: str, body: str) -> str:
|
61 |
+
try:
|
62 |
+
msg = MIMEText(body)
|
63 |
+
msg["Subject"] = subject
|
64 |
+
msg["From"] = self.email_config.get("from")
|
65 |
+
msg["To"] = to
|
66 |
+
|
67 |
+
server = smtplib.SMTP(self.email_config.get("smtp_server"), self.email_config.get("smtp_port"))
|
68 |
+
server.starttls()
|
69 |
+
server.login(self.email_config.get("username"), self.email_config.get("password"))
|
70 |
+
server.sendmail(self.email_config.get("from"), [to], msg.as_string())
|
71 |
+
server.quit()
|
72 |
+
return "Email envoyé avec succès"
|
73 |
+
except Exception as e:
|
74 |
+
return f"Erreur lors de l'envoi de l'email : {str(e)}"
|
75 |
+
|
76 |
+
def manage_files(self, action: str, file_path: str) -> str:
|
77 |
+
try:
|
78 |
+
if action == "create":
|
79 |
+
with open(file_path, 'w') as f:
|
80 |
+
f.write("")
|
81 |
+
return f"Fichier créé : {file_path}"
|
82 |
+
elif action == "delete":
|
83 |
+
os.remove(file_path)
|
84 |
+
return f"Fichier supprimé : {file_path}"
|
85 |
+
elif action == "move":
|
86 |
+
new_path = input("Entrez le nouveau chemin : ")
|
87 |
+
os.rename(file_path, new_path)
|
88 |
+
return f"Fichier déplacé de {file_path} vers {new_path}"
|
89 |
+
else:
|
90 |
+
return "Action non reconnue. Utilisez 'create', 'delete' ou 'move'."
|
91 |
+
except Exception as e:
|
92 |
+
return f"Erreur lors de la gestion du fichier : {str(e)}"
|
93 |
+
|
94 |
+
def execute_system_command(self, command: str) -> str:
|
95 |
+
try:
|
96 |
+
result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
97 |
+
return f"Commande exécutée. Sortie : {result.stdout.decode()}"
|
98 |
+
except subprocess.CalledProcessError as e:
|
99 |
+
return f"Erreur lors de l'exécution de la commande : {e.stderr.decode()}"
|
100 |
+
|
101 |
+
def log_activity(self, activity: str):
|
102 |
+
logging.info(activity)
|
103 |
|
104 |
+
def communicate_with_stellar(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
105 |
+
# Implémentation de la communication avec Stellar
|
106 |
+
self.log_activity(f"Communication avec Stellar : {message}")
|
107 |
+
# Ici, vous pourriez implémenter la logique réelle de communication
|
108 |
+
return {"status": "Message reçu par Stellar", "details": message}
|
109 |
|
110 |
+
def update_from_punkrecord(self) -> None:
|
111 |
+
# Implémentation de la mise à jour depuis PunkRecord
|
112 |
+
self.log_activity("Mise à jour depuis PunkRecord")
|
113 |
+
# Ici, vous pourriez implémenter la logique réelle de mise à jour
|
114 |
+
# Par exemple :
|
115 |
+
# new_data = punkrecord.get_updates_for_atlas()
|
116 |
+
# self.add_to_knowledge_base("email_config", new_data.get("email_config"))
|
117 |
+
# self.add_to_knowledge_base("security_level", new_data.get("security_level"))
|
118 |
|
119 |
+
def report_status(self):
|
120 |
+
# Rapporte le status du satellite
|
121 |
+
status = super().report_status()
|
122 |
+
status.update({
|
123 |
+
"Monitored_directories": self.monitored_directories,
|
124 |
+
"Email_config": self.email_config
|
125 |
+
})
|
satellites/base_satellite.py
CHANGED
@@ -60,6 +60,10 @@ class VegapunkSatellite(ABC):
|
|
60 |
# Methode pour mettre a jour de la base de connaissance local du satellite depuis punkrecord
|
61 |
pass
|
62 |
|
|
|
|
|
|
|
|
|
63 |
#
|
64 |
#
|
65 |
# class Satellite:
|
|
|
60 |
# Methode pour mettre a jour de la base de connaissance local du satellite depuis punkrecord
|
61 |
pass
|
62 |
|
63 |
+
# def communicate_with_other_satellite(self, satellite: VegapunkSatellite, message: Dict[str, Any]) -> Dict[str, Any]:
|
64 |
+
# # Methode pour communiquer avec un autre satellite
|
65 |
+
# pass
|
66 |
+
|
67 |
#
|
68 |
#
|
69 |
# class Satellite:
|
satellites/edisonSat/edison.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
-
import random
|
2 |
-
|
3 |
from satellites.base_satellite import VegapunkSatellite
|
4 |
from typing import Dict,Any,List
|
|
|
|
|
|
|
|
|
5 |
|
6 |
role = "innovation et technologie"
|
7 |
fonction = "Générer des idées innovantes et évaluer leur faisabilité technique"
|
@@ -10,158 +12,108 @@ fonction = "Générer des idées innovantes et évaluer leur faisabilité techni
|
|
10 |
class Edison(VegapunkSatellite):
|
11 |
def __init__(self):
|
12 |
super().__init__(name="Edison", specialty=role)
|
13 |
-
self.
|
14 |
-
self.
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
17 |
-
task_type = task.get(
|
18 |
-
if task_type == "
|
19 |
-
|
20 |
-
elif task_type == "
|
21 |
-
|
22 |
-
elif task_type == "
|
23 |
-
|
|
|
|
|
24 |
else:
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
"
|
35 |
-
|
36 |
-
"
|
37 |
-
"Capteur d'énergie atmosphérique"],
|
38 |
-
"Nanotechnologie": ["Matériau auto-réparant", "Nanofiltre pour la purification de l'eau",
|
39 |
-
"Nanocapteurs médicaux"],
|
40 |
-
"Biotechnologie": ["Organes artificiels bio-imprimés", "Thérapie génique personnalisée",
|
41 |
-
"Plantes bioluminescentes"]
|
42 |
}
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
"Manque d'infrastructure"]
|
56 |
-
selected_challenges = random.sample(challenges, k=random.randint(1, 3))
|
57 |
-
|
58 |
-
feasibility_result = {
|
59 |
-
"score": feasibility_score,
|
60 |
-
"interpretation": "Très faisable" if feasibility_score > 0.8 else "Faisable" if feasibility_score > 0.5 else "Peu faisable",
|
61 |
-
"challenges": selected_challenges
|
62 |
}
|
63 |
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
-
def
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
"
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
-
|
85 |
-
|
86 |
|
87 |
def communicate_with_stellar(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
88 |
-
|
89 |
-
return {"
|
90 |
-
|
91 |
-
def update_from_punkrecord(self):
|
92 |
-
print(f"{self.name} met à jour sa base de connaissances depuis Punkrecord")
|
93 |
-
# Simulation d'une mise à jour
|
94 |
-
new_tech = random.choice(["Quantum Computing", "Fusion nucléaire", "Interface cerveau-machine"])
|
95 |
-
self.add_to_knowledge_base("Nouvelle_technologie", new_tech)
|
96 |
-
|
97 |
-
def report_status(self) -> Dict[str, Any]:
|
98 |
-
status = super().report_status()
|
99 |
-
status.update({
|
100 |
-
"Domaines_technologiques": self.tech_domains,
|
101 |
-
"Idées_générées": len(self.innovation_database)
|
102 |
-
})
|
103 |
-
return status
|
104 |
-
#
|
105 |
-
# # Test de la classe Edison
|
106 |
-
# if __name__ == "__main__":
|
107 |
-
#
|
108 |
-
# edison = Edison()
|
109 |
-
#
|
110 |
-
# # Test de génération d'idée
|
111 |
-
# idea_task = {"type": "generate_idea", "domain": "IA"}
|
112 |
-
# idea_result = edison.process_task(idea_task)
|
113 |
-
# print("Idée générée:", idea_result)
|
114 |
-
#
|
115 |
-
# # Test d'évaluation de faisabilité
|
116 |
-
# if "idea" in idea_result:
|
117 |
-
# feasibility_task = {"type": "evaluate_feasibility", "idea": idea_result["idea"]}
|
118 |
-
# feasibility_result = edison.process_task(feasibility_task)
|
119 |
-
# print("Évaluation de faisabilité:", feasibility_result)
|
120 |
-
#
|
121 |
-
# # Test de simulation de prototype
|
122 |
-
# prototype_task = {"type": "simulate_prototype", "idea": idea_result["idea"]}
|
123 |
-
# prototype_result = edison.process_task(prototype_task)
|
124 |
-
# print("Simulation de prototype:", prototype_result)
|
125 |
-
#
|
126 |
-
# # Test de communication avec Stellar
|
127 |
-
# stellar_response = edison.communicate_with_stellar({"status_update": "Nouvelle idée générée et évaluée"})
|
128 |
-
# print("Réponse de Stellar:", stellar_response)
|
129 |
-
#
|
130 |
-
# # Test de mise à jour depuis PunkRecord
|
131 |
-
# edison.update_from_punkrecord()
|
132 |
-
#
|
133 |
-
# # Affichage du statut final
|
134 |
-
# print("Statut d'Edison:", edison.report_status())
|
135 |
-
#
|
136 |
-
|
137 |
-
"""
|
138 |
-
|
139 |
-
ideas = {
|
140 |
-
"IA": ["Assistant virtuel avancé", "Système de prédiction du comportement humain",
|
141 |
-
"IA pour la composition musicale"],
|
142 |
-
"Robotique": ["Robot domestique polyvalent", "Exosquelette médical",
|
143 |
-
"Nano-robots pour la réparation cellulaire"],
|
144 |
-
"Énergie Renouvelable": ["Panneau solaire à haute efficacité", "Générateur d'énergie par fusion froide",
|
145 |
-
"Capteur d'énergie atmosphérique"],
|
146 |
-
"Nanotechnologie": ["Matériau auto-réparant", "Nanofiltre pour la purification de l'eau",
|
147 |
-
"Nanocapteurs médicaux"],
|
148 |
-
"Biotechnologie": ["Organes artificiels bio-imprimés", "Thérapie génique personnalisée",
|
149 |
-
"Plantes bioluminescentes"],
|
150 |
-
"Transport": ["Véhicule autonome volant", "Hyperloop régional", "Navette spatiale réutilisable"],
|
151 |
-
"Espace": ["Station spatiale commerciale", "Exploration minière d'astéroïdes",
|
152 |
-
"Colonie lunaire permanente"],
|
153 |
-
"Médical": ["Diagnostic médical précoce", "Prothèses neurales", "Thérapie génique anti-âge"],
|
154 |
-
"Agriculture": ["Ferme verticale automatisée", "Culture hydroponique en orbite", "Robot agriculteur autonome"],
|
155 |
-
"Éducation": ["Plateforme d'apprentissage adaptatif", "Tuteur virtuel intelligent",
|
156 |
-
"Système de notation automatisé"],
|
157 |
-
"Finance": ["Blockchain pour les transactions internationales", "IA pour la gestion de portefeuille"],
|
158 |
-
"Divertissement": ["Réalité virtuelle interactive", "Jeu vidéo narratif génératif",
|
159 |
-
"Hologrammes de concert en direct"],
|
160 |
-
"Communication": ["Traducteur universel en temps réel", "Réseau social décentralisé"],
|
161 |
-
"Sécurité": ["Surveillance intelligente des villes", "Détection précoce des cyberattaques"],
|
162 |
-
"Environnement": ["Capteurs de pollution intelligents", "Recyclage automatisé des déchets"],
|
163 |
-
"Autre": ["Innovation non-technologique", "Concept artistique"]
|
164 |
-
|
165 |
-
}
|
166 |
|
167 |
-
|
|
|
|
|
|
|
|
|
|
1 |
from satellites.base_satellite import VegapunkSatellite
|
2 |
from typing import Dict,Any,List
|
3 |
+
import logging
|
4 |
+
import requests
|
5 |
+
import os
|
6 |
+
import json
|
7 |
|
8 |
role = "innovation et technologie"
|
9 |
fonction = "Générer des idées innovantes et évaluer leur faisabilité technique"
|
|
|
12 |
class Edison(VegapunkSatellite):
|
13 |
def __init__(self):
|
14 |
super().__init__(name="Edison", specialty=role)
|
15 |
+
self.llm_api_key = os.getenv("LLM_API_KEY")
|
16 |
+
self.llm_api_url = "https://api.openai.com/v1/chat/completions" # Example using OpenAI's API
|
17 |
+
self.external_apis = {
|
18 |
+
"math": "http://api.mathjs.org/v4/",
|
19 |
+
"wolfram": "http://api.wolframalpha.com/v1/result"
|
20 |
+
}
|
21 |
+
logging.basicConfig(filename='edison_log.txt', level=logging.INFO)
|
22 |
|
23 |
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
24 |
+
task_type = task.get("type")
|
25 |
+
if task_type == "solve_logic_problem":
|
26 |
+
result = self.solve_logic_problem(task["problem"])
|
27 |
+
elif task_type == "perform_complex_calculation":
|
28 |
+
result = self.perform_complex_calculation(task["expression"])
|
29 |
+
elif task_type == "generate_innovation":
|
30 |
+
result = self.generate_innovation(task["domain"])
|
31 |
+
elif task_type == "analyze_data":
|
32 |
+
result = self.analyze_data(task["data"])
|
33 |
else:
|
34 |
+
result = f"Tâche non reconnue : {task_type}"
|
35 |
+
|
36 |
+
self.log_activity(f"Tâche traitée : {task_type}, Résultat : {result}")
|
37 |
+
return {"result": result}
|
38 |
+
|
39 |
+
def solve_logic_problem(self, problem: str) -> Dict[str, Any]:
|
40 |
+
prompt = f"Résolvez le problème logique suivant étape par étape : {problem}"
|
41 |
+
response = self._query_llm(prompt)
|
42 |
+
return {
|
43 |
+
"problem": problem,
|
44 |
+
"solution": response,
|
45 |
+
"method": "LLM"
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
+
def perform_complex_calculation(self, expression: str) -> Dict[str, Any]:
|
49 |
+
try:
|
50 |
+
response = requests.get(f"{self.external_apis['math']}?expr={expression}")
|
51 |
+
result = response.text
|
52 |
+
except requests.RequestException as e:
|
53 |
+
result = f"Erreur lors du calcul : {str(e)}"
|
54 |
+
|
55 |
+
return {
|
56 |
+
"expression": expression,
|
57 |
+
"result": result,
|
58 |
+
"method": "External API (Math.js)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
+
def generate_innovation(self, domain: str) -> Dict[str, Any]:
|
62 |
+
prompt = f"Générez une idée innovante dans le domaine de {domain}. Décrivez l'idée, son impact potentiel et les défis de mise en œuvre."
|
63 |
+
response = self._query_llm(prompt)
|
64 |
+
return {
|
65 |
+
"domain": domain,
|
66 |
+
"innovation": response,
|
67 |
+
"method": "LLM"
|
68 |
+
}
|
69 |
|
70 |
+
def analyze_data(self, data: List[Dict[str, Any]]) -> Dict[str, Any]:
|
71 |
+
# Pour cet exemple, nous allons simplement calculer quelques statistiques de base
|
72 |
+
# Dans une implémentation réelle, vous pourriez utiliser des bibliothèques comme pandas ou numpy
|
73 |
+
if not data:
|
74 |
+
return {"error": "Aucune donnée à analyser"}
|
75 |
+
|
76 |
+
numeric_values = [float(item['value']) for item in data if item['type'] == 'numeric']
|
77 |
+
if numeric_values:
|
78 |
+
analysis = {
|
79 |
+
"count": len(numeric_values),
|
80 |
+
"sum": sum(numeric_values),
|
81 |
+
"average": sum(numeric_values) / len(numeric_values),
|
82 |
+
"min": min(numeric_values),
|
83 |
+
"max": max(numeric_values)
|
84 |
+
}
|
85 |
+
else:
|
86 |
+
analysis = {"error": "Aucune donnée numérique trouvée pour l'analyse"}
|
87 |
|
88 |
+
return {
|
89 |
+
"data": data,
|
90 |
+
"analysis": analysis,
|
91 |
+
"method": "Internal calculation"
|
92 |
+
}
|
93 |
|
94 |
+
def _query_llm(self, prompt: str) -> str:
|
95 |
+
headers = {
|
96 |
+
"Authorization": f"Bearer {self.llm_api_key}",
|
97 |
+
"Content-Type": "application/json"
|
98 |
+
}
|
99 |
+
data = {
|
100 |
+
"model": "gpt-3.5-turbo",
|
101 |
+
"messages": [{"role": "user", "content": prompt}]
|
102 |
}
|
103 |
+
try:
|
104 |
+
response = requests.post(self.llm_api_url, headers=headers, json=data)
|
105 |
+
response.raise_for_status()
|
106 |
+
return response.json()['choices'][0]['message']['content']
|
107 |
+
except requests.RequestException as e:
|
108 |
+
return f"Erreur lors de la requête LLM : {str(e)}"
|
109 |
|
110 |
+
def log_activity(self, activity: str):
|
111 |
+
logging.info(activity)
|
112 |
|
113 |
def communicate_with_stellar(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
114 |
+
self.log_activity(f"Communication avec Stellar : {message}")
|
115 |
+
return {"status": "Message reçu par Stellar", "details": message}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
+
def update_from_punkrecord(self) -> None:
|
118 |
+
self.log_activity("Mise à jour depuis PunkRecord")
|
119 |
+
# Ici, vous pourriez implémenter la logique pour mettre à jour les API externes ou les paramètres du modèle LLM
|
satellites/lilithSat/lilith.py
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
from satellites.base_satellite import VegapunkSatellite
|
|
|
|
|
|
|
2 |
|
3 |
role = " Explorer des solution non conventionnel , creatove,voir risqué"
|
4 |
|
@@ -8,13 +11,106 @@ fonction = "Generer des idee novatrices o explorer des solution non conventionne
|
|
8 |
class Lilith(VegapunkSatellite):
|
9 |
def __init__(self):
|
10 |
super().__init__(name="Lilith", specialty=role)
|
11 |
-
self.
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
def process_task(self, task):
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
def communicate_with_stellar(self, message):
|
17 |
-
pass
|
18 |
|
19 |
-
def update_from_punkrecord(self):
|
20 |
-
pass
|
|
|
1 |
from satellites.base_satellite import VegapunkSatellite
|
2 |
+
from typing import Dict, Any, List
|
3 |
+
import logging
|
4 |
+
import random
|
5 |
|
6 |
role = " Explorer des solution non conventionnel , creatove,voir risqué"
|
7 |
|
|
|
11 |
class Lilith(VegapunkSatellite):
|
12 |
def __init__(self):
|
13 |
super().__init__(name="Lilith", specialty=role)
|
14 |
+
self.idea_categories = ["Technologie", "Art", "Science", "Société", "Environnement"]
|
15 |
+
self.innovation_levels = ["Incrémentale", "Radicale", "Disruptive"]
|
16 |
+
self.unconventional_approaches = ["Pensée inversée", "Analogies lointaines", "Combinaison aléatoire","Contraintes extrêmes"]
|
17 |
+
logging.basicConfig(filename='lilith_log.txt', level=logging.INFO)
|
18 |
+
self.external_apis = {}
|
19 |
|
20 |
+
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
21 |
+
task_type = task.get("type")
|
22 |
+
if task_type == "generate_idea":
|
23 |
+
result = self.generate_creative_idea(task.get("domain"))
|
24 |
+
elif task_type == "solve_problem":
|
25 |
+
result = self.propose_unconventional_solution(task["problem"])
|
26 |
+
elif task_type == "brainstorm":
|
27 |
+
result = self.conduct_brainstorming_session(task["topic"], task.get("duration", 5))
|
28 |
+
elif task_type == "challenge_assumption":
|
29 |
+
result = self.challenge_assumption(task["assumption"])
|
30 |
+
else:
|
31 |
+
result = f"Tâche non reconnue : {task_type}"
|
32 |
+
|
33 |
+
self.log_activity(f"Tâche traitée : {task_type}, Résultat : {result}")
|
34 |
+
return {"result": result}
|
35 |
+
|
36 |
+
def generate_creative_idea(self, domain: str = None) -> Dict[str, Any]:
|
37 |
+
if not domain:
|
38 |
+
domain = random.choice(self.idea_categories)
|
39 |
+
|
40 |
+
innovation_level = random.choice(self.innovation_levels)
|
41 |
+
approach = random.choice(self.unconventional_approaches)
|
42 |
+
|
43 |
+
# Simulons la génération d'une idée créative
|
44 |
+
idea = f"Une {innovation_level} innovation en {domain} utilisant l'approche de {approach}"
|
45 |
+
details = f"Cette idée implique de {self._generate_idea_details(domain, approach)}"
|
46 |
+
|
47 |
+
return {
|
48 |
+
"domain": domain,
|
49 |
+
"innovation_level": innovation_level,
|
50 |
+
"approach": approach,
|
51 |
+
"idea": idea,
|
52 |
+
"details": details
|
53 |
+
}
|
54 |
+
|
55 |
+
def propose_unconventional_solution(self, problem: str) -> Dict[str, Any]:
|
56 |
+
approach = random.choice(self.unconventional_approaches)
|
57 |
+
solution = f"Résoudre '{problem}' en utilisant {approach}"
|
58 |
+
details = self._generate_solution_details(problem, approach)
|
59 |
+
|
60 |
+
return {
|
61 |
+
"problem": problem,
|
62 |
+
"approach": approach,
|
63 |
+
"solution": solution,
|
64 |
+
"details": details
|
65 |
+
}
|
66 |
+
|
67 |
+
def conduct_brainstorming_session(self, topic: str, duration: int) -> Dict[str, Any]:
|
68 |
+
ideas = []
|
69 |
+
for _ in range(duration):
|
70 |
+
ideas.append(self.generate_creative_idea(topic))
|
71 |
+
|
72 |
+
return {
|
73 |
+
"topic": topic,
|
74 |
+
"duration": duration,
|
75 |
+
"number_of_ideas": len(ideas),
|
76 |
+
"ideas": ideas
|
77 |
+
}
|
78 |
+
|
79 |
+
def challenge_assumption(self, assumption: str) -> Dict[str, Any]:
|
80 |
+
challenge = f"Et si le contraire de '{assumption}' était vrai ?"
|
81 |
+
implications = self._generate_implications(assumption)
|
82 |
+
|
83 |
+
return {
|
84 |
+
"original_assumption": assumption,
|
85 |
+
"challenge": challenge,
|
86 |
+
"potential_implications": implications
|
87 |
+
}
|
88 |
+
|
89 |
+
def _generate_idea_details(self, domain: str, approach: str) -> str:
|
90 |
+
# Cette méthode pourrait être étendue avec plus de logique pour générer des détails plus spécifiques
|
91 |
+
return f"repenser complètement la façon dont nous abordons {domain} en appliquant {approach} de manière inattendue"
|
92 |
+
|
93 |
+
def _generate_solution_details(self, problem: str, approach: str) -> str:
|
94 |
+
# Cette méthode pourrait être étendue pour générer des solutions plus détaillées et spécifiques
|
95 |
+
return f"aborder le problème de '{problem}' d'une manière totalement nouvelle en utilisant {approach} pour remettre en question nos hypothèses de base"
|
96 |
+
|
97 |
+
def _generate_implications(self, assumption: str) -> List[str]:
|
98 |
+
# Cette méthode pourrait être étendue pour générer des implications plus spécifiques et variées
|
99 |
+
return [
|
100 |
+
f"Cela pourrait transformer notre compréhension de {assumption}",
|
101 |
+
f"Cela pourrait ouvrir de nouvelles possibilités dans des domaines inattendus",
|
102 |
+
f"Cela pourrait remettre en question des pratiques établies liées à {assumption}"
|
103 |
+
]
|
104 |
+
|
105 |
+
def log_activity(self, activity: str):
|
106 |
+
logging.info(activity)
|
107 |
+
|
108 |
+
def communicate_with_stellar(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
109 |
+
self.log_activity(f"Communication avec Stellar : {message}")
|
110 |
+
return {"status": "Message reçu par Stellar", "details": message}
|
111 |
+
|
112 |
+
def update_from_punkrecord(self) -> None:
|
113 |
+
self.log_activity("Mise à jour depuis PunkRecord")
|
114 |
+
# Ici, vous pourriez implémenter la logique pour mettre à jour les approches créatives ou les domaines d'innovation
|
115 |
|
|
|
|
|
116 |
|
|
|
|
satellites/pythagorasSat/pythagoras.py
CHANGED
@@ -1,20 +1,129 @@
|
|
1 |
from satellites.base_satellite import VegapunkSatellite
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
role = "Analyse de données, formuler des recommandation et effectuer des recherche approfondie"
|
4 |
|
5 |
-
fonction = "Faire des recher sur des sujetc complexe,extraire ,analyse des information de base de donner ou web et formuler des recommandation"
|
6 |
|
|
|
|
|
7 |
|
8 |
class Pythagoras(VegapunkSatellite):
|
9 |
def __init__(self):
|
10 |
-
super().__init__(name="Pythagoras", specialty="
|
|
|
|
|
|
|
|
|
|
|
11 |
self.resources = {}
|
|
|
12 |
|
13 |
-
def process_task(self, task):
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
def
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
def update_from_punkrecord(self):
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from satellites.base_satellite import VegapunkSatellite
|
2 |
+
from typing import Dict, Any, List
|
3 |
+
import numpy as np
|
4 |
+
from scipy import stats
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import io
|
7 |
+
import base64
|
8 |
+
import random
|
9 |
+
import logging
|
10 |
|
|
|
11 |
|
|
|
12 |
|
13 |
+
role = "mathématiques, statistiques et analyse de données"
|
14 |
+
fonction = "Effectuer des calculs complexes et analyser des ensembles de données"
|
15 |
|
16 |
class Pythagoras(VegapunkSatellite):
|
17 |
def __init__(self):
|
18 |
+
super().__init__(name="Pythagoras", specialty="Role")
|
19 |
+
self.mathematical_constants = {
|
20 |
+
"pi": np.pi,
|
21 |
+
"e": np.e,
|
22 |
+
"golden_ratio": (1 + np.sqrt(5)) / 2
|
23 |
+
}
|
24 |
self.resources = {}
|
25 |
+
self.external_apis = {}
|
26 |
|
27 |
+
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
28 |
+
task_type = task.get('type')
|
29 |
+
if task_type == "calculate":
|
30 |
+
return self._perform_calculation(task.get('operation'), task.get('values'))
|
31 |
+
elif task_type == "analyze_data":
|
32 |
+
return self._analyze_dataset(task.get('data'))
|
33 |
+
elif task_type == "statistical_test":
|
34 |
+
return self._perform_statistical_test(task.get('test_type'), task.get('data'))
|
35 |
+
else:
|
36 |
+
return {"error": "Tâche non reconnue"}
|
37 |
|
38 |
+
def _perform_calculation(self, operation: str, values: List[float]) -> Dict[str, Any]:
|
39 |
+
if not operation or not values:
|
40 |
+
return {"error": "Opération ou valeurs manquantes"}
|
41 |
+
|
42 |
+
try:
|
43 |
+
if operation == "mean":
|
44 |
+
result = np.mean(values)
|
45 |
+
elif operation == "median":
|
46 |
+
result = np.median(values)
|
47 |
+
elif operation == "std_dev":
|
48 |
+
result = np.std(values)
|
49 |
+
elif operation == "correlation":
|
50 |
+
if len(values) != 2 or not all(isinstance(v, list) for v in values):
|
51 |
+
return {"error": "La corrélation nécessite deux listes de valeurs"}
|
52 |
+
result = np.corrcoef(values[0], values[1])[0, 1]
|
53 |
+
else:
|
54 |
+
return {"error": "Opération non reconnue"}
|
55 |
+
|
56 |
+
return {"operation": operation, "result": result}
|
57 |
+
except Exception as e:
|
58 |
+
return {"error": f"Erreur lors du calcul: {str(e)}"}
|
59 |
+
|
60 |
+
def _analyze_dataset(self, data: List[float]) -> Dict[str, Any]:
|
61 |
+
if not data:
|
62 |
+
return {"error": "Ensemble de données vide"}
|
63 |
+
|
64 |
+
try:
|
65 |
+
analysis = {
|
66 |
+
"mean": np.mean(data),
|
67 |
+
"median": np.median(data),
|
68 |
+
"std_dev": np.std(data),
|
69 |
+
"min": np.min(data),
|
70 |
+
"max": np.max(data),
|
71 |
+
"quartiles": np.percentile(data, [25, 50, 75]).tolist()
|
72 |
+
}
|
73 |
+
|
74 |
+
# Création d'un histogramme
|
75 |
+
plt.figure(figsize=(10, 6))
|
76 |
+
plt.hist(data, bins='auto', alpha=0.7, color='skyblue', edgecolor='black')
|
77 |
+
plt.title("Histogramme des données")
|
78 |
+
plt.xlabel("Valeurs")
|
79 |
+
plt.ylabel("Fréquence")
|
80 |
+
|
81 |
+
# Convertir le graphique en image base64
|
82 |
+
buffer = io.BytesIO()
|
83 |
+
plt.savefig(buffer, format='png')
|
84 |
+
buffer.seek(0)
|
85 |
+
image_base64 = base64.b64encode(buffer.getvalue()).decode()
|
86 |
+
plt.close()
|
87 |
+
|
88 |
+
analysis["histogram"] = image_base64
|
89 |
+
|
90 |
+
return analysis
|
91 |
+
except Exception as e:
|
92 |
+
return {"error": f"Erreur lors de l'analyse: {str(e)}"}
|
93 |
+
|
94 |
+
def _perform_statistical_test(self, test_type: str, data: Dict[str, List[float]]) -> Dict[str, Any]:
|
95 |
+
if not test_type or not data:
|
96 |
+
return {"error": "Type de test ou données manquantes"}
|
97 |
+
|
98 |
+
try:
|
99 |
+
if test_type == "t_test":
|
100 |
+
if 'group1' not in data or 'group2' not in data:
|
101 |
+
return {"error": "Deux groupes de données sont nécessaires pour le t-test"}
|
102 |
+
t_stat, p_value = stats.ttest_ind(data['group1'], data['group2'])
|
103 |
+
return {"test": "t_test", "t_statistic": t_stat, "p_value": p_value}
|
104 |
+
elif test_type == "anova":
|
105 |
+
if len(data) < 2:
|
106 |
+
return {"error": "Au moins deux groupes sont nécessaires pour l'ANOVA"}
|
107 |
+
f_stat, p_value = stats.f_oneway(*data.values())
|
108 |
+
return {"test": "ANOVA", "f_statistic": f_stat, "p_value": p_value}
|
109 |
+
else:
|
110 |
+
return {"error": "Type de test statistique non reconnu"}
|
111 |
+
except Exception as e:
|
112 |
+
return {"error": f"Erreur lors du test statistique: {str(e)}"}
|
113 |
+
|
114 |
+
def communicate_with_stellar(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
115 |
+
print(f"{self.name} envoie un message à Stellar: {message}")
|
116 |
+
return {"Statut": "Message reçu", "message": "Stellar a bien reçu le message de Pythagoras"}
|
117 |
|
118 |
def update_from_punkrecord(self):
|
119 |
+
print(f"{self.name} met à jour sa base de connaissances depuis Punkrecord")
|
120 |
+
new_constant = random.choice(["Constante de Planck", "Nombre d'Avogadro", "Constante de Boltzmann"])
|
121 |
+
self.add_to_knowledge_base("Nouvelle_constante", new_constant)
|
122 |
+
|
123 |
+
def report_status(self) -> Dict[str, Any]:
|
124 |
+
status = super().report_status()
|
125 |
+
status.update({
|
126 |
+
"Constantes_mathématiques": list(self.mathematical_constants.keys()),
|
127 |
+
"Opérations_disponibles": ["mean", "median", "std_dev", "correlation"]
|
128 |
+
})
|
129 |
+
return status
|
satellites/shakaSat/shaka.py
CHANGED
@@ -4,6 +4,7 @@ import nltk
|
|
4 |
from nltk.tokenize import word_tokenize
|
5 |
from nltk.corpus import stopwords
|
6 |
import string
|
|
|
7 |
|
8 |
role = "logique, éthique et analyse"
|
9 |
fonction = "Vérifier la cohérence des informations et filtrer les informations non éthiques"
|
@@ -12,6 +13,7 @@ class Shaka(VegapunkSatellite):
|
|
12 |
def __init__(self):
|
13 |
super().__init__(name="Shaka", specialty=role)
|
14 |
self.nlp = self._initialize_nlp_tools()
|
|
|
15 |
|
16 |
def _initialize_nlp_tools(self):
|
17 |
resources = ["stopwords", "punctuation", "averaged_perceptron_tagger", "wordnet", "punkt_tab"]
|
|
|
4 |
from nltk.tokenize import word_tokenize
|
5 |
from nltk.corpus import stopwords
|
6 |
import string
|
7 |
+
import logging
|
8 |
|
9 |
role = "logique, éthique et analyse"
|
10 |
fonction = "Vérifier la cohérence des informations et filtrer les informations non éthiques"
|
|
|
13 |
def __init__(self):
|
14 |
super().__init__(name="Shaka", specialty=role)
|
15 |
self.nlp = self._initialize_nlp_tools()
|
16 |
+
logging.basicConfig(filename='shaka.log', level=logging.INFO)
|
17 |
|
18 |
def _initialize_nlp_tools(self):
|
19 |
resources = ["stopwords", "punctuation", "averaged_perceptron_tagger", "wordnet", "punkt_tab"]
|
satellites/yorkSat/york.py
CHANGED
@@ -1,6 +1,10 @@
|
|
|
|
|
|
|
|
1 |
from satellites.base_satellite import VegapunkSatellite
|
|
|
2 |
|
3 |
-
role =
|
4 |
|
5 |
fonction = "Gerer les tache repetitive, les resource et les maintenance des systeme"
|
6 |
|
@@ -8,13 +12,100 @@ fonction = "Gerer les tache repetitive, les resource et les maintenance des syst
|
|
8 |
class York(VegapunkSatellite):
|
9 |
def __init__(self):
|
10 |
super().__init__(name="York", specialty=role)
|
11 |
-
self.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
def process_task(self, task):
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
|
18 |
|
19 |
-
def
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import psutil
|
2 |
+
import time
|
3 |
+
from typing import Dict, Any, List
|
4 |
from satellites.base_satellite import VegapunkSatellite
|
5 |
+
import logging
|
6 |
|
7 |
+
role = "Gestion des ressources et maintenance système"
|
8 |
|
9 |
fonction = "Gerer les tache repetitive, les resource et les maintenance des systeme"
|
10 |
|
|
|
12 |
class York(VegapunkSatellite):
|
13 |
def __init__(self):
|
14 |
super().__init__(name="York", specialty=role)
|
15 |
+
self.resource_thresholds ={
|
16 |
+
"cpu": 90,
|
17 |
+
"memory": 90,
|
18 |
+
"disk": 90,
|
19 |
+
"network": 75,
|
20 |
+
}
|
21 |
+
self.maintenance_schedule = {}
|
22 |
+
logging.basicConfig(filename='york.log', level=logging.INFO)
|
23 |
+
self.external_apis = {}
|
24 |
|
25 |
+
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
26 |
+
task_type = task.get("type")
|
27 |
+
if task_type == "check_resources":
|
28 |
+
result = self.check_system_resources()
|
29 |
+
elif task_type == "optimize_performance":
|
30 |
+
result = self.optimize_system_performance()
|
31 |
+
elif task_type == "schedule_maintenance":
|
32 |
+
result = self.schedule_maintenance(task["component"], task["date"])
|
33 |
+
elif task_type == "perform_maintenance":
|
34 |
+
result = self.perform_maintenance(task["component"])
|
35 |
+
else:
|
36 |
+
result = f"Tâche non reconnue : {task_type}"
|
37 |
|
38 |
+
self.log_activity(f"Tâche traitée : {task_type}, Résultat : {result}")
|
39 |
+
return {"result": result}
|
40 |
|
41 |
+
def check_system_resources(self) -> Dict[str, Any]:
|
42 |
+
cpu_usage = psutil.cpu_percent()
|
43 |
+
memory_usage = psutil.virtual_memory().percent
|
44 |
+
disk_usage = psutil.disk_usage('/').percent
|
45 |
+
network_usage = psutil.net_io_counters().bytes_sent + psutil.net_io_counters().bytes_recv
|
46 |
+
|
47 |
+
status = {
|
48 |
+
"cpu": "Normal" if cpu_usage < self.resource_thresholds["cpu"] else "Élevé",
|
49 |
+
"memory": "Normal" if memory_usage < self.resource_thresholds["memory"] else "Élevé",
|
50 |
+
"disk": "Normal" if disk_usage < self.resource_thresholds["disk"] else "Élevé",
|
51 |
+
"network": "Normal" # Simplified for this example
|
52 |
+
}
|
53 |
+
|
54 |
+
return {
|
55 |
+
"cpu_usage": cpu_usage,
|
56 |
+
"memory_usage": memory_usage,
|
57 |
+
"disk_usage": disk_usage,
|
58 |
+
"network_usage": network_usage,
|
59 |
+
"status": status
|
60 |
+
}
|
61 |
+
|
62 |
+
def optimize_system_performance(self) -> Dict[str, Any]:
|
63 |
+
# Simulation d'optimisation du système
|
64 |
+
optimizations = []
|
65 |
+
if psutil.cpu_percent() > self.resource_thresholds["cpu"]:
|
66 |
+
optimizations.append("Réduction de la charge CPU")
|
67 |
+
if psutil.virtual_memory().percent > self.resource_thresholds["memory"]:
|
68 |
+
optimizations.append("Libération de mémoire")
|
69 |
+
if psutil.disk_usage('/').percent > self.resource_thresholds["disk"]:
|
70 |
+
optimizations.append("Nettoyage de l'espace disque")
|
71 |
+
|
72 |
+
return {
|
73 |
+
"optimizations_performed": optimizations,
|
74 |
+
"performance_improvement": f"{len(optimizations) * 5}%" # Simulated improvement
|
75 |
+
}
|
76 |
+
|
77 |
+
def schedule_maintenance(self, component: str, date: str) -> Dict[str, Any]:
|
78 |
+
self.maintenance_schedule[component] = date
|
79 |
+
return {
|
80 |
+
"component": component,
|
81 |
+
"scheduled_date": date,
|
82 |
+
"status": "Maintenance programmée"
|
83 |
+
}
|
84 |
+
|
85 |
+
def perform_maintenance(self, component: str) -> Dict[str, Any]:
|
86 |
+
if component in self.maintenance_schedule:
|
87 |
+
# Simulation de maintenance
|
88 |
+
time.sleep(2) # Simule le temps de maintenance
|
89 |
+
del self.maintenance_schedule[component]
|
90 |
+
return {
|
91 |
+
"component": component,
|
92 |
+
"status": "Maintenance effectuée",
|
93 |
+
"result": "Performances du composant améliorées"
|
94 |
+
}
|
95 |
+
else:
|
96 |
+
return {
|
97 |
+
"component": component,
|
98 |
+
"status": "Erreur",
|
99 |
+
"result": "Aucune maintenance programmée pour ce composant"
|
100 |
+
}
|
101 |
+
|
102 |
+
def log_activity(self, activity: str):
|
103 |
+
logging.info(activity)
|
104 |
+
|
105 |
+
def communicate_with_stellar(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
106 |
+
self.log_activity(f"Communication avec Stellar : {message}")
|
107 |
+
return {"status": "Message reçu par Stellar", "details": message}
|
108 |
+
|
109 |
+
def update_from_punkrecord(self) -> None:
|
110 |
+
self.log_activity("Mise à jour depuis PunkRecord")
|
111 |
+
# Ici, vous pourriez implémenter la logique pour mettre à jour les seuils de ressources ou les plannings de maintenance
|
tests/atlas_test.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from satellites.atlasSat.atlas import Atlas
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
def test_atlas():
|
8 |
+
|
9 |
+
atlas = Atlas()
|
10 |
+
|
11 |
+
# Ajout de tâches à la file d'attente
|
12 |
+
atlas.add_task({"type": "monitor_directory", "directory": "/home/user/documents"})
|
13 |
+
atlas.add_task({"type": "check_changes"})
|
14 |
+
atlas.add_task({"type": "send_email", "to": "[email protected]", "subject": "Alerte", "body": "Changements détectés"})
|
15 |
+
atlas.add_task({"type": "manage_file", "action": "create", "file_path": "/tmp/test.txt"})
|
16 |
+
atlas.add_task({"type": "execute_command", "command": "ls -l /tmp"})
|
17 |
+
|
18 |
+
# Traitement des tâches
|
19 |
+
while task := atlas.get_next_task():
|
20 |
+
result = atlas.process_task(task)
|
21 |
+
print(f"Résultat de la tâche : {result}")
|
22 |
+
|
23 |
+
# Affichage du statut
|
24 |
+
print(atlas.report_status())
|
25 |
+
|
26 |
+
# Communication avec Stellar
|
27 |
+
stellar_response = atlas.communicate_with_stellar({"message": "Rapport de sécurité quotidien"})
|
28 |
+
print(f"Réponse de Stellar : {stellar_response}")
|
29 |
+
|
30 |
+
# Mise à jour depuis PunkRecord
|
31 |
+
atlas.update_from_punkrecord()
|
32 |
+
|
33 |
+
|
34 |
+
test_atlas()
|
35 |
+
|
tests/edison_test.py
CHANGED
@@ -4,36 +4,30 @@ from satellites.edisonSat.edison import Edison
|
|
4 |
def test_edison():
|
5 |
edison = Edison()
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
print("
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
# Test de mise à jour depuis PunkRecord
|
31 |
edison.update_from_punkrecord()
|
32 |
|
33 |
-
print()
|
34 |
-
|
35 |
-
# Affichage du statut final
|
36 |
-
print("Statut d'Edison:", edison.report_status())
|
37 |
-
|
38 |
|
39 |
test_edison()
|
|
|
4 |
def test_edison():
|
5 |
edison = Edison()
|
6 |
|
7 |
+
# Ajout de tâches à la file d'attente
|
8 |
+
edison.add_task({"type": "solve_logic_problem",
|
9 |
+
"problem": "Si A implique B, et B implique C, que peut-on dire de la relation entre A et C?"})
|
10 |
+
edison.add_task({"type": "perform_complex_calculation", "expression": "derivative(x^2 + 2x + 1, x)"})
|
11 |
+
edison.add_task({"type": "generate_innovation", "domain": "énergie renouvelable"})
|
12 |
+
edison.add_task({"type": "analyze_data",
|
13 |
+
"data": [{"type": "numeric", "value": 10}, {"type": "numeric", "value": 20},
|
14 |
+
{"type": "numeric", "value": 30}]})
|
15 |
+
|
16 |
+
# Traitement des tâches
|
17 |
+
while task := edison.get_next_task():
|
18 |
+
result = edison.process_task(task)
|
19 |
+
print(f"Résultat de la tâche : {result}")
|
20 |
+
|
21 |
+
# Affichage du statut
|
22 |
+
print(edison.report_status())
|
23 |
+
|
24 |
+
# Communication avec Stellar
|
25 |
+
stellar_response = edison.communicate_with_stellar(
|
26 |
+
{"message": "Nouvelle innovation générée dans le domaine de l'énergie renouvelable"})
|
27 |
+
print(f"Réponse de Stellar : {stellar_response}")
|
28 |
+
|
29 |
+
# Mise à jour depuis PunkRecord
|
|
|
30 |
edison.update_from_punkrecord()
|
31 |
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
test_edison()
|
tests/lilith_test.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from satellites.lilithSat.lilith import Lilith
|
2 |
+
|
3 |
+
|
4 |
+
lilith = Lilith()
|
5 |
+
|
6 |
+
# Ajout de tâches à la file d'attente
|
7 |
+
lilith.add_task({"type": "generate_idea", "domain": "Technologie"})
|
8 |
+
lilith.add_task({"type": "solve_problem", "problem": "Surpopulation urbaine"})
|
9 |
+
lilith.add_task({"type": "brainstorm", "topic": "Énergie renouvelable", "duration": 3})
|
10 |
+
lilith.add_task({"type": "challenge_assumption", "assumption": "La croissance économique est toujours bénéfique"})
|
11 |
+
|
12 |
+
# Traitement des tâches
|
13 |
+
while task := lilith.get_next_task():
|
14 |
+
result = lilith.process_task(task)
|
15 |
+
print(f"Résultat de la tâche : {result}")
|
16 |
+
|
17 |
+
# Affichage du statut
|
18 |
+
print(lilith.report_status())
|
19 |
+
|
20 |
+
# Communication avec Stellar
|
21 |
+
stellar_response = lilith.communicate_with_stellar(
|
22 |
+
{"message": "Nouvelle idée disruptive générée pour le domaine de l'IA"})
|
23 |
+
print(f"Réponse de Stellar : {stellar_response}")
|
24 |
+
|
25 |
+
# Mise à jour depuis PunkRecord
|
26 |
+
lilith.update_from_punkrecord()
|
tests/pythagoras_test.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from satellites.pythagorasSat.pythagoras import Pythagoras
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
|
5 |
+
def test_pythagoras():
|
6 |
+
pythagoras = Pythagoras()
|
7 |
+
|
8 |
+
test_task = {
|
9 |
+
"type": "calculate",
|
10 |
+
"operation": "mean",
|
11 |
+
"values": [1, 2, 3, 4, 5]
|
12 |
+
}
|
13 |
+
|
14 |
+
test_result = pythagoras.process_task(test_task)
|
15 |
+
print("Résultat de la tâche de test:", test_result)
|
16 |
+
print("\n\n")
|
17 |
+
# Test de calcul
|
18 |
+
calc_task = {"type": "calculate", "operation": "mean", "values": [1, 2, 3, 4, 5]}
|
19 |
+
calc_result = pythagoras.process_task(calc_task)
|
20 |
+
print("Résultat du calcul:", calc_result)
|
21 |
+
print("\n\n")
|
22 |
+
|
23 |
+
test_data = {
|
24 |
+
"type": "analyze_data",
|
25 |
+
"data": [1, 2, 3, 4, 5]
|
26 |
+
}
|
27 |
+
|
28 |
+
data_result = pythagoras.process_task(test_data)
|
29 |
+
print("Résultat de l'analyse de données:", data_result)
|
30 |
+
print("\n\n")
|
31 |
+
# Test d'analyse de données
|
32 |
+
data_task = {"type": "analyze_data", "data": np.random.normal(0, 1, 1000).tolist()}
|
33 |
+
data_result = pythagoras.process_task(data_task)
|
34 |
+
print("Résultat de l'analyse de données:", {k: v for k, v in data_result.items() if k != 'histogram'})
|
35 |
+
print("Un histogramme a été généré (non affiché ici)")
|
36 |
+
print("\n\n")
|
37 |
+
|
38 |
+
test_test = {
|
39 |
+
"type": "statistical_test",
|
40 |
+
"test_type": "correlation",
|
41 |
+
"data": [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1]]
|
42 |
+
}
|
43 |
+
|
44 |
+
test_result = pythagoras.process_task(test_test)
|
45 |
+
print("Résultat du test statistique:", test_result)
|
46 |
+
print("\n\n")
|
47 |
+
|
48 |
+
# Test de test statistique
|
49 |
+
stat_task = {
|
50 |
+
"type": "statistical_test",
|
51 |
+
"test_type": "t_test",
|
52 |
+
"data": {
|
53 |
+
"group1": np.random.normal(0, 1, 100).tolist(),
|
54 |
+
"group2": np.random.normal(0.5, 1, 100).tolist()
|
55 |
+
}
|
56 |
+
}
|
57 |
+
stat_result = pythagoras.process_task(stat_task)
|
58 |
+
print("Résultat du test statistique:", stat_result)
|
59 |
+
print("\n\n")
|
60 |
+
|
61 |
+
print("Connexion au Punkrecord")
|
62 |
+
pythagoras.update_from_punkrecord()
|
63 |
+
|
64 |
+
print("Communication avec Stellar")
|
65 |
+
stellar_response = pythagoras.communicate_with_stellar({"status_update": "Tâche terminée avec succès"})
|
66 |
+
print("Réponse de Stellar:", stellar_response)
|
67 |
+
|
68 |
+
print(pythagoras.report_status())
|
69 |
+
|
70 |
+
|
71 |
+
test_pythagoras()
|
72 |
+
|
73 |
+
print("test pythagoras")
|
74 |
+
print("By YmC")
|
tests/york_test.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from satellites.yorkSat.york import York
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
york = York()
|
7 |
+
|
8 |
+
# Ajout de tâches à la file d'attente
|
9 |
+
york.add_task({"type": "check_resources"})
|
10 |
+
york.add_task({"type": "optimize_performance"})
|
11 |
+
york.add_task({"type": "schedule_maintenance", "component": "Serveur principal", "date": "2024-09-25"})
|
12 |
+
york.add_task({"type": "perform_maintenance", "component": "Serveur principal"})
|
13 |
+
|
14 |
+
# Traitement des tâches
|
15 |
+
while task := york.get_next_task():
|
16 |
+
result = york.process_task(task)
|
17 |
+
print(f"Résultat de la tâche : {result}")
|
18 |
+
|
19 |
+
print("\n")
|
20 |
+
# Affichage du statut
|
21 |
+
print(york.report_status())
|
22 |
+
|
23 |
+
print("\n")
|
24 |
+
# Communication avec Stellar
|
25 |
+
stellar_response = york.communicate_with_stellar({"message": "Rapport de performance système"})
|
26 |
+
print(f"Réponse de Stellar : {stellar_response}")
|
27 |
+
print("\n")
|
28 |
+
# Mise à jour depuis PunkRecord
|
29 |
+
york.update_from_punkrecord()
|