Commit Graph

284 Commits

Author SHA1 Message Date
Gnome Ann 44eaab8515 Disable most top menu actions when disconnected 2021-12-30 16:33:28 -05:00
Gnome Ann 4d27f1e09d Fix "flash of unstyled content" in FF, and status icon color 2021-12-30 15:27:48 -05:00
Gnome Ann 3532a30ad4 Make the UI theme grey when not connected to server 2021-12-30 01:44:35 -05:00
Gnome Ann 276f24029e Author's Note Template 2021-12-29 23:43:36 -05:00
Gnome Ann 7573f64bf2 Add Memory box to Random Story dialog and "Random Story Persist" 2021-12-29 23:15:59 -05:00
Gnome Ann 1189781eac Show a text box for chat name when Chat Mode is enabled 2021-12-26 22:21:58 -05:00
henk717 d234f67a90 Chat Mode
The Initial commit for Chat Mode, the nickname part of the UI is missing other than that it should be fully functional. To use Chat Mode effectively you first input a small dialogue (Can be around 6 lines 3 of your own inputs and 3 of the character) formatted as Name : it will then automate the actions needed to chat properly. During this mode single line mode is forced on, and Trim Incomplete Sentences is forced off.
2021-12-26 01:51:32 +01:00
Gnome Ann 4a852d7f95 Fix `restorePrompt()` in application.js
When the prompt is deleted by the user, the topmost remaining chunk of
the story that has at most one non-whitespace character is now made the
new prompt chunk.

Also fixed issues in Chromium-based browsers (desktop and Android) where
selecting all text in the story, typing some new text to replace the
entire story and then defocusing causes the editor to break.
2021-12-23 15:43:32 -05:00
Gnome Ann 7e06c25011 Display icons for active userscripts and softprompts
Also fixes the userscript menu so that the active userscripts preserve
the previously selected order as was originally intended.
2021-12-22 23:33:27 -05:00
Gnome Ann fc04ff3a08 World info folders can now be collapsed by clicking on the folder icon 2021-12-22 13:12:35 -05:00
Gnome Ann 452b46146b Messages should be hidden on loading a save, softprompt or script 2021-12-22 12:19:36 -05:00
Gnome Ann 341b153360 Lua API fixes
* `print()` and `warn()` now work correctly with `nil` arguments
* Typo: `gpt-neo-1.3M` has been corrected to `gpt-neo-1.3B`
* Regeneration is no longer triggered when writing to `keysecondary` of
  a non-selective key
* Handle `genamt` changes in generation modifier properly
* Writing to `kobold.settings.numseqs` from a generation modifier no
  longer affects
* Formatting options in `kobold.settings` have been fixed
* Added aliases for setting names
* Fix behaviour of editing story chunks from a generation modifier
* Warnings are now yellow instead of red
* kobold.logits is now the raw logits prior to being filtered, like
  the documentation says, rather than after being filtered
* Some erroneous comments and error messages have been corrected
* These parts of the API have now been implemented properly:
    * `compute_context()` methods
    * `kobold.authorsnote`
    * `kobold.restart_generation()`
2021-12-19 20:18:28 -05:00
Gnome Ann 12718dbe24 Try long-polling first, then try websocket
This makes it so that SocketIO uses long polling to set up the
connection before switching to websocket, instead of immediately using
websocket.

This seems to resolve issues where the browser sometimes can't connect
to the websocket server until the window has been open for a minute.
2021-12-17 13:18:47 -05:00
henk717 6d9063fb8b No Prompt Gen
Allow people to enter a prompt without generating anything by the AI. Combined with the always add prompt this is a very useful feature that allows people to write world information first, and then do a specific action. This mimics the behavior previously seen in AI Dungeon forks where it prompts for world information and then asks an action and can be particularly useful for people who want the prompt to always be part of the generation.
2021-12-16 12:47:44 +01:00
Gnome Ann 338d437ea3 Use eventlet instead of gevent-websocket 2021-12-13 17:19:04 -05:00
Gnome Ann fb6762bc1a Add "AVAILABLE" and "ACTIVE" headings to userscript menu 2021-12-13 12:45:52 -05:00
Gnome Ann a06cc3d37b Make sure the "Lua error" GUI message is always visible 2021-12-13 03:21:08 -05:00
Gnome Ann d2f5544468 Add Userscripts menu into GUI 2021-12-13 01:03:26 -05:00
Gnome Ann 6d8517e224 Fix some minor coding errors 2021-12-05 11:39:59 -05:00
Gnome Ann 1393eac882 Add indentation to WI folder contents 2021-12-05 03:29:13 -05:00
Gnome Ann d46ef8550b Fix WI sortable handle events not being bound correctly
This fixes a problem where WI entries/folders are sometimes able to be
dragged into places they shouldn't be. Steps to reproduce:

1. Start a blank story
2. Refresh the browser
3. Open the W Info screen
4. Add a world info folder
5. Add a world info entry into that folder
6. Drag that world info entry
2021-12-05 03:04:45 -05:00
Gnome Ann 85aa180a90 Put safeguards on dragging and dropping into invalid positions 2021-12-05 02:50:42 -05:00
Gnome Ann 3e0b1a9e63 Fix scrolling problems with WI entries with long names/comments 2021-12-05 01:39:42 -05:00
Gnome Ann 08992dec7e Use a green horizontal line as the drag-and-drop placeholder 2021-12-05 00:34:44 -05:00
Gnome Ann b99ac92a52 WI folders and WI drag-and-drop 2021-12-04 23:59:28 -05:00
Gnome Ann a1c378deea Fix CSS issues when editing a chunk that has a comment 2021-11-21 00:48:43 -05:00
Gnome Ann c2ed31de28 Add syntax for comments <|...|> 2021-11-20 01:27:57 -05:00
henk717 b926170fb0
Merge branch 'KoboldAI:main' into united 2021-11-19 00:05:21 +01:00
Gnome Ann bb51198f40 Fix some editor issues in Firefox and possibly mobile browsers
When Firefox 93.0 was released, they broke the ability to edit text
across multiple chunks or across multiple paragraphs. If you tried,
nothing would happen.

Also, we are no longer using Mutation Observers to detect when a chunk
is modified. We are now using the beforeinput event.
2021-11-18 13:18:18 -05:00
henk717 c2371cf801
Merge pull request #23 from VE-FORBRYDERNE/scan-test
Dynamic world info scan
2021-11-10 03:31:42 +01:00
henk717 bc0f9c8032 Allow remote mode to load from client-side story files
(cherry picked from commit a1345263df)
2021-11-06 11:48:20 -04:00
Gnome Ann 7a0b0b0d2d Remove debug logging from application.js 2021-11-04 19:36:45 -04:00
Gnome Ann 7c099fe93c Allow remote mode to load from client-side story files 2021-11-04 19:33:17 -04:00
Gnome Ann 0a91ea27b3 Make the dynamic world info scan toggleable 2021-11-03 12:18:48 -04:00
Gnome Ann 4e3cc93020 Merge branch 'united' into sp 2021-10-23 11:45:03 -04:00
henk717 7b73d7cfdd Single Line Mode
Adds Single Line mode, optimized for things like chatbot testing and other cases where you want to have control over what happens after a paragraph.

This can also be used as a foundation for a chatbot optimized interface mode.
2021-10-23 17:30:48 +02:00
Gnome Ann 9e82ce34a6 HTML-escape strings in the soft prompt selection menu 2021-10-22 14:25:25 -04:00
Gnome Ann 1f449a9dda Soft prompt support (6B Colabs not supported yet) 2021-10-22 14:18:10 -04:00
Gnome Ann fdbe730a1f Fix an incorrect document.queryCommandSupported call 2021-10-13 12:51:31 -04:00
Gnome Ann 99d26c44e0 Handle CRLF newlines properly when pasting 2021-10-13 12:43:45 -04:00
Gnome Ann 718af6f7fa Pasting fallback for browsers with no execCommand support 2021-10-13 12:41:43 -04:00
Gnome Ann 407d8f7419 Also apply the enter patch to pasted text 2021-10-13 12:05:15 -04:00
Gnome Ann aaa0c3374e Fix problems with stories that end in newlines
Today I learned that the editor only works properly when the last
<chunk> tag has a <br> inside it at the end.  This last <br> is
invisible and is automatically created by all major browsers when you
use the enter key to type a newline at the end of a story to "prevent
the element from collapsing".  When there's more than one <br> at the
end of the last <chunk>, only the last of those <br>s is invisible, so
if you have three <br>s, they are rendered as two newlines.  This only
applies to the last <chunk>, so if the second last <chunk> has three
<br>s at the end, they are still rendered as three newlines.  Since
the browser is really insistent on doing this, this commit mostly deals
with dynamically creating and deleting <br> tags at the ends of <chunk>
tags as needed to provide a consistent experience, and making sure
that all <br> tags actually go inside of <chunk> tags to prevent
breaking the editor.  The latter behaviour was exhibited by Chrome and
caused a bug when you added a newline at the end of your story using
the editor.
2021-10-13 00:42:03 -04:00
Gnome Ann b3d33cc852 Fix enter key behaviour in the editor when not using Firefox 2021-10-12 00:09:02 -04:00
Gnome Ann e69e15bec7 Move using_webkit_patch to earlier in the code
I don't know it this or help or not but I hope it does.
2021-09-30 22:58:54 -04:00
Gnome Ann d7893a0b52 Check for WebKit after connecting to the server
For some reason the original way only works in Safari after pressing the
refresh button. It did not work if you typed the URL into the address
bar in Safari without refreshing afterwards.
2021-09-30 19:00:15 -04:00
Gnome Ann 00c1f49ca1 Fix slow typing speed on mobile devices 2021-09-30 17:52:35 -04:00
Gnome Ann a923b3bfa7 Safari compatibility
Only tested on macOS so far, not iOS.
2021-09-30 14:13:54 -04:00
Gnome Ann e325197748 Fix for submitting memory/AN when memory is empty 2021-09-30 10:57:29 -04:00
Gnome Ann 9ab1d182ac Guard against empty prompts 2021-09-28 19:48:43 -04:00
Gnome Ann 4961273a26 Don't scroll to the bottom of screen when exiting world info
One of my earlier commits apparently removed the need for this.
2021-09-28 19:03:43 -04:00
Gnome Ann 8447ec44ab Fix world info screen and bump application.js version 2021-09-28 19:00:23 -04:00
Gnome Ann 231290608d Do a better job of preventing editing of text when required 2021-09-28 00:48:37 -04:00
Gnome Ann f632ad9880 Use a more robust scheme for restorePrompt
The original way didn't work properly in Firefox on Android when you
select all text and replace it with something else.
2021-09-27 23:38:41 -04:00
Gnome Ann e8cefcc2c6 (Firefox) Fix certain chunks not updating when editing
I don't know why Firefox is so weird but we need to do this or else
some chunks don't update properly when you edit multiple chunks at the
same time.

One example of when this happened is when you have a story with at least
one chunk other than the prompt. Then, if you select the entire story
except for the first few characters of the prompt and then delete the
selected characters, and then defocus the story to save your changes,
the last chunk in the story will not register as having been deleted,
which you can verify if you refresh the page.

Another example. If your story has a chunk with no trailing newlines
followed by a chunk with exactly two leading newlines, if you delete
the first newline from the latter chunk and then defocus to save your
edits, the newline will be there again when you refresh the page.
2021-09-27 23:10:34 -04:00
Gnome Ann 3297c27fcd Fix using escape to save edits 2021-09-27 22:56:12 -04:00
Gnome Ann b39f12b60b Remove unneeded console.log() 2021-09-27 22:47:27 -04:00
Gnome Ann cc207109bc Merge branch 'main' into editor 2021-09-27 22:46:05 -04:00
henk717 431acce0bb
Remove unneeded scrollbars
There was an unneeded scrollbar growing as you were expanding towards the top of the screen, now this scrollbar is hidden until you actually need it making the UI look a bit more polished.
2021-09-28 04:44:17 +02:00
Gnome Ann 13b81c7523 Prevent the user from deleting the prompt 2021-09-27 22:21:14 -04:00
Gnome Ann fff095b496 Stop all animations before performing scroll-to-bottom
So that if the animation is triggered multiple times you don't have to
wait for all the animations to be performed one after the other before
you can finally manually scroll.
2021-09-27 18:10:33 -04:00
Gnome Ann 09d540b580 Prevent editing the "Welcome to KoboldAI!" message 2021-09-27 17:55:54 -04:00
Gnome Ann a327eed2c3 Fix editor scrolling issues 2021-09-27 17:44:22 -04:00
Gnome Ann 47c6f48e94 Move padding and overflow-y from #gamescreen to #gametext
For stories that are long enough for the scroll bar to appear on the
screen, Firefox on desktop would originally only allow you to start
editing if you click on the actual text, i.e. you couldn't click on the
blank part of a line. This behaviour is now fixed.
2021-09-27 16:37:38 -04:00
Gnome Ann 25758dc3ab Fix event handler for clicking on story text
It wouldn't trigger any events originally when you click on parts of the
story text area that didn't contain any text, e.g. on a blank line or on
the blank part of a line to the right of the actual text.
2021-09-27 16:33:24 -04:00
Gnome Ann 5f154b8b55 Replace all references to #gametext with game_text
Come to think of it, I'm not sure where the variable "gametext" was even
defined. Is this some kind of sorcery?
2021-09-27 16:04:42 -04:00
Gnome Ann 3b19d4518a Remove "Desktop only" from application.js comments 2021-09-27 15:57:07 -04:00
Gnome Ann c3781e0e2f Rewrite the code for the editor for better browser compat
Does not work well on mobile. That's on my to-do list, don't you worry!
2021-09-27 13:11:15 -04:00
Gnome Ann e953f2d75e Use 3-space indentation instead of 4 in downloaded JSON
This is to match the indentation style of the JSON files created by
aiserver.py which apparently use 3 space indentation...
2021-09-19 23:48:04 -04:00
Gnome Ann dff5a4e754 More missing semicolons... 2021-09-19 17:16:01 -04:00
Gnome Ann 42ecd6d2d1 Fix missing semicolon 2021-09-19 11:59:31 -04:00
Gnome Ann b5883148a5 Download Story as JSON/Plaintext no longer requires server 2021-09-19 11:41:37 -04:00
henk717 9ddab39266 Make pin more visible
If its invisible then it will be harder for new players to know its there. Now its less visible when its not selected, a little more visible when the box is selected, and fully visible when your hovering over.
2021-09-08 15:11:28 +02:00
Gnome Ann 34af94d760 Fix deselected stories in Load dialog not un-highlighting 2021-09-01 14:21:07 -04:00
Gnome Ann 7e896c98fe Move #newsavename keydown event handler 2021-09-01 14:12:12 -04:00
Gnome Ann f1633d3e5c Prevent scope leakage of some variables in application.js 2021-09-01 14:01:04 -04:00
Gnome Ann 543acf9ba4 Also allow downloading stories as plaintext 2021-09-01 13:46:37 -04:00
Gnome Ann 25bb6486eb Add an option under "Save" to download story (as JSON) 2021-09-01 13:32:11 -04:00
Gnome Ann cb446d2113 Copy the event handlers from "Save As" to the Rename dialog 2021-09-01 13:10:21 -04:00
Gnome Ann 556835cd34 Move some of the delete/rename dialog event handlers 2021-09-01 13:05:24 -04:00
Gnome Ann c276220a35 Allow deleting and renaming stories in the browser 2021-08-31 18:22:30 -04:00
Gnome Ann db284b2367 Add Open Font License to Open Iconic's CSS file 2021-08-31 16:03:11 -04:00
Gnome Ann 0fbf620f22 Added scroll-to-bottom for closing genseqs/W Info
Scroll time is halved now also.
2021-08-26 15:15:42 -04:00
Gnome Ann d7605a717b Merge branch 'united' into big-o
This resolves two merge conflicts that arose because this branch was
a few commits behind.
2021-08-26 01:37:40 -04:00
Gnome Ann 6a0299837c Make the green editing flash !important 2021-08-26 01:22:07 -04:00
Gnome Ann 8fd8612cca Adventure mode colouring now controlled by a CSS class
So that we can just toggle the class instead of having aiserver.py send
back the entire story.
2021-08-26 01:06:57 -04:00
henk717 bbd5bd0cd7
Merge pull request #8 from VE-FORBRYDERNE/misc
General usability fixes
2021-08-26 01:56:42 +02:00
Gnome Ann 796f5ffd05 Make vars.actions a dictionary instead of a list 2021-08-25 19:28:26 -04:00
Gnome Ann 5604d7f317 Replace non-breaking spaces with regular spaces 2021-08-25 19:25:57 -04:00
Gnome Ann 5603bf0584 Hide messages on updatechunk and removechunk 2021-08-25 19:22:35 -04:00
Gnome Ann cf677c60fc Stability fixes for back/retry re genseqs/useprompt
* Back and Retry buttons no longer pop a story chunk while in the
  "Select sequence to keep" menu
* No longer freezes if you retry with no story chunks beyond the initial
  prompt chunk
* When "Always Add Prompt" is on, allow Retry even if the prompt is the
  only chunk in the story
* Added error messages for Back and Retry buttons
2021-08-25 14:42:37 -04:00
Gnome Ann b52f782d92 Disable post-edit blurring and the curtain
Because we don't need them anymore.
This, combined with the chunk optimization, will allow you to
seamlessly continue editing a different chunk after you've finished
editing your current one; e.g. if you edit a chunk and use arrow keys,
backspace or the mouse to select a different chunk, you can immediately
start editing your new chunk without it defocusing.

This patch really has killed two birds with one stone, eh?
Thanks, Javalar!
2021-08-25 01:21:01 -04:00
Gnome Ann b1c6aee8d3 Integrate inline chunk editor and Adventure mode with Javalar's branch 2021-08-24 19:02:52 -04:00
Gnome Ann 62ad2f0228 Code indentation consistency 2021-08-24 18:32:48 -04:00
Gnome Ann 6d5845ff8d Merge https://github.com/KoboldAI/KoboldAI-Client/pull/45 into big-o 2021-08-24 17:27:50 -04:00
Gnome Ann 2a7c6244cb Constant world info keys 2021-08-24 13:45:20 -04:00
Gnome Ann ce59c9d399 Fix left/right arrow key bug
This happens when you have a chunk that has no trailing
newlines followed by a chunk with a single newline at the start.
Moving between those chunks would cause the caret to jump to the wrong
position sometimes.
2021-08-24 13:32:29 -04:00
Gnome Ann 90e558cf3f Won't freeze anymore if you delete the prompt 2021-08-24 11:24:29 -04:00
Gnome Ann 7059c18f70 Prevent current_editing_chunk from being a non-chunk element 2021-08-24 11:14:18 -04:00
henk717 f0962155b8
Merge pull request #5 from VE-FORBRYDERNE/editable-chunks
Scroll down on submit
2021-08-24 01:22:57 +02:00
Gnome Ann 13ce16b859 Scroll down on submit 2021-08-23 19:19:36 -04:00
henk717 c108e080bf Various Fixes
Various Fixes, mostly to make the UI play a little nicer in the new edit mode. Also reverted and optimized some of the setting stuff.
2021-08-24 01:18:09 +02:00
Gnome Ann 3bf467e63c Added dedicated inline editing commands to aiserver.py
It's a lot faster now.
2021-08-23 18:52:45 -04:00
Gnome Ann a907c0a554 Prevent aiserver.py from rarely editing the wrong chunk 2021-08-23 18:26:38 -04:00
Gnome Ann 7ce5b120a0 Also allow backspacing into another chunk
It will still defocus the chunk almost immediately though,
this needs to be fixed later
2021-08-23 18:11:03 -04:00
Gnome Ann 3c9f6963b8 Allow using left and right arrow keys to move between chunks 2021-08-23 18:00:35 -04:00
Gnome Ann 85151cec7b Prevent white border on chunks with Allow Edit off 2021-08-23 14:53:18 -04:00
Gnome Ann 81c83dfef7 Fix bug where chunks still editable with Allow Editing off
If, with Allow Editing on, you change a chunk and then click directly on
the "Allow Editing" switch again to turn it off without defocusing the
chunk in-between (by clicking outside the chunk, using enter/escape,
etc), all story chunks would still be editable.
That behaviour has now been fixed.
2021-08-23 14:25:40 -04:00
Gnome Ann 723e02d793 Improve story chunk blurring 2021-08-23 14:05:40 -04:00
Gnome Ann 2071daf335 Remove the Delete button 2021-08-23 13:22:50 -04:00
Gnome Ann f1f50e7b80 Remove display: flex; from #gamescreen CSS 2021-08-23 13:08:13 -04:00
Gnome Ann 42b4104d4f Use henk717's modified CSS for editable chunks 2021-08-23 13:06:27 -04:00
Gnome Ann 67521d53f9 You can now click on story chunks to edit them 2021-08-23 02:34:27 -04:00
henk717 136dd71171 Added --remote Mode
First step towards native Colab support, built in Cloudflare tunnels easily allows players to play KoboldAI on another device. This mode also removes buttons that would get you stuck if you have no local PC access.
2021-08-20 00:37:59 +02:00
henk717 72bfc417da top_k and tfs support by Frogging101
Adds top_k and tfs support, also fixes a SocketIO error.
2021-08-19 14:47:57 +02:00
henk717 33215a87b3 Added VE_FORBRYDERNE's Selective World Info
This update allows you to selectively choose when World Info is loaded for more control and RAM savings.
2021-08-19 13:48:33 +02:00
henk717 00414d26e2 Integrated VE_FORBRYDERNE's Adventure Mode + Cleanup
Adventure Mode allows you to play this like AID, perfect for Choose your own Adventure models
2021-08-19 13:18:01 +02:00
henk717 efbe40f1f6 Random Story Generator
Add the Random Story Generator and more userfriendly defaults
2021-08-19 12:54:44 +02:00
Javalar 9559347f82
Update or remove targeted chunks in Game Screen (#2) 2021-06-15 00:59:08 -04:00
Ralf 6f5c194297 Moved files from cdn to static directory 2021-05-31 16:30:40 +02:00
KoboldAI Dev bed1eba6eb Added option to generate multiple responses per action.
Added ability to import World Info files from AI Dungeon.
Added slider for setting World Info scan depth.
Added toggle to control whether prompt is submitted each action.
Added 'Read Only' mode with no AI to startup.
Fixed GPU/CPU choice prompt appearing when GPU isn't an option.
Added error handling to generator calls for CUDA OOM message
Added generator parameter to only return new text
2021-05-29 05:46:03 -04:00
KoboldAI Dev 2cc48e7163 Bugfix for Author's Note Depth slider not doing anything. 2021-05-22 22:06:10 -04:00
KoboldAI Dev f9bbb174a6 Added OpenAI API support
Added in-browser Save/Load/New Story controls
(Force a full refresh in your browser!)
Fixed adding InferKit API key if client.settings already exists
Added cmd calls to bat files so they'll stay open on error
Wait animation now hidden on start state/restart
2021-05-22 05:28:40 -04:00
KoboldAI Dev 643e0105d8 Menu bar will now collapse to expandable button when screen size is too thin. 2021-05-17 00:42:47 -04:00
KoboldAI Dev b05a73a04f Added ability to import aidg.club scenarios
Changed menu bar to bootstrap navbar to allow for dropdown menus
2021-05-16 05:29:39 -04:00
KoboldAI Dev 429c9b13f5 Bug fixes for AIDCAT import issues.
Modified CSS to prevent Import dialog from expanding off the page.
Updated readme with Colab link.
2021-05-14 16:27:47 -04:00
KoboldAI Dev c0736a8ec7 Added World Info
Added additional punctuation triggers for Add Sentence Spacing format
Added better screen reset logic when refresing screen or restarting server
2021-05-13 01:26:42 -04:00
KoboldAI Dev 1cc069a779 Added ability to import AIDungeon games from AIDCAT 2021-05-11 00:27:34 -04:00
KoboldAI Dev b55266a7c8 Added Formatting options
Added Bootstrap toggle library for UI
Added injection points for input/output modification
2021-05-10 19:17:10 -04:00
KoboldAI Dev d632976fbf Settings menu modularized.
Help text added to settings items.
Settings now saved to client file when changed.
Separated transformers settings and InferKit settings.
Reorganized model select list.
2021-05-07 14:32:10 -04:00
KoboldAI Dev 229b10cb91 Added support for Author's Note
Increased input textarea height
Removed generator options from save/load system
Set output length slider to use steps of 2
2021-05-05 03:04:06 -04:00
KoboldAI Dev 6e54f654d6 Added settings menu to adjust generator parameters from game UI
Fixed text scrolling when content exceeded game screen height
2021-05-04 09:56:48 -04:00
KoboldAI b6fa94da90
Initial Upload 2021-05-02 18:48:47 -04:00
KoboldAI 9cfeded178
Initial Upload 2021-05-02 18:48:24 -04:00