v1.0.157: VM API /api/supplements + /api/documents — index.cfm no longer calls Lucee api.cfm

This commit is contained in:
2026-06-23 16:40:19 +04:00
parent 3a93c48907
commit ddc0a8b42d
2 changed files with 45 additions and 11 deletions
+9 -11
View File
@@ -75,7 +75,7 @@
<body>
<div class="topbar">
<img src="/nubes-logo.svg" alt="Nubes">
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.156 — Lucee</span></span>
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.157 — Lucee</span></span>
</div>
<div class="content">
@@ -572,14 +572,11 @@ document.getElementById('llmBtn').addEventListener('click', function() {
async function refreshSupps() {
if (!contractId) { console.log('refreshSupps: no contractId'); return; }
try {
var resp = await fetch('/api.cfm?action=query&sql=' + encodeURIComponent("SELECT s.id, s.type, s.document_id FROM supplements s WHERE s.contract_id='" + contractId + "'"));
var resp = await fetch(VM_API + '/api/supplements?contract_id=' + contractId);
var data = await resp.json();
console.log('refreshSupps: data=', data);
console.log('refreshSupps: fileQueue doc_ids=', fileQueue.map(function(f){return f.doc_id;}));
if (data.OK && data.ROWS) {
data.ROWS.forEach(function(r) {
var supp = {};
data.COLUMNS.forEach(function(c, ci) { supp[String(c).toLowerCase()] = r[c]; });
if (data.ok && data.supplements) {
data.supplements.forEach(function(supp) {
console.log('refreshSupps: supp=', supp);
for (var i = 0; i < fileQueue.length; i++) {
if (fileQueue[i].doc_id === supp.document_id) {
@@ -646,13 +643,14 @@ async function showText(i) {
if (docId) {
try {
var qResp = await fetch('/api.cfm?action=query&sql=SELECT%20elements_json%20FROM%20documents%20WHERE%20id%3D\'' + docId + '\'');
var qResp = await fetch(VM_API + '/api/documents/' + docId);
var qData = await qResp.json();
var elements = [];
if (qData.OK && qData.ROWS && qData.ROWS.length > 0) {
var ej = qData.ROWS[0].ELEMENTS_JSON;
if (qData.ok && qData.elements_json) {
var ej = qData.elements_json;
if (typeof ej === 'object' && ej.Value) ej = ej.Value;
elements = JSON.parse(ej);
if (typeof ej === 'string') elements = JSON.parse(ej);
else elements = ej;
}
// Общий textify для обеих панелей