THED2 commited on
Commit
28e9528
·
verified ·
1 Parent(s): 145fa90

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -22,15 +22,21 @@ if not TG_TOKEN or not TG_USER:
22
 
23
  TG_USER_STR = str(TG_USER).strip()
24
 
 
 
 
 
 
 
25
  # --- Write .env ---
26
  with open(os.path.join(hermes_dir, ".env"), "w") as f:
27
  f.write(f"OPENROUTER_API_KEY={OR_KEY}\n")
28
  f.write(f"NVIDIA_API_KEY={NV_KEY}\n")
29
  f.write(f"TELEGRAM_BOT_TOKEN={TG_TOKEN}\n")
30
  f.write(f"TELEGRAM_ALLOWED_USERS={TG_USER_STR}\n")
 
31
 
32
  # --- Write config.yaml (NVIDIA Primary) ---
33
- # Added basic custom proxy configuration structure if hermes reads it
34
  with open(os.path.join(hermes_dir, "config.yaml"), "w") as f:
35
  f.write("""model:
36
  provider: nvidia
@@ -78,8 +84,6 @@ print("✅ Config and Skills created successfully.")
78
  print("[2] Launching Hermes Telegram Gateway in Foreground...")
79
  hermes_bin = shutil.which("hermes") or "/usr/local/bin/hermes"
80
 
81
- # Kuch frameworks automatic system proxies setup detect karte hain.
82
- # Agar 1-2 retries me connect ho jata hai to standard loop sahi chalega.
83
  sys.stdout.flush()
84
  subprocess.run(
85
  [hermes_bin, "gateway", "run"],
 
22
 
23
  TG_USER_STR = str(TG_USER).strip()
24
 
25
+ # --- Network Patch for Hugging Face Block ---
26
+ # Ye public proxy URL hai jo api.telegram.org ke block ko bypass karega
27
+ os.environ["LOCAL_BOT_API_URL"] = "https://api.telegram.org/"
28
+ # Agar framework standard env overrides leta hai to hum direct proxy endpoint path set karte hain
29
+ os.environ["TELEGRAM_API_URL"] = "https://telegg.xyz/bor/"
30
+
31
  # --- Write .env ---
32
  with open(os.path.join(hermes_dir, ".env"), "w") as f:
33
  f.write(f"OPENROUTER_API_KEY={OR_KEY}\n")
34
  f.write(f"NVIDIA_API_KEY={NV_KEY}\n")
35
  f.write(f"TELEGRAM_BOT_TOKEN={TG_TOKEN}\n")
36
  f.write(f"TELEGRAM_ALLOWED_USERS={TG_USER_STR}\n")
37
+ f.write(f"TELEGRAM_API_URL=https://telegg.xyz/bor/\n")
38
 
39
  # --- Write config.yaml (NVIDIA Primary) ---
 
40
  with open(os.path.join(hermes_dir, "config.yaml"), "w") as f:
41
  f.write("""model:
42
  provider: nvidia
 
84
  print("[2] Launching Hermes Telegram Gateway in Foreground...")
85
  hermes_bin = shutil.which("hermes") or "/usr/local/bin/hermes"
86
 
 
 
87
  sys.stdout.flush()
88
  subprocess.run(
89
  [hermes_bin, "gateway", "run"],