SimpleChat:SC: Ensure proper clearing/reseting
previous logic would have cleared/reset the xchat, without doing the same wrt iLastSys, thus leading to it pointing to a now non existent role-content entry. So if a user set a system prompt and used completion mode, it would have done the half stupid clear, after the model response was got. Inturn when user tries to send a new completion query, it would inturn lead to handle_user_submit trying to add/update system prompt if any, which will fail, bcas iLastSys will be still pointing to a non existant entry. This is fixed now, by having a proper clear helper wrt SC class.
This commit is contained in:
parent
7a0a42367f
commit
fe60655e1f
1 changed files with 6 additions and 1 deletions
|
@ -35,6 +35,11 @@ class SimpleChat {
|
|||
this.iLastSys = -1;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.xchat = [];
|
||||
this.iLastSys = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an entry into xchat
|
||||
* @param {string} role
|
||||
|
@ -397,7 +402,7 @@ class MultiChatUI {
|
|||
// in a completion mode with multiple user-assistant chat data
|
||||
// from before to be sent/occur once.
|
||||
if ((apiEP == ApiEP.Completion) && (gbCompletionFreshChatAlways)) {
|
||||
chat.xchat.length = 0;
|
||||
chat.clear();
|
||||
}
|
||||
this.ui_reset_userinput();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue