Speed Up Ai (#911)

fix: remove ai frontend throttling
This commit is contained in:
Sylvie Crowe 2024-09-30 22:14:30 -07:00 committed by GitHub
parent 23f6ab7c5e
commit 7df587d9a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,8 +41,6 @@ function promptToMsg(prompt: OpenAIPromptMessageType): ChatMessageType {
};
}
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
export class WaveAiModel implements ViewModel {
viewType: string;
blockId: string;
@ -102,14 +100,12 @@ export class WaveAiModel implements ViewModel {
// Add a typing indicator
set(this.addMessageAtom, typingMessage);
await sleep(1500);
const parts = userMessage.text.split(" ");
let currentPart = 0;
while (currentPart < parts.length) {
const part = parts[currentPart] + " ";
set(this.updateLastMessageAtom, part, true);
currentPart++;
await sleep(100);
}
set(this.updateLastMessageAtom, "", false);
});
@ -209,7 +205,6 @@ export class WaveAiModel implements ViewModel {
}
break;
}
await sleep(100);
}
globalStore.set(this.updateLastMessageAtom, "", false);
if (fullMsg != "") {