mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add {{maxPrompt}} macro
This commit is contained in:
@@ -2023,6 +2023,7 @@ function substituteParams(content, _name1, _name2, _original, _group, _replaceCh
|
||||
content = content.replace(/{{mesExamples}}/gi, fields.mesExamples || '');
|
||||
}
|
||||
|
||||
content = content.replace(/{{maxPrompt}}/gi, () => String(getMaxContextSize()));
|
||||
content = content.replace(/{{user}}/gi, _name1);
|
||||
content = content.replace(/{{char}}/gi, _name2);
|
||||
content = content.replace(/{{charIfNotGroup}}/gi, _group);
|
||||
@@ -4056,7 +4057,7 @@ function getMaxContextSize() {
|
||||
this_max_context = this_max_context - amount_gen;
|
||||
}
|
||||
if (main_api == 'openai') {
|
||||
this_max_context = oai_settings.openai_max_context;
|
||||
this_max_context = oai_settings.openai_max_context - oai_settings.openai_max_tokens;
|
||||
}
|
||||
return this_max_context;
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@
|
||||
<small>(enabled in the Advanced Formatting settings)</small>
|
||||
</div>
|
||||
<ul>
|
||||
<li><tt>{{maxPrompt}}</tt> – max allowed prompt length in tokens = (context size - response length)</li>
|
||||
<li><tt>{{exampleSeparator}}</tt> – context template example dialogues separator</li>
|
||||
<li><tt>{{chatStart}}</tt> – context template chat start line</li>
|
||||
<li><tt>{{instructSystem}}</tt> – instruct system prompt</li>
|
||||
|
Reference in New Issue
Block a user