Skip to content

Commit 1118c2a

Browse files
authored
Merge pull request #610 from Classic298/patch-1
Prompt Variables
2 parents 507a311 + e4c0f13 commit 1118c2a

1 file changed

Lines changed: 130 additions & 5 deletions

File tree

docs/features/workspace/prompts.md

Lines changed: 130 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ When creating or editing a prompt, you can configure the following settings:
2525

2626
### Prompt Variables
2727

28-
Open WebUI supports dynamic prompt variables that can be included in your prompts:
28+
Open WebUI supports two kinds of variables to make your prompts more dynamic and powerful: **System Variables** and **Custom Input Variables**.
29+
30+
**System Variables** are automatically replaced with their corresponding value when the prompt is used. They are useful for inserting dynamic information like the current date or user details.
2931

3032
* **Clipboard Content**: Use `{{CLIPBOARD}}` to insert content from your clipboard.
3133
* **Date and Time**:
@@ -39,13 +41,135 @@ Open WebUI supports dynamic prompt variables that can be included in your prompt
3941
* `{{USER_LANGUAGE}}`: User's selected language
4042
* `{{USER_LOCATION}}`: User's location (requires HTTPS and Settings > Interface toggle)
4143

44+
**Custom Input Variables** transform your prompts into interactive templates. When you use a prompt containing these variables, a modal window will automatically appear, allowing you to fill in your values. This is extremely powerful for creating complex, reusable prompts that function like forms. See the guidelines below for a full explanation.
45+
46+
By leveraging custom input variables, you can move beyond static text and build interactive tools directly within the chat interface. This feature is designed to be foolproof, enabling even non-technical users to execute complex, multi-step prompts with ease. Instead of manually editing a large block of text, users are presented with a clean, structured form. This not only streamlines the workflow but also reduces errors by guiding the user to provide exactly the right information in the right format. It unlocks a new level of interactive prompt design, making sophisticated AI usage accessible to everyone.
47+
4248
### Variable Usage Guidelines
4349

44-
* Enclose variables with double curly braces: `{{variable}}`
45-
* The `{{USER_LOCATION}}` variable requires:
50+
* Enclose all variables with double curly braces: `{{variable}}`
51+
* The `{{USER_LOCATION}}` system variable requires:
4652
* A secure HTTPS connection
47-
* Enabling the feature in Settings > Interface
48-
* The `{{CLIPBOARD}}` variable requires clipboard access permission from your device
53+
* Enabling the feature in `Settings` > `Interface`
54+
* The `{{CLIPBOARD}}` system variable requires clipboard access permission from your device
55+
56+
---
57+
58+
#### Using Custom Input Variables
59+
60+
**How It Works**
61+
62+
1. **Create a prompt** with one or more custom variables using the syntax below.
63+
2. **Use the prompt's slash command** in the chat input.
64+
3. An **"Input Variables" popup window** will appear with a form field for each variable you defined.
65+
4. **Fill out the form** and click `Save`.
66+
5. The variables in your prompt will be replaced with your input, and the final prompt will be sent to the model.
67+
68+
**Syntax**
69+
70+
There are two ways to define a custom variable:
71+
72+
1. **Simple Input**: `{{variable_name}}`
73+
* This creates a standard, single-line `text` type input field in the popup window.
74+
75+
2. **Typed Input**: `{{variable_name | [type][:property="value"]}}`
76+
* This allows you to specify the type of input field (e.g., a dropdown, a date picker) and configure its properties.
77+
78+
**Input Types Overview**
79+
80+
You can specify different input types to build rich, user-friendly forms. Here is a table of available types and their properties.
81+
82+
| Type | Description | Available Properties | Syntax Example |
83+
| :--- | :--- | :--- | :--- |
84+
| **text** | A standard single-line text input field, perfect for capturing short pieces of information like names, titles, or single-sentence summaries. This is the **default type if no other is specified**. | `placeholder`, `default` | `{{name \| text:placeholder="Enter name"}}` |
85+
| **textarea**| A multi-line text area designed for capturing longer blocks of text, such as detailed descriptions, article content, or code snippets. | `placeholder`, `default` | `{{description \| textarea}}` |
86+
| **select** | A dropdown menu that presents a predefined list of choices. This is ideal for ensuring consistent input for things like status, priority, or categories. | `options` (JSON array), `default` | `{{priority \| select:options=["High","Low"]}}` |
87+
| **number** | An input field that is restricted to numerical values only. Useful for quantities, ratings, or any other numeric data. | `placeholder`, `default` | `{{count \| number:default=5}}` |
88+
| **checkbox**| A simple checkbox that represents a true or false (boolean) value. It's perfect for on/off toggles, like 'Include a conclusion?' or 'Mark as urgent?'. | `default` (boolean) | `{{include_details \| checkbox}}` |
89+
| **date** | A calendar-based date picker that allows users to easily select a specific day, month, and year, ensuring a standardized date format. | `default` (YYYY-MM-DD) | `{{start_date \| date}}` |
90+
| **datetime-local**| A specialized picker that allows users to select both a specific date and a specific time. Great for scheduling appointments or logging event timestamps. | `default` | `{{appointment \| datetime-local}}` |
91+
| **color** | A visual color picker that allows the user to select a color or input a standard hex code (e.g., #FF5733). Useful for design and branding prompts. | `default` (hex code) | `{{brand_color \| color:default="#FFFFFF"}}` |
92+
| **email** | An input field specifically formatted and validated for email addresses, ensuring the user provides a correctly structured email. | `placeholder`, `default` | `{{recipient_email \| email}}` |
93+
| **month** | A picker that allows users to select a specific month and year, without needing to choose a day. Useful for billing cycles, reports, or timelines. | `default` | `{{billing_month \| month}}` |
94+
| **range** | A slider control that allows the user to select a numerical value from within a defined minimum and maximum range. Ideal for satisfaction scores or percentage adjustments. | `min`, `max`, `step`, `default` | `{{satisfaction \| range}}` |
95+
| **tel** | An input field designed for telephone numbers. It semantically indicates the expected input type for browsers and devices. | `placeholder`, `default` | `{{phone_number \| tel}}` |
96+
| **time** | A picker for selecting a time. Useful for scheduling meetings, logging events, or setting reminders without an associated date. | `default` | `{{meeting_time \| time}}` |
97+
| **url** | An input field for web addresses (URLs). It helps ensure that the user provides a link, which can be useful for prompts that analyze websites or reference online sources. | `placeholder`, `default` | `{{website \| url}}` |
98+
| **map** | **(Experimental)** An interactive map interface that lets users click to select geographic coordinates. This is a powerful tool for location-based prompts. | `default` (e.g., "51.5,-0.09") | `{{location \| map}}` |
99+
100+
101+
#### Example Use Cases
102+
103+
**1. Simple Article Summarizer**
104+
105+
Create a reusable prompt to summarize any article.
106+
107+
* **Command:** `/summarize_article`
108+
* **Prompt Content:**
109+
```
110+
Please summarize the following article in three key bullet points. Be concise and clear.
111+
112+
Article:
113+
{{article_text | textarea:placeholder="Paste the full text of the article here..."}}
114+
```
115+
When you type `/summarize_article`, a modal will appear with a large text area, prompting you to paste the article text.
116+
117+
**2. Advanced Bug Report Generator**
118+
119+
This prompt acts as a structured form to ensure all necessary details for a bug report are captured.
120+
121+
* **Command:** `/bug_report`
122+
* **Prompt Content:**
123+
```
124+
Generate a bug report with the following details:
125+
126+
**Summary:** {{summary | text:placeholder="A brief summary of the issue"}}
127+
**Priority:** {{priority | select:options=["High", "Medium", "Low"]:default="Medium"}}
128+
**Steps to Reproduce:**
129+
{{steps | textarea:placeholder="1. Go to...\n2. Click on...\n3. See error..."}}
130+
131+
Please format this into a clear and complete bug report document.
132+
```
133+
When used, this prompt generates a form with a text input, a dropdown menu, and two text areas.
134+
135+
**3. Social Media Post Generator**
136+
137+
This prompt generates tailored content for different social media platforms.
138+
139+
* **Command:** `/social_post`
140+
* **Prompt Content:**
141+
```
142+
Generate a social media post for the {{platform}} platform.
143+
144+
**Topic:** {{topic | text:placeholder="e.g., New feature launch"}}
145+
**Key Message:** {{key_message | textarea:placeholder="What are the essential points to communicate?"}}
146+
**Tone of Voice:** {{tone | select:options=["Professional", "Casual", "Humorous", "Inspirational"]:default="Professional"}}
147+
**Call to Action:** {{cta | text:placeholder="e.g., 'Learn more', 'Sign up today'"}}
148+
149+
Please include relevant hashtags.
150+
```
151+
152+
**4. Meeting Minutes Assistant**
153+
154+
Quickly generate structured meeting minutes by filling out a simple form.
155+
156+
* **Command:** `/meeting_minutes`
157+
* **Prompt Content:**
158+
```
159+
# Meeting Minutes
160+
161+
**Date:** {{meeting_date | date}}
162+
**Time:** {{meeting_time | time}}
163+
**Attendees:** {{attendees | text:placeholder="Comma-separated list of names"}}
164+
165+
## Agenda / Key Discussion Points
166+
{{agenda_items | textarea:placeholder="Paste the agenda or list the key topics discussed."}}
167+
168+
## Action Items
169+
{{action_items | textarea:placeholder="List each action item, who it is assigned to, and the deadline."}}
170+
171+
Please format the above information into a clean and professional meeting summary.
172+
```
49173
50174
### Access Control and Permissions
51175
@@ -58,6 +182,7 @@ Prompt management is controlled by the following permission settings:
58182
59183
* Use clear, descriptive titles for your prompts
60184
* Create intuitive slash commands that reflect the prompt's purpose
185+
* For custom variables, use clear names (e.g., `{{your_name}}` instead of `{{var1}}`) and descriptive `placeholder` text to make templates easy to understand.
61186
* Document any specific requirements or expected inputs in the prompt description
62187
* Test prompts with different variable combinations to ensure they work as intended
63188
* Consider access levels carefully when sharing prompts with other users - public sharing means that it will appear automatically for all users when they hit `/` in a chat, so you want to avoid creating too many.

0 commit comments

Comments
 (0)