21 lines
829 B
Python
Executable File
21 lines
829 B
Python
Executable File
import sys, requests, json, psycopg2
|
|
|
|
DB_PARAMS = "host=localhost dbname=adx_system user=admin password=admin123"
|
|
|
|
def get_best_config(target_isp):
|
|
# L'IA consulte le RAG et la DB pour décider
|
|
conn = psycopg2.connect(DB_PARAMS)
|
|
cur = conn.cursor()
|
|
cur.execute("SET search_path TO admin, public;")
|
|
cur.execute("SELECT config_hash, inbox_rate FROM brain_winners WHERE isp_target = %s ORDER BY inbox_rate DESC LIMIT 1", (target_isp,))
|
|
winner = cur.fetchone()
|
|
|
|
if winner:
|
|
return f"🏆 Config gagnante détectée ({winner[1]}% Inbox). Utilisation du hash: {winner[0]}"
|
|
else:
|
|
return "⚠️ Pas de winner historique. Passage en mode 'Discovery' (test aléatoire)."
|
|
|
|
if __name__ == "__main__":
|
|
isp = sys.argv[1] if len(sys.argv) > 1 else "gmail"
|
|
print(get_best_config(isp))
|