Текущее поведение
Ответ ИИ возвращается с математическими вычислениями LaTeX следующим образом:
Код: Выделить всё
The symbol \pm indicates that there are generally two solutions...
The term b^2 - 4ac is known as the discriminant...
If b^2 - 4ac > 0: Two distinct real roots.
If b^2 - 4ac = 0: One real root (a repeated root).
If b^2 - 4ac < 0: No real roots (the roots are complex).
50) window.chatBuffer.shift();
const wrap = document.createElement("div");
wrap.className = `message ${from}`;
const bubble = document.createElement("div");
if (text.startsWith('Selected subject:') || text.startsWith('Welcome!')) {
bubble.className = "subject-notification";
bubble.textContent = text;
} else {
bubble.className = "bubble";
if (from === "model") {
bubble.innerHTML = marked.parse(text);
// Render math expressions after DOM insertion
setTimeout(() => {
renderMath(bubble);
}, 10);
} else {
bubble.textContent = text;
}
}
wrap.appendChild(bubble);
messagesEl.appendChild(wrap);
messagesEl.scrollTop = messagesEl.scrollHeight;
}
[/code]
Как обеспечить правильный формат ВСЕХ математических выражений?
Подробнее здесь: https://stackoverflow.com/questions/797 ... rked-js-an
Мобильная версия