From 158b6373a1c13342792a616de8654a528c5280f1 Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Sun, 29 Jun 2025 22:07:53 +0800 Subject: [PATCH] 'commit' --- dsRag/static/ai.html | 127 +++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/dsRag/static/ai.html b/dsRag/static/ai.html index 7fa22b4d..ee20222e 100644 --- a/dsRag/static/ai.html +++ b/dsRag/static/ai.html @@ -84,7 +84,6 @@ margin-right: 5px; } - @keyframes spin { 0% { transform: rotate(0deg); @@ -183,7 +182,8 @@
-
+ +

知识库内问题示例:

@@ -227,37 +227,36 @@ -
@@ -299,47 +298,47 @@ }, body: JSON.stringify(data) }) - .then(response => { - const reader = response.body.getReader(); - const decoder = new TextDecoder(); - let buffer = ''; - let accumulatedContent = ''; - - function processChunk() { - return reader.read().then(({done, value}) => { - if (done) return; - - buffer += decoder.decode(value, {stream: true}); - const lines = buffer.split('\n'); - buffer = lines.pop(); - - for (const line of lines) { - if (line.includes('data:')) { - const jsonStr = line.replace(/^data:\s*/, '').replace(/^data:\s*/, '').trim(); - if (jsonStr) { - try { - const data = JSON.parse(jsonStr); - if (data.reply) { - accumulatedContent += data.reply; - answerArea.innerHTML = marked.parse(accumulatedContent); - MathJax.typesetPromise(); - } - } catch (e) { - console.log('忽略解析错误:', e); + .then(response => { + const reader = response.body.getReader(); + const decoder = new TextDecoder(); + let buffer = ''; + let accumulatedContent = ''; + + function processChunk() { + return reader.read().then(({done, value}) => { + if (done) return; + + buffer += decoder.decode(value, {stream: true}); + const lines = buffer.split('\n'); + buffer = lines.pop(); + + for (const line of lines) { + if (line.includes('data:')) { + const jsonStr = line.replace(/^data:\s*/, '').replace(/^data:\s*/, '').trim(); + if (jsonStr) { + try { + const data = JSON.parse(jsonStr); + if (data.reply) { + accumulatedContent += data.reply; + answerArea.innerHTML = marked.parse(accumulatedContent); + MathJax.typesetPromise(); } + } catch (e) { + console.log('忽略解析错误:', e); } } } + } - return processChunk(); - }); - } + return processChunk(); + }); + } - return processChunk(); - }) - .catch(error => { - console.error('Error:', error); - }); + return processChunk(); + }) + .catch(error => { + console.error('Error:', error); + }); } function clearAll() {