@fugood/bricks-project 2.22.0-beta.9 → 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 +108 -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 -7633
|
@@ -0,0 +1,185 @@
|
|
|
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
|
+
/* Init thermal printer connection */
|
|
13
|
+
export type GeneratorThermalPrinterActionInit = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_THERMAL_PRINTER_INIT'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Scan thermal printer */
|
|
18
|
+
export type GeneratorThermalPrinterActionScan = Action & {
|
|
19
|
+
__actionName: 'GENERATOR_THERMAL_PRINTER_SCAN'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Dispose thermal printer connection */
|
|
23
|
+
export type GeneratorThermalPrinterActionDispose = Action & {
|
|
24
|
+
__actionName: 'GENERATOR_THERMAL_PRINTER_DISPOSE'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Start print */
|
|
28
|
+
export type GeneratorThermalPrinterActionPrint = ActionWithParams & {
|
|
29
|
+
__actionName: 'GENERATOR_THERMAL_PRINTER_PRINT'
|
|
30
|
+
params?: Array<
|
|
31
|
+
| {
|
|
32
|
+
input: 'options'
|
|
33
|
+
value?: {} | DataLink | EventProperty
|
|
34
|
+
mapping?: string
|
|
35
|
+
}
|
|
36
|
+
| {
|
|
37
|
+
input: 'payload'
|
|
38
|
+
value?: Array<any> | DataLink | EventProperty
|
|
39
|
+
mapping?: string
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
input: 'rawCommands'
|
|
43
|
+
value?: string | DataLink | EventProperty
|
|
44
|
+
mapping?: string
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Check thermal printer status */
|
|
50
|
+
export type GeneratorThermalPrinterActionCheckStatus = Action & {
|
|
51
|
+
__actionName: 'GENERATOR_THERMAL_PRINTER_CHECK_STATUS'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface GeneratorThermalPrinterDef {
|
|
55
|
+
/*
|
|
56
|
+
Default property:
|
|
57
|
+
{
|
|
58
|
+
"init": false,
|
|
59
|
+
"lang": "ANK",
|
|
60
|
+
"scanTimeout": 5000,
|
|
61
|
+
"stateUpdateInterval": 5000,
|
|
62
|
+
"cutMode": "PARTIAL"
|
|
63
|
+
}
|
|
64
|
+
*/
|
|
65
|
+
property?: {
|
|
66
|
+
/* Connect printer on generator initialized */
|
|
67
|
+
init?: boolean | DataLink
|
|
68
|
+
/* Connection driver */
|
|
69
|
+
driver?: 'escpos' | 'star' | 'tsc' | DataLink
|
|
70
|
+
/* The address of the printer */
|
|
71
|
+
connectString?: string | DataLink
|
|
72
|
+
/* The language of the printer (only for EPSON) */
|
|
73
|
+
lang?: 'ANK' | 'CHINESE' | 'TAIWAN' | 'KOREAN' | 'THAI' | 'SOUTHASIA' | DataLink
|
|
74
|
+
/* The timeout of scanning */
|
|
75
|
+
scanTimeout?: number | DataLink
|
|
76
|
+
/* State update interval, 0 means no update automatically */
|
|
77
|
+
stateUpdateInterval?: number | DataLink
|
|
78
|
+
/* Enable page mode on printing */
|
|
79
|
+
pageMode?: boolean | DataLink
|
|
80
|
+
/* Printable page area width */
|
|
81
|
+
pageWidth?: number | DataLink
|
|
82
|
+
/* Printable page area height */
|
|
83
|
+
pageHeight?: number | DataLink
|
|
84
|
+
/* Cut mode at the end of printing */
|
|
85
|
+
cutMode?: 'NONE' | 'FULL' | 'PARTIAL' | DataLink
|
|
86
|
+
/* Print payload
|
|
87
|
+
example:
|
|
88
|
+
{ type: 'text', content: 'Hello, World!' }
|
|
89
|
+
{ type: 'feed', feedLines: 1 }
|
|
90
|
+
{ type: 'reverse-feed', feedLines: 1 }
|
|
91
|
+
{ type: 'image', content: '/path/to/file' }
|
|
92
|
+
{ type: 'line-space', lineSpace: 1 }
|
|
93
|
+
{ type: 'barcode', content: '1234567890', barcodeType: 'CODE128' }
|
|
94
|
+
{ type: 'symbol', content: '1234567890', symbolType: 'QRCODE' }
|
|
95
|
+
Notes:
|
|
96
|
+
- `reverse-feed` only works on ESC/POS driver
|
|
97
|
+
- `width` and `height` in Star driver is magnification factor
|
|
98
|
+
- `y` position in ESC/POS is use feed lines to offset
|
|
99
|
+
- `textFont` only works on TSC driver */
|
|
100
|
+
payload?:
|
|
101
|
+
| Array<
|
|
102
|
+
| DataLink
|
|
103
|
+
| {
|
|
104
|
+
type?:
|
|
105
|
+
| 'text'
|
|
106
|
+
| 'image'
|
|
107
|
+
| 'barcode'
|
|
108
|
+
| 'qrcode'
|
|
109
|
+
| 'line-space'
|
|
110
|
+
| 'feed'
|
|
111
|
+
| 'reverse-feed'
|
|
112
|
+
| DataLink
|
|
113
|
+
content?: string | DataLink
|
|
114
|
+
width?: number | DataLink
|
|
115
|
+
height?: number | DataLink
|
|
116
|
+
x?: number | DataLink
|
|
117
|
+
y?: number | DataLink
|
|
118
|
+
align?: 'LEFT' | 'CENTER' | 'RIGHT' | DataLink
|
|
119
|
+
textSmooth?: boolean | DataLink
|
|
120
|
+
textEmphasize?: boolean | DataLink
|
|
121
|
+
textUnderline?: boolean | DataLink
|
|
122
|
+
textLang?: 'EN' | 'JA' | 'ZH_CN' | 'ZH_TW' | 'KO' | 'TH' | 'VI' | 'MULTI' | DataLink
|
|
123
|
+
textFont?: string | DataLink
|
|
124
|
+
barcodeType?:
|
|
125
|
+
| 'CODE39'
|
|
126
|
+
| 'CODE93'
|
|
127
|
+
| 'CODE128'
|
|
128
|
+
| 'EAN13'
|
|
129
|
+
| 'JAN13'
|
|
130
|
+
| 'EAN8'
|
|
131
|
+
| 'JAN8'
|
|
132
|
+
| 'UPC_A'
|
|
133
|
+
| 'UPC_E'
|
|
134
|
+
| 'ITF'
|
|
135
|
+
| DataLink
|
|
136
|
+
barcodeHRI?: 'OFF' | 'ABOVE' | 'BELOW' | 'BOTH' | DataLink
|
|
137
|
+
qrcodeModel?: '1' | '2' | DataLink
|
|
138
|
+
qrcodeSize?: number | DataLink
|
|
139
|
+
qrcodeLevel?: 'L' | 'M' | 'Q' | 'H' | DataLink
|
|
140
|
+
qrcodeMask?: 'S0' | 'S1' | 'S2' | 'S3' | 'S4' | 'S5' | 'S6' | 'S7' | DataLink
|
|
141
|
+
feedLines?: number | DataLink
|
|
142
|
+
lineSpace?: number | DataLink
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
| DataLink
|
|
146
|
+
/* Raw ASCII commands to print */
|
|
147
|
+
rawCommands?: string | DataLink
|
|
148
|
+
}
|
|
149
|
+
events?: {
|
|
150
|
+
/* Event of connection error */
|
|
151
|
+
onError?: Array<EventAction>
|
|
152
|
+
}
|
|
153
|
+
outlets?: {
|
|
154
|
+
/* Is thermal printer initialized */
|
|
155
|
+
initialized?: () => Data
|
|
156
|
+
/* Thermal printer status */
|
|
157
|
+
status?: () => Data
|
|
158
|
+
/* Discovered devices */
|
|
159
|
+
discoveredDevices?: () => Data
|
|
160
|
+
/* Last error message */
|
|
161
|
+
lastError?: () => Data
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Thermal Printer */
|
|
166
|
+
export type GeneratorThermalPrinter = Generator &
|
|
167
|
+
GeneratorThermalPrinterDef & {
|
|
168
|
+
templateKey: 'GENERATOR_THERMAL_PRINTER'
|
|
169
|
+
switches: Array<
|
|
170
|
+
SwitchDef &
|
|
171
|
+
GeneratorThermalPrinterDef & {
|
|
172
|
+
conds?: Array<{
|
|
173
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
174
|
+
cond:
|
|
175
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
176
|
+
| SwitchCondData
|
|
177
|
+
| {
|
|
178
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
179
|
+
outlet: 'initialized' | 'status' | 'discoveredDevices' | 'lastError'
|
|
180
|
+
value: any
|
|
181
|
+
}
|
|
182
|
+
}>
|
|
183
|
+
}
|
|
184
|
+
>
|
|
185
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 the tick */
|
|
13
|
+
export type GeneratorTickAction_ = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_TICK'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Cancel the tick */
|
|
18
|
+
export type GeneratorTickActionCancel = Action & {
|
|
19
|
+
__actionName: 'GENERATOR_TICK_CANCEL'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface GeneratorTickDef {
|
|
23
|
+
/*
|
|
24
|
+
Default property:
|
|
25
|
+
{}
|
|
26
|
+
*/
|
|
27
|
+
property?: {
|
|
28
|
+
/* Start tick on generator initialized */
|
|
29
|
+
init?: boolean | DataLink
|
|
30
|
+
/* Interval of second for countdown */
|
|
31
|
+
interval?: number | DataLink
|
|
32
|
+
/* Initial value of countdown */
|
|
33
|
+
countdownStartValue?: number | DataLink
|
|
34
|
+
/* Interval of value for countdown */
|
|
35
|
+
countdownInterval?: number | DataLink
|
|
36
|
+
/* Make countdown repeatable */
|
|
37
|
+
repeat?: boolean | DataLink
|
|
38
|
+
/* Map for PROPERTY_BANK_RESULT */
|
|
39
|
+
map?: {} | DataLink
|
|
40
|
+
/* Fallback of MAP_OBJECT */
|
|
41
|
+
mapFallback?: any
|
|
42
|
+
}
|
|
43
|
+
events?: {
|
|
44
|
+
/* Event for each tick start */
|
|
45
|
+
ticking?: Array<EventAction>
|
|
46
|
+
/* Event for tick completed */
|
|
47
|
+
completed?: Array<EventAction>
|
|
48
|
+
}
|
|
49
|
+
outlets?: {
|
|
50
|
+
/* Countdown step value */
|
|
51
|
+
countdown?: () => Data
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Execute event in countdown manner */
|
|
56
|
+
export type GeneratorTick = Generator &
|
|
57
|
+
GeneratorTickDef & {
|
|
58
|
+
templateKey: 'GENERATOR_TICK'
|
|
59
|
+
switches: Array<
|
|
60
|
+
SwitchDef &
|
|
61
|
+
GeneratorTickDef & {
|
|
62
|
+
conds?: Array<{
|
|
63
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
64
|
+
cond:
|
|
65
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
66
|
+
| SwitchCondData
|
|
67
|
+
| {
|
|
68
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
69
|
+
outlet: 'countdown'
|
|
70
|
+
value: any
|
|
71
|
+
}
|
|
72
|
+
}>
|
|
73
|
+
}
|
|
74
|
+
>
|
|
75
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
/* Bind UDP port */
|
|
13
|
+
export type GeneratorUDPActionBind = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_UDP_BIND'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Send data to target */
|
|
18
|
+
export type GeneratorUDPActionSend = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_UDP_SEND'
|
|
20
|
+
params?: Array<
|
|
21
|
+
| {
|
|
22
|
+
input: 'targetHost'
|
|
23
|
+
value?: string | DataLink | EventProperty
|
|
24
|
+
mapping?: string
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
input: 'targetPort'
|
|
28
|
+
value?: number | DataLink | EventProperty
|
|
29
|
+
mapping?: string
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
input: 'sendData'
|
|
33
|
+
value?: string | DataLink | EventProperty
|
|
34
|
+
mapping?: string
|
|
35
|
+
}
|
|
36
|
+
>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Close UDP */
|
|
40
|
+
export type GeneratorUDPActionClose = Action & {
|
|
41
|
+
__actionName: 'GENERATOR_UDP_CLOSE'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface GeneratorUDPDef {
|
|
45
|
+
/*
|
|
46
|
+
Default property:
|
|
47
|
+
{
|
|
48
|
+
"init": false,
|
|
49
|
+
"type": "udp4",
|
|
50
|
+
"encoding": "base64",
|
|
51
|
+
"broadcast": false,
|
|
52
|
+
"multicast": ""
|
|
53
|
+
}
|
|
54
|
+
*/
|
|
55
|
+
property?: {
|
|
56
|
+
/* Bind port on generator initialized */
|
|
57
|
+
init?: boolean | DataLink
|
|
58
|
+
/* The family of socket */
|
|
59
|
+
type?: 'udp4' | 'udp6' | DataLink
|
|
60
|
+
/* Encoding of data */
|
|
61
|
+
encoding?: 'base64' | 'utf8' | 'ascii' | DataLink
|
|
62
|
+
/* Local bind port of UDP (0 or empty is random) */
|
|
63
|
+
localPort?: number | DataLink
|
|
64
|
+
/* Enable receive broadcast packets */
|
|
65
|
+
broadcast?: boolean | DataLink
|
|
66
|
+
/* Join multicast group (Multicast address) */
|
|
67
|
+
multicast?: string | DataLink
|
|
68
|
+
}
|
|
69
|
+
events?: {
|
|
70
|
+
/* Event of UDP port is binded */
|
|
71
|
+
onReady?: Array<EventAction>
|
|
72
|
+
/* Event of receive data */
|
|
73
|
+
onData?: Array<EventAction>
|
|
74
|
+
/* Event of socket closeed */
|
|
75
|
+
onClose?: Array<EventAction>
|
|
76
|
+
/* Event of socket error */
|
|
77
|
+
onError?: Array<EventAction>
|
|
78
|
+
}
|
|
79
|
+
outlets?: {
|
|
80
|
+
/* Local UDP binded port */
|
|
81
|
+
port?: () => Data
|
|
82
|
+
/* Last received packet */
|
|
83
|
+
lastReceive?: () => Data
|
|
84
|
+
/* Error message */
|
|
85
|
+
errorMessage?: () => Data
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* TCP Server */
|
|
90
|
+
export type GeneratorUDP = Generator &
|
|
91
|
+
GeneratorUDPDef & {
|
|
92
|
+
templateKey: 'GENERATOR_UDP'
|
|
93
|
+
switches: Array<
|
|
94
|
+
SwitchDef &
|
|
95
|
+
GeneratorUDPDef & {
|
|
96
|
+
conds?: Array<{
|
|
97
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
98
|
+
cond:
|
|
99
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
100
|
+
| SwitchCondData
|
|
101
|
+
| {
|
|
102
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
103
|
+
outlet: 'port' | 'lastReceive' | 'errorMessage'
|
|
104
|
+
value: any
|
|
105
|
+
}
|
|
106
|
+
}>
|
|
107
|
+
}
|
|
108
|
+
>
|
|
109
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
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 GeneratorVadInferenceActionLoadModel = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_VAD_INFERENCE_LOAD_MODEL'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Detect speech in audio file. You can provide `File URL` property, if not provided, it will use the default `File URL` */
|
|
18
|
+
export type GeneratorVadInferenceActionDetectFile = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_VAD_INFERENCE_DETECT_FILE'
|
|
20
|
+
params?: Array<
|
|
21
|
+
| {
|
|
22
|
+
input: 'fileUrl'
|
|
23
|
+
value?: string | DataLink | EventProperty
|
|
24
|
+
mapping?: string
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
input: 'threshold'
|
|
28
|
+
value?: number | DataLink | EventProperty
|
|
29
|
+
mapping?: string
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
input: 'minSpeechDurationMs'
|
|
33
|
+
value?: number | DataLink | EventProperty
|
|
34
|
+
mapping?: string
|
|
35
|
+
}
|
|
36
|
+
| {
|
|
37
|
+
input: 'minSilenceDurationMs'
|
|
38
|
+
value?: number | DataLink | EventProperty
|
|
39
|
+
mapping?: string
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
input: 'maxSpeechDurationS'
|
|
43
|
+
value?: number | DataLink | EventProperty
|
|
44
|
+
mapping?: string
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
input: 'speechPadMs'
|
|
48
|
+
value?: number | DataLink | EventProperty
|
|
49
|
+
mapping?: string
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
input: 'samplesOverlap'
|
|
53
|
+
value?: number | DataLink | EventProperty
|
|
54
|
+
mapping?: string
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Detect speech in audio data. Currently only support base64 encoded audio data (16-bit PCM, mono, 16kHz) */
|
|
60
|
+
export type GeneratorVadInferenceActionDetectData = ActionWithParams & {
|
|
61
|
+
__actionName: 'GENERATOR_VAD_INFERENCE_DETECT_DATA'
|
|
62
|
+
params?: Array<
|
|
63
|
+
| {
|
|
64
|
+
input: 'data'
|
|
65
|
+
value?: any | EventProperty
|
|
66
|
+
mapping?: string
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
input: 'threshold'
|
|
70
|
+
value?: number | DataLink | EventProperty
|
|
71
|
+
mapping?: string
|
|
72
|
+
}
|
|
73
|
+
| {
|
|
74
|
+
input: 'minSpeechDurationMs'
|
|
75
|
+
value?: number | DataLink | EventProperty
|
|
76
|
+
mapping?: string
|
|
77
|
+
}
|
|
78
|
+
| {
|
|
79
|
+
input: 'minSilenceDurationMs'
|
|
80
|
+
value?: number | DataLink | EventProperty
|
|
81
|
+
mapping?: string
|
|
82
|
+
}
|
|
83
|
+
| {
|
|
84
|
+
input: 'maxSpeechDurationS'
|
|
85
|
+
value?: number | DataLink | EventProperty
|
|
86
|
+
mapping?: string
|
|
87
|
+
}
|
|
88
|
+
| {
|
|
89
|
+
input: 'speechPadMs'
|
|
90
|
+
value?: number | DataLink | EventProperty
|
|
91
|
+
mapping?: string
|
|
92
|
+
}
|
|
93
|
+
| {
|
|
94
|
+
input: 'samplesOverlap'
|
|
95
|
+
value?: number | DataLink | EventProperty
|
|
96
|
+
mapping?: string
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Clear downloaded files (model, audio) & current jobs */
|
|
102
|
+
export type GeneratorVadInferenceActionClearDownload = Action & {
|
|
103
|
+
__actionName: 'GENERATOR_VAD_INFERENCE_CLEAR_DOWNLOAD'
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Release context */
|
|
107
|
+
export type GeneratorVadInferenceActionReleaseContext = Action & {
|
|
108
|
+
__actionName: 'GENERATOR_VAD_INFERENCE_RELEASE_CONTEXT'
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface GeneratorVadInferenceDef {
|
|
112
|
+
/*
|
|
113
|
+
Default property:
|
|
114
|
+
{
|
|
115
|
+
"init": false,
|
|
116
|
+
"modelName": "silero-v5.1.2",
|
|
117
|
+
"modelUseGPU": true,
|
|
118
|
+
"modelThreads": 4,
|
|
119
|
+
"detectThreshold": 0.5,
|
|
120
|
+
"detectMinSpeechDurationMs": 250,
|
|
121
|
+
"detectMinSilenceDurationMs": 100,
|
|
122
|
+
"detectMaxSpeechDurationS": 30,
|
|
123
|
+
"detectSpeechPadMs": 30,
|
|
124
|
+
"detectSamplesOverlap": 0.1
|
|
125
|
+
}
|
|
126
|
+
*/
|
|
127
|
+
property?: {
|
|
128
|
+
/* Initialize the VAD context on generator initialization
|
|
129
|
+
Please note that it will take some RAM depending on the model size */
|
|
130
|
+
init?: boolean | DataLink
|
|
131
|
+
/* Use model name, currently only supports the Silero VAD model.
|
|
132
|
+
The model download progress will be done in preload stage or the generator initialization stage.
|
|
133
|
+
You can also choose `custom` option and set `Model URL` and `Model SHA1` to use your own model */
|
|
134
|
+
modelName?: 'custom' | 'silero-v5.1.2' | DataLink
|
|
135
|
+
/* The URL or path of model
|
|
136
|
+
We used `ggml` format model, please refer to https://huggingface.co/ggml-org/whisper-vad */
|
|
137
|
+
modelUrl?: string | DataLink
|
|
138
|
+
/* Hash type of model */
|
|
139
|
+
modelHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
|
|
140
|
+
/* Hash of model */
|
|
141
|
+
modelHash?: string | DataLink
|
|
142
|
+
/* Use GPU Acceleration for inference. Currently iOS only. */
|
|
143
|
+
modelUseGPU?: boolean | DataLink
|
|
144
|
+
/* Number of threads to use for processing */
|
|
145
|
+
modelThreads?: number | DataLink
|
|
146
|
+
/* Speech probability threshold (0.0-1.0) */
|
|
147
|
+
detectThreshold?: number | DataLink
|
|
148
|
+
/* Minimum speech duration in milliseconds */
|
|
149
|
+
detectMinSpeechDurationMs?: number | DataLink
|
|
150
|
+
/* Minimum silence duration in milliseconds */
|
|
151
|
+
detectMinSilenceDurationMs?: number | DataLink
|
|
152
|
+
/* Maximum speech duration in seconds */
|
|
153
|
+
detectMaxSpeechDurationS?: number | DataLink
|
|
154
|
+
/* Padding around speech segments in milliseconds */
|
|
155
|
+
detectSpeechPadMs?: number | DataLink
|
|
156
|
+
/* Overlap between analysis windows (0.0-1.0) */
|
|
157
|
+
detectSamplesOverlap?: number | DataLink
|
|
158
|
+
/* The file URL or path to be analyzed.
|
|
159
|
+
It only supported `wav` format with 16kHz sample rate & single (mono) channel */
|
|
160
|
+
detectFileUrl?: string | DataLink
|
|
161
|
+
/* MD5 of file to be analyzed */
|
|
162
|
+
detectFileMd5?: string | DataLink
|
|
163
|
+
}
|
|
164
|
+
events?: {
|
|
165
|
+
/* Event triggered when context state changes */
|
|
166
|
+
onContextStateChange?: Array<EventAction>
|
|
167
|
+
/* Event triggered when error occurs */
|
|
168
|
+
onError?: Array<EventAction>
|
|
169
|
+
/* Event triggered when got detection result */
|
|
170
|
+
onDetected?: Array<EventAction>
|
|
171
|
+
}
|
|
172
|
+
outlets?: {
|
|
173
|
+
/* Context state */
|
|
174
|
+
contextState?: () => Data
|
|
175
|
+
/* Context details */
|
|
176
|
+
contextDetails?: () => Data
|
|
177
|
+
/* Is detecting */
|
|
178
|
+
isDetecting?: () => Data
|
|
179
|
+
/* Detection segments result */
|
|
180
|
+
detectionSegments?: () => Data
|
|
181
|
+
/* Detection details */
|
|
182
|
+
detectionDetails?: () => Data
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* Local Voice Activity Detection (VAD) inference based on GGML and [whisper.rn](https://github.com/mybigday/whisper.rn) */
|
|
187
|
+
export type GeneratorVadInference = Generator &
|
|
188
|
+
GeneratorVadInferenceDef & {
|
|
189
|
+
templateKey: 'GENERATOR_VAD_INFERENCE'
|
|
190
|
+
switches: Array<
|
|
191
|
+
SwitchDef &
|
|
192
|
+
GeneratorVadInferenceDef & {
|
|
193
|
+
conds?: Array<{
|
|
194
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
195
|
+
cond:
|
|
196
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
197
|
+
| SwitchCondData
|
|
198
|
+
| {
|
|
199
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
200
|
+
outlet:
|
|
201
|
+
| 'contextState'
|
|
202
|
+
| 'contextDetails'
|
|
203
|
+
| 'isDetecting'
|
|
204
|
+
| 'detectionSegments'
|
|
205
|
+
| 'detectionDetails'
|
|
206
|
+
value: any
|
|
207
|
+
}
|
|
208
|
+
}>
|
|
209
|
+
}
|
|
210
|
+
>
|
|
211
|
+
}
|