From 5b4cd3115232c424c4338896e33c2f56ca1efcd5 Mon Sep 17 00:00:00 2001 From: mic Date: Mon, 29 Jul 2024 22:54:00 +0200 Subject: [PATCH] commented out mock functions --- api_webchat/model-worker.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/api_webchat/model-worker.js b/api_webchat/model-worker.js index 6b716096..8bdb4866 100644 --- a/api_webchat/model-worker.js +++ b/api_webchat/model-worker.js @@ -23,19 +23,19 @@ import { OpenAI } from '../js/api/openai.js'; //========================== for testing -const MOCK_TOKENS = ['Good', ' morning', ' Mr', ' Plop', 'py', ',', 'and', ' I', ' said', '\n', '"', 'Good', ' morn', 'ing', ' Mrs',' Plop', 'py', ,'"', '\n', 'Oh', ' how', ' the', ' win', 'ter', ' even', 'ings', ' must', ' just', ' fly']; +// const MOCK_TOKENS = ['Good', ' morning', ' Mr', ' Plop', 'py', ',', 'and', ' I', ' said', '\n', '"', 'Good', ' morn', 'ing', ' Mrs',' Plop', 'py', ,'"', '\n', 'Oh', ' how', ' the', ' win', 'ter', ' even', 'ings', ' must', ' just', ' fly']; -function mockDelay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} +// function mockDelay(ms) { +// return new Promise(resolve => setTimeout(resolve, ms)); +// } -async function processMockTokens() { - for (const token of MOCK_TOKENS) { - await mockDelay(Math.random() * 50 + 50); // Random delay between 100ms and 150ms - postMessage({ type: 'newToken', payload: { token } }); - } - postMessage({ type: 'tokensDone' }); -} +// async function processMockTokens() { +// for (const token of MOCK_TOKENS) { +// await mockDelay(Math.random() * 50 + 50); // Random delay between 100ms and 150ms +// postMessage({ type: 'newToken', payload: { token } }); +// } +// postMessage({ type: 'tokensDone' }); +// } //========================== for testing - END