-
🌐 admin_panel.phpWeb, 1.54 kB⬇
-
🌐 api.jsWeb, 5.89 kB⬇
-
🌐 api.phpWeb, 6.54 kB⬇
-
🌐 app.jsWeb, 84.72 kB⬇
-
🌐 base.cssWeb, 2.23 kB⬇
-
🌐 context.jsWeb, 9.37 kB⬇
-
🌐 conversation-index.jsWeb, 10.19 kB⬇
-
🌐 conversation.jsWeb, 16.61 kB⬇
-
🌐 conversations.jsWeb, 15.16 kB⬇
-
🌐 diction.jsWeb, 935 B⬇
-
🌐 document.jsWeb, 947 B⬇
-
🌐 dynamic.phpWeb, 430 B⬇
-
📷 favicon-lg.pngImage, 9.11 kB⬇
-
📷 favicon.pngImage, 3.12 kB⬇
-
🌐 index.phpWeb, 17.38 kB⬇
-
🌐 indexjs.jsWeb, 572 B⬇
-
🌐 login.phpWeb, 767 B⬇
-
❓ manifest.webmanifestUnknown, 262 B⬇
-
🌐 memory.jsWeb, 407 B⬇
-
🌐 models.jsonWeb, 4.27 kB⬇
-
🌐 notebook-index.jsWeb, 721 B⬇
-
⚠️ php.iniOS File, 356 B⬇
-
🌐 scratchpad-conversation.jsWeb, 2.09 kB⬇
-
🌐 scratchpad-index.jsWeb, 10.19 kB⬇
-
🌐 storage.jsWeb, 15.25 kB⬇
-
🌐 style.cssWeb, 20.81 kB⬇
-
🌐 theme_dark.jsonWeb, 266 B⬇
-
🌐 theme_light.jsonWeb, 267 B⬇
-
🌐 users.jsWeb, 18.18 kB⬇
import Conversation from './conversation.js';
import { escapeHtml } from './util/format-utils.js';
/**
* Class ScratchpadConversation
* Handles formatting and rendering specifically for scratchpad conversation items.
*/
class ScratchpadConversation {
#conversation;
/**
* Initializes a new instance of ScratchpadConversation.
*/
constructor() {
this.#conversation = new Conversation();
}
/**
* Formats a single scratchpad item as HTML.
* @param {Object} data - The data object for the scratchpad item.
* @param {number} index - The index of the item in history.
* @param {Object} [conversation_settings={}] - Settings for the conversation.
* @returns {string} The formatted HTML string.
*/
format_scratchpad_item(data, index, conversation_settings = {}) {
if (!data) return '';
let html = '';
const rawTitle = data['summary'] || data.title || data.query || 'Scratchpad Entry';
const titleText = escapeHtml(rawTitle);
html += `<h3 class="scratchpad-header">${titleText}</h3>`;
if (!data.pending) {
html += `
<div class="div-chat-response-buttons">
<div class="div-chat-response-buttons-left">
<button class="btn-copy-scratchpad" data-index="${index}">Copy</button>
</div>
<div class="div-chat-response-buttons-right">
<button class="btn-redo-scratchpad" data-index="${index}">Redo</button>
<button class="btn-undo-scratchpad" data-index="${index}">Undo</button>
<button class="btn-delete-scratchpad" data-index="${index}">Delete</button>
</div>
</div>
`;
}
html += this.#conversation.format_thinking_block(data.thinking, !!data.pending, index);
if (data.pending) {
return html;
}
let response_html = this.#conversation.format_content_block(data.content);
response_html += this.#conversation.format_annotations_block(data.annotations);
html += `<div class="div-response-content" data-index="${index}">${response_html}</div>`;
html += this.#conversation.format_suggestions(data, conversation_settings);
html += this.#conversation.format_cost_summary(data);
return html;
}
}
export default ScratchpadConversation;
scratchpad-conversation.js
×
Type: Web, text/plain
2.09 Kilobytes
Last Modified 2026-09-04 14:24:06
⬇ Download File
Type: Web, text/plain
2.09 Kilobytes
Last Modified 2026-09-04 14:24:06
⬇ Download File