XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Delete index.js

e70097b6
H Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +0 -38
Deleted projects/text_to_speech/index.js +0 -38
@@ -1,38 +0,0 @@
1 const worker = {}
2 if (!worker.current) {
3 // Create the worker if it does not yet exist.
4 worker.current = new Worker(new URL('./worker.js', import.meta.url), {
5 type: 'module'
6 });
7 }
8
9 window.doSpeech = false;
10
11 const onMessageReceived = (e) => {
12 switch (e.data.status) {
13 case 'error':
14 window.onSpeechResponse(null);
15 window.doSpeech = false;
16 break;
17 case 'complete':
18 const blobUrl = URL.createObjectURL(e.data.output);
19 window.onSpeechResponse(blobUrl);
20 window.doSpeech = false;
21 break;
22 }
23 };
24 worker.current.addEventListener('message', onMessageReceived);
25
26 import { DEFAULT_SPEAKER, SPEAKERS } from './constants';
27
28 const handleGenerateSpeech = (text, speaker_id=DEFAULT_SPEAKER) => {
29 window.doSpeech = true;
30 worker.current.postMessage({
31 text,
32 speaker_id: speaker_id,
33 });
34 };
35
36 window.SPEAKERS = SPEAKERS;
37 window.handleGenerateSpeech = handleGenerateSpeech;
38 window.onSpeechResponse = (url) => console.log(url);