mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Polish and bugfixes on import variables
This commit is contained in:
@@ -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)
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user