commented out mock functions

This commit is contained in:
mic 2024-07-29 22:54:00 +02:00
parent 1cc1ea4a88
commit 5b4cd31152

View file

@ -23,19 +23,19 @@
import { OpenAI } from '../js/api/openai.js'; import { OpenAI } from '../js/api/openai.js';
//========================== for testing //========================== 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) { // function mockDelay(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); // return new Promise(resolve => setTimeout(resolve, ms));
} // }
async function processMockTokens() { // async function processMockTokens() {
for (const token of MOCK_TOKENS) { // for (const token of MOCK_TOKENS) {
await mockDelay(Math.random() * 50 + 50); // Random delay between 100ms and 150ms // await mockDelay(Math.random() * 50 + 50); // Random delay between 100ms and 150ms
postMessage({ type: 'newToken', payload: { token } }); // postMessage({ type: 'newToken', payload: { token } });
} // }
postMessage({ type: 'tokensDone' }); // postMessage({ type: 'tokensDone' });
} // }
//========================== for testing - END //========================== for testing - END