Polish and bugfixes on import variables

This commit is contained in:
somebody
2022-09-15 22:13:54 -05:00
parent b7dc60bff8
commit 73b1e551fa
3 changed files with 2 additions and 6 deletions

View File

@@ -339,15 +339,12 @@ class ImportBuffer:
def _replace_placeholders(self, text: str, ph_ids: dict):
for ph_id, value in ph_ids.items():
print(f"iterating upon {ph_id=}")
pattern = "\${(?:\d#)?%s.*?}" % ph_id
pattern = "\${(?:\d#)?%s.*?}" % re.escape(ph_id)
for ph_text in re.findall(pattern, text):
print(f"instance of {ph_id} in text, replaceing with {value}")
text = text.replace(ph_text, value)
return text
def replace_placeholders(self, ph_ids: dict):
print(f"Replacing with {ph_ids}")
self.prompt = self._replace_placeholders(self.prompt, ph_ids)
self.memory = self._replace_placeholders(self.memory, ph_ids)
self.authors_note = self._replace_placeholders(self.authors_note, ph_ids)

View File

@@ -3474,7 +3474,6 @@ function sendPromptConfiguration() {
socket.emit("configure_prompt", data);
document.querySelector("#popup").classList.add("hidden");
document.querySelector("#prompt-config-container").classList.add("hidden");
$(".prompt-config-ph").remove();
}

View File

@@ -113,7 +113,7 @@
<input autocomplete="off" class="form-control" type="text" placeholder="Prompt Number (4-digit number at the end of aetherroom.club URL)" id="aidgpromptnum">
</div>
<div class="popup_load_cancel">
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="socket.emit('load_aidg_club', document.getElementById('aidgpromptnum').value); this.parentElement.parentElement.classList.add('hidden');">Accept</button>
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="socket.emit('load_aidg_club', document.getElementById('aidgpromptnum').value); $('.popup').addClass('hidden');">Accept</button>
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="this.parentElement.parentElement.classList.add('hidden');">Cancel</button>
</div>
</div>