V1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
"""Adaptateur V1. À ajuster à l'interface exacte de l'installation Hermes existante."""
|
||||
import os, subprocess, requests
|
||||
|
||||
def ask_hermes(text:str)->str:
|
||||
if os.getenv('HERMES_MODE','cli') == 'http':
|
||||
r=requests.post(os.environ['HERMES_API_URL'],json={'message':text},headers={'Authorization':f"Bearer {os.getenv('HERMES_API_TOKEN','')}"},timeout=120);r.raise_for_status();return r.json().get('response',r.text)
|
||||
p=subprocess.run([os.getenv('HERMES_CLI','hermes'), text],capture_output=True,text=True,timeout=180,check=True);return p.stdout.strip()
|
||||
Reference in New Issue
Block a user