v1.0.43: превью текста + первые строки таблиц в модалке

This commit is contained in:
2026-06-19 07:36:27 +04:00
parent 836b0eca6b
commit 6fc85811b7
2 changed files with 27 additions and 3 deletions
+12 -1
View File
@@ -61,7 +61,7 @@
<body> <body>
<div class="topbar"> <div class="topbar">
<img src="/nubes-logo.svg" alt="Nubes"> <img src="/nubes-logo.svg" alt="Nubes">
<span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.42 — Lucee</span></span> <span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.43 — Lucee</span></span>
</div> </div>
<div class="content"> <div class="content">
@@ -424,6 +424,17 @@ function showInfo(i) {
html += '<div class="kv"><span class="k">Параграфов</span><span class="v">' + (d.PARAGRAPHS||0) + '</span></div>'; html += '<div class="kv"><span class="k">Параграфов</span><span class="v">' + (d.PARAGRAPHS||0) + '</span></div>';
html += '<div class="kv"><span class="k">Таблиц</span><span class="v">' + (d.TABLES||0) + '</span></div>'; html += '<div class="kv"><span class="k">Таблиц</span><span class="v">' + (d.TABLES||0) + '</span></div>';
html += '<div class="kv"><span class="k">Строк таблиц</span><span class="v">' + (d.TABLE_ROWS||0) + '</span></div>'; html += '<div class="kv"><span class="k">Строк таблиц</span><span class="v">' + (d.TABLE_ROWS||0) + '</span></div>';
if (d.TEXT_PREVIEW) {
html += '<div style="margin-top:10px;font-weight:600;font-size:13px;">Превью текста:</div>';
html += '<pre>' + d.TEXT_PREVIEW + '</pre>';
}
if (d.TABLE_HEADERS && d.TABLE_HEADERS.length > 0) {
html += '<div style="margin-top:10px;font-weight:600;font-size:13px;">Первые строки таблиц:</div>';
d.TABLE_HEADERS.forEach(function(hdr, ti) {
html += '<div style="margin-top:4px;font-size:11px;color:var(--muted);">Таблица ' + (ti+1) + ':</div>';
html += '<pre>' + (hdr||[]).map(function(c){return c||'(пусто)';}).join(' | ') + '</pre>';
});
}
if (d.ERRORS && d.ERRORS.length > 0) { if (d.ERRORS && d.ERRORS.length > 0) {
html += '<div style="margin-top:8px;color:var(--destructive);font-weight:600;">Ошибки:</div>'; html += '<div style="margin-top:8px;color:var(--destructive);font-weight:600;">Ошибки:</div>';
html += '<pre>' + d.ERRORS.join('\n') + '</pre>'; html += '<pre>' + d.ERRORS.join('\n') + '</pre>';
+15 -2
View File
@@ -309,16 +309,29 @@
<cfset paraCount = 0> <cfset paraCount = 0>
<cfset tblCount = 0> <cfset tblCount = 0>
<cfset tblRows = 0> <cfset tblRows = 0>
<cfset textPreview = "">
<cfset tblHeaders = []>
<cfloop array="#elements#" index="el"> <cfloop array="#elements#" index="el">
<cfif el.type EQ "paragraph"><cfset paraCount++> <cfif el.type EQ "paragraph">
<cfelseif el.type EQ "table"><cfset tblCount++><cfset tblRows += arrayLen(el.rows)> <cfset paraCount++>
<cfif len(textPreview) LT 200>
<cfset textPreview &= el.text & chr(10)>
</cfif>
<cfelseif el.type EQ "table">
<cfset tblCount++>
<cfset tblRows += arrayLen(el.rows)>
<cfif arrayLen(el.rows) GT 0>
<cfset arrayAppend(tblHeaders, el.rows[1])>
</cfif>
</cfif> </cfif>
</cfloop> </cfloop>
<cfset textPreview = left(textPreview, 200)>
<cfset result = {ok: true, doc_id: url.doc_id, filename: doc.filename, <cfset result = {ok: true, doc_id: url.doc_id, filename: doc.filename,
mime_type: doc.mime_type, status: newStatus, mime_type: doc.mime_type, status: newStatus,
element_count: arrayLen(elements), error_count: arrayLen(errors), element_count: arrayLen(elements), error_count: arrayLen(errors),
paragraphs: paraCount, tables: tblCount, table_rows: tblRows, paragraphs: paraCount, tables: tblCount, table_rows: tblRows,
text_preview: textPreview, table_headers: tblHeaders,
errors: errors, files: files}> errors: errors, files: files}>
</cfif> </cfif>
</cfif> </cfif>