@fugood/bricks-project 2.22.0-beta.8 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compile/action-name-map.ts +112 -1
- package/compile/index.ts +10 -1
- package/package.json +3 -3
- package/tools/postinstall.ts +16 -9
- package/types/animation.ts +2 -1
- package/types/brick-base.ts +79 -0
- package/types/bricks/3DViewer.ts +200 -0
- package/types/bricks/Camera.ts +195 -0
- package/types/bricks/Chart.ts +362 -0
- package/types/bricks/GenerativeMedia.ts +240 -0
- package/types/bricks/Icon.ts +93 -0
- package/types/bricks/Image.ts +104 -0
- package/types/bricks/Items.ts +461 -0
- package/types/bricks/Lottie.ts +159 -0
- package/types/bricks/QrCode.ts +112 -0
- package/types/bricks/Rect.ts +110 -0
- package/types/bricks/RichText.ts +123 -0
- package/types/bricks/Rive.ts +209 -0
- package/types/bricks/Slideshow.ts +155 -0
- package/types/bricks/Svg.ts +94 -0
- package/types/bricks/Text.ts +143 -0
- package/types/bricks/TextInput.ts +231 -0
- package/types/bricks/Video.ts +170 -0
- package/types/bricks/VideoStreaming.ts +107 -0
- package/types/bricks/WebRtcStream.ts +60 -0
- package/types/bricks/WebView.ts +157 -0
- package/types/bricks/index.ts +20 -0
- package/types/common.ts +8 -3
- package/types/data.ts +6 -0
- package/types/generators/AlarmClock.ts +102 -0
- package/types/generators/Assistant.ts +546 -0
- package/types/generators/BleCentral.ts +225 -0
- package/types/generators/BlePeripheral.ts +202 -0
- package/types/generators/CanvasMap.ts +57 -0
- package/types/generators/CastlesPay.ts +77 -0
- package/types/generators/DataBank.ts +123 -0
- package/types/generators/File.ts +351 -0
- package/types/generators/GraphQl.ts +124 -0
- package/types/generators/Http.ts +117 -0
- package/types/generators/HttpServer.ts +164 -0
- package/types/generators/Information.ts +97 -0
- package/types/generators/Intent.ts +107 -0
- package/types/generators/Iterator.ts +95 -0
- package/types/generators/Keyboard.ts +85 -0
- package/types/generators/LlmAnthropicCompat.ts +188 -0
- package/types/generators/LlmGgml.ts +719 -0
- package/types/generators/LlmOnnx.ts +184 -0
- package/types/generators/LlmOpenAiCompat.ts +206 -0
- package/types/generators/LlmQualcommAiEngine.ts +213 -0
- package/types/generators/Mcp.ts +294 -0
- package/types/generators/McpServer.ts +248 -0
- package/types/generators/MediaFlow.ts +142 -0
- package/types/generators/MqttBroker.ts +121 -0
- package/types/generators/MqttClient.ts +129 -0
- package/types/generators/Question.ts +395 -0
- package/types/generators/RealtimeTranscription.ts +180 -0
- package/types/generators/RerankerGgml.ts +153 -0
- package/types/generators/SerialPort.ts +141 -0
- package/types/generators/SoundPlayer.ts +86 -0
- package/types/generators/SoundRecorder.ts +113 -0
- package/types/generators/SpeechToTextGgml.ts +462 -0
- package/types/generators/SpeechToTextOnnx.ts +227 -0
- package/types/generators/SpeechToTextPlatform.ts +75 -0
- package/types/generators/SqLite.ts +118 -0
- package/types/generators/Step.ts +101 -0
- package/types/generators/TapToPayOnIPhone.ts +175 -0
- package/types/generators/Tcp.ts +120 -0
- package/types/generators/TcpServer.ts +137 -0
- package/types/generators/TextToSpeechGgml.ts +182 -0
- package/types/generators/TextToSpeechOnnx.ts +169 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
- package/types/generators/ThermalPrinter.ts +185 -0
- package/types/generators/Tick.ts +75 -0
- package/types/generators/Udp.ts +109 -0
- package/types/generators/VadGgml.ts +211 -0
- package/types/generators/VectorStore.ts +223 -0
- package/types/generators/Watchdog.ts +96 -0
- package/types/generators/WebCrawler.ts +97 -0
- package/types/generators/WebRtc.ts +165 -0
- package/types/generators/WebSocket.ts +142 -0
- package/types/generators/index.ts +51 -0
- package/types/system.ts +64 -0
- package/utils/data.ts +45 -0
- package/utils/event-props.ts +89 -0
- package/types/bricks.ts +0 -3168
- package/types/generators.ts +0 -7580
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Start TCP server */
|
|
13
|
+
export type GeneratorTCPServerActionStart = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_TCP_SERVER_START'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Send data to specify connection */
|
|
18
|
+
export type GeneratorTCPServerActionSend = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_TCP_SERVER_SEND'
|
|
20
|
+
params?: Array<
|
|
21
|
+
| {
|
|
22
|
+
input: 'remote'
|
|
23
|
+
value?: string | DataLink | EventProperty
|
|
24
|
+
mapping?: string
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
input: 'sendData'
|
|
28
|
+
value?: string | DataLink | EventProperty
|
|
29
|
+
mapping?: string
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* End specify connection */
|
|
35
|
+
export type GeneratorTCPServerActionEnd = ActionWithParams & {
|
|
36
|
+
__actionName: 'GENERATOR_TCP_SERVER_END'
|
|
37
|
+
params?: Array<
|
|
38
|
+
| {
|
|
39
|
+
input: 'remote'
|
|
40
|
+
value?: string | DataLink | EventProperty
|
|
41
|
+
mapping?: string
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
input: 'generatorTcpClientEndWithData'
|
|
45
|
+
value?: string | DataLink | EventProperty
|
|
46
|
+
mapping?: string
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Stop TCP server */
|
|
52
|
+
export type GeneratorTCPServerActionStop = Action & {
|
|
53
|
+
__actionName: 'GENERATOR_TCP_SERVER_STOP'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface GeneratorTCPServerDef {
|
|
57
|
+
/*
|
|
58
|
+
Default property:
|
|
59
|
+
{
|
|
60
|
+
"init": false,
|
|
61
|
+
"dataMode": "raw",
|
|
62
|
+
"encoding": "utf8",
|
|
63
|
+
"bufferSize": 1024,
|
|
64
|
+
"concurrent": 5,
|
|
65
|
+
"idleTimeout": 0
|
|
66
|
+
}
|
|
67
|
+
*/
|
|
68
|
+
property?: {
|
|
69
|
+
/* Start TCP server on generator initialized */
|
|
70
|
+
init?: boolean | DataLink
|
|
71
|
+
/* Bind port of TCP server */
|
|
72
|
+
port?: number | DataLink
|
|
73
|
+
/* Data mode
|
|
74
|
+
CRLF: Receive until CRLF
|
|
75
|
+
LF: Receive until LF
|
|
76
|
+
raw: Raw packet */
|
|
77
|
+
dataMode?: 'CRLF' | 'LF' | 'raw' | DataLink
|
|
78
|
+
/* Encoding of data */
|
|
79
|
+
encoding?: 'base64' | 'utf8' | 'ascii' | DataLink
|
|
80
|
+
/* Buffer size limit of receive plaintext line */
|
|
81
|
+
bufferSize?: number | DataLink
|
|
82
|
+
/* Max concurrent connection count */
|
|
83
|
+
concurrent?: number | DataLink
|
|
84
|
+
/* Max connection idle time, 0 is disable */
|
|
85
|
+
idleTimeout?: number | DataLink
|
|
86
|
+
/* Enable TLS */
|
|
87
|
+
tls?: boolean | DataLink
|
|
88
|
+
/* TLS key pair (Base64 encoded no password PKCS #12) */
|
|
89
|
+
tlsKeyPair?: string | DataLink
|
|
90
|
+
}
|
|
91
|
+
events?: {
|
|
92
|
+
/* Event of TCP server is ready */
|
|
93
|
+
onReady?: Array<EventAction>
|
|
94
|
+
/* Event of TCP server accept the connection */
|
|
95
|
+
onAcceptConnection?: Array<EventAction>
|
|
96
|
+
/* Event of receive data */
|
|
97
|
+
onData?: Array<EventAction>
|
|
98
|
+
/* Event of connection idle timeout */
|
|
99
|
+
onTimeout?: Array<EventAction>
|
|
100
|
+
/* Event of connection close */
|
|
101
|
+
onClose?: Array<EventAction>
|
|
102
|
+
/* Event of server or connection error */
|
|
103
|
+
onError?: Array<EventAction>
|
|
104
|
+
}
|
|
105
|
+
outlets?: {
|
|
106
|
+
/* Is server started */
|
|
107
|
+
started?: () => Data
|
|
108
|
+
/* Accepted connections */
|
|
109
|
+
connections?: () => Data
|
|
110
|
+
/* Last received data */
|
|
111
|
+
lastData?: () => Data
|
|
112
|
+
/* Error message */
|
|
113
|
+
errorMessage?: () => Data
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* TCP Server */
|
|
118
|
+
export type GeneratorTCPServer = Generator &
|
|
119
|
+
GeneratorTCPServerDef & {
|
|
120
|
+
templateKey: 'GENERATOR_TCP_SERVER'
|
|
121
|
+
switches: Array<
|
|
122
|
+
SwitchDef &
|
|
123
|
+
GeneratorTCPServerDef & {
|
|
124
|
+
conds?: Array<{
|
|
125
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
126
|
+
cond:
|
|
127
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
128
|
+
| SwitchCondData
|
|
129
|
+
| {
|
|
130
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
131
|
+
outlet: 'started' | 'connections' | 'lastData' | 'errorMessage'
|
|
132
|
+
value: any
|
|
133
|
+
}
|
|
134
|
+
}>
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Load the model */
|
|
13
|
+
export type GeneratorGGMLTTSActionLoadModel = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_GGML_TTS_LOAD_MODEL'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Generate audio */
|
|
18
|
+
export type GeneratorGGMLTTSActionGenerate = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_GGML_TTS_GENERATE'
|
|
20
|
+
params?: Array<{
|
|
21
|
+
input: 'text'
|
|
22
|
+
value?: string | DataLink | EventProperty
|
|
23
|
+
mapping?: string
|
|
24
|
+
}>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Clean cache */
|
|
28
|
+
export type GeneratorGGMLTTSActionCleanCache = Action & {
|
|
29
|
+
__actionName: 'GENERATOR_GGML_TTS_CLEAN_CACHE'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Release context */
|
|
33
|
+
export type GeneratorGGMLTTSActionReleaseContext = Action & {
|
|
34
|
+
__actionName: 'GENERATOR_GGML_TTS_RELEASE_CONTEXT'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Cancel current generation and clear queue */
|
|
38
|
+
export type GeneratorGGMLTTSActionCancel = Action & {
|
|
39
|
+
__actionName: 'GENERATOR_GGML_TTS_CANCEL'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface GeneratorGGMLTTSDef {
|
|
43
|
+
/*
|
|
44
|
+
Default property:
|
|
45
|
+
{
|
|
46
|
+
"vocoderUrl": "https://huggingface.co/ggml-org/WavTokenizer/resolve/main/WavTokenizer-Large-75-F16.gguf",
|
|
47
|
+
"vocoderHashType": "sha256",
|
|
48
|
+
"vocoderHash": "2356baa8631cc2995ea3465196a017a2733600d849a91180c0f97fa7fb375bbe",
|
|
49
|
+
"vocoderBatchSize": 4096,
|
|
50
|
+
"outputType": "play",
|
|
51
|
+
"cacheGenerated": true,
|
|
52
|
+
"autoInferEnable": false,
|
|
53
|
+
"softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
|
|
54
|
+
"hardBreakTime": 500,
|
|
55
|
+
"completionTemperature": 0.1,
|
|
56
|
+
"completionRepetitionPenalty": 1.1,
|
|
57
|
+
"completionTopK": 40,
|
|
58
|
+
"completionTopP": 0.9,
|
|
59
|
+
"completionMinP": 0.05,
|
|
60
|
+
"useGuideToken": true,
|
|
61
|
+
"contextSize": 8192,
|
|
62
|
+
"batchSize": 8192,
|
|
63
|
+
"microBatchSize": 512,
|
|
64
|
+
"maxThreads": 2,
|
|
65
|
+
"accelVariant": "default",
|
|
66
|
+
"mainGpu": 0,
|
|
67
|
+
"gpuLayers": 0,
|
|
68
|
+
"useMlock": true,
|
|
69
|
+
"useMmap": true,
|
|
70
|
+
"useFlashAttn": "off"
|
|
71
|
+
}
|
|
72
|
+
*/
|
|
73
|
+
property?: {
|
|
74
|
+
/* Initialize the TTS context on generator initialization */
|
|
75
|
+
init?: boolean | DataLink
|
|
76
|
+
/* The URL or path of model
|
|
77
|
+
We used GGUF format model, please refer to https://github.com/ggerganov/llama.cpp/tree/master#description */
|
|
78
|
+
modelUrl?: string | DataLink
|
|
79
|
+
/* Hash type of model */
|
|
80
|
+
modelHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
|
|
81
|
+
/* Hash of model */
|
|
82
|
+
modelHash?: string | DataLink
|
|
83
|
+
/* The URL or path of vocoder model */
|
|
84
|
+
vocoderUrl?: string | DataLink
|
|
85
|
+
/* Hash type of vocoder model */
|
|
86
|
+
vocoderHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
|
|
87
|
+
/* Hash of vocoder model */
|
|
88
|
+
vocoderHash?: string | DataLink
|
|
89
|
+
/* Batch size of vocoder model */
|
|
90
|
+
vocoderBatchSize?: number | DataLink
|
|
91
|
+
/* Output mode */
|
|
92
|
+
outputType?: 'play' | 'file' | DataLink
|
|
93
|
+
/* Enable cache for generated audio */
|
|
94
|
+
cacheGenerated?: boolean | DataLink
|
|
95
|
+
/* Text to generate */
|
|
96
|
+
prompt?: string | DataLink
|
|
97
|
+
/* Speaker JSON */
|
|
98
|
+
speaker?: {} | DataLink
|
|
99
|
+
/* Auto inference when prompt changes */
|
|
100
|
+
autoInferEnable?: boolean | DataLink
|
|
101
|
+
/* Segmentation rule for auto inference */
|
|
102
|
+
softBreakRegex?: string | DataLink
|
|
103
|
+
/* Time to force inference when softBreakRegex is not satisfied */
|
|
104
|
+
hardBreakTime?: number | DataLink
|
|
105
|
+
/* Temperature */
|
|
106
|
+
completionTemperature?: number | DataLink
|
|
107
|
+
/* Repetition Penalty */
|
|
108
|
+
completionRepetitionPenalty?: number | DataLink
|
|
109
|
+
/* Top K sampling */
|
|
110
|
+
completionTopK?: number | DataLink
|
|
111
|
+
/* Top P sampling */
|
|
112
|
+
completionTopP?: number | DataLink
|
|
113
|
+
/* Min P sampling */
|
|
114
|
+
completionMinP?: number | DataLink
|
|
115
|
+
/* Set the random number generator (RNG) seed (default: -1, -1 = random seed) */
|
|
116
|
+
completionSeed?: number | DataLink
|
|
117
|
+
/* Number of tokens to predict */
|
|
118
|
+
completionPredict?: number | DataLink
|
|
119
|
+
/* Enable guide token to help prevent hallucinations by forcing the TTS to use the correct words. */
|
|
120
|
+
useGuideToken?: boolean | DataLink
|
|
121
|
+
/* Context size, for OutTTS recommended 4096 ~ 8192 (Default to 4096) */
|
|
122
|
+
contextSize?: number | DataLink
|
|
123
|
+
/* Logical batch size for prompt processing */
|
|
124
|
+
batchSize?: number | DataLink
|
|
125
|
+
/* Physical batch size for prompt processing */
|
|
126
|
+
microBatchSize?: number | DataLink
|
|
127
|
+
/* Number of threads */
|
|
128
|
+
maxThreads?: number | DataLink
|
|
129
|
+
/* Accelerator variant (Only for desktop)
|
|
130
|
+
`default` - CPU / Metal (macOS)
|
|
131
|
+
`vulkan` - Use Vulkan
|
|
132
|
+
`cuda` - Use CUDA */
|
|
133
|
+
accelVariant?: 'default' | 'vulkan' | 'cuda' | DataLink
|
|
134
|
+
/* Main GPU index */
|
|
135
|
+
mainGpu?: number | DataLink
|
|
136
|
+
/* Number of GPU layers (NOTE: Currently not supported for Android) */
|
|
137
|
+
gpuLayers?: number | DataLink
|
|
138
|
+
/* Use memory lock */
|
|
139
|
+
useMlock?: boolean | DataLink
|
|
140
|
+
/* Use mmap */
|
|
141
|
+
useMmap?: boolean | DataLink
|
|
142
|
+
/* Use Flash Attention for inference (Recommended with GPU enabled) */
|
|
143
|
+
useFlashAttn?: 'auto' | 'on' | 'off' | DataLink
|
|
144
|
+
}
|
|
145
|
+
events?: {
|
|
146
|
+
/* Event triggered when state change */
|
|
147
|
+
onContextStateChange?: Array<EventAction>
|
|
148
|
+
/* Event triggered when error occurs */
|
|
149
|
+
onError?: Array<EventAction>
|
|
150
|
+
}
|
|
151
|
+
outlets?: {
|
|
152
|
+
/* Context state */
|
|
153
|
+
contextState?: () => Data
|
|
154
|
+
/* Generated audio file */
|
|
155
|
+
generatedAudio?: () => Data
|
|
156
|
+
/* Generated audio file is playing */
|
|
157
|
+
generatedAudioPlaying?: () => Data
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Local Text-to-Speech (TTS) inference based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
|
162
|
+
You can use any converted model on HuggingFace. */
|
|
163
|
+
export type GeneratorGGMLTTS = Generator &
|
|
164
|
+
GeneratorGGMLTTSDef & {
|
|
165
|
+
templateKey: 'GENERATOR_GGML_TTS'
|
|
166
|
+
switches: Array<
|
|
167
|
+
SwitchDef &
|
|
168
|
+
GeneratorGGMLTTSDef & {
|
|
169
|
+
conds?: Array<{
|
|
170
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
171
|
+
cond:
|
|
172
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
173
|
+
| SwitchCondData
|
|
174
|
+
| {
|
|
175
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
176
|
+
outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
|
|
177
|
+
value: any
|
|
178
|
+
}
|
|
179
|
+
}>
|
|
180
|
+
}
|
|
181
|
+
>
|
|
182
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Load the model */
|
|
13
|
+
export type GeneratorTTSActionLoadModel = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_TTS_LOAD_MODEL'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Generate audio */
|
|
18
|
+
export type GeneratorTTSActionGenerate = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_TTS_GENERATE'
|
|
20
|
+
params?: Array<{
|
|
21
|
+
input: 'text'
|
|
22
|
+
value?: string | DataLink | EventProperty
|
|
23
|
+
mapping?: string
|
|
24
|
+
}>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Clean cache */
|
|
28
|
+
export type GeneratorTTSActionCleanCache = Action & {
|
|
29
|
+
__actionName: 'GENERATOR_TTS_CLEAN_CACHE'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Release context */
|
|
33
|
+
export type GeneratorTTSActionReleaseContext = Action & {
|
|
34
|
+
__actionName: 'GENERATOR_TTS_RELEASE_CONTEXT'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Cancel current generation and clear queue */
|
|
38
|
+
export type GeneratorTTSActionCancel = Action & {
|
|
39
|
+
__actionName: 'GENERATOR_TTS_CANCEL'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface GeneratorTTSDef {
|
|
43
|
+
/*
|
|
44
|
+
Default property:
|
|
45
|
+
{
|
|
46
|
+
"model": "BricksDisplay/vits-eng",
|
|
47
|
+
"modelType": "auto",
|
|
48
|
+
"vocoderModel": "speecht5_hifigan",
|
|
49
|
+
"maxLength": 4096,
|
|
50
|
+
"temperature": 0.1,
|
|
51
|
+
"repetitionPenalty": 1.1,
|
|
52
|
+
"doSample": true,
|
|
53
|
+
"outputType": "play",
|
|
54
|
+
"cacheGenerated": true,
|
|
55
|
+
"speed": 1,
|
|
56
|
+
"autoInferEnable": false,
|
|
57
|
+
"softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
|
|
58
|
+
"hardBreakTime": 500,
|
|
59
|
+
"executionMode": "sequential"
|
|
60
|
+
}
|
|
61
|
+
*/
|
|
62
|
+
property?: {
|
|
63
|
+
/* Initialize the TTS context on generator initialization */
|
|
64
|
+
init?: boolean | DataLink
|
|
65
|
+
/* TTS model
|
|
66
|
+
The mms-tts models are licensed under CC-BY-NC-4.0 */
|
|
67
|
+
model?: string | DataLink
|
|
68
|
+
/* Model type */
|
|
69
|
+
modelType?: string | DataLink
|
|
70
|
+
/* Quantize type */
|
|
71
|
+
quantizeType?:
|
|
72
|
+
| 'auto'
|
|
73
|
+
| 'none'
|
|
74
|
+
| 'fp16'
|
|
75
|
+
| 'q8'
|
|
76
|
+
| 'int8'
|
|
77
|
+
| 'uint8'
|
|
78
|
+
| 'q4'
|
|
79
|
+
| 'bnb4'
|
|
80
|
+
| 'q4f16'
|
|
81
|
+
| DataLink
|
|
82
|
+
/* Vocoder model for SpeechT5 */
|
|
83
|
+
vocoderModel?: 'Custom' | 'speecht5_hifigan' | DataLink
|
|
84
|
+
/* Custom vocoder model
|
|
85
|
+
Choose model from https://huggingface.co/models?library=transformers.js&other=hifigan */
|
|
86
|
+
customVocoderModel?: string | DataLink
|
|
87
|
+
/* Speaker embedding, for SpeechT5 or StyleTTS (Kokoro) */
|
|
88
|
+
speakerEmbedUrl?: string | DataLink
|
|
89
|
+
/* Hash of `speakerEmbedUrl` */
|
|
90
|
+
speakerEmbedHash?: string | DataLink
|
|
91
|
+
/* Hash type of `speakerEmbedUrl` */
|
|
92
|
+
speakerEmbedHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
|
|
93
|
+
/* Speaker config, for OuteTTS model */
|
|
94
|
+
speakerConfig?: {} | DataLink
|
|
95
|
+
/* Audio token generation max length */
|
|
96
|
+
maxLength?: number | DataLink
|
|
97
|
+
/* Audio token generation temperature */
|
|
98
|
+
temperature?: number | DataLink
|
|
99
|
+
/* Audio token generation repetition penalty */
|
|
100
|
+
repetitionPenalty?: number | DataLink
|
|
101
|
+
/* Use greedy sampling for audio token generation */
|
|
102
|
+
doSample?: boolean | DataLink
|
|
103
|
+
/* Output mode */
|
|
104
|
+
outputType?: 'play' | 'file' | DataLink
|
|
105
|
+
/* Enable cache for generated audio */
|
|
106
|
+
cacheGenerated?: boolean | DataLink
|
|
107
|
+
/* Speed of the generated audio, for StyleTTS (Kokoro) */
|
|
108
|
+
speed?: number | DataLink
|
|
109
|
+
/* Text to generate */
|
|
110
|
+
prompt?: string | DataLink
|
|
111
|
+
/* Auto inference when prompt changes */
|
|
112
|
+
autoInferEnable?: boolean | DataLink
|
|
113
|
+
/* Segmentation rule for auto inference */
|
|
114
|
+
softBreakRegex?: string | DataLink
|
|
115
|
+
/* Time to force inference when softBreakRegex is not satisfied */
|
|
116
|
+
hardBreakTime?: number | DataLink
|
|
117
|
+
/* Executor candidates, descending order of priority
|
|
118
|
+
Default will be xnnpack, wasm, cpu */
|
|
119
|
+
executors?:
|
|
120
|
+
| Array<'qnn' | 'dml' | 'nnapi' | 'xnnpack' | 'coreml' | 'cpu' | 'wasm' | 'webgpu' | DataLink>
|
|
121
|
+
| DataLink
|
|
122
|
+
/* Execution mode
|
|
123
|
+
Usually when the model has many branches, setting this option to `parallel` will give you better performance. */
|
|
124
|
+
executionMode?: 'sequential' | 'parallel' | DataLink
|
|
125
|
+
/* QNN backend */
|
|
126
|
+
qnnBackend?: 'HTP' | 'HTA' | 'DSP' | 'GPU' | 'CPU' | DataLink
|
|
127
|
+
/* Enable FP16 for QNN HTP */
|
|
128
|
+
qnnHtpEnableFp16?: boolean | DataLink
|
|
129
|
+
/* Enable QNN debug */
|
|
130
|
+
qnnEnableDebug?: boolean | DataLink
|
|
131
|
+
}
|
|
132
|
+
events?: {
|
|
133
|
+
/* Event triggered when state change */
|
|
134
|
+
onContextStateChange?: Array<EventAction>
|
|
135
|
+
/* Event triggered when error occurs */
|
|
136
|
+
onError?: Array<EventAction>
|
|
137
|
+
}
|
|
138
|
+
outlets?: {
|
|
139
|
+
/* Context state */
|
|
140
|
+
contextState?: () => Data
|
|
141
|
+
/* Generated audio file */
|
|
142
|
+
generatedAudio?: () => Data
|
|
143
|
+
/* Generated audio file is playing */
|
|
144
|
+
generatedAudioPlaying?: () => Data
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Local Text-to-Speech (TTS) inference based on ONNX Runtime and [transformers.js](https://huggingface.co/docs/transformers.js)
|
|
149
|
+
You can use any converted model on HuggingFace. */
|
|
150
|
+
export type GeneratorTTS = Generator &
|
|
151
|
+
GeneratorTTSDef & {
|
|
152
|
+
templateKey: 'GENERATOR_TTS'
|
|
153
|
+
switches: Array<
|
|
154
|
+
SwitchDef &
|
|
155
|
+
GeneratorTTSDef & {
|
|
156
|
+
conds?: Array<{
|
|
157
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
158
|
+
cond:
|
|
159
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
160
|
+
| SwitchCondData
|
|
161
|
+
| {
|
|
162
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
163
|
+
outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
|
|
164
|
+
value: any
|
|
165
|
+
}
|
|
166
|
+
}>
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Generate audio */
|
|
13
|
+
export type GeneratorOpenAiTTSActionGenerate = ActionWithParams & {
|
|
14
|
+
__actionName: 'GENERATOR_OPENAI_TTS_GENERATE'
|
|
15
|
+
params?: Array<{
|
|
16
|
+
input: 'text'
|
|
17
|
+
value?: string | DataLink | EventProperty
|
|
18
|
+
mapping?: string
|
|
19
|
+
}>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Clean cache */
|
|
23
|
+
export type GeneratorOpenAiTTSActionCleanCache = Action & {
|
|
24
|
+
__actionName: 'GENERATOR_OPENAI_TTS_CLEAN_CACHE'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Cancel current generation and clear queue */
|
|
28
|
+
export type GeneratorOpenAiTTSActionCancel = Action & {
|
|
29
|
+
__actionName: 'GENERATOR_OPENAI_TTS_CANCEL'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface GeneratorOpenAiTTSDef {
|
|
33
|
+
/*
|
|
34
|
+
Default property:
|
|
35
|
+
{
|
|
36
|
+
"apiEndpoint": "https://api.openai.com/v1",
|
|
37
|
+
"model": "tts-1",
|
|
38
|
+
"voice": "alloy",
|
|
39
|
+
"speed": 1,
|
|
40
|
+
"outputType": "play",
|
|
41
|
+
"playbackVolume": 100,
|
|
42
|
+
"cacheGenerated": true,
|
|
43
|
+
"autoInferEnable": false,
|
|
44
|
+
"softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
|
|
45
|
+
"hardBreakTime": 500
|
|
46
|
+
}
|
|
47
|
+
*/
|
|
48
|
+
property?: {
|
|
49
|
+
/* API endpoint URL */
|
|
50
|
+
apiEndpoint?: string | DataLink
|
|
51
|
+
/* OpenAI API Key */
|
|
52
|
+
apiKey?: string | DataLink
|
|
53
|
+
/* OpenAI TTS model */
|
|
54
|
+
model?: string | DataLink
|
|
55
|
+
/* Voice to use
|
|
56
|
+
Select voice from https://openai.fm , default alloy */
|
|
57
|
+
voice?: string | DataLink
|
|
58
|
+
/* Additional instructions for the speech generation */
|
|
59
|
+
instructions?: string | DataLink
|
|
60
|
+
/* Speed of the generated audio */
|
|
61
|
+
speed?: number | DataLink
|
|
62
|
+
/* Output mode */
|
|
63
|
+
outputType?: 'play' | 'file' | DataLink
|
|
64
|
+
/* Playback volume (0 - 100) */
|
|
65
|
+
playbackVolume?: number | DataLink
|
|
66
|
+
/* Enable cache for generated audio */
|
|
67
|
+
cacheGenerated?: boolean | DataLink
|
|
68
|
+
/* Text to generate */
|
|
69
|
+
prompt?: string | DataLink
|
|
70
|
+
/* Auto inference when prompt changes */
|
|
71
|
+
autoInferEnable?: boolean | DataLink
|
|
72
|
+
/* Segmentation rule for auto inference */
|
|
73
|
+
softBreakRegex?: string | DataLink
|
|
74
|
+
/* Time to force inference when softBreakRegex is not satisfied */
|
|
75
|
+
hardBreakTime?: number | DataLink
|
|
76
|
+
}
|
|
77
|
+
events?: {
|
|
78
|
+
/* Event triggered when state change */
|
|
79
|
+
onContextStateChange?: Array<EventAction>
|
|
80
|
+
/* Event triggered when error occurs */
|
|
81
|
+
onError?: Array<EventAction>
|
|
82
|
+
}
|
|
83
|
+
outlets?: {
|
|
84
|
+
/* Context state */
|
|
85
|
+
contextState?: () => Data
|
|
86
|
+
/* Generated audio file */
|
|
87
|
+
generatedAudio?: () => Data
|
|
88
|
+
/* Generated audio file is playing */
|
|
89
|
+
generatedAudioPlaying?: () => Data
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Generate speech from text using OpenAI's Text-to-Speech API */
|
|
94
|
+
export type GeneratorOpenAiTTS = Generator &
|
|
95
|
+
GeneratorOpenAiTTSDef & {
|
|
96
|
+
templateKey: 'GENERATOR_OPENAI_TTS'
|
|
97
|
+
switches: Array<
|
|
98
|
+
SwitchDef &
|
|
99
|
+
GeneratorOpenAiTTSDef & {
|
|
100
|
+
conds?: Array<{
|
|
101
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
102
|
+
cond:
|
|
103
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
104
|
+
| SwitchCondData
|
|
105
|
+
| {
|
|
106
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
107
|
+
outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
|
|
108
|
+
value: any
|
|
109
|
+
}
|
|
110
|
+
}>
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
}
|