Decouple system prompts from instruct mode
This commit is contained in:
parent
0b0bd27321
commit
b377a2b7d3
|
@ -467,10 +467,6 @@
|
|||
"filename": "presets/context/Adventure.json",
|
||||
"type": "context"
|
||||
},
|
||||
{
|
||||
"filename": "presets/context/Alpaca-Roleplay.json",
|
||||
"type": "context"
|
||||
},
|
||||
{
|
||||
"filename": "presets/context/Alpaca-Single-Turn.json",
|
||||
"type": "context"
|
||||
|
@ -555,10 +551,6 @@
|
|||
"filename": "presets/instruct/Adventure.json",
|
||||
"type": "instruct"
|
||||
},
|
||||
{
|
||||
"filename": "presets/instruct/Alpaca-Roleplay.json",
|
||||
"type": "instruct"
|
||||
},
|
||||
{
|
||||
"filename": "presets/instruct/Alpaca-Single-Turn.json",
|
||||
"type": "instruct"
|
||||
|
@ -686,5 +678,49 @@
|
|||
{
|
||||
"filename": "presets/instruct/Gemma 2.json",
|
||||
"type": "instruct"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Actor.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Assistant - Expert.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Assistant - Simple.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Chain of Thought.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Roleplay - Detailed.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Roleplay - Immersive.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Roleplay - Simple.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Text Adventure.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Writer - Creative.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Writer - Realistic.json",
|
||||
"type": "sysprompt"
|
||||
},
|
||||
{
|
||||
"filename": "presets/sysprompt/Blank.json",
|
||||
"type": "sysprompt"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"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",
|
||||
"example_separator": "### New Roleplay:",
|
||||
"chat_start": "### New Roleplay:",
|
||||
"use_stop_strings": false,
|
||||
"allow_jailbreak": false,
|
||||
"always_force_name2": true,
|
||||
"trim_sentences": false,
|
||||
"include_newline": false,
|
||||
"single_line": false,
|
||||
"name": "Alpaca-Roleplay"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"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}}",
|
||||
"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}}",
|
||||
"example_separator": "### Example:",
|
||||
"chat_start": "### START ROLEPLAY:",
|
||||
"use_stop_strings": false,
|
||||
|
@ -9,4 +9,4 @@
|
|||
"include_newline": false,
|
||||
"single_line": false,
|
||||
"name": "Libra-32B"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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.]",
|
||||
"input_sequence": "",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"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.",
|
||||
"input_sequence": "### Instruction:",
|
||||
"output_sequence": "### Response:",
|
||||
"last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):",
|
||||
"system_sequence": "### Input:",
|
||||
"stop_sequence": "",
|
||||
"wrap": true,
|
||||
"macro": true,
|
||||
"names_behavior": "always",
|
||||
"activation_regex": "",
|
||||
"system_sequence_prefix": "",
|
||||
"system_sequence_suffix": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "\n\n",
|
||||
"input_suffix": "\n\n",
|
||||
"system_suffix": "\n\n",
|
||||
"user_alignment_message": "",
|
||||
"system_same_as_user": false,
|
||||
"last_system_sequence": "",
|
||||
"name": "Alpaca-Roleplay"
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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.",
|
||||
"input_sequence": "",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "\n### Response:",
|
||||
|
@ -11,7 +10,7 @@
|
|||
"activation_regex": "",
|
||||
"system_sequence_prefix": "",
|
||||
"system_sequence_suffix": "",
|
||||
"first_output_sequence": "<START OF ROLEPLAY>",
|
||||
"first_output_sequence": "<START OF CHAT>",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "",
|
||||
"input_suffix": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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",
|
||||
"input_sequence": "### Instruction:",
|
||||
"output_sequence": "### Response:",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.",
|
||||
"input_sequence": "<|im_start|>[{{name}}]",
|
||||
"output_sequence": "<|im_start|>[{{name}}]",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.",
|
||||
"input_sequence": "<|im_start|>user",
|
||||
"output_sequence": "<|im_start|>assistant",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||
"input_sequence": "<|START_OF_TURN_TOKEN|><|USER_TOKEN|>",
|
||||
"output_sequence": "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",
|
||||
"first_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "You are an intelligent, skilled, versatile writer.\n\nYour task is to write a role-play based on the information below.",
|
||||
"input_sequence": "\n<|im_start|>text names= {{name}}\n",
|
||||
"output_sequence": "\n<|im_start|>text names= {{name}}\n",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "You are an intelligent, skilled, versatile writer.\n\nYour task is to write a role-play based on the information below.",
|
||||
"input_sequence": "<|eot_id|>\n<|start_header_id|>writer character: {{user}}<|end_header_id|>\n\n",
|
||||
"output_sequence": "<|eot_id|>\n<|start_header_id|>writer character: {{char}}<|end_header_id|>\n\n",
|
||||
"first_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Continue writing this story and portray characters realistically.",
|
||||
"input_sequence": "<start_of_turn>user",
|
||||
"output_sequence": "<start_of_turn>model",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
|
||||
"input_sequence": "USER: ",
|
||||
"output_sequence": "GPT: ",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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.",
|
||||
"input_sequence": "",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "\n### Response:",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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",
|
||||
"input_sequence": "### Instruction:",
|
||||
"output_sequence": "### Response: (length = unlimited)",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||
"input_sequence": "[INST] ",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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}}.",
|
||||
"input_sequence": "<|start_header_id|>user<|end_header_id|>\n\n",
|
||||
"output_sequence": "<|start_header_id|>assistant<|end_header_id|>\n\n",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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}}.",
|
||||
"input_sequence": "<|start_header_id|>[{{name}}]<|end_header_id|>\n\n",
|
||||
"output_sequence": "<|start_header_id|>[{{name}}]<|end_header_id|>\n\n",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Enter roleplay mode. You must act as {{char}}, whose persona follows:",
|
||||
"input_sequence": "<|user|>",
|
||||
"output_sequence": "<|model|>",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||
"input_sequence": "[INST] ",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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",
|
||||
"input_sequence": "\nUser: ",
|
||||
"output_sequence": "\nAssistant: ",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||
"input_sequence": "<|user|>\n",
|
||||
"output_sequence": "<|assistant|>\n",
|
||||
"first_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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.",
|
||||
"input_sequence": "<|user|>",
|
||||
"output_sequence": "<|model|>",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "",
|
||||
"input_sequence": "",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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.",
|
||||
"input_sequence": "USER: ",
|
||||
"output_sequence": "ASSISTANT: ",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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",
|
||||
"input_sequence": "### Human:",
|
||||
"output_sequence": "### Assistant:",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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",
|
||||
"input_sequence": "\nUSER: ",
|
||||
"output_sequence": "\nASSISTANT: ",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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}}.",
|
||||
"input_sequence": "USER: ",
|
||||
"output_sequence": "ASSISTANT: ",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n",
|
||||
"input_sequence": "",
|
||||
"output_sequence": "### Response:",
|
||||
"last_output_sequence": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"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.]",
|
||||
"input_sequence": "### Instruction:\n#### {{name}}:",
|
||||
"output_sequence": "### Response:\n#### {{name}}:",
|
||||
"last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):\n#### {{name}}:",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Actor",
|
||||
"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}}."
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Assistant - Expert",
|
||||
"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."
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Assistant - Simple",
|
||||
"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."
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Blank",
|
||||
"content": ""
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Chain of Thought",
|
||||
"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."
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Roleplay - Detailed",
|
||||
"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."
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Roleplay - Immersive",
|
||||
"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.]"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Roleplay - Simple",
|
||||
"content": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}."
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Text Adventure",
|
||||
"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.]"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Writer - Creative",
|
||||
"content": "You are an intelligent, skilled, versatile writer.\n\nYour task is to write a role-play based on the information below."
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "Writer - Realistic",
|
||||
"content": "Continue writing this story and portray characters realistically."
|
||||
}
|
|
@ -154,7 +154,6 @@
|
|||
"instruct": {
|
||||
"enabled": false,
|
||||
"preset": "Alpaca",
|
||||
"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",
|
||||
"input_sequence": "### Instruction:",
|
||||
"output_sequence": "### Response:",
|
||||
"last_output_sequence": "",
|
||||
|
@ -174,6 +173,11 @@
|
|||
"user_alignment_message": "",
|
||||
"system_same_as_user": false
|
||||
},
|
||||
"sysprompt": {
|
||||
"enabled": true,
|
||||
"name": "Blank",
|
||||
"content": ""
|
||||
},
|
||||
"default_context": "Default",
|
||||
"context": {
|
||||
"preset": "Default",
|
||||
|
|
|
@ -3206,116 +3206,74 @@
|
|||
<small data-i18n="Allow Post-History Instructions">Allow Post-History Instructions</small>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<h4 class="range-block-title justifyLeft standoutHeader">
|
||||
<span data-i18n="Custom Stopping Strings">
|
||||
Custom Stopping Strings
|
||||
</span>
|
||||
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#custom-stopping-strings" class="notes-link" target="_blank">
|
||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||
</a>
|
||||
</h4>
|
||||
<div>
|
||||
<small>
|
||||
<span data-i18n="JSON serialized array of strings">JSON serialized array of strings</span>
|
||||
<i class="fa-solid fa-question-circle opacity50p" title="e.g: ["Ford", "BMW", "Fiat"]"></i>
|
||||
</small>
|
||||
</div>
|
||||
<div>
|
||||
<textarea id="custom_stopping_strings" class="text_pole textarea_compact monospace autoSetHeight"></textarea>
|
||||
</div>
|
||||
<label class="checkbox_label" for="custom_stopping_strings_macro">
|
||||
<input id="custom_stopping_strings_macro" type="checkbox" checked>
|
||||
<small data-i18n="Replace Macro in Custom Stopping Strings">
|
||||
Replace Macro in Custom Stopping Strings
|
||||
</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
||||
<div id="instructSettingsBlock">
|
||||
<div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
||||
<div id="SystemPromptBlock">
|
||||
<h4 class="standoutHeader title_restorable justifySpaceBetween">
|
||||
<div class="flex-container">
|
||||
<span data-i18n="Instruct Template">Instruct Template</span>
|
||||
<a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
|
||||
<span data-i18n="System Prompt">System Prompt</span>
|
||||
<a href="/" class="notes-link" target="_blank">
|
||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<label for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
|
||||
<input id="instruct_enabled" type="checkbox" style="display:none;" />
|
||||
<label for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
|
||||
<input id="sysprompt_enabled" type="checkbox" style="display:none;" />
|
||||
<small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
|
||||
</label>
|
||||
<label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context
If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context">
|
||||
<input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
|
||||
<small><i class="fa-solid fa-link menu_button margin0"></i></small>
|
||||
</label>
|
||||
</div>
|
||||
</h4>
|
||||
|
||||
<div class="flex-container margin0 justifyCenter">
|
||||
<input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings">
|
||||
<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>
|
||||
<i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>
|
||||
<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>
|
||||
<i data-preset-manager-import="instruct" class=" menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
|
||||
<i data-preset-manager-export="instruct" class=" menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
|
||||
<i data-preset-manager-restore="instruct" class=" menu_button fa-solid fa-recycle" title="Restore current template" data-i18n="[title]Restore current template"></i>
|
||||
<i data-preset-manager-delete="instruct" class=" menu_button fa-solid fa-trash-can" title="Delete template" data-i18n="[title]Delete template"></i>
|
||||
<input type="file" hidden data-preset-manager-file="sysprompt" accept=".json, .settings">
|
||||
<i data-preset-manager-update="sysprompt" class="menu_button fa-solid fa-save" title="Update current prompt" data-i18n="[title]Update current prompt"></i>
|
||||
<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>
|
||||
<i data-preset-manager-import="sysprompt" class="menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
|
||||
<i data-preset-manager-export="sysprompt" class="menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
|
||||
<i data-preset-manager-restore="sysprompt" class="menu_button fa-solid fa-recycle" title="Restore current prompt" data-i18n="[title]Restore current prompt"></i>
|
||||
<i data-preset-manager-delete="sysprompt" class="menu_button fa-solid fa-trash-can" title="Delete prompt" data-i18n="[title]Delete prompt"></i>
|
||||
</div>
|
||||
|
||||
<div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
|
||||
<select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
|
||||
</div>
|
||||
<label>
|
||||
<small>
|
||||
<span data-i18n="Activation Regex">Activation Regex</span>
|
||||
<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>
|
||||
</small>
|
||||
</label>
|
||||
<div>
|
||||
<input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i">
|
||||
</div>
|
||||
<div>
|
||||
<label for="instruct_system_prompt" class="flex-container">
|
||||
<small data-i18n="System Prompt">System Prompt</small>
|
||||
<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>
|
||||
</label>
|
||||
<textarea id="instruct_system_prompt" class="text_pole textarea_compact autoSetHeight"></textarea>
|
||||
<div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
|
||||
<select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="instruct_wrap" class="checkbox_label">
|
||||
<input id="instruct_wrap" type="checkbox" />
|
||||
<small data-i18n="Wrap Sequences with Newline">Wrap Sequences with Newline</small>
|
||||
<label for="sysprompt_content" class="flex-container">
|
||||
<small data-i18n="Prompt Content">Prompt Content</small>
|
||||
<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>
|
||||
</label>
|
||||
<label for="instruct_macro" class="checkbox_label">
|
||||
<input id="instruct_macro" type="checkbox" />
|
||||
<small data-i18n="Replace Macro in Sequences">Replace Macro in Sequences</small>
|
||||
</label>
|
||||
<label for="instruct_skip_examples" class="checkbox_label">
|
||||
<input id="instruct_skip_examples" type="checkbox" />
|
||||
<small data-i18n="Skip Example Dialogues Formatting">Skip Example Dialogues Formatting</small>
|
||||
</label>
|
||||
<div id="instruct_names_behavior">
|
||||
<small data-i18n="Include Names">
|
||||
Include Names
|
||||
</small>
|
||||
<label for="instruct_names_behavior_none" class="checkbox_label" title="Do not add name prefixes before the message contents.">
|
||||
<input id="instruct_names_behavior_none" name="names_behavior" value="none" type="radio" />
|
||||
<small data-i18n="Never">Never</small>
|
||||
</label>
|
||||
<label for="instruct_names_behavior_force" class="checkbox_label" title="Only add name prefixes to messages from group characters and past personas.">
|
||||
<input id="instruct_names_behavior_force" name="names_behavior" value="force" type="radio" />
|
||||
<small data-i18n="Groups and Past Personas">Groups and Past Personas</small>
|
||||
</label>
|
||||
<label for="instruct_names_behavior_always" class="checkbox_label" title="Always add name prefixes to messages.">
|
||||
<input id="instruct_names_behavior_always" name="names_behavior" value="always" type="radio" />
|
||||
<small data-i18n="Always">Always</small>
|
||||
</label>
|
||||
</div>
|
||||
<textarea id="sysprompt_content" class="text_pole textarea_compact autoSetHeight"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4 class="range-block-title justifyLeft standoutHeader">
|
||||
<span data-i18n="Custom Stopping Strings">
|
||||
Custom Stopping Strings
|
||||
</span>
|
||||
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#custom-stopping-strings" class="notes-link" target="_blank">
|
||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||
</a>
|
||||
</h4>
|
||||
<div>
|
||||
<small>
|
||||
<span data-i18n="JSON serialized array of strings">JSON serialized array of strings</span>
|
||||
<i class="fa-solid fa-question-circle opacity50p" title="e.g: ["Ford", "BMW", "Fiat"]"></i>
|
||||
</small>
|
||||
</div>
|
||||
<div>
|
||||
<textarea id="custom_stopping_strings" class="text_pole textarea_compact monospace autoSetHeight"></textarea>
|
||||
</div>
|
||||
<label class="checkbox_label" for="custom_stopping_strings_macro">
|
||||
<input id="custom_stopping_strings_macro" type="checkbox" checked>
|
||||
<small data-i18n="Replace Macro in Custom Stopping Strings">
|
||||
Replace Macro in Custom Stopping Strings
|
||||
</small>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div name="tokenizerSettingsBlock">
|
||||
<div name="tokenizerSelectorBlock">
|
||||
<h4 class="standoutHeader"><span data-i18n="Tokenizer">Tokenizer</span>
|
||||
|
@ -3386,8 +3344,75 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="InstructSequencesColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
||||
<div class="wide100p flexFlowColumn">
|
||||
<div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
||||
<div id="instructSettingsBlock">
|
||||
<h4 class="standoutHeader title_restorable justifySpaceBetween">
|
||||
<div class="flex-container">
|
||||
<span data-i18n="Instruct Template">Instruct Template</span>
|
||||
<a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
|
||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<label for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
|
||||
<input id="instruct_enabled" type="checkbox" style="display:none;" />
|
||||
<small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
|
||||
</label>
|
||||
<label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context
If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context">
|
||||
<input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
|
||||
<small><i class="fa-solid fa-link menu_button margin0"></i></small>
|
||||
</label>
|
||||
</div>
|
||||
</h4>
|
||||
<div class="flex-container margin0 justifyCenter">
|
||||
<input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings">
|
||||
<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>
|
||||
<i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>
|
||||
<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>
|
||||
<i data-preset-manager-import="instruct" class=" menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
|
||||
<i data-preset-manager-export="instruct" class=" menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
|
||||
<i data-preset-manager-restore="instruct" class=" menu_button fa-solid fa-recycle" title="Restore current template" data-i18n="[title]Restore current template"></i>
|
||||
<i data-preset-manager-delete="instruct" class=" menu_button fa-solid fa-trash-can" title="Delete template" data-i18n="[title]Delete template"></i>
|
||||
</div>
|
||||
|
||||
<div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
|
||||
<select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
|
||||
</div>
|
||||
<label>
|
||||
<small>
|
||||
<span data-i18n="Activation Regex">Activation Regex</span>
|
||||
<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>
|
||||
</small>
|
||||
</label>
|
||||
<div>
|
||||
<input type="text" id="instruct_activation_regex" class="text_pole textarea_compact" placeholder="e.g. /llama(-)?[3|3.1]/i">
|
||||
</div>
|
||||
<div>
|
||||
<label for="instruct_wrap" class="checkbox_label">
|
||||
<input id="instruct_wrap" type="checkbox" />
|
||||
<small data-i18n="Wrap Sequences with Newline">Wrap Sequences with Newline</small>
|
||||
</label>
|
||||
<label for="instruct_macro" class="checkbox_label">
|
||||
<input id="instruct_macro" type="checkbox" />
|
||||
<small data-i18n="Replace Macro in Sequences">Replace Macro in Sequences</small>
|
||||
</label>
|
||||
<label for="instruct_skip_examples" class="checkbox_label">
|
||||
<input id="instruct_skip_examples" type="checkbox" />
|
||||
<small data-i18n="Skip Example Dialogues Formatting">Skip Example Dialogues Formatting</small>
|
||||
</label>
|
||||
<div>
|
||||
<small data-i18n="Include Names">
|
||||
Include Names
|
||||
</small>
|
||||
<select id="instruct_names_behavior">
|
||||
<option value="none" data-i18n="Never">Never</option>
|
||||
<option value="force" data-i18n="Groups and Past Personas">Groups and Past Personas</option>
|
||||
<option value="always" data-i18n="Always">Always</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="InstructSequencesColumn" class="wide100p flexFlowColumn">
|
||||
<h4 class="standoutHeader title_restorable">
|
||||
<b>
|
||||
<span data-i18n="Instruct Sequences">
|
||||
|
|
|
@ -3515,9 +3515,9 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
jailbreak,
|
||||
} = getCharacterCardFields();
|
||||
|
||||
if (isInstruct) {
|
||||
system = power_user.prefer_character_prompt && system ? system : baseChatReplace(power_user.instruct.system_prompt, name1, name2);
|
||||
system = formatInstructModeSystemPrompt(substituteParams(system, name1, name2, power_user.instruct.system_prompt));
|
||||
if (power_user.sysprompt.enabled) {
|
||||
system = power_user.prefer_character_prompt && system ? system : baseChatReplace(power_user.sysprompt.content, name1, name2);
|
||||
system = isInstruct ? formatInstructModeSystemPrompt(substituteParams(system, name1, name2, power_user.sysprompt.content)) : system;
|
||||
}
|
||||
|
||||
// Depth prompt (character-specific A/N)
|
||||
|
@ -4344,7 +4344,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
this_max_context: this_max_context,
|
||||
padding: power_user.token_padding,
|
||||
main_api: main_api,
|
||||
instruction: isInstruct ? substituteParams(power_user.prefer_character_prompt && system ? system : power_user.instruct.system_prompt) : '',
|
||||
instruction: power_user.sysprompt.enabled ? substituteParams(power_user.prefer_character_prompt && system ? system : power_user.sysprompt.content) : '',
|
||||
userPersona: (power_user.persona_description_position == persona_description_positions.IN_PROMPT ? (persona || '') : ''),
|
||||
tokenizer: getFriendlyTokenizerName(main_api).tokenizerName || '',
|
||||
};
|
||||
|
|
|
@ -23,7 +23,6 @@ export const names_behavior_types = {
|
|||
const controls = [
|
||||
{ id: 'instruct_enabled', property: 'enabled', isCheckbox: true },
|
||||
{ id: 'instruct_wrap', property: 'wrap', isCheckbox: true },
|
||||
{ id: 'instruct_system_prompt', property: 'system_prompt', isCheckbox: false },
|
||||
{ id: 'instruct_system_sequence_prefix', property: 'system_sequence_prefix', isCheckbox: false },
|
||||
{ id: 'instruct_system_sequence_suffix', property: 'system_sequence_suffix', isCheckbox: false },
|
||||
{ id: 'instruct_input_sequence', property: 'input_sequence', isCheckbox: false },
|
||||
|
@ -43,7 +42,7 @@ const controls = [
|
|||
{ id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
|
||||
{ id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },
|
||||
{ id: 'instruct_skip_examples', property: 'skip_examples', isCheckbox: true },
|
||||
{ id: 'instruct_names_behavior input[name="names_behavior"]', property: 'names_behavior', isCheckbox: false },
|
||||
{ id: 'instruct_names_behavior', property: 'names_behavior', isCheckbox: false },
|
||||
{ id: 'instruct_system_same_as_user', property: 'system_same_as_user', isCheckbox: true, trigger: true },
|
||||
];
|
||||
|
||||
|
@ -109,9 +108,10 @@ export async function loadInstructMode(data) {
|
|||
|
||||
if (control.isCheckbox) {
|
||||
$element.prop('checked', power_user.instruct[control.property]);
|
||||
} else if (control.property === 'names_behavior') {
|
||||
const behavior = power_user.instruct[control.property];
|
||||
$element.filter(`[value="${behavior}"]`).prop('checked', true);
|
||||
} else if ($element.is('select')) {
|
||||
const value = power_user.instruct[control.property];
|
||||
$element.val(value);
|
||||
$element.filter(`[value="${value}"]`).prop('checked', true);
|
||||
} else {
|
||||
$element.val(power_user.instruct[control.property]);
|
||||
}
|
||||
|
@ -584,9 +584,13 @@ export function replaceInstructMacros(input, env) {
|
|||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const syspromptMacros = {
|
||||
'systemPrompt': (power_user.prefer_character_prompt && env.charPrompt ? env.charPrompt : power_user.sysprompt.content),
|
||||
'defaultSystemPrompt|instructSystem|instructSystemPrompt': power_user.sysprompt.content,
|
||||
};
|
||||
|
||||
const instructMacros = {
|
||||
'systemPrompt': (power_user.prefer_character_prompt && env.charPrompt ? env.charPrompt : power_user.instruct.system_prompt),
|
||||
'instructSystem|instructSystemPrompt': power_user.instruct.system_prompt,
|
||||
'instructSystemPromptPrefix': power_user.instruct.system_sequence_prefix,
|
||||
'instructSystemPromptSuffix': power_user.instruct.system_sequence_suffix,
|
||||
'instructInput|instructUserPrefix': power_user.instruct.input_sequence,
|
||||
|
@ -609,6 +613,11 @@ export function replaceInstructMacros(input, env) {
|
|||
input = input.replace(regex, power_user.instruct.enabled ? value : '');
|
||||
}
|
||||
|
||||
for (const [placeholder, value] of Object.entries(syspromptMacros)) {
|
||||
const regex = new RegExp(`{{(${placeholder})}}`, 'gi');
|
||||
input = input.replace(regex, power_user.sysprompt.enabled ? value : '');
|
||||
}
|
||||
|
||||
input = input.replace(/{{exampleSeparator}}/gi, power_user.context.example_separator);
|
||||
input = input.replace(/{{chatStart}}/gi, power_user.context.chat_start);
|
||||
|
||||
|
@ -686,9 +695,10 @@ jQuery(() => {
|
|||
|
||||
if (control.isCheckbox) {
|
||||
$element.prop('checked', power_user.instruct[control.property]).trigger('input');
|
||||
} else if (control.property === 'names_behavior') {
|
||||
const behavior = power_user.instruct[control.property];
|
||||
$element.filter(`[value="${behavior}"]`).prop('checked', true).trigger('input');
|
||||
} else if ($element.is('select')) {
|
||||
const value = power_user.instruct[control.property];
|
||||
$element.val(value);
|
||||
$element.filter(`[value="${value}"]`).prop('checked', true).trigger('input');
|
||||
} else {
|
||||
$element.val(power_user.instruct[control.property]);
|
||||
$element.trigger('input');
|
||||
|
|
|
@ -50,6 +50,7 @@ import { AUTOCOMPLETE_SELECT_KEY, AUTOCOMPLETE_WIDTH } from './autocomplete/Auto
|
|||
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
|
||||
import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
import { POPUP_TYPE, callGenericPopup } from './popup.js';
|
||||
import { loadSystemPrompts } from './sysprompt.js';
|
||||
|
||||
export {
|
||||
loadPowerUserSettings,
|
||||
|
@ -210,7 +211,6 @@ let power_user = {
|
|||
instruct: {
|
||||
enabled: false,
|
||||
preset: 'Alpaca',
|
||||
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',
|
||||
input_sequence: '### Instruction:',
|
||||
input_suffix: '',
|
||||
output_sequence: '### Response:',
|
||||
|
@ -245,6 +245,12 @@ let power_user = {
|
|||
names_as_stop_strings: true,
|
||||
},
|
||||
|
||||
sysprompt: {
|
||||
enabled: true,
|
||||
name: 'Blank',
|
||||
content: '',
|
||||
},
|
||||
|
||||
personas: {},
|
||||
default_persona: null,
|
||||
persona_descriptions: {},
|
||||
|
@ -1598,6 +1604,7 @@ async function loadPowerUserSettings(settings, data) {
|
|||
reloadMarkdownProcessor(power_user.render_formulas);
|
||||
await loadInstructMode(data);
|
||||
await loadContextSettings();
|
||||
await loadSystemPrompts(data);
|
||||
loadMaxContextUnlocked();
|
||||
switchWaifuMode();
|
||||
switchSpoilerMode();
|
||||
|
|
|
@ -25,6 +25,7 @@ import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashComma
|
|||
import { enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
|
||||
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
|
||||
import { system_prompts } from './sysprompt.js';
|
||||
import {
|
||||
textgenerationwebui_preset_names,
|
||||
textgenerationwebui_presets,
|
||||
|
@ -228,6 +229,10 @@ class PresetManager {
|
|||
presets = instruct_presets;
|
||||
preset_names = instruct_presets.map(x => x.name);
|
||||
break;
|
||||
case 'sysprompt':
|
||||
presets = system_prompts;
|
||||
preset_names = system_prompts.map(x => x.name);
|
||||
break;
|
||||
default:
|
||||
console.warn(`Unknown API ID ${this.apiId}`);
|
||||
}
|
||||
|
@ -240,7 +245,7 @@ class PresetManager {
|
|||
}
|
||||
|
||||
isAdvancedFormatting() {
|
||||
return this.apiId == 'context' || this.apiId == 'instruct';
|
||||
return this.apiId == 'context' || this.apiId == 'instruct' || this.apiId == 'sysprompt';
|
||||
}
|
||||
|
||||
updateList(name, preset) {
|
||||
|
@ -298,6 +303,11 @@ class PresetManager {
|
|||
instruct_preset['name'] = name || power_user.instruct.preset;
|
||||
return instruct_preset;
|
||||
}
|
||||
case 'sysprompt': {
|
||||
const sysprompt_preset = structuredClone(power_user.sysprompt);
|
||||
sysprompt_preset['name'] = name || power_user.sysprompt.preset;
|
||||
return sysprompt_preset;
|
||||
}
|
||||
default:
|
||||
console.warn(`Unknown API ID ${apiId}`);
|
||||
return {};
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
import { saveSettingsDebounced } from '../script.js';
|
||||
import { power_user } from './power-user.js';
|
||||
import { resetScrollHeight } from './utils.js';
|
||||
|
||||
export let system_prompts = [];
|
||||
|
||||
const $enabled = $('#sysprompt_enabled');
|
||||
const $select = $('#sysprompt_select');
|
||||
const $content = $('#sysprompt_content');
|
||||
const $contentBlock = $('#SystemPromptBlock');
|
||||
|
||||
/**
|
||||
* Loads sysprompt settings from the given data object.
|
||||
* @param {object} data Settings data object.
|
||||
*/
|
||||
export async function loadSystemPrompts(data) {
|
||||
if (data.instruct !== undefined) {
|
||||
system_prompts = data.sysprompt;
|
||||
}
|
||||
|
||||
toggleSyspromptDisabledControls();
|
||||
|
||||
for (const prompt of system_prompts) {
|
||||
$('<option>').val(prompt.name).text(prompt.name).appendTo($select);
|
||||
}
|
||||
|
||||
$enabled.prop('checked', power_user.sysprompt.enabled);
|
||||
$select.val(power_user.sysprompt.name);
|
||||
$content.val(power_user.sysprompt.content);
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
await resetScrollHeight($content);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSyspromptDisabledControls() {
|
||||
$enabled.parent().find('i').toggleClass('toggleEnabled', !!power_user.sysprompt.enabled);
|
||||
$contentBlock.toggleClass('disabled', !power_user.sysprompt.enabled);
|
||||
}
|
||||
|
||||
jQuery(function () {
|
||||
$enabled.on('input', function () {
|
||||
power_user.sysprompt.enabled = !!$(this).prop('checked');
|
||||
toggleSyspromptDisabledControls();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$select.on('input', async function () {
|
||||
const name = String($(this).val());
|
||||
const prompt = system_prompts.find(p => p.name === name);
|
||||
if (prompt) {
|
||||
$content.val(prompt.content);
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
await resetScrollHeight($content);
|
||||
}
|
||||
|
||||
power_user.sysprompt.name = name;
|
||||
power_user.sysprompt.content = prompt.content;
|
||||
}
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$content.on('input', function () {
|
||||
power_user.sysprompt.content = String($(this).val());
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
});
|
|
@ -57,8 +57,8 @@
|
|||
<li><tt>{{maxPrompt}}</tt> – <span data-i18n="help_macros_41">max allowed prompt length in tokens = (context size - response length)</span></li>
|
||||
<li><tt>{{exampleSeparator}}</tt> – <span data-i18n="help_macros_42">context template example dialogues separator</span></li>
|
||||
<li><tt>{{chatStart}}</tt> – <span data-i18n="help_macros_43">context template chat start line</span></li>
|
||||
<li><tt>{{systemPrompt}}</tt> – <span data-i18n="help_macros_44">main system prompt (either character prompt override if chosen, or instructSystemPrompt)</span></li>
|
||||
<li><tt>{{instructSystemPrompt}}</tt> – <span data-i18n="help_macros_45">instruct system prompt</span></li>
|
||||
<li><tt>{{systemPrompt}}</tt> – <span data-i18n="help_macros_44">system prompt content if enabled (either character prompt override if allowed, or defaultSystemPrompt)</span></li>
|
||||
<li><tt>{{defaultSystemPrompt}}</tt> – <span data-i18n="help_macros_45">system prompt content</span></li>
|
||||
<li><tt>{{instructSystemPromptPrefix}}</tt> – <span data-i18n="help_macros_46">instruct system prompt prefix sequence</span></li>
|
||||
<li><tt>{{instructSystemPromptSuffix}}</tt> – <span data-i18n="help_macros_47">instruct system prompt suffix sequence</span></li>
|
||||
<li><tt>{{instructUserPrefix}}</tt> – <span data-i18n="help_macros_48">instruct user prefix sequence</span></li>
|
||||
|
|
|
@ -42,6 +42,7 @@ const USER_DIRECTORY_TEMPLATE = Object.freeze({
|
|||
files: 'user/files',
|
||||
vectors: 'vectors',
|
||||
backups: 'backups',
|
||||
sysprompt: 'sysprompt',
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue