@fugood/bricks-ctor 2.25.0-beta.6 → 2.25.0-beta.61

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.
Files changed (133) hide show
  1. package/package.json +4 -24
  2. package/tools/deploy.ts +19 -165
  3. package/tools/mcp-server.ts +17 -26
  4. package/tools/postinstall.ts +21 -235
  5. package/tools/pull.ts +18 -121
  6. package/tools/push-config.ts +19 -0
  7. package/tools/simulator.ts +21 -0
  8. package/compile/action-name-map.ts +0 -1015
  9. package/compile/index.ts +0 -1278
  10. package/compile/util.ts +0 -358
  11. package/index.ts +0 -6
  12. package/skills/bricks-ctor/SKILL.md +0 -32
  13. package/skills/bricks-ctor/rules/animation.md +0 -159
  14. package/skills/bricks-ctor/rules/architecture-patterns.md +0 -69
  15. package/skills/bricks-ctor/rules/automations.md +0 -221
  16. package/skills/bricks-ctor/rules/buttress.md +0 -156
  17. package/skills/bricks-ctor/rules/data-calculation.md +0 -209
  18. package/skills/bricks-ctor/rules/local-sync.md +0 -129
  19. package/skills/bricks-ctor/rules/media-flow.md +0 -158
  20. package/skills/bricks-ctor/rules/remote-data-bank.md +0 -196
  21. package/skills/bricks-ctor/rules/standby-transition.md +0 -124
  22. package/skills/bricks-design/LICENSE.txt +0 -180
  23. package/skills/bricks-design/SKILL.md +0 -66
  24. package/skills/rive-marketplace/SKILL.md +0 -99
  25. package/tools/_git-author.ts +0 -29
  26. package/tools/_shell.ts +0 -173
  27. package/tools/icons/.gitattributes +0 -1
  28. package/tools/icons/fa6pro-glyphmap.json +0 -4686
  29. package/tools/icons/fa6pro-meta.json +0 -1
  30. package/tools/mcp-tools/compile.ts +0 -92
  31. package/tools/mcp-tools/huggingface.ts +0 -762
  32. package/tools/mcp-tools/icons.ts +0 -81
  33. package/tools/mcp-tools/lottie.ts +0 -102
  34. package/tools/mcp-tools/media.ts +0 -110
  35. package/tools/preview-main.mjs +0 -293
  36. package/tools/preview.ts +0 -150
  37. package/types/animation.ts +0 -100
  38. package/types/automation.ts +0 -235
  39. package/types/brick-base.ts +0 -80
  40. package/types/bricks/Camera.ts +0 -246
  41. package/types/bricks/Chart.ts +0 -372
  42. package/types/bricks/GenerativeMedia.ts +0 -290
  43. package/types/bricks/Icon.ts +0 -98
  44. package/types/bricks/Image.ts +0 -114
  45. package/types/bricks/Items.ts +0 -476
  46. package/types/bricks/Lottie.ts +0 -168
  47. package/types/bricks/Maps.ts +0 -262
  48. package/types/bricks/QrCode.ts +0 -117
  49. package/types/bricks/Rect.ts +0 -150
  50. package/types/bricks/RichText.ts +0 -128
  51. package/types/bricks/Rive.ts +0 -220
  52. package/types/bricks/Sketch.ts +0 -254
  53. package/types/bricks/Slideshow.ts +0 -201
  54. package/types/bricks/Svg.ts +0 -99
  55. package/types/bricks/Text.ts +0 -148
  56. package/types/bricks/TextInput.ts +0 -242
  57. package/types/bricks/Video.ts +0 -175
  58. package/types/bricks/VideoStreaming.ts +0 -112
  59. package/types/bricks/WebRtcStream.ts +0 -65
  60. package/types/bricks/WebView.ts +0 -168
  61. package/types/bricks/index.ts +0 -22
  62. package/types/canvas.ts +0 -82
  63. package/types/common.ts +0 -144
  64. package/types/data-calc-command.ts +0 -7005
  65. package/types/data-calc-script.ts +0 -21
  66. package/types/data-calc.ts +0 -11
  67. package/types/data.ts +0 -95
  68. package/types/generators/AlarmClock.ts +0 -110
  69. package/types/generators/Assistant.ts +0 -621
  70. package/types/generators/BleCentral.ts +0 -247
  71. package/types/generators/BlePeripheral.ts +0 -208
  72. package/types/generators/CanvasMap.ts +0 -74
  73. package/types/generators/CastlesPay.ts +0 -87
  74. package/types/generators/DataBank.ts +0 -160
  75. package/types/generators/File.ts +0 -432
  76. package/types/generators/GraphQl.ts +0 -132
  77. package/types/generators/Http.ts +0 -222
  78. package/types/generators/HttpServer.ts +0 -176
  79. package/types/generators/Information.ts +0 -103
  80. package/types/generators/Intent.ts +0 -168
  81. package/types/generators/Iterator.ts +0 -108
  82. package/types/generators/Keyboard.ts +0 -105
  83. package/types/generators/LlmAnthropicCompat.ts +0 -212
  84. package/types/generators/LlmAppleBuiltin.ts +0 -159
  85. package/types/generators/LlmGgml.ts +0 -861
  86. package/types/generators/LlmMediaTekNeuroPilot.ts +0 -235
  87. package/types/generators/LlmMlx.ts +0 -227
  88. package/types/generators/LlmOnnx.ts +0 -213
  89. package/types/generators/LlmOpenAiCompat.ts +0 -312
  90. package/types/generators/LlmQualcommAiEngine.ts +0 -247
  91. package/types/generators/Mcp.ts +0 -637
  92. package/types/generators/McpServer.ts +0 -289
  93. package/types/generators/MediaFlow.ts +0 -170
  94. package/types/generators/MqttBroker.ts +0 -141
  95. package/types/generators/MqttClient.ts +0 -141
  96. package/types/generators/Question.ts +0 -408
  97. package/types/generators/RealtimeTranscription.ts +0 -287
  98. package/types/generators/RerankerGgml.ts +0 -191
  99. package/types/generators/SerialPort.ts +0 -151
  100. package/types/generators/SoundPlayer.ts +0 -94
  101. package/types/generators/SoundRecorder.ts +0 -130
  102. package/types/generators/SpeechToTextGgml.ts +0 -419
  103. package/types/generators/SpeechToTextOnnx.ts +0 -236
  104. package/types/generators/SpeechToTextPlatform.ts +0 -85
  105. package/types/generators/SqLite.ts +0 -159
  106. package/types/generators/Step.ts +0 -107
  107. package/types/generators/SttAppleBuiltin.ts +0 -130
  108. package/types/generators/Tcp.ts +0 -126
  109. package/types/generators/TcpServer.ts +0 -147
  110. package/types/generators/TextToSpeechAppleBuiltin.ts +0 -127
  111. package/types/generators/TextToSpeechGgml.ts +0 -221
  112. package/types/generators/TextToSpeechOnnx.ts +0 -178
  113. package/types/generators/TextToSpeechOpenAiLike.ts +0 -121
  114. package/types/generators/ThermalPrinter.ts +0 -191
  115. package/types/generators/Tick.ts +0 -83
  116. package/types/generators/Udp.ts +0 -120
  117. package/types/generators/VadGgml.ts +0 -250
  118. package/types/generators/VadOnnx.ts +0 -231
  119. package/types/generators/VadTraditional.ts +0 -138
  120. package/types/generators/VectorStore.ts +0 -257
  121. package/types/generators/Watchdog.ts +0 -107
  122. package/types/generators/WebCrawler.ts +0 -103
  123. package/types/generators/WebRtc.ts +0 -181
  124. package/types/generators/WebSocket.ts +0 -148
  125. package/types/generators/index.ts +0 -57
  126. package/types/index.ts +0 -13
  127. package/types/subspace.ts +0 -60
  128. package/types/switch.ts +0 -51
  129. package/types/system.ts +0 -707
  130. package/utils/calc.ts +0 -126
  131. package/utils/data.ts +0 -497
  132. package/utils/event-props.ts +0 -886
  133. package/utils/id.ts +0 -80
@@ -1,221 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * Local Text-to-Speech (TTS) inference based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
4
- * You can use any converted model on HuggingFace.
5
- *
6
- * ## Notice
7
- * - The device RAM must be larger than 8GB
8
- * - iOS: Recommended use M1+ / A17+ chip device. Supported GPU acceleration by Metal.
9
- * - macOS: Recommended use M1+ chip device. Supported GPU acceleration by Metal.
10
- * - Android: Recommended use Android 13+ system.
11
- * - Supported GPU acceleration by OpenCL, currently only for Qualcomm Adreno 700+ GPUs, other GPUs are not supported.
12
- * - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 2+ GPUs.
13
- * - Linux / Windows
14
- * - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
15
- * - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)
16
- */
17
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
18
- import type { Data, DataLink } from '../data'
19
- import type {
20
- Brick,
21
- Generator,
22
- EventAction,
23
- ActionWithDataParams,
24
- ActionWithParams,
25
- Action,
26
- EventProperty,
27
- } from '../common'
28
- import type { TemplateEventPropsMap } from '../../utils/event-props'
29
-
30
- /* Load the model */
31
- export type GeneratorGGMLTTSActionLoadModel = Action & {
32
- __actionName: 'GENERATOR_GGML_TTS_LOAD_MODEL'
33
- }
34
-
35
- /* Generate audio */
36
- export type GeneratorGGMLTTSActionGenerate = ActionWithParams & {
37
- __actionName: 'GENERATOR_GGML_TTS_GENERATE'
38
- params?: Array<{
39
- input: 'text'
40
- value?: string | DataLink | EventProperty
41
- mapping?: string
42
- }>
43
- }
44
-
45
- /* Clean cache */
46
- export type GeneratorGGMLTTSActionCleanCache = Action & {
47
- __actionName: 'GENERATOR_GGML_TTS_CLEAN_CACHE'
48
- }
49
-
50
- /* Release context */
51
- export type GeneratorGGMLTTSActionReleaseContext = Action & {
52
- __actionName: 'GENERATOR_GGML_TTS_RELEASE_CONTEXT'
53
- }
54
-
55
- /* Cancel current generation and clear queue */
56
- export type GeneratorGGMLTTSActionCancel = Action & {
57
- __actionName: 'GENERATOR_GGML_TTS_CANCEL'
58
- }
59
-
60
- interface GeneratorGGMLTTSDef {
61
- /*
62
- Default property:
63
- {
64
- "vocoderUrl": "https://huggingface.co/ggml-org/WavTokenizer/resolve/main/WavTokenizer-Large-75-F16.gguf",
65
- "vocoderHashType": "sha256",
66
- "vocoderHash": "2356baa8631cc2995ea3465196a017a2733600d849a91180c0f97fa7fb375bbe",
67
- "vocoderBatchSize": 4096,
68
- "outputType": "play",
69
- "cacheGenerated": true,
70
- "autoInferEnable": false,
71
- "softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
72
- "hardBreakTime": 500,
73
- "completionTemperature": 0.1,
74
- "completionRepetitionPenalty": 1.1,
75
- "completionTopK": 40,
76
- "completionTopP": 0.9,
77
- "completionMinP": 0.05,
78
- "useGuideToken": true,
79
- "contextSize": 8192,
80
- "batchSize": 8192,
81
- "microBatchSize": 512,
82
- "maxThreads": 2,
83
- "accelVariant": "default",
84
- "mainGpu": 0,
85
- "gpuLayers": 0,
86
- "useMlock": true,
87
- "useMmap": true,
88
- "useFlashAttn": "off"
89
- }
90
- */
91
- property?: {
92
- /* Initialize the TTS context on generator initialization */
93
- init?: boolean | DataLink
94
- /* The URL or path of model
95
- We used GGUF format model, please refer to https://github.com/ggerganov/llama.cpp/tree/master#description */
96
- modelUrl?: string | DataLink
97
- /* Hash type of model */
98
- modelHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
99
- /* Hash of model */
100
- modelHash?: string | DataLink
101
- /* The URL or path of vocoder model */
102
- vocoderUrl?: string | DataLink
103
- /* Hash type of vocoder model */
104
- vocoderHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
105
- /* Hash of vocoder model */
106
- vocoderHash?: string | DataLink
107
- /* Batch size of vocoder model */
108
- vocoderBatchSize?: number | DataLink
109
- /* Output mode */
110
- outputType?: 'play' | 'file' | DataLink
111
- /* Enable cache for generated audio */
112
- cacheGenerated?: boolean | DataLink
113
- /* Text to generate */
114
- prompt?: string | DataLink
115
- /* Speaker JSON */
116
- speaker?: {} | DataLink
117
- /* Auto inference when prompt changes */
118
- autoInferEnable?: boolean | DataLink
119
- /* Segmentation rule for auto inference */
120
- softBreakRegex?: string | DataLink
121
- /* Time to force inference when softBreakRegex is not satisfied */
122
- hardBreakTime?: number | DataLink
123
- /* Temperature */
124
- completionTemperature?: number | DataLink
125
- /* Repetition Penalty */
126
- completionRepetitionPenalty?: number | DataLink
127
- /* Top K sampling */
128
- completionTopK?: number | DataLink
129
- /* Top P sampling */
130
- completionTopP?: number | DataLink
131
- /* Min P sampling */
132
- completionMinP?: number | DataLink
133
- /* Set the random number generator (RNG) seed (default: -1, -1 = random seed) */
134
- completionSeed?: number | DataLink
135
- /* Number of tokens to predict */
136
- completionPredict?: number | DataLink
137
- /* Enable guide token to help prevent hallucinations by forcing the TTS to use the correct words. */
138
- useGuideToken?: boolean | DataLink
139
- /* Context size, for OutTTS recommended 4096 ~ 8192 (Default to 4096) */
140
- contextSize?: number | DataLink
141
- /* Logical batch size for prompt processing */
142
- batchSize?: number | DataLink
143
- /* Physical batch size for prompt processing */
144
- microBatchSize?: number | DataLink
145
- /* Number of threads */
146
- maxThreads?: number | DataLink
147
- /* Accelerator variant (Only for desktop)
148
- `default` - CPU / Metal (macOS)
149
- `vulkan` - Use Vulkan
150
- `cuda` - Use CUDA
151
- `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon */
152
- accelVariant?: 'default' | 'vulkan' | 'cuda' | 'snapdragon' | DataLink
153
- /* Devices. For example:
154
-
155
- Metal or CPU for iOS/tvOS/MacOS
156
- OpenCL or CPU for Android
157
- - Add `HTP0`, `HTP1`, `...` for OpenCL/Hexagon devices (Use HTP* for all HTP devices)
158
- For Desktop, you may want to include/exclude GPUs */
159
- devices?: Array<string | DataLink> | DataLink
160
- /* Main GPU index */
161
- mainGpu?: number | DataLink
162
- /* Number of GPU layers (NOTE: Currently not supported for Android) */
163
- gpuLayers?: number | DataLink
164
- /* Use memory lock */
165
- useMlock?: boolean | DataLink
166
- /* Use mmap */
167
- useMmap?: boolean | DataLink
168
- /* Use Flash Attention for inference (Recommended with GPU enabled) */
169
- useFlashAttn?: 'auto' | 'on' | 'off' | DataLink
170
- }
171
- events?: {
172
- /* Event triggered when state change */
173
- onContextStateChange?: Array<
174
- EventAction<string & keyof TemplateEventPropsMap['GgmlTts']['onContextStateChange']>
175
- >
176
- /* Event triggered when error occurs */
177
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['GgmlTts']['onError']>>
178
- }
179
- outlets?: {
180
- /* Context state */
181
- contextState?: () => Data<string>
182
- /* Generated audio file */
183
- generatedAudio?: () => Data<string>
184
- /* Generated audio file is playing */
185
- generatedAudioPlaying?: () => Data<boolean>
186
- }
187
- }
188
-
189
- /* Local Text-to-Speech (TTS) inference based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
190
- You can use any converted model on HuggingFace.
191
-
192
- ## Notice
193
- - The device RAM must be larger than 8GB
194
- - iOS: Recommended use M1+ / A17+ chip device. Supported GPU acceleration by Metal.
195
- - macOS: Recommended use M1+ chip device. Supported GPU acceleration by Metal.
196
- - Android: Recommended use Android 13+ system.
197
- - Supported GPU acceleration by OpenCL, currently only for Qualcomm Adreno 700+ GPUs, other GPUs are not supported.
198
- - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 2+ GPUs.
199
- - Linux / Windows
200
- - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
201
- - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux) */
202
- export type GeneratorGGMLTTS = Generator &
203
- GeneratorGGMLTTSDef & {
204
- templateKey: 'GENERATOR_GGML_TTS'
205
- switches?: Array<
206
- SwitchDef &
207
- GeneratorGGMLTTSDef & {
208
- conds?: Array<{
209
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
210
- cond:
211
- | SwitchCondInnerStateCurrentCanvas
212
- | SwitchCondData
213
- | {
214
- __typename: 'SwitchCondInnerStateOutlet'
215
- outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
216
- value: any
217
- }
218
- }>
219
- }
220
- >
221
- }
@@ -1,178 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * Local Text-to-Speech (TTS) inference based on ONNX Runtime and [transformers.js](https://huggingface.co/docs/transformers.js)
4
- * You can use any converted model on HuggingFace.
5
- */
6
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
7
- import type { Data, DataLink } from '../data'
8
- import type {
9
- Brick,
10
- Generator,
11
- EventAction,
12
- ActionWithDataParams,
13
- ActionWithParams,
14
- Action,
15
- EventProperty,
16
- } from '../common'
17
- import type { TemplateEventPropsMap } from '../../utils/event-props'
18
-
19
- /* Load the model */
20
- export type GeneratorTTSActionLoadModel = Action & {
21
- __actionName: 'GENERATOR_TTS_LOAD_MODEL'
22
- }
23
-
24
- /* Generate audio */
25
- export type GeneratorTTSActionGenerate = ActionWithParams & {
26
- __actionName: 'GENERATOR_TTS_GENERATE'
27
- params?: Array<{
28
- input: 'text'
29
- value?: string | DataLink | EventProperty
30
- mapping?: string
31
- }>
32
- }
33
-
34
- /* Clean cache */
35
- export type GeneratorTTSActionCleanCache = Action & {
36
- __actionName: 'GENERATOR_TTS_CLEAN_CACHE'
37
- }
38
-
39
- /* Release context */
40
- export type GeneratorTTSActionReleaseContext = Action & {
41
- __actionName: 'GENERATOR_TTS_RELEASE_CONTEXT'
42
- }
43
-
44
- /* Cancel current generation and clear queue */
45
- export type GeneratorTTSActionCancel = Action & {
46
- __actionName: 'GENERATOR_TTS_CANCEL'
47
- }
48
-
49
- interface GeneratorTTSDef {
50
- /*
51
- Default property:
52
- {
53
- "model": "BricksDisplay/vits-eng",
54
- "modelType": "auto",
55
- "vocoderModel": "speecht5_hifigan",
56
- "maxLength": 4096,
57
- "temperature": 0.1,
58
- "repetitionPenalty": 1.1,
59
- "doSample": true,
60
- "outputType": "play",
61
- "cacheGenerated": true,
62
- "speed": 1,
63
- "autoInferEnable": false,
64
- "softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
65
- "hardBreakTime": 500,
66
- "executionMode": "sequential"
67
- }
68
- */
69
- property?: {
70
- /* Initialize the TTS context on generator initialization */
71
- init?: boolean | DataLink
72
- /* TTS model
73
- The mms-tts models are licensed under CC-BY-NC-4.0 */
74
- model?: string | DataLink
75
- /* Model type */
76
- modelType?: string | DataLink
77
- /* Quantize type */
78
- quantizeType?:
79
- | 'auto'
80
- | 'none'
81
- | 'fp16'
82
- | 'q8'
83
- | 'int8'
84
- | 'uint8'
85
- | 'q4'
86
- | 'bnb4'
87
- | 'q4f16'
88
- | DataLink
89
- /* Vocoder model for SpeechT5 */
90
- vocoderModel?: 'Custom' | 'speecht5_hifigan' | DataLink
91
- /* Custom vocoder model
92
- Choose model from https://huggingface.co/models?library=transformers.js&other=hifigan */
93
- customVocoderModel?: string | DataLink
94
- /* Speaker embedding, for SpeechT5 or StyleTTS (Kokoro) */
95
- speakerEmbedUrl?: string | DataLink
96
- /* Hash of `speakerEmbedUrl` */
97
- speakerEmbedHash?: string | DataLink
98
- /* Hash type of `speakerEmbedUrl` */
99
- speakerEmbedHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
100
- /* Speaker config, for OuteTTS model */
101
- speakerConfig?: {} | DataLink
102
- /* Audio token generation max length */
103
- maxLength?: number | DataLink
104
- /* Audio token generation temperature */
105
- temperature?: number | DataLink
106
- /* Audio token generation repetition penalty */
107
- repetitionPenalty?: number | DataLink
108
- /* Use greedy sampling for audio token generation */
109
- doSample?: boolean | DataLink
110
- /* Output mode */
111
- outputType?: 'play' | 'file' | DataLink
112
- /* Enable cache for generated audio */
113
- cacheGenerated?: boolean | DataLink
114
- /* Speed of the generated audio, for StyleTTS (Kokoro) */
115
- speed?: number | DataLink
116
- /* Text to generate */
117
- prompt?: string | DataLink
118
- /* Auto inference when prompt changes */
119
- autoInferEnable?: boolean | DataLink
120
- /* Segmentation rule for auto inference */
121
- softBreakRegex?: string | DataLink
122
- /* Time to force inference when softBreakRegex is not satisfied */
123
- hardBreakTime?: number | DataLink
124
- /* Executor candidates, descending order of priority
125
- Default will be xnnpack, wasm, cpu */
126
- executors?:
127
- | Array<'qnn' | 'dml' | 'nnapi' | 'xnnpack' | 'coreml' | 'cpu' | 'wasm' | 'webgpu' | DataLink>
128
- | DataLink
129
- /* Execution mode
130
- Usually when the model has many branches, setting this option to `parallel` will give you better performance. */
131
- executionMode?: 'sequential' | 'parallel' | DataLink
132
- /* QNN backend */
133
- qnnBackend?: 'HTP' | 'HTA' | 'DSP' | 'GPU' | 'CPU' | DataLink
134
- /* Enable FP16 for QNN HTP */
135
- qnnHtpEnableFp16?: boolean | DataLink
136
- /* Enable QNN debug */
137
- qnnEnableDebug?: boolean | DataLink
138
- }
139
- events?: {
140
- /* Event triggered when state change */
141
- onContextStateChange?: Array<
142
- EventAction<string & keyof TemplateEventPropsMap['Tts']['onContextStateChange']>
143
- >
144
- /* Event triggered when error occurs */
145
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Tts']['onError']>>
146
- }
147
- outlets?: {
148
- /* Context state */
149
- contextState?: () => Data<string>
150
- /* Generated audio file */
151
- generatedAudio?: () => Data<string>
152
- /* Generated audio file is playing */
153
- generatedAudioPlaying?: () => Data<boolean>
154
- }
155
- }
156
-
157
- /* Local Text-to-Speech (TTS) inference based on ONNX Runtime and [transformers.js](https://huggingface.co/docs/transformers.js)
158
- You can use any converted model on HuggingFace. */
159
- export type GeneratorTTS = Generator &
160
- GeneratorTTSDef & {
161
- templateKey: 'GENERATOR_TTS'
162
- switches?: Array<
163
- SwitchDef &
164
- GeneratorTTSDef & {
165
- conds?: Array<{
166
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
167
- cond:
168
- | SwitchCondInnerStateCurrentCanvas
169
- | SwitchCondData
170
- | {
171
- __typename: 'SwitchCondInnerStateOutlet'
172
- outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
173
- value: any
174
- }
175
- }>
176
- }
177
- >
178
- }
@@ -1,121 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * Generate speech from text using OpenAI's Text-to-Speech API
4
- */
5
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
- import type { Data, DataLink } from '../data'
7
- import type {
8
- Brick,
9
- Generator,
10
- EventAction,
11
- ActionWithDataParams,
12
- ActionWithParams,
13
- Action,
14
- EventProperty,
15
- } from '../common'
16
- import type { TemplateEventPropsMap } from '../../utils/event-props'
17
-
18
- /* Generate audio */
19
- export type GeneratorOpenAiTTSActionGenerate = ActionWithParams & {
20
- __actionName: 'GENERATOR_OPENAI_TTS_GENERATE'
21
- params?: Array<{
22
- input: 'text'
23
- value?: string | DataLink | EventProperty
24
- mapping?: string
25
- }>
26
- }
27
-
28
- /* Clean cache */
29
- export type GeneratorOpenAiTTSActionCleanCache = Action & {
30
- __actionName: 'GENERATOR_OPENAI_TTS_CLEAN_CACHE'
31
- }
32
-
33
- /* Cancel current generation and clear queue */
34
- export type GeneratorOpenAiTTSActionCancel = Action & {
35
- __actionName: 'GENERATOR_OPENAI_TTS_CANCEL'
36
- }
37
-
38
- interface GeneratorOpenAiTTSDef {
39
- /*
40
- Default property:
41
- {
42
- "apiEndpoint": "https://api.openai.com/v1",
43
- "model": "tts-1",
44
- "voice": "alloy",
45
- "speed": 1,
46
- "outputType": "play",
47
- "playbackVolume": 100,
48
- "cacheGenerated": true,
49
- "autoInferEnable": false,
50
- "softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
51
- "hardBreakTime": 500
52
- }
53
- */
54
- property?: {
55
- /* API endpoint URL */
56
- apiEndpoint?: string | DataLink
57
- /* OpenAI API Key */
58
- apiKey?: string | DataLink
59
- /* OpenAI TTS model */
60
- model?: string | DataLink
61
- /* Voice to use
62
- Select voice from https://openai.fm , default alloy */
63
- voice?: string | DataLink
64
- /* Additional instructions for the speech generation */
65
- instructions?: string | DataLink
66
- /* Speed of the generated audio */
67
- speed?: number | DataLink
68
- /* Output mode */
69
- outputType?: 'play' | 'file' | DataLink
70
- /* Playback volume (0 - 100) */
71
- playbackVolume?: number | DataLink
72
- /* Enable cache for generated audio */
73
- cacheGenerated?: boolean | DataLink
74
- /* Text to generate */
75
- prompt?: string | DataLink
76
- /* Auto inference when prompt changes */
77
- autoInferEnable?: boolean | DataLink
78
- /* Segmentation rule for auto inference */
79
- softBreakRegex?: string | DataLink
80
- /* Time to force inference when softBreakRegex is not satisfied */
81
- hardBreakTime?: number | DataLink
82
- }
83
- events?: {
84
- /* Event triggered when state change */
85
- onContextStateChange?: Array<
86
- EventAction<string & keyof TemplateEventPropsMap['OpenaiTts']['onContextStateChange']>
87
- >
88
- /* Event triggered when error occurs */
89
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['OpenaiTts']['onError']>>
90
- }
91
- outlets?: {
92
- /* Context state */
93
- contextState?: () => Data<string>
94
- /* Generated audio file */
95
- generatedAudio?: () => Data<string>
96
- /* Generated audio file is playing */
97
- generatedAudioPlaying?: () => Data<boolean>
98
- }
99
- }
100
-
101
- /* Generate speech from text using OpenAI's Text-to-Speech API */
102
- export type GeneratorOpenAiTTS = Generator &
103
- GeneratorOpenAiTTSDef & {
104
- templateKey: 'GENERATOR_OPENAI_TTS'
105
- switches?: Array<
106
- SwitchDef &
107
- GeneratorOpenAiTTSDef & {
108
- conds?: Array<{
109
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
110
- cond:
111
- | SwitchCondInnerStateCurrentCanvas
112
- | SwitchCondData
113
- | {
114
- __typename: 'SwitchCondInnerStateOutlet'
115
- outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
116
- value: any
117
- }
118
- }>
119
- }
120
- >
121
- }