Commit Graph

59 Commits

Author SHA1 Message Date
Gnome Ann
20e48b11d7 Typical sampling 2022-03-27 16:25:50 -04:00
Gnome Ann
3f18888eec Repetition penalty slope and range 2022-01-24 15:30:38 -05:00
Gnome Ann
82455e310b Modify Lua warn() function to support @on and @off 2022-01-21 01:28:26 -05:00
Gnome Ann
44d49ed0b2 Lua require function will now display errors properly 2022-01-21 00:56:25 -05:00
Gnome Ann
293b75e89f Add an API_VERSION variable to Lua bridge 2022-01-17 14:28:08 -05:00
Gnome Ann
a4e8f0780c Fix a typo in bridge.lua 2022-01-17 10:48:53 -05:00
Gnome Ann
f4eb896a69 Use original TPU backend if possible 2022-01-15 23:31:07 -05:00
Gnome Ann
fbf5062074 Add option to compute_context() to not scan story 2022-01-04 19:26:59 -05:00
Gnome Ann
6db01ea5fe Fix __len metamethod of KoboldWorldInfoFolderSelector 2022-01-01 12:33:02 -05:00
Gnome Ann
3a243f9eed Passthrough userscript loading errors 2021-12-31 22:02:24 -05:00
Gnome Ann
ccfafe4f0a Lua API fixes for deleting/editing story chunks 2021-12-31 18:28:03 -05:00
Gnome Ann
a580f18a14 Override the __close metamethod of FILE* objects
This enables the use of a Lua 5.4 feature where you can have Lua
auto-close a file when exiting a block. For example:

```
do
    local f <close> = kobold.get_config_file()
end
```

If we exit from the `do` block under any circumstances, including via an
error or return statement, the `FILE*` `f` automatically closes right
before that happens.
2021-12-31 16:56:44 -05:00
Gnome Ann
7645db9dd4 Use set lookup for sandbox_require_builtins instead of iteration 2021-12-30 01:45:14 -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
35539a8785 Allow require() in userscripts to import built-in modules 2021-12-29 13:47:03 -05:00
Gnome Ann
6aa2f50045 Add chatmode and chatname fields in bridge.lua 2021-12-26 19:07:44 -05:00
Gnome Ann
6183ecd669 Fix io-related security issues in Lua sandbox
* `io.lines` with a string as first argument is now disallowed because
  it reads a file given a filename
* `io.input` and `io.output` no longer permit having a string as first
  argument because that would allow access to local files
2021-12-26 14:23:56 -05:00
Gnome Ann
32a0d7c453 More Lua API fixes
* Removed `vars.model_orig`
* `requirex()` in bridge.lua now maintains a separate module cache for each
  userscript instead of using the same cache for all userscripts
* `vars.lua_deleted` and `vars.lua_edited` are now erased right before running
  the input modifiers instead of right before each time the generation modifiers
  are run
2021-12-26 12:49:28 -05:00
Gnome Ann
b2def30d9d Update Lua modeltype and model API 2021-12-23 16:35:52 -05:00
Gnome Ann
1e1b45d47a Add support for multiple library paths in bridge.lua 2021-12-22 14:24:31 -05:00
Gnome Ann
175416c1ba Use table.pack in bridge.lua metawrapper newindex metamethod 2021-12-22 12:06:22 -05:00
Gnome Ann
bc26b7c7af Correct some type annotations in bridge.lua 2021-12-22 12:05:59 -05:00
Gnome Ann
988a68e237 Use local variables as much as possible in bridge.lua 2021-12-22 11:47:47 -05:00
Gnome Ann
d538782b1e Add individual configuration files for userscripts 2021-12-22 02:59:31 -05:00
Gnome Ann
8c63f7c034 Change |nil in Lua type annotations to ? 2021-12-21 23:43:56 -05:00
Gnome Ann
7dd319491d Fix compute_context() method of world info folders 2021-12-19 20:46:37 -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
769333738d Fix behaviour of kobold.outputs with read-only and no prompt gen 2021-12-17 12:59:01 -05:00
henk717
d15b43e20e Not always a list of strings
kobold.outputs must be a 1D list of strings, but sometimes its still blank. In those cases rather than throwing an error and crashing the scripting its better if it does nothing.
2021-12-16 12:54:10 +01:00
Gnome Ann
6e6e0b2b4d Allow Lua to stop generation from input modifier 2021-12-13 19:32:01 -05:00
Gnome Ann
338d437ea3 Use eventlet instead of gevent-websocket 2021-12-13 17:19:04 -05:00
Gnome Ann
ed9c2a4d52 Fix a bug that occurs when userscript doesn't have all 3 modifiers 2021-12-13 11:50:10 -05:00
Gnome Ann
11f9866dbe Enable more of the IO library in Lua sandbox
Also changes the Lua warning color to red.
2021-12-13 11:22:58 -05:00
Gnome Ann
82e149ee02 Catch Lua errors properly 2021-12-13 02:32:09 -05:00
Gnome Ann
5f06d20085 Format Lua printed messages and warnings 2021-12-13 01:59:53 -05:00
Gnome Ann
b99e9f1292 Don't wrap koboldbridge in bridge.lua 2021-12-13 01:06:05 -05:00
Gnome Ann
d2f5544468 Add Userscripts menu into GUI 2021-12-13 01:03:26 -05:00
Gnome Ann
39bfb0862a Allow user input to be modified from Lua
Also adds some handlers in the Lua code for when the game is not started
yet
2021-12-12 20:44:03 -05:00
Gnome Ann
fbf3e7615b Add API for generated tokens and output text 2021-12-12 19:27:20 -05:00
Gnome Ann
ceabd2ef7b Add Lua API for editing logits during generation
TPU backend not supported yet.
2021-12-12 16:18:45 -05:00
Gnome Ann
e2c3ac041b Complete the Lua generation halting API 2021-12-12 12:52:03 -05:00
Gnome Ann
e06861bb0b Rename v to wrapped_func in metawrapper.__newindex() 2021-12-12 12:20:01 -05:00
Gnome Ann
d76dd35791 Add Lua API for reading model information 2021-12-12 12:09:59 -05:00
Gnome Ann
09df371d99 Handle nested wrapped functions in bridge.lua properly 2021-12-12 11:30:04 -05:00
Gnome Ann
00eb125ad0 Allow Lua API to toggle dynamic scan 2021-12-12 01:55:46 -05:00
Gnome Ann
5692a7dfe2 Add Lua API for reading the text the user submitted to the AI 2021-12-12 01:52:42 -05:00
Gnome Ann
2a752c073e Changing story chunks in Lua API should require regeneration 2021-12-12 01:43:40 -05:00
Gnome Ann
3b87c58de9 Make KoboldStory iterators methods instead of static functions 2021-12-12 01:33:49 -05:00
Gnome Ann
36209bfe69 Add Lua API for story chunks 2021-12-11 23:44:07 -05:00