feat: Alert user with fix options when chat fmIndex is out of range#1497
Open
sub-hub wants to merge 3 commits into
Open
feat: Alert user with fix options when chat fmIndex is out of range#1497sub-hub wants to merge 3 commits into
sub-hub wants to merge 3 commits into
Conversation
Collaborator
Author
|
Oh, and if fmindex is out of range and you want to switch to a different fm, simply pressing the right arrow key returns fmindex to the beginning. So I didn't change this behavior. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Images
Send a chat also works very well.
Summary
The first message index in the chat data is stored separately from the bot, so the first message index in the chat can be larger than the size of the first message the bot has when the chat put in to the another bot.
So places that use fmindex should have exceptions, but they don't have them now.
I Added
?? firstMessagefallback to allalternateGreetings[fmIndex]lookups across DefaultChatScreen, cbs.ts, index.svelte.ts, scripts.ts, and triggers.tsThe Popup
When
fmIndexgoes out of bounds, the user is shown a popup with two options:The popup check triggers in two scenarios:
fmIndexright before building the prompt. If out of bounds, the popup blocks sending until the user fixes it.chat index 0right after import. ForrisuAllChats, only the first item is checked, but since the validation repeats on send, this isn't a major issue.Concern
There are similar
fmIndexissues that were not fixed in this PR, as they are far removed from the original problem:HypaV3Modal/utils.ts— returnsnullinstead offirstMessagebranches.ts— uses?? 0instead of?? firstMessagecharacters.ts(exportChat HTML mode) — uses?? 0instead of?? firstMessageReproduction
{ "type": "risuChat", "ver": 2, "data": { "message": [], "note": "", "name": "New Chat 1", "localLore": [], "fmIndex": 999, "id": "eded059d-5f9e-49db-b51a-bd1228b2369d" }, "folders": [] }Try to import the above json into any bot. You will get an error if you try to send a chat.
Details
To be more specific, I have configured the bot to use the first fm if there is no data corresponding to fmindex.
This applies to the backend, frontend, cbs, triggers, and even @@repeat_back.
We must decide whether to use the first fm or the last fm when a value does not exist in the data using fmindex going forward.
If my approach (Use first fm) differs from yours, please let me know.
Footnotes
Modifies the behavior of prompting, requesting, or handling responses from AI models. ↩
Over 80% of the code is AI generated. ↩