Polish mobile UI and editor workflows

This commit is contained in:
pewdiepie-archdaemon
2026-06-27 13:05:44 +00:00
parent 87e46e576a
commit 45ee5a71f4
48 changed files with 6455 additions and 1177 deletions
+15 -1
View File
@@ -1068,6 +1068,17 @@ document.addEventListener('click', function(e) {
}
}, true);
function resolveDocumentPlaceholderLinks(text, metadata) {
if (!text || !metadata || !Array.isArray(metadata.tool_events)) return text;
const docEvents = metadata.tool_events.filter(ev => ev && ev.doc_id);
if (!docEvents.length) return text;
return String(text).replace(/#document-(\d+)\b/g, (match, num) => {
const idx = Number(num) - 1;
const ev = Number.isInteger(idx) && idx >= 0 ? docEvents[idx] : null;
return ev && ev.doc_id ? `#document-${ev.doc_id}` : match;
});
}
// Jump-to-entity anchors — the agent emits links like
// [New Chat](#session-89effa28)
// [Notes](#document-abc123)
@@ -2005,7 +2016,7 @@ export function addMessage(role, content, modelName, metadata) {
for (let r = 0; r < maxRound; r++) {
const roundNum = r + 1;
const txt = (roundTexts[r] || '').trim();
const txt = resolveDocumentPlaceholderLinks((roundTexts[r] || '').trim(), metadata);
if (txt) {
const wrap = document.createElement('div');
@@ -2186,6 +2197,9 @@ export function addMessage(role, content, modelName, metadata) {
b.className = 'body';
let text = markdownModule.squashOutsideCode(stripToolBlocks(textRaw || ''));
if (role === 'assistant') {
text = resolveDocumentPlaceholderLinks(text, metadata);
}
// For user messages, pull out vision-model image descriptions ([Image: name]\n
// <multi-line desc>) into a collapsible "image description" section. Done for