Commit Graph

240 Commits

Author SHA1 Message Date
Cohee
238b667262 Merge branch 'staging' of https://github.com/SillyLossy/TavernAI into staging 2023-08-14 22:19:17 +03:00
Cohee
3850e6b50a Replace object stores for Chroma and token cache 2023-08-14 22:19:14 +03:00
maver
033dc45ab9 Move quick edit ui identifiers into configuration 2023-08-14 20:29:01 +02:00
maver
9543f54f8c Fix user jb/main not replacing original placeholder in character main/jb 2023-08-14 20:28:54 +02:00
Cohee
edcce96a6e IndexedDB open sometime hangs forever 2023-08-14 19:40:31 +03:00
Cohee
d395d3d8e6 Add peek proxy password btn 2023-08-14 12:01:06 +03:00
Cohee
6da3453efc Fix example dialogue syntax 2023-08-14 11:52:58 +03:00
Cohee
e6bf870c55 Persist token cache to indexedDb 2023-08-13 22:45:27 +03:00
maver
0f897158b9 Create a deep clone of the preset before applying
Prevents non-primitives from causing overlapping references
2023-08-12 19:40:01 +02:00
maver
f5aa7f7970 Remove obsolete prompt manager settings object 2023-08-12 18:52:52 +02:00
maver
03b8bb64fa Prevent new example chat message being added for no reason 2023-08-12 18:40:39 +02:00
maver
a9fa42524d Fix prompts object reference being shared
By deepcloning a copy
2023-08-12 18:40:39 +02:00
maver
f2c4645207 Use chatcompletion log function for token budget 2023-08-12 18:40:39 +02:00
maver
19e5502555 Remove obsolete assignment 2023-08-12 18:40:39 +02:00
maver
b1254fa2ab Copy migrated preset into loaded presets
Since this only is populated once during page load
2023-08-12 18:40:39 +02:00
maver
5a92f72703 Add flag to preset saving, allowing to prevent triggering the UI 2023-08-12 18:40:39 +02:00
maver
46c7e63fad Remove obsolete debugging output 2023-08-12 18:40:39 +02:00
maver
cdfe3a6841 Fix user messages not being added when populating example dialogue 2023-08-12 18:40:39 +02:00
maver
a8ee723853 Always add impersonate prompt last 2023-08-12 18:40:39 +02:00
Cohee
dd89009ecd Use tokenizer-specific token cache 2023-08-12 18:40:39 +02:00
maver
2805a684a8 Emit events on changing chatcompletion source or model 2023-08-12 18:40:39 +02:00
maver
d82ea66664 Refactor addItem method of MessageCollection 2023-08-12 18:40:39 +02:00
maver
4100ae9e0b Do not insert authors note into main
Since it is already present in the chat history
2023-08-12 18:40:39 +02:00
maver
d2ee6e9a12 Append quietPrompt last 2023-08-12 18:40:39 +02:00
Cohee
463f01d2a6 #870 Fix Claude in prompt manager 2023-08-12 18:40:39 +02:00
Cohee
29552ecfcf Sanitize completion names. Only send names in msg texts if names in completion is disabled 2023-08-12 18:40:39 +02:00
maver
1b7a1cbc4a Add quick edit drawer and fields for main and jailbreak 2023-08-12 18:40:39 +02:00
maver
38bfcf5324 Remove advanced options toggle 2023-08-12 18:40:39 +02:00
maver
222fd3429d Center globe icon 2023-08-12 18:40:39 +02:00
maver
bc4befeb22 Rename prompt lists to prompt order
Includes renaming of configuration, no functional changes
2023-08-12 18:40:39 +02:00
maver
63d224d8af Refactor and simplify setup method for prompt manager. 2023-08-12 18:40:39 +02:00
maver
ad6575887a Remove obsolete function getGroupMembers 2023-08-12 18:40:39 +02:00
maver
b58ce0370d Refactor token counting after completion. Simplify code. 2023-08-12 18:40:39 +02:00
maver
57fd04b974 Refactor token counting after completion. Simplify code. 2023-08-12 18:40:39 +02:00
maver
dfd49813af Refactor naming scheme for default promptmanager defaults 2023-08-12 18:40:39 +02:00
maver
9d6cf017d2 Move main and jailbreak override from manager into openai script.
Makes the code clearer and easier to understand
2023-08-12 18:40:39 +02:00
maver
075c0c29f0 Refactor prepareOpenAiMessages, move prompt preparation in its own function 2023-08-12 18:40:39 +02:00
maver
7ea6e89b05 Add reset prompt support for enhance definitions 2023-08-12 18:40:39 +02:00
maver
b2acc9eb0f Refactor documentation and make code more readable
No functional changes
2023-08-12 18:40:39 +02:00
maver
19ee831d82 Prevent prompt manager initialization more than once 2023-08-12 18:40:39 +02:00
maver
76154fd8ee Fix authors note position not being considered 2023-08-12 18:40:39 +02:00
maver
41aae57f05 Do not send empty scenario and personality prompts 2023-08-12 18:40:39 +02:00
maver
6a52d6febd Fix invalid character name error not being handled 2023-08-12 18:40:39 +02:00
maver
4dd94a4a62 Do not generate group responses on dry run 2023-08-12 18:40:39 +02:00
maver
a706ecd48c Add charIfNotGroup placeholder to default main prompt 2023-08-12 18:40:39 +02:00
maver
cf305c0395 Do not attempt a dryrun if no character has been selected 2023-08-12 18:40:39 +02:00
maver
82a11316bc Add continue nudge to editable utility prompts 2023-08-12 18:40:39 +02:00
maver
0e4ce734ad Fix continue functionality not working as expected 2023-08-12 18:40:39 +02:00
maver
f4cfa8ba94 Remove obsolete logs and improve documentation 2023-08-12 18:40:39 +02:00
maver
f2227ded9a Move utility prompts in its own, independent dropdown
And merge with existing advanced prompt bits
2023-08-12 18:40:38 +02:00
maver
9669199408 Allow user to edit new chat, new group chat and new example chat prompts 2023-08-12 18:40:38 +02:00
maver
2ed1cee82e Fill tokenizer legacy counts where possible. 2023-08-12 18:40:38 +02:00
maver
9784950c54 Add documentation for chat completion
And dependant classes
2023-08-12 18:40:38 +02:00
maver
74a7aa513b Reintroduce event types after rebase 2023-08-12 18:40:38 +02:00
maver
d70ecbdcd9 Add support for cycle prompt 2023-08-12 18:40:38 +02:00
maver
e93424b2cf Don't use debounce for prompt manager save settings function 2023-08-12 18:40:38 +02:00
maver
ce8a71cf53 Add error handling to openai message counting 2023-08-12 18:40:38 +02:00
maver
4509df0fd9 Add support for empty prompt replacement 2023-08-12 18:40:38 +02:00
maver
632fa770be Create a deep copy of prompt defaults on char select
Along other minor fixes and optimizations
2023-08-12 18:40:38 +02:00
maver
85c4b6fad3 Improve error messages 2023-08-12 18:40:38 +02:00
maver
a0bd67e455 Allow markers to inspected for their content 2023-08-12 18:40:38 +02:00
maver
2452b37e28 Add fallback for empty dialogue example prompts 2023-08-12 18:40:38 +02:00
maver
2fc3577431 Throw a recoverable error on invalid character naming 2023-08-12 18:40:38 +02:00
maver
1b7da6ecbc Remove faulty characters in default configuration 2023-08-12 18:40:38 +02:00
maver
e908610b99 Save prompt manager items to perset 2023-08-12 18:40:38 +02:00
maver
6cea524f2c Fix prompt-manager being rendered twice. 2023-08-12 18:40:38 +02:00
maver
bf0dc07b1f Improve in-code documentation 2023-08-12 18:40:38 +02:00
maver
d0aba85692 Add support for persona description positioning 2023-08-12 18:40:38 +02:00
maver
221ecbf8d6 Add reset for main,nsfw and jailbreak prompts 2023-08-12 18:40:38 +02:00
maver
9cf41a6a52 Remove doubled initialization of prompt manager 2023-08-12 18:40:38 +02:00
maver
7c1e370abe Allow the user to toggle names in chat history 2023-08-12 18:40:38 +02:00
maver
25eef5d100 Pass nsfwAvoidance message instead of prompt
Fixing invalid argument exception being thrown
2023-08-12 18:40:38 +02:00
maver
f207e0eab3 Add basic WindowAI support 2023-08-12 18:40:38 +02:00
maver
5c18abadac Pass chat message name to chatcompletion endpoint 2023-08-12 18:40:38 +02:00
maver
aaa2c48e7d Add basic claude support 2023-08-12 18:40:38 +02:00
maver
28fa2f5f57 Render prompt manager after swiping with updated tokens
Including world info and extension prompts
2023-08-12 18:40:38 +02:00
maver
2f4424e6c6 Declare prepareOpenAIMessages as synchronous
As there is no need for the function o be async anymore.
2023-08-12 18:40:38 +02:00
maver
6e37db2fb3 Declare prepareOpenAIMessages as synchronous
As there is no need for the function o be async anymore.
2023-08-12 18:40:38 +02:00
maver
6c25211f0a Support original-placeholder 2023-08-12 18:40:38 +02:00
maver
312b02c36e Do not count messages with empty prompts 2023-08-12 18:40:38 +02:00
maver
6617243f1b Add event system to openai script
Lost during rebasing
2023-08-12 18:40:38 +02:00
maver
be30fef700 Disable toggling of main prompt 2023-08-12 18:40:38 +02:00
maver
b8b3dd4caf Various improvements for stability and token counting. 2023-08-12 18:40:38 +02:00
maver
2c36fbdc1d Apply character specific prompt overrides
Jailbreak and main
2023-08-12 18:40:36 +02:00
maver
5afd60c578 Add dialogue examples first if user decides 2023-08-12 18:40:18 +02:00
maver
474571e17a Handle various error scenarios during token counting 2023-08-12 18:40:18 +02:00
maver
73e3001493 Refactor addMessageToChatCompletion 2023-08-12 18:40:18 +02:00
maver
5270d261aa Add memory and authors note to chat completion 2023-08-12 18:40:18 +02:00
maver
bf5404f6ce Add enhanced definitions 2023-08-12 18:40:18 +02:00
maver
21b37950e4 Fix chat completion not recognizing 0-position 2023-08-12 18:40:18 +02:00
maver
dd7f326460 Improve in-code documentation 2023-08-12 18:40:18 +02:00
maver
74a5167a0e Add nsfw avoidance prompt, quiet prompt and bias to chat completion 2023-08-12 18:40:18 +02:00
maver
37c7a82aba Respect impersonate option 2023-08-12 18:40:18 +02:00
maver
edba17c96e Add dialogue examples to chat completion 2023-08-12 18:40:18 +02:00
maver
8ae2c80358 Introduction of additional helper classes, refactoring 2023-08-12 18:40:18 +02:00
maver
18641ea3d2 Add prototype for prompt manager token management 2023-08-12 18:40:18 +02:00
maver
05f7e5677d Simplify example message handling 2023-08-12 18:40:18 +02:00
maver
77e183f5dd Add support for authors note and summary extensions 2023-08-12 18:40:18 +02:00
maver
a66041f503 Fix extension prompt being not parsed correctly 2023-08-12 18:40:18 +02:00
maver
64c04957c2 Enable TokenHandler to return total token count 2023-08-12 18:40:18 +02:00
maver
eb315993b4 Let prompt manager handle character and scenario prompts 2023-08-12 18:40:18 +02:00
maver
4d8d4cd262 Streamline token counting
By using TokenHandler instead of custom token handling
2023-08-12 18:40:18 +02:00
SillyLossy
14a66ec937 Don't duplicate start chat marker if character has no example dialogues 2023-08-12 18:40:18 +02:00
maver
dce91f8fad Send main prompt with group chat 2023-08-12 18:40:18 +02:00
maver
7411ca1154 Prevent duplicate messages
By removing obsolete example message assignments
2023-08-12 18:40:18 +02:00
maver
9a7bbd4ffb Add prompt manager support for group chats 2023-08-12 18:40:18 +02:00
maver
989f704605 Improve strength of main and impersonation prompt 2023-08-12 18:40:18 +02:00
maver
53fe7f1d94 Remove obsolete interface elements and handling
Jailbreak etc.
2023-08-12 18:40:18 +02:00
maver
720c9973ec Fix default prompts not being set correctly 2023-08-12 18:40:18 +02:00
maver
e47f436cf7 Add support for nsfw avoidance prompt 2023-08-12 18:40:17 +02:00
maver
f395c99a5d Remove obsolete default settings in prompt manager constructor 2023-08-12 18:40:17 +02:00
maver
a041230a99 Let oai prompt manager handle enhanced definitions 2023-08-12 18:40:17 +02:00
maver
b54bd36d65 Do not apped start new chat messages on example chat handling
The prompt manager does this job now.
2023-08-12 18:40:17 +02:00
maver
5a6340165c Never use token handler for openai
For now.
2023-08-12 18:40:17 +02:00
maver
0513d9c8c0 Simplify impersonate prompt handling 2023-08-12 18:40:17 +02:00
maver
42544e9d26 Fix quiet prompt functionality after rebasing 2023-08-12 18:40:17 +02:00
maver
6e1bb65437 Remove obsolete settings to update after change 2023-08-12 18:40:17 +02:00
maver
85d99335b9 Rework of prepareOpenAIMessages 2023-08-12 18:40:17 +02:00
maver
bc041d8fb3 Use saveSettings function instead of saveSettingsDebounced 2023-08-12 18:40:17 +02:00
maver
fff966fc9f Check oai settings for empty prompt manager configuration 2023-08-12 18:39:54 +02:00
maver
c9bc4e3353 Remove obsolete prompt related assignments 2023-08-12 18:39:54 +02:00
maver
e7cd203c19 Allow token counts to be cached when no character is selected 2023-08-12 18:39:54 +02:00
maver
ded29a225d Let prompt manager control messages sent to openai 2023-08-12 18:39:54 +02:00
maver
c6eee88cd4 Add prompt manager setup 2023-08-12 18:39:54 +02:00
maver
77cd51ccaa Add prompt manager configuration and default configuration 2023-08-12 18:39:54 +02:00
Cohee
f3cff9cd28 #917 Don't add a prefill for summarization 2023-08-11 17:23:03 +03:00
spacegeek69
4b48861d13 [OpenRouter] Switch to token per dollar for prices 2023-08-10 21:13:24 +02:00
Cohee
92666b18d4
Merge pull request #912 from spacegeek69/sg69-api-prices-fix
[OpenRouter] Show more API price information
2023-08-10 20:04:15 +03:00
Cohee
c6b18de4ef Currency formatting 2023-08-10 13:01:55 +03:00
Cohee
aa49efe656 More precise prompt costs 2023-08-10 12:58:21 +03:00
spacegeek69
f9db8eee67 [OpenRouter] Show API prices in list/description 2023-08-10 11:21:58 +02:00
Cohee
1f8f200caf #909 Add OpenRouter prompt cost calculation 2023-08-09 21:59:34 +03:00
Cohee
dddc49c235 #798 Claude assistant prefill 2023-07-30 01:51:59 +03:00
Cohee
3fb4756c03 #803 Add a separate field for proxy password 2023-07-28 21:33:29 +03:00
Cohee1207
01f1f67de3 Clean-up JB prompt of caret returns and dangling spaces 2023-07-22 16:50:34 +03:00
Cohee1207
bc6e46bac8 Code clean-up 2023-07-21 23:40:53 +03:00
Cohee1207
374e931b2e Don't revert OAI model to default 2023-07-21 23:40:12 +03:00
Cohee1207
f28e7cf47c Redirect to OpenAI site to view usage 2023-07-21 23:35:54 +03:00
Cohee
500eae40e2 Load external API models into OAI list 2023-07-21 13:35:39 +03:00
Cohee
edd41989fd Initial commit 2023-07-20 20:32:15 +03:00