mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 09:02:08 +00:00
Show first 10 lines of system prompt with click to expand for full content
This commit is contained in:
parent
f5e38c4007
commit
f9838bb5d4
2 changed files with 35 additions and 13 deletions
|
|
@ -495,6 +495,9 @@
|
||||||
padding: var(--line-height);
|
padding: var(--line-height);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-bottom: var(--line-height);
|
margin-bottom: var(--line-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-prompt.expandable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -503,26 +506,35 @@
|
||||||
color: var(--customMessageLabel);
|
color: var(--customMessageLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
.system-prompt-collapsed {
|
.system-prompt-preview {
|
||||||
color: var(--customMessageText);
|
color: var(--customMessageText);
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
font-size: 11px;
|
||||||
|
margin-top: var(--line-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.system-prompt-content {
|
.system-prompt-expand-hint {
|
||||||
|
color: var(--muted);
|
||||||
|
font-style: italic;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-prompt-full {
|
||||||
display: none;
|
display: none;
|
||||||
color: var(--customMessageText);
|
color: var(--customMessageText);
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
max-height: 400px;
|
|
||||||
overflow-y: auto;
|
|
||||||
margin-top: var(--line-height);
|
margin-top: var(--line-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.system-prompt.expanded .system-prompt-collapsed {
|
.system-prompt.expanded .system-prompt-preview,
|
||||||
|
.system-prompt.expanded .system-prompt-expand-hint {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.system-prompt.expanded .system-prompt-content {
|
.system-prompt.expanded .system-prompt-full {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -964,13 +964,23 @@
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
if (systemPrompt) {
|
if (systemPrompt) {
|
||||||
const promptLines = systemPrompt.split('\n').length;
|
const lines = systemPrompt.split('\n');
|
||||||
const promptChars = systemPrompt.length;
|
const previewLines = 10;
|
||||||
html += `<div class="system-prompt" onclick="this.classList.toggle('expanded')">
|
if (lines.length > previewLines) {
|
||||||
<div class="system-prompt-header">System Prompt</div>
|
const preview = lines.slice(0, previewLines).join('\n');
|
||||||
<div class="system-prompt-collapsed">${promptLines} lines, ${promptChars.toLocaleString()} chars (click to expand)</div>
|
const remaining = lines.length - previewLines;
|
||||||
<div class="system-prompt-content">${escapeHtml(systemPrompt)}</div>
|
html += `<div class="system-prompt expandable" onclick="this.classList.toggle('expanded')">
|
||||||
</div>`;
|
<div class="system-prompt-header">System Prompt</div>
|
||||||
|
<div class="system-prompt-preview">${escapeHtml(preview)}</div>
|
||||||
|
<div class="system-prompt-expand-hint">... (${remaining} more lines, click to expand)</div>
|
||||||
|
<div class="system-prompt-full">${escapeHtml(systemPrompt)}</div>
|
||||||
|
</div>`;
|
||||||
|
} else {
|
||||||
|
html += `<div class="system-prompt">
|
||||||
|
<div class="system-prompt-header">System Prompt</div>
|
||||||
|
<div class="system-prompt-full" style="display: block">${escapeHtml(systemPrompt)}</div>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tools && tools.length > 0) {
|
if (tools && tools.length > 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue