Parse assistant messages as Markdown (marked.js)
This commit is contained in:
1 parent
6556d62f17
commit
18b2feef4a
7 files changed
+157
-45
No files matched your search
@@ -109,8 +109,13 @@ async function loadLatestArchive() {
|
||||
const div = document.createElement('div');
|
||||
switch (msg.type) {
|
||||
case 'text':
|
||||
div.className = msg.role === 'user' ? 'msg user archived' : 'msg assistant archived';
|
||||
div.textContent = (msg.content || '').trim();
|
||||
if (msg.role === 'user') {
|
||||
div.className = 'msg user archived';
|
||||
div.textContent = (msg.content || '').trim();
|
||||
} else {
|
||||
div.className = 'msg assistant markdown archived';
|
||||
div.innerHTML = renderMarkdown(msg.content);
|
||||
}
|
||||
if (msg.role === 'user' && msg.attachmentCount > 0) {
|
||||
let names = [];
|
||||
try { if (msg.attachmentNames) names = JSON.parse(msg.attachmentNames); } catch {}
|
||||
|
||||
Reference in new issue
Block a user