Skip to content

Commit b4f2ff7

Browse files
authored
feat: show prompt template content in platform-info UI (#220)
Add Content field to PromptInfo so the platform_info response includes the actual prompt template text. The Prompts tab now shows a collapsible "Show prompt template" toggle on each card, letting users inspect what each prompt instructs the AI to do.
1 parent 7ad3444 commit b4f2ff7

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

apps/platform-info/index.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,32 @@
714714
border-color: var(--success);
715715
}
716716

717+
.prompt-template-toggle {
718+
font-size: 11px;
719+
color: var(--accent);
720+
cursor: pointer;
721+
margin-top: 4px;
722+
user-select: none;
723+
}
724+
.prompt-template-toggle:hover { text-decoration: underline; }
725+
726+
.prompt-template {
727+
margin-top: 8px;
728+
}
729+
.prompt-template pre {
730+
font-family: var(--font-mono);
731+
font-size: 11.5px;
732+
line-height: 1.55;
733+
color: var(--text-secondary);
734+
background: var(--bg);
735+
border: 1px solid var(--border);
736+
border-radius: 6px;
737+
padding: 10px 12px;
738+
white-space: pre-wrap;
739+
word-break: break-word;
740+
margin: 0;
741+
}
742+
717743
.hidden { display: none !important; }
718744
</style>
719745
</head>
@@ -1173,6 +1199,12 @@
11731199
}).join('')
11741200
+ '</div>';
11751201
}
1202+
var templateHtml = '';
1203+
if (p.content) {
1204+
templateHtml = '<div class="prompt-template-toggle" onclick="toggleTemplate(' + idx + ', this)">Show prompt template</div>'
1205+
+ '<div class="prompt-template" id="prompt-tpl-' + idx + '" style="display:none">'
1206+
+ '<pre>' + esc(p.content) + '</pre></div>';
1207+
}
11761208
return '<div class="prompt-card">'
11771209
+ '<div class="prompt-card-header">'
11781210
+ '<div>'
@@ -1183,9 +1215,18 @@
11831215
+ '</div>'
11841216
+ (p.description ? '<div class="prompt-card-desc">' + esc(p.description) + '</div>' : '')
11851217
+ argsHtml
1218+
+ templateHtml
11861219
+ '</div>';
11871220
}
11881221

1222+
function toggleTemplate(idx, el) {
1223+
var tpl = document.getElementById('prompt-tpl-' + idx);
1224+
if (!tpl) { return; }
1225+
var hidden = tpl.style.display === 'none';
1226+
tpl.style.display = hidden ? 'block' : 'none';
1227+
el.textContent = hidden ? 'Hide prompt template' : 'Show prompt template';
1228+
}
1229+
11891230
function copyPrompt(idx, btn) {
11901231
var p = _prompts[idx];
11911232
if (!p) { return; }

pkg/platform/prompts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ func (p *Platform) registerPromptWithCategory(cfg PromptConfig, category string)
155155
Name: cfg.Name,
156156
Description: cfg.Description,
157157
Category: category,
158+
Content: cfg.Content,
158159
}
159160
for _, arg := range cfg.Arguments {
160161
info.Arguments = append(info.Arguments, registry.PromptArgumentInfo{

pkg/platform/prompts_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ func TestPromptMetadataCollection(t *testing.T) {
540540
}
541541
customFound = true
542542
assert.Equal(t, "A custom prompt", info.Description)
543+
assert.Equal(t, "Do {thing}.", info.Content)
543544
require.Len(t, info.Arguments, 1)
544545
assert.Equal(t, "thing", info.Arguments[0].Name)
545546
assert.True(t, info.Arguments[0].Required)
@@ -551,9 +552,10 @@ func TestPromptMetadataCollection(t *testing.T) {
551552
assert.NotEqual(t, autoPromptName, info.Name, "platform-overview should not be in collected infos")
552553
}
553554

554-
// Verify categories are set
555+
// Verify categories and content are set
555556
for _, info := range infos {
556557
assert.NotEmpty(t, info.Category, "prompt %q should have a category", info.Name)
558+
assert.NotEmpty(t, info.Content, "prompt %q should have content", info.Name)
557559
}
558560
}
559561

pkg/registry/toolkit.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type PromptInfo struct {
4949
Name string `json:"name"`
5050
Description string `json:"description"`
5151
Category string `json:"category,omitempty"`
52+
Content string `json:"content,omitempty"`
5253
Arguments []PromptArgumentInfo `json:"arguments,omitempty"`
5354
}
5455

0 commit comments

Comments
 (0)