v1.0.21: промпт на сервере (prompt.cfm + БД)

This commit is contained in:
2026-06-18 19:26:57 +04:00
parent 642705ebe6
commit a6a1c70f41
2 changed files with 80 additions and 3 deletions
+24 -3
View File
@@ -64,7 +64,7 @@
<body>
<div class="topbar">
<img src="/nubes-logo.svg" alt="Nubes">
<span class="title">Сверка договоров <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.20 — Lucee</span></span>
<span class="title">Сверка договоров <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.21 — Lucee</span></span>
</div>
<div class="content">
@@ -431,9 +431,30 @@ document.getElementById('btnFull').addEventListener('click', async function() {
// ── Промпт ─────────────────────────────────────────────────
var promptEditor = document.getElementById('promptEditor');
promptEditor.value = localStorage.getItem('llm_prompt') || '';
// Загружаем промпт с сервера при появлении contract_id
var origUploadNext = null;
(function() {
var checkPrompt = setInterval(function() {
if (contractId) {
clearInterval(checkPrompt);
fetch('/prompt.cfm?contract_id=' + contractId)
.then(function(r) { return r.json(); })
.then(function(d) { if (d.OK) promptEditor.value = d.PROMPT || ''; });
}
}, 500);
})();
// Автосохранение на сервер при изменении
var promptTimer = null;
promptEditor.addEventListener('input', function() {
localStorage.setItem('llm_prompt', this.value);
clearTimeout(promptTimer);
promptTimer = setTimeout(function() {
if (!contractId) return;
fetch('/prompt.cfm?contract_id=' + contractId, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: promptEditor.value})
});
}, 800);
});
// ── Чат ───────────────────────────────────────────────────