From a474b4324b4e06adf42bc8e4a56bf3034c962cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sat, 27 Jun 2026 13:06:21 +0400 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=83=D0=B1=D1=80=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D1=85=D0=B0=D1=80=D0=B4=D0=BA=D0=BE=D0=B4=20API-=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B0=20(chat.cfm),=20verify=3DTrue=20(llm.py),=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B2=D1=8F=D0=B7=D0=B0=D1=82=D1=8C=20llm=5Fprompt?= =?UTF-8?q?=20=D0=BE=D1=82=20Lucee?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat.cfm | 16 +++++++--------- deploy/llm_prompt.py | 22 ++++++---------------- deploy/services/llm.py | 2 +- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/chat.cfm b/chat.cfm index 22dc1ce..f332eec 100644 --- a/chat.cfm +++ b/chat.cfm @@ -15,14 +15,12 @@ - + - SELECT d.filename, sr.row_num, sr.name, sr.price, sr.qty, sr.sum, sr.date_start - FROM spec_rows sr - JOIN supplements s ON sr.supplement_id = s.id - JOIN documents d ON s.document_id = d.id - WHERE s.contract_id = - ORDER BY s.created_at, sr.row_num + SELECT name, price, qty, sum, date_start + FROM spec_current + WHERE contract_id = + ORDER BY name @@ -32,7 +30,7 @@ - + dict | None: - """Получить активный промпт из БД. Возвращает {id, body} или None.""" + """Получить активный промпт из БД напрямую (а не через Lucee HTTP).""" try: - with httpx.Client(http2=True, timeout=10) as client: - resp = client.get( - f"{LUCEE_URL}/prompt.cfm", - params={"action": "get_active", "role": role}, - ) - resp.raise_for_status() - data = resp.json() - # Lucee serializeJSON → UPPERCASE keys, normalize to lowercase - data = {k.lower(): v for k, v in data.items()} - if data.get("ok") and data.get("body"): - return {"id": data.get("id", ""), "body": data["body"]} + row = db_prompts.get_active(role) + if row and row.get("body"): + return {"id": row.get("id", ""), "body": row["body"]} except Exception: pass return None diff --git a/deploy/services/llm.py b/deploy/services/llm.py index b88351d..abf73c1 100644 --- a/deploy/services/llm.py +++ b/deploy/services/llm.py @@ -16,7 +16,7 @@ def call_llm(current_spec, doc_text, build_prompt_fn): "max_tokens": 8000, "temperature": 0.1, } - with httpx.Client(http2=True, timeout=120, verify=False) as client: + with httpx.Client(http2=True, timeout=120, verify=True) as client: resp = client.post( LLM_URL, json=payload,