diff --git a/gpt_interface/ingest.py b/gpt_interface/ingest.py index 8491d56..161a6e6 100644 --- a/gpt_interface/ingest.py +++ b/gpt_interface/ingest.py @@ -8,7 +8,10 @@ from flask import Blueprint, abort, jsonify, request bp = Blueprint("ingest_text", __name__) BASE = Path(os.getenv("INGEST_DIR", "/home/pi/tmp_git")).resolve() BASE.mkdir(parents=True, exist_ok=True) -TOKEN = os.getenv("INGEST_TOKEN", "change-me") +TOKEN = None +with open("/home/pi/gpt_cont_api_key", "r") as f: + TOKEN = f.read().strip() + # prosty bufor kawałków w RAM (na 1 proces) chunks = {} @@ -34,6 +37,8 @@ def ingest_text(): entry = chunks.setdefault(key, {}) entry[index] = urllib.parse.unquote_plus(chunk) + if TOKEN is None: + exit("No API token set!") if len(entry) == total: # składamy i zapisujemy data = "".join(entry[i] for i in range(1, total + 1))