Skip to content

Commit 3dd9b4f

Browse files
pweglikMateusz Kopciński
authored andcommitted
fix: Prevent next forward calls when isGenerating=true (#371)
### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improves or adds clarity to existing documentation) ### Tested on - [ ] iOS - [ ] Android
1 parent 364db14 commit 3dd9b4f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/controllers/LLMController.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ export class LLMController {
145145
public delete() {
146146
if (this._isGenerating) {
147147
throw new Error(
148-
'Model is generating! You cannot delete the model now. You need to interrupt first.'
148+
getError(ETError.ModelGenerating) +
149+
'You cannot delete the model now. You need to interrupt first.'
149150
);
150151
}
151152
this.onToken?.remove();
@@ -159,6 +160,9 @@ export class LLMController {
159160
if (!this._isReady) {
160161
throw new Error(getError(ETError.ModuleNotLoaded));
161162
}
163+
if (this._isGenerating) {
164+
throw new Error(getError(ETError.ModelGenerating));
165+
}
162166
try {
163167
this.responseCallback('');
164168
this.isGeneratingCallback(true);

0 commit comments

Comments
 (0)