From 55cf5f2f6747442b497d84a86cce98628c751515 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Sat, 17 Dec 2022 04:10:56 +0100 Subject: [PATCH 01/14] Update usage instructions for git-clone use --- readme.md => README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename readme.md => README.md (99%) diff --git a/readme.md b/README.md similarity index 99% rename from readme.md rename to README.md index 413242d5..fc3b73dc 100644 --- a/readme.md +++ b/README.md @@ -105,7 +105,7 @@ KoboldAI has a large number of dependencies you will need to install on your com ### Downloading the latest version of KoboldAI -KoboldAI is a rolling release on our github, the code you see is also the game. You can the software by clicking on the green Code button at the top of the page and clicking Download ZIP. +KoboldAI is a rolling release on our github, the code you see is also the game. You can download the software by clicking on the green Code button at the top of the page and clicking Download ZIP. Then, you can run install_requirements.bat/sh (using sudo/admin mode is recommanded to avoid errors), and then once it's done, either play.bat/sh or remote-play.bat/sh to run it. The easiest way for Windows users is to use the [offline installer](https://sourceforge.net/projects/koboldai/files/latest/download) below. @@ -228,4 +228,4 @@ Did we miss your contribution? Feel free to issue a commit adding your name to t KoboldAI is licensed with a AGPL license, in short this means that it can be used by anyone for any purpose. However, if you decide to make a publicly available instance your users are entitled to a copy of the source code including all modifications that you have made (which needs to be available trough an interface such as a button on your website), you may also not distribute this project in a form that does not contain the source code (Such as compiling / encrypting the code and distributing this version without also distributing the source code that includes the changes that you made. You are allowed to distribute this in a closed form if you also provide a separate archive with the source code.). -umamba.exe is bundled for convenience because we observed that many of our users had trouble with command line download methods, it is not part of our project and does not fall under the AGPL license. It is licensed under the BSD-3-Clause license. Other files with differing licenses will have a reference or embedded version of this license within the file. It has been sourced from https://anaconda.org/conda-forge/micromamba/files and its source code can be found here : https://github.com/mamba-org/mamba/tree/master/micromamba \ No newline at end of file +umamba.exe is bundled for convenience because we observed that many of our users had trouble with command line download methods, it is not part of our project and does not fall under the AGPL license. It is licensed under the BSD-3-Clause license. Other files with differing licenses will have a reference or embedded version of this license within the file. It has been sourced from https://anaconda.org/conda-forge/micromamba/files and its source code can be found here : https://github.com/mamba-org/mamba/tree/master/micromamba From a4f49c097acc446f459cd227c7f1f9b68d9bf7c8 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Sat, 17 Dec 2022 12:13:51 +0100 Subject: [PATCH 02/14] Add git clone command and Linux case --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc3b73dc..20a1957a 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ KoboldAI has a large number of dependencies you will need to install on your com ### Downloading the latest version of KoboldAI -KoboldAI is a rolling release on our github, the code you see is also the game. You can download the software by clicking on the green Code button at the top of the page and clicking Download ZIP. Then, you can run install_requirements.bat/sh (using sudo/admin mode is recommanded to avoid errors), and then once it's done, either play.bat/sh or remote-play.bat/sh to run it. +KoboldAI is a rolling release on our github, the code you see is also the game. You can download the software by clicking on the green Code button at the top of the page and clicking Download ZIP, or use the `git clone` command instead. Then, on Windows you need to you run install_requirements.bat (using admin mode is recommanded to avoid errors), and once it's done, or if you're on Linux, either play.bat/sh or remote-play.bat/sh to run it. The easiest way for Windows users is to use the [offline installer](https://sourceforge.net/projects/koboldai/files/latest/download) below. From 9b4f434d33599c5d929b38ccb5596a77e52ead0e Mon Sep 17 00:00:00 2001 From: Henk Date: Wed, 21 Dec 2022 03:48:14 +0100 Subject: [PATCH 03/14] Submodule support for Linux Adds submodule support for docker and colab, also enables updating again by default. We manually disable this for official releases. --- colabkobold.sh | 2 ++ docker-standalone/docker-helper.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/colabkobold.sh b/colabkobold.sh index 4c41675a..25ccbb52 100644 --- a/colabkobold.sh +++ b/colabkobold.sh @@ -136,6 +136,8 @@ if [ "$init" != "skip" ]; then git reset --hard origin/$(git_default_branch) fi + git submodule update --init --recursive + cd /content/KoboldAI-Client cp -rn stories/* /content/drive/MyDrive/KoboldAI/stories/ diff --git a/docker-standalone/docker-helper.sh b/docker-standalone/docker-helper.sh index 30107e8a..5d738e6c 100755 --- a/docker-standalone/docker-helper.sh +++ b/docker-standalone/docker-helper.sh @@ -1,7 +1,7 @@ #!/bin/bash cd /opt/koboldai -git pull -#./install_requirements.sh cuda + +git pull --recurse-submodules && ./install_requirements.sh cuda if [[ ! -v KOBOLDAI_DATADIR ]];then mkdir /content From 1dbc987048ad2126bc01c48854854ee36827f270 Mon Sep 17 00:00:00 2001 From: henk717 Date: Wed, 21 Dec 2022 16:52:41 +0100 Subject: [PATCH 04/14] 6B models now Colab Free has beefier GPU's --- colab/GPU.ipynb | 71 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb index 8c76b5ed..203f53ba 100644 --- a/colab/GPU.ipynb +++ b/colab/GPU.ipynb @@ -6,7 +6,6 @@ "name": "ColabKobold GPU", "private_outputs": true, "provenance": [], - "collapsed_sections": [], "include_colab_link": true }, "kernelspec": { @@ -40,7 +39,23 @@ "\n", "For more information about KoboldAI check our our Github readme : https://github.com/KoboldAI/KoboldAI-Client/blob/main/readme.md\n", "\n", - "For the larger AI models (That are typically more coherent) check out our **[TPU edition](https://colab.research.google.com/github/KoboldAI/KoboldAI-Client/blob/main/colab/TPU.ipynb)**!" + "For the larger AI models (That are typically more coherent) check out our **[TPU edition](https://colab.research.google.com/github/KoboldAI/KoboldAI-Client/blob/main/colab/TPU.ipynb)**!\n", + "\n", + "---\n", + "## How to load KoboldAI: Everything you need to know\n", + "1. On a phone? First put your browser in desktop mode because of a Google Colab bug. Otherwise nothing will happen when you click the play button. Then tap the play button next to \"<-- Tap This if you play on Mobile\", you will see an audio player. Keep the audio player playing so Colab does not get shut down in the background.\n", + "2. Select the desired model, you will find a description of all the available models further down the page.\n", + "3. Click the play button next to \"<-- Select your model below and then click this to start KoboldAI\".\n", + "4. Got a message saying no accelerator is available? Click cancel, and try again in a few minutes. If you do not manage to get a session when you frequently try again try at a different time of day, colab can be busy or your priority may have been lowered by frequent usage.\n", + "5. After everything is done loading you will get a link that you can use to open KoboldAI. In case of Localtunnel you will also be warned that some people are abusing Localtunnel for phishing, once you acknowledge this warning you will be taken to KoboldAI's interface. If you picked Cloudflare and get a 1033 error refresh the error page after waiting one minute.\n", + "\n", + "---\n", + "\n", + "Further down the page you can find descriptions of the models, and tips to get the most out of your Google Colab experience.\n", + "\n", + "Make sure to keep this page open while you are using KoboldAI, and check back regularly to see if you got a Captcha. Failure to complete the captcha's in time can result in termination of your session or a lower priority towards the TPUs.\n", + "\n", + "Firefox users need to disable the enhanced tracking protection or use a different browser in order to be able to use Google Colab without errors (This is not something we can do anything about, the cookie blocker breaks the Google Drive integration because it uses different domains)." ] }, { @@ -67,23 +82,55 @@ "#@title <-- Select your model below and then click this to start KoboldAI\n", "#@markdown You can find a description of the models below along with instructions on how to start KoboldAI.\n", "\n", - "Model = \"Nerys 2.7B\" #@param [\"Nerys 2.7B\", \"AID 2.7B\", \"Erebus 2.7B\", \"Janeway 2.7B\", \"Picard 2.7B\", \"Horni LN 2.7B\", \"Horni 2.7B\", \"Shinen 2.7B\", \"OPT 2.7B\", \"Fairseq Dense 2.7B\", \"Neo 2.7B\"] {allow-input: true}\n", + "Model = \"Nerys V2 6B\" #@param [\"Nerys V2 6B\", \"Erebus 6B\", \"Skein 6B\", \"Janeway 6B\", \"Adventure 6B\", \"Lit V2 6B\", \"Lit 6B\", \"Shinen 6B\", \"Nerys 2.7B\", \"AID 2.7B\", \"Erebus 2.7B\", \"Janeway 2.7B\", \"Picard 2.7B\", \"Horni LN 2.7B\", \"Horni 2.7B\", \"Shinen 2.7B\", \"OPT 2.7B\", \"Fairseq Dense 2.7B\", \"Neo 2.7B\"] {allow-input: true}\n", "Version = \"Official\" #@param [\"Official\", \"United\"] {allow-input: true}\n", "Provider = \"Localtunnel\" #@param [\"Localtunnel\", \"Cloudflare\"]\n", - "use_google_drive = True #@param {type:\"boolean\"}\n", + "use_google_drive = True #@param {type:\"boolean\"}\n", "\n", "!nvidia-smi\n", "from google.colab import drive\n", "if use_google_drive:\n", - " drive.mount('/content/drive/')\n", - "else:\n", - " import os\n", - " if not os.path.exists(\"/content/drive\"):\n", - " os.mkdir(\"/content/drive\")\n", - " if not os.path.exists(\"/content/drive/MyDrive/\"):\n", - " os.mkdir(\"/content/drive/MyDrive/\")\n", + " drive.mount('/content/drive/')\n", + "else:\n", + " import os\n", + " if not os.path.exists(\"/content/drive\"):\n", + " os.mkdir(\"/content/drive\")\n", + " if not os.path.exists(\"/content/drive/MyDrive/\"):\n", + " os.mkdir(\"/content/drive/MyDrive/\")\n", "\n", - "if Model == \"Nerys 2.7B\":\n", + "if Model == \"Nerys V2 6B\":\n", + " Model = \"KoboldAI/OPT-6B-nerys-v2\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Erebus 6B\":\n", + " Model = \"KoboldAI/OPT-6.7B-Erebus\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Skein 6B\":\n", + " Model = \"KoboldAI/GPT-J-6B-Skein\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Janeway 6B\":\n", + " Model = \"KoboldAI/GPT-J-6B-Janeway\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Adventure 6B\":\n", + " Model = \"KoboldAI/GPT-J-6B-Adventure\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Lit V2 6B\":\n", + " Model = \"hakurei/litv2-6B-rev3\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Lit 6B\":\n", + " Model = \"hakurei/lit-6B\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Shinen 6B\":\n", + " Model = \"KoboldAI/GPT-J-6B-Shinen\"\n", + " path = \"\"\n", + " download = \"\"\n", + "elif Model == \"Nerys 2.7B\":\n", " Model = \"KoboldAI/fairseq-dense-2.7B-Nerys\"\n", " path = \"\"\n", " download = \"\"\n", From 29c476203994abc9509269191d8cdb21ced0d6b4 Mon Sep 17 00:00:00 2001 From: Henk Date: Thu, 22 Dec 2022 01:53:11 +0100 Subject: [PATCH 05/14] ColabKobold Update Allows ColabKobold to handle the new directories --- .gitignore | 1 + Install Horde Bridge.bat | 41 ---------------------------------------- colabkobold.sh | 11 +++++++++++ 3 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 Install Horde Bridge.bat diff --git a/.gitignore b/.gitignore index 9a70a260..46718789 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ userscripts !userscripts/api_documentation.* softprompts models +functional_models !models/models go here.txt Uninstall flask_session diff --git a/Install Horde Bridge.bat b/Install Horde Bridge.bat deleted file mode 100644 index c1d48fcf..00000000 --- a/Install Horde Bridge.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo off -cd /D %~dp0 -TITLE KoboldAI - Installing Horde Bridge -SET /P M=nul -subst K: miniconda3 >nul -SET TEMP=K:\ -SET TMP=K:\ -call K:\python\condabin\activate -git clone https://github.com/db0/KoboldAI-Horde-Bridge KoboldAI-Horde -python -m venv KoboldAI-Horde\venv -KoboldAI-Horde\venv\scripts\pip install -r KoboldAI-Horde\requirements.txt -cmd /k - -:drivemap_B -ECHO Runtime launching in B: drive mode -subst /D B: >nul -subst B: miniconda3 >nul -SET TEMP=B:\ -SET TMP=B:\ -call B:\python\condabin\activate -git clone https://github.com/db0/KoboldAI-Horde-Bridge KoboldAI-Horde -python -m venv KoboldAI-Horde\venv -KoboldAI-Horde\venv\scripts\pip install -r KoboldAI-Horde\requirements.txt -cmd /k diff --git a/colabkobold.sh b/colabkobold.sh index 25ccbb52..a300e382 100644 --- a/colabkobold.sh +++ b/colabkobold.sh @@ -98,6 +98,9 @@ mkdir /content/drive/MyDrive/KoboldAI/models/ mkdir /content/drive/MyDrive/KoboldAI/settings/ mkdir /content/drive/MyDrive/KoboldAI/softprompts/ mkdir /content/drive/MyDrive/KoboldAI/userscripts/ +mkdir /content/drive/MyDrive/KoboldAI/presets +mkdir $/content/drive/MyDrive/KoboldAI/themes + if [ "$init" == "drive" ]; then echo Google Drive folders created. exit 0 @@ -143,6 +146,8 @@ if [ "$init" != "skip" ]; then cp -rn stories/* /content/drive/MyDrive/KoboldAI/stories/ cp -rn userscripts/* /content/drive/MyDrive/KoboldAI/userscripts/ cp -rn softprompts/* /content/drive/MyDrive/KoboldAI/softprompts/ + cp -rn softprompts/* /content/drive/MyDrive/KoboldAI/presets/ + cp -rn softprompts/* /content/drive/MyDrive/KoboldAI/themes/ rm stories rm -rf stories/ rm userscripts @@ -151,11 +156,17 @@ if [ "$init" != "skip" ]; then rm -rf softprompts/ rm models rm -rf models/ + rm presets + rm -rf presets/ + rm themes + rm -rf themes/ ln -s /content/drive/MyDrive/KoboldAI/stories/ stories ln -s /content/drive/MyDrive/KoboldAI/settings/ settings ln -s /content/drive/MyDrive/KoboldAI/softprompts/ softprompts ln -s /content/drive/MyDrive/KoboldAI/userscripts/ userscripts ln -s /content/drive/MyDrive/KoboldAI/models/ models + ln -s /content/drive/MyDrive/KoboldAI/presets/ presets + ln -s /content/drive/MyDrive/KoboldAI/themes/ themes if [ -n "${COLAB_TPU_ADDR+set}" ]; then pip install -r requirements_mtj.txt From ca52b07f13f954cf117583249f940037ce93b8c1 Mon Sep 17 00:00:00 2001 From: Henk Date: Thu, 22 Dec 2022 01:56:44 +0100 Subject: [PATCH 06/14] ColabKobold Fixes Made a few mistakes in my initial commit --- colabkobold.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/colabkobold.sh b/colabkobold.sh index a300e382..799a6d9c 100644 --- a/colabkobold.sh +++ b/colabkobold.sh @@ -98,8 +98,8 @@ mkdir /content/drive/MyDrive/KoboldAI/models/ mkdir /content/drive/MyDrive/KoboldAI/settings/ mkdir /content/drive/MyDrive/KoboldAI/softprompts/ mkdir /content/drive/MyDrive/KoboldAI/userscripts/ -mkdir /content/drive/MyDrive/KoboldAI/presets -mkdir $/content/drive/MyDrive/KoboldAI/themes +mkdir /content/drive/MyDrive/KoboldAI/presets/ +mkdir /content/drive/MyDrive/KoboldAI/themes/ if [ "$init" == "drive" ]; then echo Google Drive folders created. @@ -146,8 +146,8 @@ if [ "$init" != "skip" ]; then cp -rn stories/* /content/drive/MyDrive/KoboldAI/stories/ cp -rn userscripts/* /content/drive/MyDrive/KoboldAI/userscripts/ cp -rn softprompts/* /content/drive/MyDrive/KoboldAI/softprompts/ - cp -rn softprompts/* /content/drive/MyDrive/KoboldAI/presets/ - cp -rn softprompts/* /content/drive/MyDrive/KoboldAI/themes/ + cp -rn presets/* /content/drive/MyDrive/KoboldAI/presets/ + cp -rn themes/* /content/drive/MyDrive/KoboldAI/themes/ rm stories rm -rf stories/ rm userscripts From 46438b96c362e4ea2dc8696a99cfa7be0c928c6d Mon Sep 17 00:00:00 2001 From: somebody Date: Mon, 26 Dec 2022 17:05:15 -0600 Subject: [PATCH 07/14] Fix selection after line bugging out And push big check encapsulating all of select_game_text to the beginning to be a bit neater --- static/koboldai.js | 106 ++++++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 49 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index 3021397b..0281916a 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -2991,66 +2991,74 @@ function toggle_adventure_mode(button) { } function select_game_text(event) { - if ((event == null) || (event.code == 'ArrowRight') || (event.code == 'ArrowLeft') || (event.code == 'ArrowDown') || (event.code == 'ArrowUp')) { - let new_selected_game_chunk = null; - if (document.selection) { - if (document.selection.createRange().parentElement().id == 'story_prompt') { - new_selected_game_chunk = document.selection.createRange().parentElement(); - } else if (document.selection.createRange().parentElement().id == 'gamescreen') { + if (!((event === null) || ["ArrowRight", "ArrowLeft", "ArrowDown", "ArrowUp"].includes(event.code))) return; + + let anchorNode = window.getSelection().anchorNode; + let new_selected_game_chunk = null; + + if (document.selection) { + if (document.selection.createRange().parentElement().id == 'story_prompt') { + new_selected_game_chunk = document.selection.createRange().parentElement(); + } else if (document.selection.createRange().parentElement().id == 'gamescreen') { + new_selected_game_chunk = null; + //console.log("Do nothing"); + } else { + new_selected_game_chunk = document.selection.createRange().parentElement().parentElement(); + } + } else if (anchorNode != null && anchorNode.tagName === "SPAN") { + // If clicking to the right of an action, the event target is actually + // the whole of gametext, and the anchorNode is a child span of an + // action rather than a text node. + new_selected_game_chunk = anchorNode.parentNode; + } else if (anchorNode != null ) { + if(anchorNode.parentNode) { + if (anchorNode.parentNode.id == 'story_prompt') { + new_selected_game_chunk = anchorNode.parentNode; + } else if (anchorNode.parentNode.id == "gamescreen") { new_selected_game_chunk = null; //console.log("Do nothing"); } else { - new_selected_game_chunk = document.selection.createRange().parentElement().parentElement(); + new_selected_game_chunk = anchorNode.parentNode.parentNode; } - } else if (window.getSelection().anchorNode != null ) { - if(window.getSelection().anchorNode.parentNode) { - if (window.getSelection().anchorNode.parentNode.id == 'story_prompt') { - new_selected_game_chunk = window.getSelection().anchorNode.parentNode; - } else if (window.getSelection().anchorNode.parentNode.id == "gamescreen") { - new_selected_game_chunk = null; - //console.log("Do nothing"); - } else { - new_selected_game_chunk = window.getSelection().anchorNode.parentNode.parentNode; - } + } else { + new_selected_game_chunk = null; + } + } + + //if we've moved to a new game chunk we need to save the old chunk + if (((new_selected_game_chunk != selected_game_chunk) && (selected_game_chunk != null)) || (document.activeElement != document.getElementById("Selected Text"))) { + if ((selected_game_chunk != null) && (selected_game_chunk.innerText != selected_game_chunk.original_text) && (selected_game_chunk != document.getElementById("welcome_text"))) { + if (selected_game_chunk.id == 'story_prompt') { + edit_game_text(-1); } else { - new_selected_game_chunk = null; + edit_game_text(parseInt(selected_game_chunk.getAttribute("chunk"))); } } - //if we've moved to a new game chunk we need to save the old chunk - if (((new_selected_game_chunk != selected_game_chunk) && (selected_game_chunk != null)) || (document.activeElement != document.getElementById("Selected Text"))) { - if ((selected_game_chunk != null) && (selected_game_chunk.innerText != selected_game_chunk.original_text) && (selected_game_chunk != document.getElementById("welcome_text"))) { - if (selected_game_chunk.id == 'story_prompt') { - edit_game_text(-1); - } else { - edit_game_text(parseInt(selected_game_chunk.getAttribute("chunk"))); - } + } + + //Check to see if new selection is a game chunk or something else + if (new_selected_game_chunk == null) { + selected_game_chunk = null; + for (item of document.getElementsByClassName("editing")) { + item.classList.remove("editing"); + } + window.getSelection().removeAllRanges() + } else if (((new_selected_game_chunk.id == "story_prompt") || (new_selected_game_chunk.id.slice(0,20) == "Selected Text Chunk ")) && (document.activeElement.isContentEditable)) { + if (new_selected_game_chunk != selected_game_chunk) { + for (item of document.getElementsByClassName("editing")) { + item.classList.remove("editing"); } + selected_game_chunk = new_selected_game_chunk; + selected_game_chunk.classList.add("editing"); + update_story_picture(selected_game_chunk.getAttribute("chunk")); } - //Check to see if new selection is a game chunk or something else - if (new_selected_game_chunk == null) { - selected_game_chunk = null; - for (item of document.getElementsByClassName("editing")) { - item.classList.remove("editing"); - } - window.getSelection().removeAllRanges() - } else if (((new_selected_game_chunk.id == "story_prompt") || (new_selected_game_chunk.id.slice(0,20) == "Selected Text Chunk ")) && (document.activeElement.isContentEditable)) { - if (new_selected_game_chunk != selected_game_chunk) { - for (item of document.getElementsByClassName("editing")) { - item.classList.remove("editing"); - } - selected_game_chunk = new_selected_game_chunk; - selected_game_chunk.classList.add("editing"); - update_story_picture(selected_game_chunk.getAttribute("chunk")); - } - - } else { - selected_game_chunk = null; - for (item of document.getElementsByClassName("editing")) { - item.classList.remove("editing"); - } - window.getSelection().removeAllRanges() + } else { + selected_game_chunk = null; + for (item of document.getElementsByClassName("editing")) { + item.classList.remove("editing"); } + window.getSelection().removeAllRanges() } } From 80a58f1be94e413215952d03cb7be8a5dc232c29 Mon Sep 17 00:00:00 2001 From: somebody Date: Mon, 26 Dec 2022 21:14:45 -0600 Subject: [PATCH 08/14] Oops --- templates/popups.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/popups.html b/templates/popups.html index 4621a281..50f4e817 100644 --- a/templates/popups.html +++ b/templates/popups.html @@ -174,8 +174,6 @@ - message-popup -

From ab043e78dc78f9e0a872c0b87fa8727ffade957b Mon Sep 17 00:00:00 2001 From: Taylor Date: Thu, 29 Dec 2022 23:20:52 -0500 Subject: [PATCH 11/14] Clean up CSS significantly --- static/koboldai.css | 54 +++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/static/koboldai.css b/static/koboldai.css index 3bc5b8d8..fc9c3222 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -16,10 +16,12 @@ input[type='range'] { overflow: hidden; border-color: var(--setting_background); - width: 100%; + width: calc(100% - 10px); -webkit-appearance: none; background-color: var(--rangeslider_background_color); border-radius: 16px; + margin-left: 5px; + margin-right: 5px; } input[type='range']::-webkit-slider-runnable-track { @@ -179,9 +181,12 @@ border-top-right-radius: var(--tabs_rounding); display: flex; flex-direction: row; flex-wrap: wrap; - width: 100%; } +#Images { + padding-left: 10px; + padding-right: 10px; +} .dynamic-setting-container { background-color: var(--setting_background); @@ -213,6 +218,7 @@ border-top-right-radius: var(--tabs_rounding); border-radius: var(--radius_settings_background); padding: 2px; margin: 2px; + width: calc(50% - 4px); } .setting_container_sp { @@ -229,6 +235,11 @@ border-top-right-radius: var(--tabs_rounding); margin: 2px; } +#biasing { + margin-left: 5px; + margin-right: 5px; +} + .setting_container.var_sync_alt_system_alt_gen[system_alt_gen="true"] { display: none; } @@ -250,6 +261,7 @@ border-top-right-radius: var(--tabs_rounding); border-radius: var(--radius_settings_background); padding: 2px; margin-top: 5px; + flex-grow: 1; } #story_menu_author .setting_tile_area{ @@ -269,6 +281,7 @@ border-top-right-radius: var(--tabs_rounding); border-radius: var(--radius_settings_background); padding: 2px; margin: 2px; + width: calc(50% - 4px); } .setting_container_single .setting_item{ font-size: calc(0.93em + var(--font_size_adjustment)); @@ -287,6 +300,7 @@ border-top-right-radius: var(--tabs_rounding); border-radius: var(--radius_settings_background); padding: 1px; margin: 2px; + width: calc(100% - 8px); } .setting_container_single_wide .setting_item{ font-size: calc(0.93em + var(--font_size_adjustment)); @@ -453,7 +467,7 @@ border-top-right-radius: var(--tabs_rounding); .SideMenu .flyout_menu_contents { overflow-x: hidden; overflow-y: auto; - height: calc(100vh - 40px); + height: calc(100vh - 34px); } .settings_footer { @@ -544,6 +558,9 @@ border-top-right-radius: var(--tabs_rounding); border-radius: var(--radius_settings_button); border-style:solid; height: 35px; + display: inline-flex; + align-items: center; + justify-content: center; } .settings_button > .material-icons-outlined { @@ -551,13 +568,6 @@ border-top-right-radius: var(--tabs_rounding); top: 2px; } - -.settings_button > .button_label { - position: relative; - bottom: 3px; - right: 4px; -} - .settings_button > .material-icons-outlined { position: relative; top: 1px; @@ -751,7 +761,7 @@ border-top-right-radius: var(--tabs_rounding); border: 2px solid var(--palette_card_text); border-radius: var(--radius_palette_card); box-shadow: var(--palette_card_shadow); - margin: 5px; + margin-top: 5px; padding: 5px 0 10px 0; background: var(--palette_card_background); color: var(--palette_card_text); @@ -2284,6 +2294,7 @@ body { opacity: 0.7; font-size: small; float: right; + padding-right: 10px; } .debug-dump-log { @@ -2428,6 +2439,13 @@ body { } /* Substitutions */ +#Substitutions { + margin-left: 10px; + margin-right: 10px; + justify-content: center; + width: auto; +} + #Substitutions > .help_text > .helpicon { position: relative; margin-left: 1px; @@ -3010,6 +3028,11 @@ button.disabled { padding: 5px 7px 5px 7px; } +textarea.fullwidth { + border-style: solid; + resize: vertical; +} + .rawtext { white-space: pre-wrap; } @@ -3315,9 +3338,12 @@ select { } @-moz-document url-prefix() { - select, .presets { - padding-left: 5px; /* Add padding to the left side of the select element */ - } + select, .presets { + padding-left: 5px; /* Add padding to the left side of the select element */ + } + select { + padding-top: 0; + } } From 86ede6a2d6948e776dc78a289df8850271445961 Mon Sep 17 00:00:00 2001 From: Taylor Date: Thu, 29 Dec 2022 23:31:33 -0500 Subject: [PATCH 12/14] Nudge the toggles in CSS --- static/koboldai.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/koboldai.css b/static/koboldai.css index fc9c3222..bb8055d8 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -357,6 +357,10 @@ border-top-right-radius: var(--tabs_rounding); overflow: hidden; } +.setting_item .toggle { + margin-left: 5px; +} + .setting_item_input { width:95%; } From 0fbfcbe17dbe4e4960006a6a3de0cfc5c86300b5 Mon Sep 17 00:00:00 2001 From: somebody Date: Sun, 1 Jan 2023 15:55:49 -0600 Subject: [PATCH 13/14] Better cross-browser styling for WI item type The WI item type styling for Chrome is now (as far as I can tell) 1:1 with Firefox. This means there is actually now typing feedback!!! --- static/koboldai.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/koboldai.css b/static/koboldai.css index aac1ee67..5c0e4d40 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -1110,12 +1110,20 @@ td.server_vars { .world_info_item_type { /* Workaround for Firefox bug: https://stackoverflow.com/a/42283543 */ padding: 1px; + padding-bottom: 0px; + display: inline-block; + height: 2.8ex; + cursor: text; outline: none; border-bottom: 1px solid gray; transition: color 200ms, border-bottom-color 200ms; } +.world_info_item_type::before { + opacity: 0.3 !important; +} + .world_info_item_type.bad-input { color: rgb(255, 103, 103); border-bottom-color: red; From 48dd451a8cf3dfadb2c6df65837f4fde4b07973a Mon Sep 17 00:00:00 2001 From: Llama <34464159+pi6am@users.noreply.github.com> Date: Sun, 1 Jan 2023 21:12:25 -0800 Subject: [PATCH 14/14] Add the ability to insert the story prompt into the art guide. The art guide now optionally supports the sequence <|> If this exists in the art guide, <|> is replaced by the story summary. Otherwise, the art guide is appended to the summary as before. Update the default art guide to place the medium before the summary. Also update the art guide tooltip to include the new default. --- aiserver.py | 18 +++++++++++++----- gensettings.py | 2 +- koboldai_settings.py | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/aiserver.py b/aiserver.py index bb79fe99..814d8f8c 100644 --- a/aiserver.py +++ b/aiserver.py @@ -9492,7 +9492,7 @@ def UI_2_generate_image_from_story(data): koboldai_vars.generating_image = True eventlet.sleep(0) - art_guide = '{}'.format(koboldai_vars.img_gen_art_guide) + art_guide = str(koboldai_vars.img_gen_art_guide) if 'action_id' in data and (int(data['action_id']) in koboldai_vars.actions.actions or int(data['action_id']) == -1): action_id = int(data['action_id']) @@ -9526,13 +9526,21 @@ def UI_2_generate_image_from_story(data): max_length = args.max_summary_length - len(koboldai_vars.summary_tokenizer.encode(art_guide)) keys = [summarize(text, max_length=max_length)] - logger.debug("Text from summarizer: {}".format(keys[0])) - prompt = ", ".join(keys) + logger.debug("Text from summarizer: {}".format(prompt)) + + if art_guide: + if '<|>' in art_guide: + full_prompt = art_guide.replace('<|>', prompt) + else: + full_prompt = f"{prompt}, {art_guide}" + else: + full_prompt = prompt + generate_story_image( - ", ".join([part for part in [prompt, art_guide] if part]), + full_prompt, file_prefix=f"action_{action_id}", - display_prompt=prompt, + display_prompt=full_prompt, log_data={"actionId": action_id}, ) diff --git a/gensettings.py b/gensettings.py index 1e6f94fa..214d2f45 100644 --- a/gensettings.py +++ b/gensettings.py @@ -613,7 +613,7 @@ gensettingstf = [ "label": "Art Guide", "id": "img_gen_art_guide", "default": "", - "tooltip": "The art guide sent with image gen requests. \nDefault: fantasy illustration, artstation, by jason felix by steve argyle by tyler jacobson by peter mohrbacher, cinematic lighting", + "tooltip": "The art guide sent with image gen requests. <|> (optional) is replaced with the story summary, otherwise the art guide is appended to the summary. \nDefault: masterpiece, digital painting, <|>, dramatic lighting, highly detailed, trending", "menu_path": "Interface", "sub_path": "Images", "classname": "user", diff --git a/koboldai_settings.py b/koboldai_settings.py index a0588572..45281e3f 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -1159,7 +1159,7 @@ class user_settings(settings): self.show_budget = False self.ui_level = 2 self.img_gen_api_url = "http://127.0.0.1:7860" - self.img_gen_art_guide = "digital painting, dramatic lighting, highly detailed, trending" + self.img_gen_art_guide = "masterpiece, digital painting, <|>, dramatic lighting, highly detailed, trending" self.img_gen_negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name" self.img_gen_steps = 30 self.img_gen_cfg_scale = 7.0