refactor: deploy-lucee + deploy-check — два независимых набора кода ВМ

This commit is contained in:
2026-06-27 19:37:35 +04:00
parent 623cd9140f
commit ec5e23589b
60 changed files with 4805 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
"""LLM service — call LLM API."""
import os, json
import httpx
LLM_URL = "https://api.aillm.ru/v1/chat/completions"
LLM_KEY = os.environ.get("LLM_KEY") or os.environ.get("LLM_API_KEY", "")
LLM_MODEL = "gpt-oss-120b"
def call_llm(current_spec, doc_text, build_prompt_fn):
"""Call LLM. Returns (parsed_result, prompt_id)."""
prompt, prompt_id = build_prompt_fn(current_spec, doc_text)
payload = {
"model": LLM_MODEL,
"messages": [{"role": "user", "content": prompt}],
"max_tokens": 8000,
"temperature": 0.1,
}
with httpx.Client(http2=True, timeout=120, verify=True) as client:
resp = client.post(
LLM_URL,
json=payload,
headers={
"Authorization": f"Bearer {LLM_KEY}",
"Content-Type": "application/json",
},
)
resp.raise_for_status()
data = resp.json()
raw_text = data.get("choices", [{}])[0].get("message", {}).get("content", "")
json_text = raw_text
if "```json" in json_text:
json_text = json_text.split("```json")[1].split("```")[0]
elif "```" in json_text:
json_text = json_text.split("```")[1].split("```")[0]
return json.loads(json_text.strip()), prompt_id