mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-07 23:58:42 +01:00
Code clean-up
This commit is contained in:
parent
d1933be86a
commit
0ba600bb2b
@ -2304,6 +2304,8 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
|
||||
environment.scenario = fields.scenario || '';
|
||||
environment.persona = fields.persona || '';
|
||||
environment.mesExamples = fields.mesExamples || '';
|
||||
environment.charVersion = fields.version || '';
|
||||
environment.char_version = fields.version || '';
|
||||
}
|
||||
|
||||
// Must be substituted last so that they're replaced inside {{description}}
|
||||
@ -2311,7 +2313,6 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
|
||||
environment.char = _name2 ?? name2;
|
||||
environment.group = environment.charIfNotGroup = getGroupValue();
|
||||
environment.model = getGeneratingModel();
|
||||
environment.char_version = characters.filter(x => x.name === environment.char).map(x => x.data.character_version)[0];
|
||||
|
||||
return evaluateMacros(content, environment);
|
||||
}
|
||||
@ -2602,10 +2603,10 @@ export function baseChatReplace(value, name1, name2) {
|
||||
|
||||
/**
|
||||
* Returns the character card fields for the current character.
|
||||
* @returns {{system: string, mesExamples: string, description: string, personality: string, persona: string, scenario: string, jailbreak: string}}
|
||||
* @returns {{system: string, mesExamples: string, description: string, personality: string, persona: string, scenario: string, jailbreak: string, version: string}}
|
||||
*/
|
||||
export function getCharacterCardFields() {
|
||||
const result = { system: '', mesExamples: '', description: '', personality: '', persona: '', scenario: '', jailbreak: '' };
|
||||
const result = { system: '', mesExamples: '', description: '', personality: '', persona: '', scenario: '', jailbreak: '', version: '' };
|
||||
const character = characters[this_chid];
|
||||
|
||||
if (!character) {
|
||||
@ -2620,6 +2621,7 @@ export function getCharacterCardFields() {
|
||||
result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2);
|
||||
result.system = power_user.prefer_character_prompt ? baseChatReplace(characters[this_chid].data?.system_prompt?.trim(), name1, name2) : '';
|
||||
result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(characters[this_chid].data?.post_history_instructions?.trim(), name1, name2) : '';
|
||||
result.version = characters[this_chid].data?.character_version ?? '';
|
||||
|
||||
if (selected_group) {
|
||||
const groupCards = getGroupCharacterCards(selected_group, Number(this_chid));
|
||||
|
@ -337,8 +337,6 @@ export function evaluateMacros(content, env) {
|
||||
content = content.replace(/{{isotime}}/gi, () => moment().format('HH:mm'));
|
||||
content = content.replace(/{{isodate}}/gi, () => moment().format('YYYY-MM-DD'));
|
||||
|
||||
content = content.replace(/{{char_version}}/gi, env.char_version);
|
||||
|
||||
content = content.replace(/{{datetimeformat +([^}]*)}}/gi, (_, format) => {
|
||||
const formattedTime = moment().format(format);
|
||||
return formattedTime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user