Commit Graph

108 Commits

Author SHA1 Message Date
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 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
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 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