Token-Optimierung: Prompt Caching + Tool-Result-Truncation in History
This commit is contained in:
1 parent
ec5917ef63
commit
f74409dd89
12 files changed
+220
-59
No files matched your search
@@ -409,6 +409,58 @@ async function loadAndShowAttachments(messageId, indicator) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── System-Prompt Modal ──
|
||||
|
||||
async function showSystemPromptModal(sessionId) {
|
||||
// Overlay
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'sp-overlay';
|
||||
|
||||
// Modal
|
||||
const modal = document.createElement('div');
|
||||
modal.className = 'sp-modal';
|
||||
|
||||
// Header
|
||||
const header = document.createElement('div');
|
||||
header.className = 'sp-header';
|
||||
const title = document.createElement('span');
|
||||
title.textContent = 'System-Prompt';
|
||||
const closeBtn = document.createElement('button');
|
||||
closeBtn.textContent = '✕';
|
||||
closeBtn.className = 'sp-close';
|
||||
header.appendChild(title);
|
||||
header.appendChild(closeBtn);
|
||||
|
||||
// Body
|
||||
const body = document.createElement('div');
|
||||
body.className = 'sp-body markdown';
|
||||
body.innerHTML = '<div class="sp-loading">Laden...</div>';
|
||||
|
||||
modal.appendChild(header);
|
||||
modal.appendChild(body);
|
||||
overlay.appendChild(modal);
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
// Schließen
|
||||
const close = () => overlay.remove();
|
||||
closeBtn.addEventListener('click', close);
|
||||
overlay.addEventListener('click', (e) => {
|
||||
if (e.target === overlay) close();
|
||||
});
|
||||
const onKey = (e) => {
|
||||
if (e.key === 'Escape') { close(); document.removeEventListener('keydown', onKey); }
|
||||
};
|
||||
document.addEventListener('keydown', onKey);
|
||||
|
||||
// Laden
|
||||
try {
|
||||
const prompt = await apiGetSystemPrompt(sessionId);
|
||||
body.innerHTML = renderMarkdown(prompt);
|
||||
} catch (e) {
|
||||
body.innerHTML = '<div class="sp-loading" style="color:var(--dangerous)">Fehler beim Laden des System-Prompts</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// ── Meta Bar ──
|
||||
|
||||
function setMeta(text) {
|
||||
|
||||
Reference in new issue
Block a user