|
|
@ -372,7 +372,18 @@ function generateRelation() {
|
|
|
|
|
|
|
|
|
|
|
|
function processChunk() {
|
|
|
|
function processChunk() {
|
|
|
|
return reader.read().then(({done, value}) => {
|
|
|
|
return reader.read().then(({done, value}) => {
|
|
|
|
if (done) return;
|
|
|
|
if (done) {
|
|
|
|
|
|
|
|
// 在HTML内容完全接收后执行其中的脚本
|
|
|
|
|
|
|
|
const scripts = answerArea.getElementsByTagName('script');
|
|
|
|
|
|
|
|
for (let i = 0; i < scripts.length; i++) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
eval(scripts[i].innerHTML);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
console.error('脚本执行错误:', e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buffer += decoder.decode(value, {stream: true});
|
|
|
|
buffer += decoder.decode(value, {stream: true});
|
|
|
|
const lines = buffer.split('\n');
|
|
|
|
const lines = buffer.split('\n');
|
|
|
@ -388,7 +399,6 @@ function generateRelation() {
|
|
|
|
accumulatedContent += data.reply;
|
|
|
|
accumulatedContent += data.reply;
|
|
|
|
answerArea.innerHTML = marked.parse(accumulatedContent, markedOptions);
|
|
|
|
answerArea.innerHTML = marked.parse(accumulatedContent, markedOptions);
|
|
|
|
MathJax.typesetPromise();
|
|
|
|
MathJax.typesetPromise();
|
|
|
|
// 添加自动滚动到最新的内容
|
|
|
|
|
|
|
|
answerArea.scrollTop = answerArea.scrollHeight;
|
|
|
|
answerArea.scrollTop = answerArea.scrollHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|