Repository navigation
ui: Custom Prompts - #25034
ui: Custom Prompts#25034allozaur wants to merge 29 commits into
Conversation
fa43e12 to
6c1629a
Compare
|
I actually vibed an MCP to achieve such functionality. MCP would scan folder and list mark down files as prompts and through MCP they will be available as assistant prompts. |
| @@ -148,19 +210,50 @@ | |||
| }, | |||
| save: handleSaveEdit, | |||
| saveOnly: handleSaveEditOnly, | |||
| saveAsLibrary: handleSaveAsLibrary, | |||
| updateLibraryPrompt: handleUpdateLibraryPrompt, | |||
| cancel: handleCancelEdit, | |||
| startEdit: handleEdit | |||
| }); | |||
|
|
|||
| let mcpPromptExtra = $derived.by(() => { | |||
| if (message.role !== MessageRole.USER) return null; | |||
| if (message.content.trim()) return null; | |||
| if (!message.extra || message.extra.length !== 1) return null; | |||
| let mcpPromptExtra = $derived.by((): DatabaseMessageExtraMcpPrompt | null => { | |||
| if (message.role === MessageRole.USER) { | |||
| if (message.content.trim()) return null; | |||
| if (!message.extra || message.extra.length !== 1) return null; | |||
|
|
|||
| const extra = message.extra[0]; | |||
|
|
|||
| if (extra.type === AttachmentType.MCP_PROMPT) { | |||
| return extra as DatabaseMessageExtraMcpPrompt; | |||
| } | |||
|
|
|||
| return null; | |||
| } | |||
|
|
|||
| if (message.role === MessageRole.SYSTEM) { | |||
| // System messages created from an MCP prompt carry the server/prompt | |||
| // identity through their synthetic `mcp:<server>:<prompt>` promptId. | |||
| // Treat them as MCP-prompt messages so they render with the same styled | |||
| // surface instead of a plain system textarea. | |||
| const custom = customPromptExtra; | |||
|
|
|||
| if (!custom?.promptId.startsWith('mcp:')) return null; | |||
|
|
|||
| const extra = message.extra[0]; | |||
| const stripped = custom.promptId.slice('mcp:'.length); | |||
| const sepIndex = stripped.indexOf(':'); | |||
|
|
|||
| if (extra.type === AttachmentType.MCP_PROMPT) { | |||
| return extra as DatabaseMessageExtraMcpPrompt; | |||
| if (sepIndex <= 0) return null; | |||
|
|
|||
| const serverName = stripped.slice(0, sepIndex); | |||
| const promptName = stripped.slice(sepIndex + 1); | |||
|
|
|||
| return { | |||
| type: AttachmentType.MCP_PROMPT, | |||
| name: promptName, | |||
| serverName, | |||
| promptName, | |||
| content: message.content | |||
| }; | |||
There was a problem hiding this comment.
if possible, we should move this logic and related markup to somehow manage from ChatMessageCustomPrompt.svelte
|
Very cool! I think Importing/Exporting Prompts (or Prompt-collections), comparable to how chats can be imported/exported would be a nice feature for sharing prompts with other users. "Copying" prompts for A/B-tests might also be useful. |
we will develop this further to support skills in a similiar way. this PR is a beginning of this type of functionality |
yeah, this one i can still squash in this PR |
8842ac0 to
552872d
Compare
|
May I ask how closely do you plan to follow the mcp- and skill-specs? Skills over mcp are still being discussed (modelcontextprotocol/modelcontextprotocol#2640). I don't know if it is a good idea to mix mcp-prompts with agents-skills, since mcp-prompts are already quite well-defined by the modelcontextprotocol team and skills are defined by the agentskills team and have their own specification: https://github.com/agentskills/agentskills/blob/main/docs/specification.mdx. I think mcp-prompts have their uses in chat as templates on how to get started with an mcp-server by giving the user examples, while skills allow for progressive disclosure of information for agents by having frontmatter, |
552872d to
31b816e
Compare
Skills and MCP Prompts live as separate entities from the stores & services point of view. Only the UI app layer is sth that's allowing to use them e. g. as a system/user message or a text attachment. My intention is to have these 2 features have separate abstractions, but still allow to play with them and include in the conversations. |
5207d72 to
8bc61ec
Compare
8bc61ec to
7765e45
Compare
|
Closing this one: it has been replaced by a prompt library I'm building on my fork (allozaur#29), which covers the same ground with a System message submenu and a Library page. I'll reference this PR when that work comes upstream. |
Overview
Close #20678
Demo
prompts-demo-h264.mp4
Prompts library (
/prompts)DialogPromptAddNew(title, content, optional category)CodeDiffpreview before applying (DialogPromptSync)System messages
ChatMessageEditForm) for user, assistant, and system messages;variant="system"wraps it in the dashed bubble so the read view matches the edit viewpromptIdextra), so the editor and the chat display can always look the referenced prompt upMCP
UI primitives (new building blocks for future features)
Command(cmdk) paletteInputGroup(with addon / button / input / text / textarea parts)Toggle,ToggleGroupRequirements
Qwen3.6-35B-A3B/Qwen3.6-27Blocally