Merge pull request #234 from one-some/UI2

Add title support to aidg import and finder
This commit is contained in:
ebolam
2022-10-21 08:34:42 -04:00
committed by GitHub
3 changed files with 9 additions and 1 deletions

View File

@@ -297,6 +297,7 @@ class ImportBuffer:
authors_note: Optional[str] = None
notes: Optional[str] = None
world_infos: Optional[dict] = None
title: Optional[str] = None
@dataclass
class PromptPlaceholder:
@@ -416,6 +417,7 @@ class ImportBuffer:
self.memory = j["memory"]
self.authors_note = j["authorsNote"]
self.notes = j["description"]
self.title = j["title"] or "Imported Story"
self.world_infos = []
@@ -449,6 +451,7 @@ class ImportBuffer:
koboldai_vars.memory = self.memory or ""
koboldai_vars.authornote = self.authors_note or ""
koboldai_vars.notes = self.notes
koboldai_vars.story_name = self.title
for wi in self.world_infos:
koboldai_vars.worldinfo_v2.add_item(

View File

@@ -76,6 +76,7 @@ var finder_actions = [
{name: "Load Story", icon: "folder_open", type: "action", func: function() { socket.emit('load_story_list', ''); }},
{name: "Save Story", icon: "save", type: "action", func: function() { socket.emit("save_story", null, (response) => {save_as_story(response);}); }},
{name: "Download Story", icon: "file_download", type: "action", func: function() { document.getElementById('download_iframe').src = 'json'; }},
{name: "Import Story", icon: "file_download", desc: "Import a prompt from aetherroom.club, formerly prompts.aidg.club", type: "action", func: openClubImport },
// Locations
{name: "Setting Presets", icon: "open_in_new", type: "location", func: function() { highlightEl(".var_sync_model_selected_preset") }},
@@ -4616,6 +4617,10 @@ function updateTitle() {
document.title = `${titleInput.innerText} - KoboldAI Client`;
}
function openClubImport() {
document.getElementById("import_aidg_club_popup").classList.remove("hidden");
}
//// INIT ////
document.onkeydown = detect_key_down;

View File

@@ -22,7 +22,7 @@
<span class="button_label">Load from Local</span>
</button>
<input class="hidden" type=file id="upload_without_save" onchange="upload_file_without_save(this)">
<button id="import_story_button" class="settings_button hidden" onclick="document.getElementById('import_aidg_club_popup').classList.remove('hidden');">
<button id="import_story_button" class="settings_button hidden" onclick="openClubImport();">
<span class="material-icons-outlined cursor" tooltip="Import Story">cloud_download</span>
<span class="button_label">Import Story</span>
</button>