Decouple system prompts from instruct mode

b377a2b7d34a052307de8f253f258bdc2d28acad

Cohee <18619528+Cohee1207@users.noreply.github.com>

51 files changed, +318 -177Showing whitespace changes
default/content/index.json+44 -8
@@ -468,10 +468,6 @@
468 "type": "context"468 "type": "context"
469 },469 },
470 {470 {
471 "filename": "presets/context/Alpaca-Roleplay.json",
472 "type": "context"
473 },
474 {
475 "filename": "presets/context/Alpaca-Single-Turn.json",471 "filename": "presets/context/Alpaca-Single-Turn.json",
476 "type": "context"472 "type": "context"
477 },473 },
@@ -556,10 +552,6 @@
556 "type": "instruct"552 "type": "instruct"
557 },553 },
558 {554 {
559 "filename": "presets/instruct/Alpaca-Roleplay.json",
560 "type": "instruct"
561 },
562 {
563 "filename": "presets/instruct/Alpaca-Single-Turn.json",555 "filename": "presets/instruct/Alpaca-Single-Turn.json",
564 "type": "instruct"556 "type": "instruct"
565 },557 },
@@ -686,5 +678,49 @@
686 {678 {
687 "filename": "presets/instruct/Gemma 2.json",679 "filename": "presets/instruct/Gemma 2.json",
688 "type": "instruct"680 "type": "instruct"
681 },
682 {
683 "filename": "presets/sysprompt/Actor.json",
684 "type": "sysprompt"
685 },
686 {
687 "filename": "presets/sysprompt/Assistant - Expert.json",
688 "type": "sysprompt"
689 },
690 {
691 "filename": "presets/sysprompt/Assistant - Simple.json",
692 "type": "sysprompt"
693 },
694 {
695 "filename": "presets/sysprompt/Chain of Thought.json",
696 "type": "sysprompt"
697 },
698 {
699 "filename": "presets/sysprompt/Roleplay - Detailed.json",
700 "type": "sysprompt"
701 },
702 {
703 "filename": "presets/sysprompt/Roleplay - Immersive.json",
704 "type": "sysprompt"
705 },
706 {
707 "filename": "presets/sysprompt/Roleplay - Simple.json",
708 "type": "sysprompt"
709 },
710 {
711 "filename": "presets/sysprompt/Text Adventure.json",
712 "type": "sysprompt"
713 },
714 {
715 "filename": "presets/sysprompt/Writer - Creative.json",
716 "type": "sysprompt"
717 },
718 {
719 "filename": "presets/sysprompt/Writer - Realistic.json",
720 "type": "sysprompt"
721 },
722 {
723 "filename": "presets/sysprompt/Blank.json",
724 "type": "sysprompt"
689 }725 }
690]726]
default/content/presets/context/Alpaca-Roleplay.json+0 -12
@@ -1,12 +0,0 @@
1{
2 "story_string": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n\n{{#if system}}{{system}}\n\n{{/if}}### Input:\n{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}\n\n",
3 "example_separator": "### New Roleplay:",
4 "chat_start": "### New Roleplay:",
5 "use_stop_strings": false,
6 "allow_jailbreak": false,
7 "always_force_name2": true,
8 "trim_sentences": false,
9 "include_newline": false,
10 "single_line": false,
11 "name": "Alpaca-Roleplay"
12}
default/content/presets/context/Libra-32B.json+1 -1
@@ -1,5 +1,5 @@
1{1{
2 "story_string": "### Instruction:\nWrite {{char}}'s next reply in this roleplay with {{user}}. Use the provided character sheet and example dialogue for formatting direction and character speech patterns.\n\n{{#if system}}{{system}}\n\n{{/if}}### Character Sheet:\n{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",2 "story_string": "### Instruction:\n{{#if system}}{{system}}\n\n{{/if}}### Character Sheet:\n{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
3 "example_separator": "### Example:",3 "example_separator": "### Example:",
4 "chat_start": "### START ROLEPLAY:",4 "chat_start": "### START ROLEPLAY:",
5 "use_stop_strings": false,5 "use_stop_strings": false,
default/content/presets/instruct/Adventure.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "[Enter Adventure Mode. Narrate the story based on {{user}}'s dialogue and actions after \">\". Describe the surroundings in vivid detail. Be detailed, creative, verbose, and proactive. Move the story forward by introducing fantasy elements and interesting characters.]",
3 "input_sequence": "",2 "input_sequence": "",
4 "output_sequence": "",3 "output_sequence": "",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Alpaca-Roleplay.json+0 -23
@@ -1,23 +0,0 @@
1{
2 "system_prompt": "Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions.",
3 "input_sequence": "### Instruction:",
4 "output_sequence": "### Response:",
5 "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):",
6 "system_sequence": "### Input:",
7 "stop_sequence": "",
8 "wrap": true,
9 "macro": true,
10 "names_behavior": "always",
11 "activation_regex": "",
12 "system_sequence_prefix": "",
13 "system_sequence_suffix": "",
14 "first_output_sequence": "",
15 "skip_examples": false,
16 "output_suffix": "\n\n",
17 "input_suffix": "\n\n",
18 "system_suffix": "\n\n",
19 "user_alignment_message": "",
20 "system_same_as_user": false,
21 "last_system_sequence": "",
22 "name": "Alpaca-Roleplay"
23}
default/content/presets/instruct/Alpaca-Single-Turn.json+1 -2
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\nWrite 1 reply only, italicize actions, and avoid quotation marks. Use markdown. Be proactive, creative, and drive the plot and conversation forward. Include dialog as well as narration.",
3 "input_sequence": "",2 "input_sequence": "",
4 "output_sequence": "",3 "output_sequence": "",
5 "last_output_sequence": "\n### Response:",4 "last_output_sequence": "\n### Response:",
@@ -11,7 +10,7 @@
11 "activation_regex": "",10 "activation_regex": "",
12 "system_sequence_prefix": "",11 "system_sequence_prefix": "",
13 "system_sequence_suffix": "",12 "system_sequence_suffix": "",
14 "first_output_sequence": "<START OF ROLEPLAY>",13 "first_output_sequence": "<START OF CHAT>",
15 "skip_examples": false,14 "skip_examples": false,
16 "output_suffix": "",15 "output_suffix": "",
17 "input_suffix": "",16 "input_suffix": "",
default/content/presets/instruct/Alpaca.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\nWrite {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
3 "input_sequence": "### Instruction:",2 "input_sequence": "### Instruction:",
4 "output_sequence": "### Response:",3 "output_sequence": "### Response:",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/ChatML-Names.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.",
3 "input_sequence": "<|im_start|>[{{name}}]",2 "input_sequence": "<|im_start|>[{{name}}]",
4 "output_sequence": "<|im_start|>[{{name}}]",3 "output_sequence": "<|im_start|>[{{name}}]",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/ChatML.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.",
3 "input_sequence": "<|im_start|>user",2 "input_sequence": "<|im_start|>user",
4 "output_sequence": "<|im_start|>assistant",3 "output_sequence": "<|im_start|>assistant",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Command R.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
3 "input_sequence": "<|START_OF_TURN_TOKEN|><|USER_TOKEN|>",2 "input_sequence": "<|START_OF_TURN_TOKEN|><|USER_TOKEN|>",
4 "output_sequence": "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",3 "output_sequence": "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",
5 "first_output_sequence": "",4 "first_output_sequence": "",
default/content/presets/instruct/DreamGen Role-Play V1 ChatML.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "You are an intelligent, skilled, versatile writer.\n\nYour task is to write a role-play based on the information below.",
3 "input_sequence": "\n<|im_start|>text names= {{name}}\n",2 "input_sequence": "\n<|im_start|>text names= {{name}}\n",
4 "output_sequence": "\n<|im_start|>text names= {{name}}\n",3 "output_sequence": "\n<|im_start|>text names= {{name}}\n",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/DreamGen Role-Play V1 Llama3.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "You are an intelligent, skilled, versatile writer.\n\nYour task is to write a role-play based on the information below.",
3 "input_sequence": "<|eot_id|>\n<|start_header_id|>writer character: {{user}}<|end_header_id|>\n\n",2 "input_sequence": "<|eot_id|>\n<|start_header_id|>writer character: {{user}}<|end_header_id|>\n\n",
4 "output_sequence": "<|eot_id|>\n<|start_header_id|>writer character: {{char}}<|end_header_id|>\n\n",3 "output_sequence": "<|eot_id|>\n<|start_header_id|>writer character: {{char}}<|end_header_id|>\n\n",
5 "first_output_sequence": "",4 "first_output_sequence": "",
default/content/presets/instruct/Gemma 2.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Continue writing this story and portray characters realistically.",
3 "input_sequence": "<start_of_turn>user",2 "input_sequence": "<start_of_turn>user",
4 "output_sequence": "<start_of_turn>model",3 "output_sequence": "<start_of_turn>model",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Koala.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
3 "input_sequence": "USER: ",2 "input_sequence": "USER: ",
4 "output_sequence": "GPT: ",3 "output_sequence": "GPT: ",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Libra-32B.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Avoid repetition, don't loop. Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions.",
3 "input_sequence": "",2 "input_sequence": "",
4 "output_sequence": "",3 "output_sequence": "",
5 "last_output_sequence": "\n### Response:",4 "last_output_sequence": "\n### Response:",
default/content/presets/instruct/Lightning 1.1.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\nTake the role of {{char}} in a play that leaves a lasting impression on {{user}}. Write {{char}}'s next reply.\nNever skip or gloss over {{char}}’s actions. Progress the scene at a naturally slow pace.\n\n",
3 "input_sequence": "### Instruction:",2 "input_sequence": "### Instruction:",
4 "output_sequence": "### Response: (length = unlimited)",3 "output_sequence": "### Response: (length = unlimited)",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Llama 2 Chat.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
3 "input_sequence": "[INST] ",2 "input_sequence": "[INST] ",
4 "output_sequence": "",3 "output_sequence": "",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Llama 3 Instruct.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "You are an expert actor that can fully immerse yourself into any role given. You do not break character for any reason, even if someone tries addressing you as an AI or language model. Currently your role is {{char}}, which is described in detail below. As {{char}}, continue the exchange with {{user}}.",
3 "input_sequence": "<|start_header_id|>user<|end_header_id|>\n\n",2 "input_sequence": "<|start_header_id|>user<|end_header_id|>\n\n",
4 "output_sequence": "<|start_header_id|>assistant<|end_header_id|>\n\n",3 "output_sequence": "<|start_header_id|>assistant<|end_header_id|>\n\n",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Llama-3-Instruct-Names.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "You are an expert actor that can fully immerse yourself into any role given. You do not break character for any reason, even if someone tries addressing you as an AI or language model. Currently your role is {{char}}, which is described in detail below. As {{char}}, continue the exchange with {{user}}.",
3 "input_sequence": "<|start_header_id|>[{{name}}]<|end_header_id|>\n\n",2 "input_sequence": "<|start_header_id|>[{{name}}]<|end_header_id|>\n\n",
4 "output_sequence": "<|start_header_id|>[{{name}}]<|end_header_id|>\n\n",3 "output_sequence": "<|start_header_id|>[{{name}}]<|end_header_id|>\n\n",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Metharme.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Enter roleplay mode. You must act as {{char}}, whose persona follows:",
3 "input_sequence": "<|user|>",2 "input_sequence": "<|user|>",
4 "output_sequence": "<|model|>",3 "output_sequence": "<|model|>",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Mistral.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
3 "input_sequence": "[INST] ",2 "input_sequence": "[INST] ",
4 "output_sequence": "",3 "output_sequence": "",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/OpenOrca-OpenChat.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "You are a helpful assistant. Please answer truthfully and write out your thinking step by step to be sure you get the right answer. If you make a mistake or encounter an error in your thinking, say so out loud and attempt to correct it. If you don't know or aren't sure about something, say so clearly. You will act as a professional logician, mathematician, and physicist. You will also act as the most appropriate type of expert to answer any particular question or solve the relevant problem; state which expert type your are, if so. Also think of any particular named expert that would be ideal to answer the relevant question or solve the relevant problem; name and act as them, if appropriate.\n",
3 "input_sequence": "\nUser: ",2 "input_sequence": "\nUser: ",
4 "output_sequence": "\nAssistant: ",3 "output_sequence": "\nAssistant: ",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Phi.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
3 "input_sequence": "<|user|>\n",2 "input_sequence": "<|user|>\n",
4 "output_sequence": "<|assistant|>\n",3 "output_sequence": "<|assistant|>\n",
5 "first_output_sequence": "",4 "first_output_sequence": "",
default/content/presets/instruct/Pygmalion.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Enter RP mode. You shall reply to {{user}} while staying in character. Your responses must be detailed, creative, immersive, and drive the scenario forward. You will follow {{char}}'s persona.",
3 "input_sequence": "<|user|>",2 "input_sequence": "<|user|>",
4 "output_sequence": "<|model|>",3 "output_sequence": "<|model|>",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Story.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "",
3 "input_sequence": "",2 "input_sequence": "",
4 "output_sequence": "",3 "output_sequence": "",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Synthia.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation.",
3 "input_sequence": "USER: ",2 "input_sequence": "USER: ",
4 "output_sequence": "ASSISTANT: ",3 "output_sequence": "ASSISTANT: ",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Vicuna 1.0.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n\nWrite {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
3 "input_sequence": "### Human:",2 "input_sequence": "### Human:",
4 "output_sequence": "### Assistant:",3 "output_sequence": "### Assistant:",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/Vicuna 1.1.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.\n\nWrite {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
3 "input_sequence": "\nUSER: ",2 "input_sequence": "\nUSER: ",
4 "output_sequence": "\nASSISTANT: ",3 "output_sequence": "\nASSISTANT: ",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/WizardLM-13B.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.\n\nWrite {{char}}'s next detailed reply in a fictional roleplay chat between {{user}} and {{char}}.",
3 "input_sequence": "USER: ",2 "input_sequence": "USER: ",
4 "output_sequence": "ASSISTANT: ",3 "output_sequence": "ASSISTANT: ",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/WizardLM.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
3 "input_sequence": "",2 "input_sequence": "",
4 "output_sequence": "### Response:",3 "output_sequence": "### Response:",
5 "last_output_sequence": "",4 "last_output_sequence": "",
default/content/presets/instruct/simple-proxy-for-tavern.json+0 -1
@@ -1,5 +1,4 @@
1{1{
2 "system_prompt": "[System note: Write one reply only. Do not decide what {{user}} says or does. Write at least one paragraph, up to four. Be descriptive and immersive, providing vivid details about {{char}}'s actions, emotions, and the environment. Write with a high degree of complexity and burstiness. Do not repeat this message.]",
3 "input_sequence": "### Instruction:\n#### {{name}}:",2 "input_sequence": "### Instruction:\n#### {{name}}:",
4 "output_sequence": "### Response:\n#### {{name}}:",3 "output_sequence": "### Response:\n#### {{name}}:",
5 "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):\n#### {{name}}:",4 "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):\n#### {{name}}:",
default/content/presets/sysprompt/Actor.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Actor",
3 "content": "You are an expert actor that can fully immerse yourself into any role given. You do not break character for any reason, even if someone tries addressing you as an AI or language model. Currently your role is {{char}}, which is described in detail below. As {{char}}, continue the exchange with {{user}}."
4}
default/content/presets/sysprompt/Assistant - Expert.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Assistant - Expert",
3 "content": "You are a helpful assistant. Please answer truthfully and write out your thinking step by step to be sure you get the right answer. If you make a mistake or encounter an error in your thinking, say so out loud and attempt to correct it. If you don't know or aren't sure about something, say so clearly. You will act as a professional logician, mathematician, and physicist. You will also act as the most appropriate type of expert to answer any particular question or solve the relevant problem; state which expert type your are, if so. Also think of any particular named expert that would be ideal to answer the relevant question or solve the relevant problem; name and act as them, if appropriate."
4}
default/content/presets/sysprompt/Assistant - Simple.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Assistant - Simple",
3 "content": "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions."
4}
default/content/presets/sysprompt/Blank.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Blank",
3 "content": ""
4}
default/content/presets/sysprompt/Chain of Thought.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Chain of Thought",
3 "content": "Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation."
4}
default/content/presets/sysprompt/Roleplay - Detailed.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Roleplay - Detailed",
3 "content": "Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions. Keep the story immersive and engaging. You will follow {{char}}'s persona."
4}
default/content/presets/sysprompt/Roleplay - Immersive.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Roleplay - Immersive",
3 "content": "[System note: Write one reply only. Do not decide what {{user}} says or does. Write at least one paragraph, up to four. Be descriptive and immersive, providing vivid details about {{char}}'s actions, emotions, and the environment. Write with a high degree of complexity and burstiness. Do not repeat this message.]"
4}
default/content/presets/sysprompt/Roleplay - Simple.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Roleplay - Simple",
3 "content": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}."
4}
default/content/presets/sysprompt/Text Adventure.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Text Adventure",
3 "content": "[Enter Adventure Mode. Narrate the story based on {{user}}'s dialogue and actions after \">\". Describe the surroundings in vivid detail. Be detailed, creative, verbose, and proactive. Move the story forward by introducing fantasy elements and interesting characters.]"
4}
default/content/presets/sysprompt/Writer - Creative.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Writer - Creative",
3 "content": "You are an intelligent, skilled, versatile writer.\n\nYour task is to write a role-play based on the information below."
4}
default/content/presets/sysprompt/Writer - Realistic.json+4 -0
@@ -0,0 +1,4 @@
1{
2 "name": "Writer - Realistic",
3 "content": "Continue writing this story and portray characters realistically."
4}
default/content/settings.json+5 -1
@@ -154,7 +154,6 @@
154 "instruct": {154 "instruct": {
155 "enabled": false,155 "enabled": false,
156 "preset": "Alpaca",156 "preset": "Alpaca",
157 "system_prompt": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\nWrite {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
158 "input_sequence": "### Instruction:",157 "input_sequence": "### Instruction:",
159 "output_sequence": "### Response:",158 "output_sequence": "### Response:",
160 "last_output_sequence": "",159 "last_output_sequence": "",
@@ -174,6 +173,11 @@
174 "user_alignment_message": "",173 "user_alignment_message": "",
175 "system_same_as_user": false174 "system_same_as_user": false
176 },175 },
176 "sysprompt": {
177 "enabled": true,
178 "name": "Blank",
179 "content": ""
180 },
177 "default_context": "Default",181 "default_context": "Default",
178 "context": {182 "context": {
179 "preset": "Default",183 "preset": "Default",
public/index.html+111 -86
@@ -3206,6 +3206,48 @@
3206 <small data-i18n="Allow Post-History Instructions">Allow Post-History Instructions</small>3206 <small data-i18n="Allow Post-History Instructions">Allow Post-History Instructions</small>
3207 </label>3207 </label>
3208 </div>3208 </div>
3209 </div>
3210 </div>
3211 <div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3212 <div id="SystemPromptBlock">
3213 <h4 class="standoutHeader title_restorable justifySpaceBetween">
3214 <div class="flex-container">
3215 <span data-i18n="System Prompt">System Prompt</span>
3216 <a href="/" class="notes-link" target="_blank">
3217 <span class="fa-solid fa-circle-question note-link-span"></span>
3218 </a>
3219 </div>
3220 <div class="flex-container">
3221 <label for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
3222 <input id="sysprompt_enabled" type="checkbox" style="display:none;" />
3223 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
3224 </label>
3225 </div>
3226 </h4>
3227
3228 <div class="flex-container margin0 justifyCenter">
3229 <input type="file" hidden data-preset-manager-file="sysprompt" accept=".json, .settings">
3230 <i data-preset-manager-update="sysprompt" class="menu_button fa-solid fa-save" title="Update current prompt" data-i18n="[title]Update current prompt"></i>
3231 <i data-preset-manager-new="sysprompt" class="menu_button fa-solid fa-file-circle-plus" title="Save prompt as" data-i18n="[title]Save prompt as"></i>
3232 <i data-preset-manager-import="sysprompt" class="menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
3233 <i data-preset-manager-export="sysprompt" class="menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
3234 <i data-preset-manager-restore="sysprompt" class="menu_button fa-solid fa-recycle" title="Restore current prompt" data-i18n="[title]Restore current prompt"></i>
3235 <i data-preset-manager-delete="sysprompt" class="menu_button fa-solid fa-trash-can" title="Delete prompt" data-i18n="[title]Delete prompt"></i>
3236 </div>
3237
3238 <div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
3239 <select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>
3240 </div>
3241
3242 <div>
3243 <label for="sysprompt_content" class="flex-container">
3244 <small data-i18n="Prompt Content">Prompt Content</small>
3245 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="sysprompt_content" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
3246 </label>
3247 <textarea id="sysprompt_content" class="text_pole textarea_compact autoSetHeight"></textarea>
3248 </div>
3249 </div>
3250
3209 <div>3251 <div>
3210 <h4 class="range-block-title justifyLeft standoutHeader">3252 <h4 class="range-block-title justifyLeft standoutHeader">
3211 <span data-i18n="Custom Stopping Strings">3253 <span data-i18n="Custom Stopping Strings">
@@ -3231,91 +3273,7 @@
3231 </small>3273 </small>
3232 </label>3274 </label>
3233 </div>3275 </div>
3234 </div>
3235 </div>
3236 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3237 <div id="instructSettingsBlock">
3238 <h4 class="standoutHeader title_restorable justifySpaceBetween">
3239 <div class="flex-container">
3240 <span data-i18n="Instruct Template">Instruct Template</span>
3241 <a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
3242 <span class="fa-solid fa-circle-question note-link-span"></span>
3243 </a>
3244 </div>
3245 <div class="flex-container">
3246 <label for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
3247 <input id="instruct_enabled" type="checkbox" style="display:none;" />
3248 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
3249 </label>
3250 <label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context&#10If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context">
3251 <input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
3252 <small><i class="fa-solid fa-link menu_button margin0"></i></small>
3253 </label>
3254 </div>
3255 </h4>
3256 <div class="flex-container margin0 justifyCenter">
3257 <input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings">
3258 <i id="instruct_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this template on API connection." data-i18n="[title]Auto-select this template on API connection"></i>
3259 <i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>
3260 <i data-preset-manager-new="instruct" class="menu_button fa-solid fa-file-circle-plus" title="Save template as" data-i18n="[title]Save template as"></i>
3261 <i data-preset-manager-import="instruct" class=" menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
3262 <i data-preset-manager-export="instruct" class=" menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
3263 <i data-preset-manager-restore="instruct" class=" menu_button fa-solid fa-recycle" title="Restore current template" data-i18n="[title]Restore current template"></i>
3264 <i data-preset-manager-delete="instruct" class=" menu_button fa-solid fa-trash-can" title="Delete template" data-i18n="[title]Delete template"></i>
3265 </div>
32663276
3267 <div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
3268 <select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
3269 </div>
3270 <label>
3271 <small>
3272 <span data-i18n="Activation Regex">Activation Regex</span>
3273 <span class="fa-solid fa-circle-question" title="When connecting to an API or choosing a model, automatically activate this Instruct Template if the model name matches the provided regular expression."></span>
3274 </small>
3275 </label>
3276 <div>
3277 <input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i">
3278 </div>
3279 <div>
3280 <label for="instruct_system_prompt" class="flex-container">
3281 <small data-i18n="System Prompt">System Prompt</small>
3282 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="instruct_system_prompt" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
3283 </label>
3284 <textarea id="instruct_system_prompt" class="text_pole textarea_compact autoSetHeight"></textarea>
3285 </div>
3286
3287 <div>
3288 <label for="instruct_wrap" class="checkbox_label">
3289 <input id="instruct_wrap" type="checkbox" />
3290 <small data-i18n="Wrap Sequences with Newline">Wrap Sequences with Newline</small>
3291 </label>
3292 <label for="instruct_macro" class="checkbox_label">
3293 <input id="instruct_macro" type="checkbox" />
3294 <small data-i18n="Replace Macro in Sequences">Replace Macro in Sequences</small>
3295 </label>
3296 <label for="instruct_skip_examples" class="checkbox_label">
3297 <input id="instruct_skip_examples" type="checkbox" />
3298 <small data-i18n="Skip Example Dialogues Formatting">Skip Example Dialogues Formatting</small>
3299 </label>
3300 <div id="instruct_names_behavior">
3301 <small data-i18n="Include Names">
3302 Include Names
3303 </small>
3304 <label for="instruct_names_behavior_none" class="checkbox_label" title="Do not add name prefixes before the message contents.">
3305 <input id="instruct_names_behavior_none" name="names_behavior" value="none" type="radio" />
3306 <small data-i18n="Never">Never</small>
3307 </label>
3308 <label for="instruct_names_behavior_force" class="checkbox_label" title="Only add name prefixes to messages from group characters and past personas.">
3309 <input id="instruct_names_behavior_force" name="names_behavior" value="force" type="radio" />
3310 <small data-i18n="Groups and Past Personas">Groups and Past Personas</small>
3311 </label>
3312 <label for="instruct_names_behavior_always" class="checkbox_label" title="Always add name prefixes to messages.">
3313 <input id="instruct_names_behavior_always" name="names_behavior" value="always" type="radio" />
3314 <small data-i18n="Always">Always</small>
3315 </label>
3316 </div>
3317 </div>
3318 </div>
3319 <div name="tokenizerSettingsBlock">3277 <div name="tokenizerSettingsBlock">
3320 <div name="tokenizerSelectorBlock">3278 <div name="tokenizerSelectorBlock">
3321 <h4 class="standoutHeader"><span data-i18n="Tokenizer">Tokenizer</span>3279 <h4 class="standoutHeader"><span data-i18n="Tokenizer">Tokenizer</span>
@@ -3386,8 +3344,75 @@
3386 </div>3344 </div>
3387 </div>3345 </div>
3388 </div>3346 </div>
3389 <div id="InstructSequencesColumn" class="flex-container flexNoGap flexFlowColumn flex1">3347 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3390 <div class="wide100p flexFlowColumn">3348 <div id="instructSettingsBlock">
3349 <h4 class="standoutHeader title_restorable justifySpaceBetween">
3350 <div class="flex-container">
3351 <span data-i18n="Instruct Template">Instruct Template</span>
3352 <a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
3353 <span class="fa-solid fa-circle-question note-link-span"></span>
3354 </a>
3355 </div>
3356 <div class="flex-container">
3357 <label for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
3358 <input id="instruct_enabled" type="checkbox" style="display:none;" />
3359 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
3360 </label>
3361 <label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context&#10If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context">
3362 <input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
3363 <small><i class="fa-solid fa-link menu_button margin0"></i></small>
3364 </label>
3365 </div>
3366 </h4>
3367 <div class="flex-container margin0 justifyCenter">
3368 <input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings">
3369 <i id="instruct_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this template on API connection." data-i18n="[title]Auto-select this template on API connection"></i>
3370 <i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>
3371 <i data-preset-manager-new="instruct" class="menu_button fa-solid fa-file-circle-plus" title="Save template as" data-i18n="[title]Save template as"></i>
3372 <i data-preset-manager-import="instruct" class=" menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
3373 <i data-preset-manager-export="instruct" class=" menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
3374 <i data-preset-manager-restore="instruct" class=" menu_button fa-solid fa-recycle" title="Restore current template" data-i18n="[title]Restore current template"></i>
3375 <i data-preset-manager-delete="instruct" class=" menu_button fa-solid fa-trash-can" title="Delete template" data-i18n="[title]Delete template"></i>
3376 </div>
3377
3378 <div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
3379 <select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
3380 </div>
3381 <label>
3382 <small>
3383 <span data-i18n="Activation Regex">Activation Regex</span>
3384 <span class="fa-solid fa-circle-question" title="When connecting to an API or choosing a model, automatically activate this Instruct Template if the model name matches the provided regular expression."></span>
3385 </small>
3386 </label>
3387 <div>
3388 <input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i">
3389 </div>
3390 <div>
3391 <label for="instruct_wrap" class="checkbox_label">
3392 <input id="instruct_wrap" type="checkbox" />
3393 <small data-i18n="Wrap Sequences with Newline">Wrap Sequences with Newline</small>
3394 </label>
3395 <label for="instruct_macro" class="checkbox_label">
3396 <input id="instruct_macro" type="checkbox" />
3397 <small data-i18n="Replace Macro in Sequences">Replace Macro in Sequences</small>
3398 </label>
3399 <label for="instruct_skip_examples" class="checkbox_label">
3400 <input id="instruct_skip_examples" type="checkbox" />
3401 <small data-i18n="Skip Example Dialogues Formatting">Skip Example Dialogues Formatting</small>
3402 </label>
3403 <div>
3404 <small data-i18n="Include Names">
3405 Include Names
3406 </small>
3407 <select id="instruct_names_behavior">
3408 <option value="none" data-i18n="Never">Never</option>
3409 <option value="force" data-i18n="Groups and Past Personas">Groups and Past Personas</option>
3410 <option value="always" data-i18n="Always">Always</option>
3411 </select>
3412 </div>
3413 </div>
3414 </div>
3415 <div id="InstructSequencesColumn" class="wide100p flexFlowColumn">
3391 <h4 class="standoutHeader title_restorable">3416 <h4 class="standoutHeader title_restorable">
3392 <b>3417 <b>
3393 <span data-i18n="Instruct Sequences">3418 <span data-i18n="Instruct Sequences">
public/script.js+4 -4
@@ -3515,9 +3515,9 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
3515 jailbreak,3515 jailbreak,
3516 } = getCharacterCardFields();3516 } = getCharacterCardFields();
35173517
3518 if (isInstruct) {3518 if (power_user.sysprompt.enabled) {
3519 system = power_user.prefer_character_prompt && system ? system : baseChatReplace(power_user.instruct.system_prompt, name1, name2);3519 system = power_user.prefer_character_prompt && system ? system : baseChatReplace(power_user.sysprompt.content, name1, name2);
3520 system = formatInstructModeSystemPrompt(substituteParams(system, name1, name2, power_user.instruct.system_prompt));3520 system = isInstruct ? formatInstructModeSystemPrompt(substituteParams(system, name1, name2, power_user.sysprompt.content)) : system;
3521 }3521 }
35223522
3523 // Depth prompt (character-specific A/N)3523 // Depth prompt (character-specific A/N)
@@ -4344,7 +4344,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
4344 this_max_context: this_max_context,4344 this_max_context: this_max_context,
4345 padding: power_user.token_padding,4345 padding: power_user.token_padding,
4346 main_api: main_api,4346 main_api: main_api,
4347 instruction: isInstruct ? substituteParams(power_user.prefer_character_prompt && system ? system : power_user.instruct.system_prompt) : '',4347 instruction: power_user.sysprompt.enabled ? substituteParams(power_user.prefer_character_prompt && system ? system : power_user.sysprompt.content) : '',
4348 userPersona: (power_user.persona_description_position == persona_description_positions.IN_PROMPT ? (persona || '') : ''),4348 userPersona: (power_user.persona_description_position == persona_description_positions.IN_PROMPT ? (persona || '') : ''),
4349 tokenizer: getFriendlyTokenizerName(main_api).tokenizerName || '',4349 tokenizer: getFriendlyTokenizerName(main_api).tokenizerName || '',
4350 };4350 };
public/scripts/instruct-mode.js+20 -10
@@ -23,7 +23,6 @@ export const names_behavior_types = {
23const controls = [23const controls = [
24 { id: 'instruct_enabled', property: 'enabled', isCheckbox: true },24 { id: 'instruct_enabled', property: 'enabled', isCheckbox: true },
25 { id: 'instruct_wrap', property: 'wrap', isCheckbox: true },25 { id: 'instruct_wrap', property: 'wrap', isCheckbox: true },
26 { id: 'instruct_system_prompt', property: 'system_prompt', isCheckbox: false },
27 { id: 'instruct_system_sequence_prefix', property: 'system_sequence_prefix', isCheckbox: false },26 { id: 'instruct_system_sequence_prefix', property: 'system_sequence_prefix', isCheckbox: false },
28 { id: 'instruct_system_sequence_suffix', property: 'system_sequence_suffix', isCheckbox: false },27 { id: 'instruct_system_sequence_suffix', property: 'system_sequence_suffix', isCheckbox: false },
29 { id: 'instruct_input_sequence', property: 'input_sequence', isCheckbox: false },28 { id: 'instruct_input_sequence', property: 'input_sequence', isCheckbox: false },
@@ -43,7 +42,7 @@ const controls = [
43 { id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },42 { id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
44 { id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },43 { id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },
45 { id: 'instruct_skip_examples', property: 'skip_examples', isCheckbox: true },44 { id: 'instruct_skip_examples', property: 'skip_examples', isCheckbox: true },
46 { id: 'instruct_names_behavior input[name="names_behavior"]', property: 'names_behavior', isCheckbox: false },45 { id: 'instruct_names_behavior', property: 'names_behavior', isCheckbox: false },
47 { id: 'instruct_system_same_as_user', property: 'system_same_as_user', isCheckbox: true, trigger: true },46 { id: 'instruct_system_same_as_user', property: 'system_same_as_user', isCheckbox: true, trigger: true },
48];47];
4948
@@ -109,9 +108,10 @@ export async function loadInstructMode(data) {
109108
110 if (control.isCheckbox) {109 if (control.isCheckbox) {
111 $element.prop('checked', power_user.instruct[control.property]);110 $element.prop('checked', power_user.instruct[control.property]);
112 } else if (control.property === 'names_behavior') {111 } else if ($element.is('select')) {
113 const behavior = power_user.instruct[control.property];112 const value = power_user.instruct[control.property];
114 $element.filter(`[value="${behavior}"]`).prop('checked', true);113 $element.val(value);
114 $element.filter(`[value="${value}"]`).prop('checked', true);
115 } else {115 } else {
116 $element.val(power_user.instruct[control.property]);116 $element.val(power_user.instruct[control.property]);
117 }117 }
@@ -584,9 +584,13 @@ export function replaceInstructMacros(input, env) {
584 if (!input) {584 if (!input) {
585 return '';585 return '';
586 }586 }
587
588 const syspromptMacros = {
589 'systemPrompt': (power_user.prefer_character_prompt && env.charPrompt ? env.charPrompt : power_user.sysprompt.content),
590 'defaultSystemPrompt|instructSystem|instructSystemPrompt': power_user.sysprompt.content,
591 };
592
587 const instructMacros = {593 const instructMacros = {
588 'systemPrompt': (power_user.prefer_character_prompt && env.charPrompt ? env.charPrompt : power_user.instruct.system_prompt),
589 'instructSystem|instructSystemPrompt': power_user.instruct.system_prompt,
590 'instructSystemPromptPrefix': power_user.instruct.system_sequence_prefix,594 'instructSystemPromptPrefix': power_user.instruct.system_sequence_prefix,
591 'instructSystemPromptSuffix': power_user.instruct.system_sequence_suffix,595 'instructSystemPromptSuffix': power_user.instruct.system_sequence_suffix,
592 'instructInput|instructUserPrefix': power_user.instruct.input_sequence,596 'instructInput|instructUserPrefix': power_user.instruct.input_sequence,
@@ -609,6 +613,11 @@ export function replaceInstructMacros(input, env) {
609 input = input.replace(regex, power_user.instruct.enabled ? value : '');613 input = input.replace(regex, power_user.instruct.enabled ? value : '');
610 }614 }
611615
616 for (const [placeholder, value] of Object.entries(syspromptMacros)) {
617 const regex = new RegExp(`{{(${placeholder})}}`, 'gi');
618 input = input.replace(regex, power_user.sysprompt.enabled ? value : '');
619 }
620
612 input = input.replace(/{{exampleSeparator}}/gi, power_user.context.example_separator);621 input = input.replace(/{{exampleSeparator}}/gi, power_user.context.example_separator);
613 input = input.replace(/{{chatStart}}/gi, power_user.context.chat_start);622 input = input.replace(/{{chatStart}}/gi, power_user.context.chat_start);
614623
@@ -686,9 +695,10 @@ jQuery(() => {
686695
687 if (control.isCheckbox) {696 if (control.isCheckbox) {
688 $element.prop('checked', power_user.instruct[control.property]).trigger('input');697 $element.prop('checked', power_user.instruct[control.property]).trigger('input');
689 } else if (control.property === 'names_behavior') {698 } else if ($element.is('select')) {
690 const behavior = power_user.instruct[control.property];699 const value = power_user.instruct[control.property];
691 $element.filter(`[value="${behavior}"]`).prop('checked', true).trigger('input');700 $element.val(value);
701 $element.filter(`[value="${value}"]`).prop('checked', true).trigger('input');
692 } else {702 } else {
693 $element.val(power_user.instruct[control.property]);703 $element.val(power_user.instruct[control.property]);
694 $element.trigger('input');704 $element.trigger('input');
public/scripts/power-user.js+8 -1
@@ -50,6 +50,7 @@ import { AUTOCOMPLETE_SELECT_KEY, AUTOCOMPLETE_WIDTH } from './autocomplete/Auto
50import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';50import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
51import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';51import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
52import { POPUP_TYPE, callGenericPopup } from './popup.js';52import { POPUP_TYPE, callGenericPopup } from './popup.js';
53import { loadSystemPrompts } from './sysprompt.js';
5354
54export {55export {
55 loadPowerUserSettings,56 loadPowerUserSettings,
@@ -210,7 +211,6 @@ let power_user = {
210 instruct: {211 instruct: {
211 enabled: false,212 enabled: false,
212 preset: 'Alpaca',213 preset: 'Alpaca',
213 system_prompt: 'Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\nWrite {{char}}\'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n',
214 input_sequence: '### Instruction:',214 input_sequence: '### Instruction:',
215 input_suffix: '',215 input_suffix: '',
216 output_sequence: '### Response:',216 output_sequence: '### Response:',
@@ -245,6 +245,12 @@ let power_user = {
245 names_as_stop_strings: true,245 names_as_stop_strings: true,
246 },246 },
247247
248 sysprompt: {
249 enabled: true,
250 name: 'Blank',
251 content: '',
252 },
253
248 personas: {},254 personas: {},
249 default_persona: null,255 default_persona: null,
250 persona_descriptions: {},256 persona_descriptions: {},
@@ -1598,6 +1604,7 @@ async function loadPowerUserSettings(settings, data) {
1598 reloadMarkdownProcessor(power_user.render_formulas);1604 reloadMarkdownProcessor(power_user.render_formulas);
1599 await loadInstructMode(data);1605 await loadInstructMode(data);
1600 await loadContextSettings();1606 await loadContextSettings();
1607 await loadSystemPrompts(data);
1601 loadMaxContextUnlocked();1608 loadMaxContextUnlocked();
1602 switchWaifuMode();1609 switchWaifuMode();
1603 switchSpoilerMode();1610 switchSpoilerMode();
public/scripts/preset-manager.js+11 -1
@@ -25,6 +25,7 @@ import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashComma
25import { enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';25import { enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
26import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';26import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
27import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';27import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
28import { system_prompts } from './sysprompt.js';
28import {29import {
29 textgenerationwebui_preset_names,30 textgenerationwebui_preset_names,
30 textgenerationwebui_presets,31 textgenerationwebui_presets,
@@ -228,6 +229,10 @@ class PresetManager {
228 presets = instruct_presets;229 presets = instruct_presets;
229 preset_names = instruct_presets.map(x => x.name);230 preset_names = instruct_presets.map(x => x.name);
230 break;231 break;
232 case 'sysprompt':
233 presets = system_prompts;
234 preset_names = system_prompts.map(x => x.name);
235 break;
231 default:236 default:
232 console.warn(`Unknown API ID ${this.apiId}`);237 console.warn(`Unknown API ID ${this.apiId}`);
233 }238 }
@@ -240,7 +245,7 @@ class PresetManager {
240 }245 }
241246
242 isAdvancedFormatting() {247 isAdvancedFormatting() {
243 return this.apiId == 'context' || this.apiId == 'instruct';248 return this.apiId == 'context' || this.apiId == 'instruct' || this.apiId == 'sysprompt';
244 }249 }
245250
246 updateList(name, preset) {251 updateList(name, preset) {
@@ -298,6 +303,11 @@ class PresetManager {
298 instruct_preset['name'] = name || power_user.instruct.preset;303 instruct_preset['name'] = name || power_user.instruct.preset;
299 return instruct_preset;304 return instruct_preset;
300 }305 }
306 case 'sysprompt': {
307 const sysprompt_preset = structuredClone(power_user.sysprompt);
308 sysprompt_preset['name'] = name || power_user.sysprompt.preset;
309 return sysprompt_preset;
310 }
301 default:311 default:
302 console.warn(`Unknown API ID ${apiId}`);312 console.warn(`Unknown API ID ${apiId}`);
303 return {};313 return {};
public/scripts/sysprompt.js+66 -0
@@ -0,0 +1,66 @@
1import { saveSettingsDebounced } from '../script.js';
2import { power_user } from './power-user.js';
3import { resetScrollHeight } from './utils.js';
4
5export let system_prompts = [];
6
7const $enabled = $('#sysprompt_enabled');
8const $select = $('#sysprompt_select');
9const $content = $('#sysprompt_content');
10const $contentBlock = $('#SystemPromptBlock');
11
12/**
13 * Loads sysprompt settings from the given data object.
14 * @param {object} data Settings data object.
15 */
16export async function loadSystemPrompts(data) {
17 if (data.instruct !== undefined) {
18 system_prompts = data.sysprompt;
19 }
20
21 toggleSyspromptDisabledControls();
22
23 for (const prompt of system_prompts) {
24 $('<option>').val(prompt.name).text(prompt.name).appendTo($select);
25 }
26
27 $enabled.prop('checked', power_user.sysprompt.enabled);
28 $select.val(power_user.sysprompt.name);
29 $content.val(power_user.sysprompt.content);
30 if (!CSS.supports('field-sizing', 'content')) {
31 await resetScrollHeight($content);
32 }
33}
34
35function toggleSyspromptDisabledControls() {
36 $enabled.parent().find('i').toggleClass('toggleEnabled', !!power_user.sysprompt.enabled);
37 $contentBlock.toggleClass('disabled', !power_user.sysprompt.enabled);
38}
39
40jQuery(function () {
41 $enabled.on('input', function () {
42 power_user.sysprompt.enabled = !!$(this).prop('checked');
43 toggleSyspromptDisabledControls();
44 saveSettingsDebounced();
45 });
46
47 $select.on('input', async function () {
48 const name = String($(this).val());
49 const prompt = system_prompts.find(p => p.name === name);
50 if (prompt) {
51 $content.val(prompt.content);
52 if (!CSS.supports('field-sizing', 'content')) {
53 await resetScrollHeight($content);
54 }
55
56 power_user.sysprompt.name = name;
57 power_user.sysprompt.content = prompt.content;
58 }
59 saveSettingsDebounced();
60 });
61
62 $content.on('input', function () {
63 power_user.sysprompt.content = String($(this).val());
64 saveSettingsDebounced();
65 });
66});
public/scripts/templates/macros.html+2 -2
@@ -57,8 +57,8 @@
57 <li><tt>&lcub;&lcub;maxPrompt&rcub;&rcub;</tt> – <span data-i18n="help_macros_41">max allowed prompt length in tokens = (context size - response length)</span></li>57 <li><tt>&lcub;&lcub;maxPrompt&rcub;&rcub;</tt> – <span data-i18n="help_macros_41">max allowed prompt length in tokens = (context size - response length)</span></li>
58 <li><tt>&lcub;&lcub;exampleSeparator&rcub;&rcub;</tt> – <span data-i18n="help_macros_42">context template example dialogues separator</span></li>58 <li><tt>&lcub;&lcub;exampleSeparator&rcub;&rcub;</tt> – <span data-i18n="help_macros_42">context template example dialogues separator</span></li>
59 <li><tt>&lcub;&lcub;chatStart&rcub;&rcub;</tt> – <span data-i18n="help_macros_43">context template chat start line</span></li>59 <li><tt>&lcub;&lcub;chatStart&rcub;&rcub;</tt> – <span data-i18n="help_macros_43">context template chat start line</span></li>
60 <li><tt>&lcub;&lcub;systemPrompt&rcub;&rcub;</tt> – <span data-i18n="help_macros_44">main system prompt (either character prompt override if chosen, or instructSystemPrompt)</span></li>60 <li><tt>&lcub;&lcub;systemPrompt&rcub;&rcub;</tt> – <span data-i18n="help_macros_44">system prompt content if enabled (either character prompt override if allowed, or defaultSystemPrompt)</span></li>
61 <li><tt>&lcub;&lcub;instructSystemPrompt&rcub;&rcub;</tt> – <span data-i18n="help_macros_45">instruct system prompt</span></li>61 <li><tt>&lcub;&lcub;defaultSystemPrompt&rcub;&rcub;</tt> – <span data-i18n="help_macros_45">system prompt content</span></li>
62 <li><tt>&lcub;&lcub;instructSystemPromptPrefix&rcub;&rcub;</tt> – <span data-i18n="help_macros_46">instruct system prompt prefix sequence</span></li>62 <li><tt>&lcub;&lcub;instructSystemPromptPrefix&rcub;&rcub;</tt> – <span data-i18n="help_macros_46">instruct system prompt prefix sequence</span></li>
63 <li><tt>&lcub;&lcub;instructSystemPromptSuffix&rcub;&rcub;</tt> – <span data-i18n="help_macros_47">instruct system prompt suffix sequence</span></li>63 <li><tt>&lcub;&lcub;instructSystemPromptSuffix&rcub;&rcub;</tt> – <span data-i18n="help_macros_47">instruct system prompt suffix sequence</span></li>
64 <li><tt>&lcub;&lcub;instructUserPrefix&rcub;&rcub;</tt> – <span data-i18n="help_macros_48">instruct user prefix sequence</span></li>64 <li><tt>&lcub;&lcub;instructUserPrefix&rcub;&rcub;</tt> – <span data-i18n="help_macros_48">instruct user prefix sequence</span></li>
src/constants.js+1 -0
@@ -42,6 +42,7 @@ const USER_DIRECTORY_TEMPLATE = Object.freeze({
42 files: 'user/files',42 files: 'user/files',
43 vectors: 'vectors',43 vectors: 'vectors',
44 backups: 'backups',44 backups: 'backups',
45 sysprompt: 'sysprompt',
45});46});
4647
47/**48/**