Fixed and improved the system prompt of chats started from assistants (#1172)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-06 17:44:58 +01:00
1 parent bbf4dc2231
commit 31862f5ecd
50 files changed
+1112 -107

No files matched your search

@@ -8,6 +8,7 @@ This folder keeps the Lua manifest (`plugin.lua`) that defines a custom assistan
- [Directory Structure](#directory-structure)
- [Structure](#structure)
- [Minimal Requirements Assistant Table](#example-minimal-requirements-assistant-table)
- [Continuing in a Chat](#continuing-in-a-chat)
- [Supported types (matching the Blazor UI components):](#supported-types-matching-the-blazor-ui-components)
- [Component References](#component-references)
- [`TEXT_AREA` reference](#text_area-reference)
@@ -85,6 +86,7 @@ A plugin may split its Lua code into several files and load them with `require`.
- Form assistants additionally require `SystemPrompt`, `SubmitText`, `AllowProfiles`, and a nested `UI` definition.
- Direct chat launchers instead require a `LaunchBehavior`: either `"OPEN_WORKSPACE_CHAT_BY_NAME"` together with a `WorkspaceName`, or `"OPEN_TEMPORARY_CHAT"` for a chat that belongs to no workspace. AI Studio stops reading the form-only fields as soon as a launch behavior is active, so older launchers that still carry them keep working.
- `ToolIds` is optional for both kinds and names the tools the assistant runs with, such as `{"web_search"}`. When present, it must list at least one unique, non-empty tool ID; omit the field instead of writing an empty list. For a form assistant, naming tools takes the choice away from users: the tool selection disappears, and the assistant always runs with exactly these tools. For a launcher, the tools are merely preselected and users may change them once the chat is open. Naming a tool is a wish, not a permission: a tool switched off in the settings stays off, one whose settings are incomplete cannot run, and every tool still has to meet the confidence requirements of the provider in use. A tool ID unknown to the installation is skipped. Tools which only make sense together form a tool collection, such as `mailboxes` for searching, reading, and counting mails; name such tools by the ID of their collection. The ID of one of its tools selects the whole collection as well.
- `ChatSystemPrompt` is optional for form assistants and decides which system prompt a chat gets that continues the result of your assistant: `"AI_STUDIO_DEFAULT"`, `"ASSISTANT"`, or `"CUSTOM"` together with `CustomChatSystemPrompt`. See [Continuing in a Chat](#continuing-in-a-chat).
- `DEPLOYED_USING_CONFIG_SERVER` identifies who manages the assistant plugin. Set it to `false` for locally managed plugins. A missing field is also treated as local for compatibility with existing plugins. Enterprise-distributed plugins must set it to `true` and cannot be revised with AI in AI Studio.
- `AI_STUDIO_ASSISTANT_BUILDER = {Generated = true, SchemaVersion = 1}` is reserved for plugins generated by the AI Studio Assistant Builder. It enables Builder-specific actions such as safe deletion and must not be added to manually authored or enterprise-distributed assistants. Newly generated Builder assistants always set `DEPLOYED_USING_CONFIG_SERVER = false` explicitly.
- `UI.Type` is always `"FORM"` and `UI.Children` is a list of component tables.
@@ -109,6 +111,33 @@ ASSISTANT = {
}
```
## Continuing in a Chat
Users can continue the result of a form assistant in a chat: "Send to ..." → "New Chat" opens a chat with the conversation of the assistant. Which system prompt that chat gets is your decision, made in the optional field `ChatSystemPrompt`:
| Value | The chat gets |
|---|---|
| `"AI_STUDIO_DEFAULT"` | The default prompt of AI Studio. A chat gets this one as well when the field is missing. |
| `"ASSISTANT"` | Your `SystemPrompt`, so the chat keeps the role and the rules of your assistant. |
| `"CUSTOM"` | The prompt in `CustomChatSystemPrompt`, which you write for the chat. |
Choose `"ASSISTANT"` when your system prompt suits follow-up questions as well. When it demands a fixed format or JSON, or forbids questions, write a prompt for the chat instead: keep the role and the context of your assistant, and tell the model to answer the follow-up questions of the user about the result.
```lua
ASSISTANT = {
-- ...
["SystemPrompt"] = "You translate the text into plain language. Answer with the translation only.",
["ChatSystemPrompt"] = "CUSTOM",
["CustomChatSystemPrompt"] = "You are an expert in plain language. The user had a text translated into plain language and asks follow-up questions about the translation. Explain your choices and revise the translation when asked.",
-- ...
}
```
- `CustomChatSystemPrompt` belongs to `"CUSTOM"` only, and `"CUSTOM"` needs it. Otherwise, as with an unknown value, AI Studio does not load the plugin.
- AI Studio wraps the prompt for the chat with the same security preamble and postamble as your `SystemPrompt`, and the security audit checks it as well.
- In the chat, the view of the complete system prompt names your assistant as the source of the prompt.
- Direct chat launchers do not read these fields: their chat gets the prompt of its chat template, or the default prompt of AI Studio.
- Requires AI Studio v26.11.1 or newer. Older versions ignore both fields, and their chats get the default prompt of AI Studio.
## Direct Launch into a Chat
Assistant plugins can optionally skip the normal assistant page and open a chat directly from the tile. The chat either lives in a workspace or in none at all; everything else about the two behaviors is the same.