@fugood/bricks-project 2.22.0-beta.14 → 2.22.0-beta.16

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.
@@ -100,6 +100,9 @@ export const templateActionNameMap = {
100
100
  payloadType: 'CHANNEL_PUBLISH_PAYLOAD_TYPE',
101
101
  payload: 'CHANNEL_PUBLISH_PAYLOAD',
102
102
  },
103
+ DELAY: {
104
+ time: 'DELAY_TIME',
105
+ },
103
106
  USE_SHARE_APPLICATION: {
104
107
  applicationId: 'APPLICATION_ID',
105
108
  releaseVersion: 'RELEASE_VERSION',
@@ -142,6 +145,13 @@ export const templateActionNameMap = {
142
145
  },
143
146
  },
144
147
 
148
+ BRICK_VIDEO: {
149
+ BRICK_VIDEO_SEEK: {
150
+ seekTime: 'BRICK_VIDEO_SEEK_TIME',
151
+ play: 'BRICK_VIDEO_PLAY',
152
+ },
153
+ },
154
+
145
155
  BRICK_SLIDESHOW: {
146
156
  BRICK_SLIDESHOW_JUMP_TO_INDEX: {
147
157
  index: 'BRICK_SLIDESHOW_INDEX',
@@ -231,7 +241,12 @@ export const templateActionNameMap = {
231
241
  index: 'BRICK_ITEMS_INDEX',
232
242
  },
233
243
  },
234
-
244
+ BRICK_LOTTIE: {
245
+ BRICK_LOTTIE_PLAY: {
246
+ startFrame: 'BRICK_LOTTIE_START_FRAME',
247
+ endFrame: 'BRICK_LOTTIE_END_FRAME',
248
+ },
249
+ },
235
250
  BRICK_RIVE: {
236
251
  BRICK_RIVE_PLAY: {
237
252
  animationName: 'BRICK_RIVE_ANIMATION_NAME',
@@ -595,6 +610,26 @@ export const templateActionNameMap = {
595
610
  realtimeVadFreqThold: 'GENERATOR_SPEECH_INFERENCE_REALTIME_VAD_FREQ_THOLD',
596
611
  },
597
612
  },
613
+ GENERATOR_VAD_INFERENCE: {
614
+ GENERATOR_VAD_INFERENCE_DETECT_FILE: {
615
+ fileUrl: 'GENERATOR_VAD_INFERENCE_FILE_URL',
616
+ threshold: 'GENERATOR_VAD_INFERENCE_THRESHOLD',
617
+ minSpeechDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SPEECH_DURATION_MS',
618
+ minSilenceDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SILENCE_DURATION_MS',
619
+ maxSpeechDurationS: 'GENERATOR_VAD_INFERENCE_MAX_SPEECH_DURATION_S',
620
+ speechPadMs: 'GENERATOR_VAD_INFERENCE_SPEECH_PAD_MS',
621
+ samplesOverlap: 'GENERATOR_VAD_INFERENCE_SAMPLES_OVERLAP',
622
+ },
623
+ GENERATOR_VAD_INFERENCE_DETECT_DATA: {
624
+ data: 'GENERATOR_VAD_INFERENCE_DATA',
625
+ threshold: 'GENERATOR_VAD_INFERENCE_THRESHOLD',
626
+ minSpeechDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SPEECH_DURATION_MS',
627
+ minSilenceDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SILENCE_DURATION_MS',
628
+ maxSpeechDurationS: 'GENERATOR_VAD_INFERENCE_MAX_SPEECH_DURATION_S',
629
+ speechPadMs: 'GENERATOR_VAD_INFERENCE_SPEECH_PAD_MS',
630
+ samplesOverlap: 'GENERATOR_VAD_INFERENCE_SAMPLES_OVERLAP',
631
+ },
632
+ },
598
633
  GENERATOR_LLM: {
599
634
  GENERATOR_LLM_TOKENIZE: {
600
635
  mode: 'GENERATOR_LLM_MODE',
@@ -612,6 +647,7 @@ export const templateActionNameMap = {
612
647
  tools: 'GENERATOR_LLM_TOOLS',
613
648
  parallelToolCalls: 'GENERATOR_LLM_PARALLEL_TOOL_CALLS',
614
649
  toolChoice: 'GENERATOR_LLM_TOOL_CHOICE',
650
+ enableThinking: 'GENERATOR_LLM_ENABLE_THINKING',
615
651
  prompt: 'GENERATOR_LLM_PROMPT',
616
652
  promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
617
653
  promptTemplateData: 'GENERATOR_LLM_PROMPT_TEMPLATE_DATA',
@@ -625,6 +661,7 @@ export const templateActionNameMap = {
625
661
  tools: 'GENERATOR_LLM_TOOLS',
626
662
  parallelToolCalls: 'GENERATOR_LLM_PARALLEL_TOOL_CALLS',
627
663
  toolChoice: 'GENERATOR_LLM_TOOL_CHOICE',
664
+ enableThinking: 'GENERATOR_LLM_ENABLE_THINKING',
628
665
  prompt: 'GENERATOR_LLM_PROMPT',
629
666
  promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
630
667
  promptTemplateData: 'GENERATOR_LLM_PROMPT_TEMPLATE_DATA',
@@ -663,6 +700,17 @@ export const templateActionNameMap = {
663
700
  sessionCustomKey: 'GENERATOR_LLM_SESSION_CUSTOM_KEY',
664
701
  },
665
702
  },
703
+ GENERATOR_GGML_TTS: {
704
+ GENERATOR_GGML_TTS_GENERATE: {
705
+ text: 'GENERATOR_GGML_TTS_TEXT',
706
+ },
707
+ },
708
+ GENERATOR_RERANKER: {
709
+ GENERATOR_RERANKER_RERANK: {
710
+ query: 'GENERATOR_RERANKER_QUERY',
711
+ documents: 'GENERATOR_RERANKER_DOCUMENTS',
712
+ },
713
+ },
666
714
  GENERATOR_QNN_LLM: {
667
715
  GENERATOR_QNN_LLM_GENERATE: {
668
716
  prompt: 'GENERATOR_QNN_LLM_PROMPT',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.22.0-beta.14",
3
+ "version": "2.22.0-beta.16",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "build": "node scripts/build.js"
@@ -14,5 +14,5 @@
14
14
  "lodash": "^4.17.4",
15
15
  "uuid": "^8.3.1"
16
16
  },
17
- "gitHead": "4b62185a9ec82561db90d85b8281de9e67f978ae"
17
+ "gitHead": "d8231fa6787b8d95bc2bec94a86ceba596cf57f0"
18
18
  }
@@ -1,15 +1,7 @@
1
1
  import { $ } from 'bun'
2
2
  import { stat, readFile, writeFile } from 'fs/promises'
3
- const cwd = process.cwd()
4
-
5
- const libFiles = ['types', 'utils', 'index.ts']
6
3
 
7
- await $`mkdir -p ${cwd}/project`
8
- for (const file of libFiles) {
9
- await $`cp -r ${__dirname}/../${file} ${cwd}/project`
10
- }
11
-
12
- console.log('Copied files to project/')
4
+ const cwd = process.cwd()
13
5
 
14
6
  async function exists(f: string) {
15
7
  try {
@@ -20,6 +12,21 @@ async function exists(f: string) {
20
12
  }
21
13
  }
22
14
 
15
+ // handle flag --skip-copy
16
+ const skipCopyProject = process.argv.includes('--skip-copy-project')
17
+ if (skipCopyProject) {
18
+ console.log('Skipping copy of files to project/')
19
+ } else {
20
+
21
+ const libFiles = ['types', 'utils', 'index.ts']
22
+
23
+ await $`mkdir -p ${cwd}/project`
24
+ for (const file of libFiles) {
25
+ await $`cp -r ${__dirname}/../${file} ${cwd}/project`
26
+ }
27
+ console.log('Copied files to project/')
28
+ }
29
+
23
30
  const projectMcpServer = {
24
31
  command: 'bun',
25
32
  args: [`${cwd}/node_modules/@fugood/bricks-project/tools/mcp-server.ts`],
package/types/bricks.ts CHANGED
@@ -865,6 +865,43 @@ export type BrickIcon = Brick &
865
865
  >
866
866
  }
867
867
 
868
+ /* Play the video */
869
+ export type BrickVideoActionPlay = Action & {
870
+ __actionName: 'BRICK_VIDEO_PLAY'
871
+ }
872
+
873
+ /* Seek the video */
874
+ export type BrickVideoActionSeek = ActionWithParams & {
875
+ __actionName: 'BRICK_VIDEO_SEEK'
876
+ params?: Array<
877
+ | {
878
+ input: 'seekTime'
879
+ value?: number | DataLink | EventProperty
880
+ mapping?: string
881
+ }
882
+ | {
883
+ input: 'play'
884
+ value?: boolean | DataLink | EventProperty
885
+ mapping?: string
886
+ }
887
+ >
888
+ }
889
+
890
+ /* Pause the video */
891
+ export type BrickVideoActionPause = Action & {
892
+ __actionName: 'BRICK_VIDEO_PAUSE'
893
+ }
894
+
895
+ /* Replay the video */
896
+ export type BrickVideoActionReplay = Action & {
897
+ __actionName: 'BRICK_VIDEO_REPLAY'
898
+ }
899
+
900
+ /* Stop the video */
901
+ export type BrickVideoActionStop = Action & {
902
+ __actionName: 'BRICK_VIDEO_STOP'
903
+ }
904
+
868
905
  interface BrickVideoDef {
869
906
  /*
870
907
  Default property:
@@ -2108,6 +2145,43 @@ export type BrickItems = Brick &
2108
2145
  >
2109
2146
  }
2110
2147
 
2148
+ /* Play animation */
2149
+ export type BrickLottieActionPlay = ActionWithParams & {
2150
+ __actionName: 'BRICK_LOTTIE_PLAY'
2151
+ params?: Array<
2152
+ | {
2153
+ input: 'startFrame'
2154
+ value?: number | DataLink | EventProperty
2155
+ mapping?: string
2156
+ }
2157
+ | {
2158
+ input: 'endFrame'
2159
+ value?: number | DataLink | EventProperty
2160
+ mapping?: string
2161
+ }
2162
+ >
2163
+ }
2164
+
2165
+ /* Pause animation */
2166
+ export type BrickLottieActionPause = Action & {
2167
+ __actionName: 'BRICK_LOTTIE_PAUSE'
2168
+ }
2169
+
2170
+ /* Resume animation */
2171
+ export type BrickLottieActionResume = Action & {
2172
+ __actionName: 'BRICK_LOTTIE_RESUME'
2173
+ }
2174
+
2175
+ /* Stop animation */
2176
+ export type BrickLottieActionStop = Action & {
2177
+ __actionName: 'BRICK_LOTTIE_STOP'
2178
+ }
2179
+
2180
+ /* Reset animation */
2181
+ export type BrickLottieActionReset = Action & {
2182
+ __actionName: 'BRICK_LOTTIE_RESET'
2183
+ }
2184
+
2111
2185
  interface BrickLottieDef {
2112
2186
  /*
2113
2187
  Default property:
@@ -2990,6 +3064,10 @@ Default property:
2990
3064
  type?: 'image' | 'video' | DataLink
2991
3065
  /* Default image to display when no generated image is available */
2992
3066
  defaultImage?: string | DataLink
3067
+ /* The hash of the default image */
3068
+ defaultImageHash?: string | DataLink
3069
+ /* The type of the default image hash */
3070
+ defaultImageHashType?: 'md5' | 'sha1' | 'sha256' | DataLink
2993
3071
  /* The Lottie animation to show while generating */
2994
3072
  loadingAnimation?: string | DataLink
2995
3073
  /* The Lottie animation to show when an error occurs */
package/types/common.ts CHANGED
@@ -65,7 +65,7 @@ export type ItemBrickID = string
65
65
 
66
66
  export type EventAction = {
67
67
  handler: 'system' | (() => Brick | Generator) | SubspaceID | ItemBrickID
68
- action: Action
68
+ action: ActionWithParams | ActionWithDataParams
69
69
  waitAsync?: boolean
70
70
  }
71
71
 
@@ -182,8 +182,8 @@ export type GeneratorFileActionReadContent = ActionWithParams & {
182
182
  }
183
183
 
184
184
  /* Delete */
185
- export type GeneratorFileActionGeneratorDeleteFile = Action & {
186
- __actionName: 'GENERATOR_DELETE_FILE'
185
+ export type GeneratorFileActionDelete = Action & {
186
+ __actionName: 'GENERATOR_FILE_DELETE'
187
187
  }
188
188
 
189
189
  /* Append (Currently only support text file) */
@@ -4850,8 +4850,13 @@ Default property:
4850
4850
  "model": "BricksDisplay/vits-eng",
4851
4851
  "modelType": "auto",
4852
4852
  "vocoderModel": "speecht5_hifigan",
4853
+ "maxLength": 4096,
4854
+ "temperature": 0.1,
4855
+ "repetitionPenalty": 1.1,
4856
+ "doSample": true,
4853
4857
  "outputType": "play",
4854
4858
  "cacheGenerated": true,
4859
+ "speed": 1,
4855
4860
  "autoInferEnable": false,
4856
4861
  "softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
4857
4862
  "hardBreakTime": 500,
@@ -4868,6 +4873,9 @@ Default property:
4868
4873
  | 'BricksDisplay/vits-eng'
4869
4874
  | 'BricksDisplay/vits-cmn'
4870
4875
  | 'BricksDisplay/ellie-Bert-VITS2'
4876
+ | 'onnx-community/Kokoro-82M-v1.0-ONNX'
4877
+ | 'onnx-community/Kokoro-82M-v1.1-zh-ONNX'
4878
+ | 'onnx-community/OuteTTS-1.0-0.6B-ONNX'
4871
4879
  | 'mms-tts-ara (NC)'
4872
4880
  | 'mms-tts-deu (NC)'
4873
4881
  | 'mms-tts-eng (NC)'
@@ -4883,7 +4891,14 @@ Default property:
4883
4891
  | 'speecht5_tts'
4884
4892
  | DataLink
4885
4893
  /* Model type */
4886
- modelType?: 'auto' | 'vits' | 'bert_vits2' | 'speecht5' | DataLink
4894
+ modelType?:
4895
+ | 'auto'
4896
+ | 'vits'
4897
+ | 'bert_vits2'
4898
+ | 'style_text_to_speech_2'
4899
+ | 'speecht5'
4900
+ | 'outetts-1.0'
4901
+ | DataLink
4887
4902
  /* Load quantized model (deprecated, use `quantizeType` instead) */
4888
4903
  quantized?: boolean | DataLink
4889
4904
  /* Quantize type */
@@ -4906,14 +4921,26 @@ Default property:
4906
4921
  /* Custom vocoder model
4907
4922
  Choose model from https://huggingface.co/models?library=transformers.js&other=hifigan */
4908
4923
  customVocoderModel?: string | DataLink
4909
- /* XVector speaker embedding for HiFi-GAN */
4924
+ /* Speaker embedding, for SpeechT5 or StyleTTS (Kokoro) */
4910
4925
  speakerEmbedUrl?: string | DataLink
4911
4926
  /* MD5 checksum of `speakerEmbedUrl` */
4912
4927
  speakerEmbedMd5?: string | DataLink
4928
+ /* Speaker config, for OuteTTS model */
4929
+ speakerConfig?: {} | DataLink
4930
+ /* Audio token generation max length */
4931
+ maxLength?: number | DataLink
4932
+ /* Audio token generation temperature */
4933
+ temperature?: number | DataLink
4934
+ /* Audio token generation repetition penalty */
4935
+ repetitionPenalty?: number | DataLink
4936
+ /* Use greedy sampling for audio token generation */
4937
+ doSample?: boolean | DataLink
4913
4938
  /* Output mode */
4914
4939
  outputType?: 'play' | 'file' | DataLink
4915
4940
  /* Enable cache for generated audio */
4916
4941
  cacheGenerated?: boolean | DataLink
4942
+ /* Speed of the generated audio, for StyleTTS (Kokoro) */
4943
+ speed?: number | DataLink
4917
4944
  /* Text to generate */
4918
4945
  prompt?: string | DataLink
4919
4946
  /* Auto inference when prompt changes */
@@ -5894,6 +5921,207 @@ export type GeneratorSpeechInference = Generator &
5894
5921
  >
5895
5922
  }
5896
5923
 
5924
+ /* Load the model */
5925
+ export type GeneratorVadInferenceActionLoadModel = Action & {
5926
+ __actionName: 'GENERATOR_VAD_INFERENCE_LOAD_MODEL'
5927
+ }
5928
+
5929
+ /* Detect speech in audio file. You can provide `File URL` property, if not provided, it will use the default `File URL` */
5930
+ export type GeneratorVadInferenceActionDetectFile = ActionWithParams & {
5931
+ __actionName: 'GENERATOR_VAD_INFERENCE_DETECT_FILE'
5932
+ params?: Array<
5933
+ | {
5934
+ input: 'fileUrl'
5935
+ value?: string | DataLink | EventProperty
5936
+ mapping?: string
5937
+ }
5938
+ | {
5939
+ input: 'threshold'
5940
+ value?: number | DataLink | EventProperty
5941
+ mapping?: string
5942
+ }
5943
+ | {
5944
+ input: 'minSpeechDurationMs'
5945
+ value?: number | DataLink | EventProperty
5946
+ mapping?: string
5947
+ }
5948
+ | {
5949
+ input: 'minSilenceDurationMs'
5950
+ value?: number | DataLink | EventProperty
5951
+ mapping?: string
5952
+ }
5953
+ | {
5954
+ input: 'maxSpeechDurationS'
5955
+ value?: number | DataLink | EventProperty
5956
+ mapping?: string
5957
+ }
5958
+ | {
5959
+ input: 'speechPadMs'
5960
+ value?: number | DataLink | EventProperty
5961
+ mapping?: string
5962
+ }
5963
+ | {
5964
+ input: 'samplesOverlap'
5965
+ value?: number | DataLink | EventProperty
5966
+ mapping?: string
5967
+ }
5968
+ >
5969
+ }
5970
+
5971
+ /* Detect speech in audio data. Currently only support base64 encoded audio data (16-bit PCM, mono, 16kHz) */
5972
+ export type GeneratorVadInferenceActionDetectData = ActionWithParams & {
5973
+ __actionName: 'GENERATOR_VAD_INFERENCE_DETECT_DATA'
5974
+ params?: Array<
5975
+ | {
5976
+ input: 'data'
5977
+ value?: any | EventProperty
5978
+ mapping?: string
5979
+ }
5980
+ | {
5981
+ input: 'threshold'
5982
+ value?: number | DataLink | EventProperty
5983
+ mapping?: string
5984
+ }
5985
+ | {
5986
+ input: 'minSpeechDurationMs'
5987
+ value?: number | DataLink | EventProperty
5988
+ mapping?: string
5989
+ }
5990
+ | {
5991
+ input: 'minSilenceDurationMs'
5992
+ value?: number | DataLink | EventProperty
5993
+ mapping?: string
5994
+ }
5995
+ | {
5996
+ input: 'maxSpeechDurationS'
5997
+ value?: number | DataLink | EventProperty
5998
+ mapping?: string
5999
+ }
6000
+ | {
6001
+ input: 'speechPadMs'
6002
+ value?: number | DataLink | EventProperty
6003
+ mapping?: string
6004
+ }
6005
+ | {
6006
+ input: 'samplesOverlap'
6007
+ value?: number | DataLink | EventProperty
6008
+ mapping?: string
6009
+ }
6010
+ >
6011
+ }
6012
+
6013
+ /* Clear downloaded files (model, audio) & current jobs */
6014
+ export type GeneratorVadInferenceActionClearDownload = Action & {
6015
+ __actionName: 'GENERATOR_VAD_INFERENCE_CLEAR_DOWNLOAD'
6016
+ }
6017
+
6018
+ /* Release context */
6019
+ export type GeneratorVadInferenceActionReleaseContext = Action & {
6020
+ __actionName: 'GENERATOR_VAD_INFERENCE_RELEASE_CONTEXT'
6021
+ }
6022
+
6023
+ interface GeneratorVadInferenceDef {
6024
+ /*
6025
+ Default property:
6026
+ {
6027
+ "init": false,
6028
+ "modelName": "silero-v5.1.2",
6029
+ "modelUseGPU": true,
6030
+ "modelThreads": 4,
6031
+ "detectThreshold": 0.5,
6032
+ "detectMinSpeechDurationMs": 250,
6033
+ "detectMinSilenceDurationMs": 100,
6034
+ "detectMaxSpeechDurationS": 30,
6035
+ "detectSpeechPadMs": 30,
6036
+ "detectSamplesOverlap": 0.1
6037
+ }
6038
+ */
6039
+ property?: {
6040
+ /* Initialize the VAD context on generator initialization
6041
+ Please note that it will take some RAM depending on the model size */
6042
+ init?: boolean | DataLink
6043
+ /* Use model name, currently only supports the Silero VAD model.
6044
+ The model download progress will be done in preload stage or the generator initialization stage.
6045
+ You can also choose `custom` option and set `Model URL` and `Model SHA1` to use your own model */
6046
+ modelName?: 'custom' | 'silero-v5.1.2' | DataLink
6047
+ /* The URL or path of model
6048
+ We used `ggml` format model, please refer to https://huggingface.co/ggml-org/whisper-vad */
6049
+ modelUrl?: string | DataLink
6050
+ /* Hash type of model */
6051
+ modelHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
6052
+ /* Hash of model */
6053
+ modelHash?: string | DataLink
6054
+ /* Use GPU Acceleration for inference. Currently iOS only. */
6055
+ modelUseGPU?: boolean | DataLink
6056
+ /* Number of threads to use for processing */
6057
+ modelThreads?: number | DataLink
6058
+ /* Speech probability threshold (0.0-1.0) */
6059
+ detectThreshold?: number | DataLink
6060
+ /* Minimum speech duration in milliseconds */
6061
+ detectMinSpeechDurationMs?: number | DataLink
6062
+ /* Minimum silence duration in milliseconds */
6063
+ detectMinSilenceDurationMs?: number | DataLink
6064
+ /* Maximum speech duration in seconds */
6065
+ detectMaxSpeechDurationS?: number | DataLink
6066
+ /* Padding around speech segments in milliseconds */
6067
+ detectSpeechPadMs?: number | DataLink
6068
+ /* Overlap between analysis windows (0.0-1.0) */
6069
+ detectSamplesOverlap?: number | DataLink
6070
+ /* The file URL or path to be analyzed.
6071
+ It only supported `wav` format with 16kHz sample rate & single (mono) channel */
6072
+ detectFileUrl?: string | DataLink
6073
+ /* MD5 of file to be analyzed */
6074
+ detectFileMd5?: string | DataLink
6075
+ }
6076
+ events?: {
6077
+ /* Event triggered when load is done */
6078
+ onContextStateChange?: Array<EventAction>
6079
+ /* Event triggered when error occurs */
6080
+ onError?: Array<EventAction>
6081
+ /* Event triggered when got detection result */
6082
+ onDetected?: Array<EventAction>
6083
+ }
6084
+ outlets?: {
6085
+ /* Context state */
6086
+ contextState?: () => Data
6087
+ /* Context details */
6088
+ contextDetails?: () => Data
6089
+ /* Is detecting */
6090
+ isDetecting?: () => Data
6091
+ /* Detection segments result */
6092
+ detectionSegments?: () => Data
6093
+ /* Detection details */
6094
+ detectionDetails?: () => Data
6095
+ }
6096
+ }
6097
+
6098
+ /* Local Voice Activity Detection (VAD) inference based on GGML and [whisper.rn](https://github.com/mybigday/whisper.rn) */
6099
+ export type GeneratorVadInference = Generator &
6100
+ GeneratorVadInferenceDef & {
6101
+ templateKey: 'GENERATOR_VAD_INFERENCE'
6102
+ switches: Array<
6103
+ SwitchDef &
6104
+ GeneratorVadInferenceDef & {
6105
+ conds?: Array<{
6106
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
6107
+ cond:
6108
+ | SwitchCondInnerStateCurrentCanvas
6109
+ | SwitchCondData
6110
+ | {
6111
+ __typename: 'SwitchCondInnerStateOutlet'
6112
+ outlet:
6113
+ | 'contextState'
6114
+ | 'contextDetails'
6115
+ | 'isDetecting'
6116
+ | 'detectionSegments'
6117
+ | 'detectionDetails'
6118
+ value: any
6119
+ }
6120
+ }>
6121
+ }
6122
+ >
6123
+ }
6124
+
5897
6125
  /* Load the model */
5898
6126
  export type GeneratorLLMActionLoadModel = Action & {
5899
6127
  __actionName: 'GENERATOR_LLM_LOAD_MODEL'
@@ -5975,6 +6203,11 @@ export type GeneratorLLMActionProcessPrompt = ActionWithParams & {
5975
6203
  value?: string | DataLink | EventProperty
5976
6204
  mapping?: string
5977
6205
  }
6206
+ | {
6207
+ input: 'enableThinking'
6208
+ value?: boolean | DataLink | EventProperty
6209
+ mapping?: string
6210
+ }
5978
6211
  | {
5979
6212
  input: 'prompt'
5980
6213
  value?: string | DataLink | EventProperty
@@ -6037,6 +6270,11 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
6037
6270
  value?: string | DataLink | EventProperty
6038
6271
  mapping?: string
6039
6272
  }
6273
+ | {
6274
+ input: 'enableThinking'
6275
+ value?: boolean | DataLink | EventProperty
6276
+ mapping?: string
6277
+ }
6040
6278
  | {
6041
6279
  input: 'prompt'
6042
6280
  value?: string | DataLink | EventProperty
@@ -6261,6 +6499,7 @@ Default property:
6261
6499
  "completionMode": "auto",
6262
6500
  "completionPrompt": "",
6263
6501
  "completionPromptTemplateType": "${}",
6502
+ "completionEnableThinking": true,
6264
6503
  "completionStopWords": [
6265
6504
  "</s>",
6266
6505
  "<|end|>",
@@ -6406,6 +6645,8 @@ Default property:
6406
6645
  }
6407
6646
  schema?: {} | DataLink
6408
6647
  }
6648
+ /* Enable thinking */
6649
+ completionEnableThinking?: boolean | DataLink
6409
6650
  /* Stop words */
6410
6651
  completionStopWords?: Array<string | DataLink> | DataLink
6411
6652
  /* Number of tokens to predict */
@@ -6544,6 +6785,308 @@ export type GeneratorLLM = Generator &
6544
6785
  >
6545
6786
  }
6546
6787
 
6788
+ /* Load the model */
6789
+ export type GeneratorGGMLTTSActionLoadModel = Action & {
6790
+ __actionName: 'GENERATOR_GGML_TTS_LOAD_MODEL'
6791
+ }
6792
+
6793
+ /* Generate audio */
6794
+ export type GeneratorGGMLTTSActionGenerate = ActionWithParams & {
6795
+ __actionName: 'GENERATOR_GGML_TTS_GENERATE'
6796
+ params?: Array<{
6797
+ input: 'text'
6798
+ value?: string | DataLink | EventProperty
6799
+ mapping?: string
6800
+ }>
6801
+ }
6802
+
6803
+ /* Clean cache */
6804
+ export type GeneratorGGMLTTSActionCleanCache = Action & {
6805
+ __actionName: 'GENERATOR_GGML_TTS_CLEAN_CACHE'
6806
+ }
6807
+
6808
+ /* Release context */
6809
+ export type GeneratorGGMLTTSActionReleaseContext = Action & {
6810
+ __actionName: 'GENERATOR_GGML_TTS_RELEASE_CONTEXT'
6811
+ }
6812
+
6813
+ interface GeneratorGGMLTTSDef {
6814
+ /*
6815
+ Default property:
6816
+ {
6817
+ "vocoderUrl": "https://huggingface.co/ggml-org/WavTokenizer/resolve/main/WavTokenizer-Large-75-F16.gguf",
6818
+ "vocoderHashType": "sha256",
6819
+ "vocoderHash": "2356baa8631cc2995ea3465196a017a2733600d849a91180c0f97fa7fb375bbe",
6820
+ "outputType": "play",
6821
+ "cacheGenerated": true,
6822
+ "autoInferEnable": false,
6823
+ "softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
6824
+ "hardBreakTime": 500,
6825
+ "completionTemperature": 0.1,
6826
+ "completionRepetitionPenalty": 1.1,
6827
+ "completionTopK": 40,
6828
+ "completionTopP": 0.9,
6829
+ "completionMinP": 0.05,
6830
+ "useGuideToken": false,
6831
+ "contextSize": 4096,
6832
+ "batchSize": 512,
6833
+ "maxThreads": 1,
6834
+ "accelVariant": "default",
6835
+ "mainGpu": 0,
6836
+ "gpuLayers": 0,
6837
+ "useMlock": true,
6838
+ "useMmap": true,
6839
+ "useFlashAttn": false
6840
+ }
6841
+ */
6842
+ property?: {
6843
+ /* Initialize the TTS context on generator initialization */
6844
+ init?: boolean | DataLink
6845
+ /* The URL or path of model
6846
+ We used GGUF format model, please refer to https://github.com/ggerganov/llama.cpp/tree/master#description */
6847
+ modelUrl?: string | DataLink
6848
+ /* Hash type of model */
6849
+ modelHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
6850
+ /* Hash of model */
6851
+ modelHash?: string | DataLink
6852
+ /* The URL or path of vocoder model */
6853
+ vocoderUrl?: string | DataLink
6854
+ /* Hash type of vocoder model */
6855
+ vocoderHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
6856
+ /* Hash of vocoder model */
6857
+ vocoderHash?: string | DataLink
6858
+ /* Output mode */
6859
+ outputType?: 'play' | 'file' | DataLink
6860
+ /* Enable cache for generated audio */
6861
+ cacheGenerated?: boolean | DataLink
6862
+ /* Text to generate */
6863
+ prompt?: string | DataLink
6864
+ /* Speaker JSON */
6865
+ speaker?: {} | DataLink
6866
+ /* Auto inference when prompt changes */
6867
+ autoInferEnable?: boolean | DataLink
6868
+ /* Segmentation rule for auto inference */
6869
+ softBreakRegex?: string | DataLink
6870
+ /* Time to force inference when softBreakRegex is not satisfied */
6871
+ hardBreakTime?: number | DataLink
6872
+ /* Temperature */
6873
+ completionTemperature?: number | DataLink
6874
+ /* Repetition Penalty */
6875
+ completionRepetitionPenalty?: number | DataLink
6876
+ /* Top K sampling */
6877
+ completionTopK?: number | DataLink
6878
+ /* Top P sampling */
6879
+ completionTopP?: number | DataLink
6880
+ /* Min P sampling */
6881
+ completionMinP?: number | DataLink
6882
+ /* Set the random number generator (RNG) seed (default: -1, -1 = random seed) */
6883
+ completionSeed?: number | DataLink
6884
+ /* Enable guide token to help prevent hallucinations by forcing the TTS to use the correct words. */
6885
+ useGuideToken?: boolean | DataLink
6886
+ /* Context size, for OutTTS recommended 4096 ~ 8192 (Default to 4096) */
6887
+ contextSize?: number | DataLink
6888
+ /* Logical batch size for prompt processing */
6889
+ batchSize?: number | DataLink
6890
+ /* Number of threads */
6891
+ maxThreads?: number | DataLink
6892
+ /* Accelerator variant (Only for desktop)
6893
+ `default` - CPU / Metal (macOS)
6894
+ `vulkan` - Use Vulkan
6895
+ `cuda` - Use CUDA */
6896
+ accelVariant?: 'default' | 'vulkan' | 'cuda' | DataLink
6897
+ /* Main GPU index */
6898
+ mainGpu?: number | DataLink
6899
+ /* Number of GPU layers (NOTE: Currently not supported for Android) */
6900
+ gpuLayers?: number | DataLink
6901
+ /* Use memory lock */
6902
+ useMlock?: boolean | DataLink
6903
+ /* Use mmap */
6904
+ useMmap?: boolean | DataLink
6905
+ /* Use Flash Attention for inference (Recommended with GPU enabled) */
6906
+ useFlashAttn?: boolean | DataLink
6907
+ }
6908
+ events?: {
6909
+ /* Event triggered when state change */
6910
+ onContextStateChange?: Array<EventAction>
6911
+ /* Event triggered when error occurs */
6912
+ onError?: Array<EventAction>
6913
+ }
6914
+ outlets?: {
6915
+ /* Context state */
6916
+ contextState?: () => Data
6917
+ /* Generated audio file */
6918
+ generatedAudio?: () => Data
6919
+ /* Generated audio file is playing */
6920
+ generatedAudioPlaying?: () => Data
6921
+ }
6922
+ }
6923
+
6924
+ /* Local Text-to-Speech (TTS) inference based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
6925
+ You can use any converted model on HuggingFace. */
6926
+ export type GeneratorGGMLTTS = Generator &
6927
+ GeneratorGGMLTTSDef & {
6928
+ templateKey: 'GENERATOR_GGML_TTS'
6929
+ switches: Array<
6930
+ SwitchDef &
6931
+ GeneratorGGMLTTSDef & {
6932
+ conds?: Array<{
6933
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
6934
+ cond:
6935
+ | SwitchCondInnerStateCurrentCanvas
6936
+ | SwitchCondData
6937
+ | {
6938
+ __typename: 'SwitchCondInnerStateOutlet'
6939
+ outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
6940
+ value: any
6941
+ }
6942
+ }>
6943
+ }
6944
+ >
6945
+ }
6946
+
6947
+ /* Load the model */
6948
+ export type GeneratorRerankerActionLoadModel = Action & {
6949
+ __actionName: 'GENERATOR_RERANKER_LOAD_MODEL'
6950
+ }
6951
+
6952
+ /* Rerank documents based on query relevance */
6953
+ export type GeneratorRerankerActionRerank = ActionWithParams & {
6954
+ __actionName: 'GENERATOR_RERANKER_RERANK'
6955
+ params?: Array<
6956
+ | {
6957
+ input: 'query'
6958
+ value?: string | DataLink | EventProperty
6959
+ mapping?: string
6960
+ }
6961
+ | {
6962
+ input: 'documents'
6963
+ value?: Array<any> | DataLink | EventProperty
6964
+ mapping?: string
6965
+ }
6966
+ >
6967
+ }
6968
+
6969
+ /* Release context */
6970
+ export type GeneratorRerankerActionReleaseContext = Action & {
6971
+ __actionName: 'GENERATOR_RERANKER_RELEASE_CONTEXT'
6972
+ }
6973
+
6974
+ interface GeneratorRerankerDef {
6975
+ /*
6976
+ Default property:
6977
+ {
6978
+ "init": false,
6979
+ "contextSize": 512,
6980
+ "batchSize": 512,
6981
+ "uBatchSize": 512,
6982
+ "accelVariant": "default",
6983
+ "mainGpu": 0,
6984
+ "gpuLayers": 0,
6985
+ "useMlock": true,
6986
+ "useMmap": true,
6987
+ "normalize": 1
6988
+ }
6989
+ */
6990
+ property?: {
6991
+ /* Initialize the Reranker context on generator initialization */
6992
+ init?: boolean | DataLink
6993
+ /* The URL or path of reranker model (GGUF format) */
6994
+ modelUrl?: string | DataLink
6995
+ /* Hash of reranker model */
6996
+ modelHash?: string | DataLink
6997
+ /* Hash type of reranker model */
6998
+ modelHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
6999
+ /* Context size (0 ~ 4096) (Default to 512) */
7000
+ contextSize?: number | DataLink
7001
+ /* Logical batch size for processing (default: 512) */
7002
+ batchSize?: number | DataLink
7003
+ /* Physical maximum batch size (default: 512) */
7004
+ uBatchSize?: number | DataLink
7005
+ /* Accelerator variant (default: default) */
7006
+ accelVariant?:
7007
+ | 'default'
7008
+ | 'avx'
7009
+ | 'avx2'
7010
+ | 'avx512'
7011
+ | 'metal'
7012
+ | 'opencl'
7013
+ | 'vulkan'
7014
+ | 'cuda'
7015
+ | 'rocm'
7016
+ | DataLink
7017
+ /* Main GPU index (default: 0) */
7018
+ mainGpu?: number | DataLink
7019
+ /* Number of layers to store in VRAM (default: 0) */
7020
+ gpuLayers?: number | DataLink
7021
+ /* Maximum number of threads to use (default: auto) */
7022
+ maxThreads?: number | DataLink
7023
+ /* Use mlock to keep model in memory (default: true) */
7024
+ useMlock?: boolean | DataLink
7025
+ /* Use mmap for model loading (default: true) */
7026
+ useMmap?: boolean | DataLink
7027
+ /* Query text for reranking */
7028
+ query?: string | DataLink
7029
+ /* Array of documents to rerank */
7030
+ documents?: Array<string | DataLink> | DataLink
7031
+ /* Normalize reranking scores (default: from model config) */
7032
+ normalize?: number | DataLink | boolean | DataLink | DataLink
7033
+ /* Maximum number of documents to return (default: unlimited) */
7034
+ topK?: number | DataLink
7035
+ }
7036
+ events?: {
7037
+ /* Event triggered when the reranker context state changes (loading, ready, error, released) */
7038
+ onContextStateChange?: Array<EventAction>
7039
+ /* Event triggered when an error occurs during reranker operations */
7040
+ onError?: Array<EventAction>
7041
+ }
7042
+ outlets?: {
7043
+ /* Current state of the reranker context (loading, ready, error, released) */
7044
+ contextState?: () => Data
7045
+ /* Loading progress of the reranker model (0-100) */
7046
+ contextLoadProgress?: () => Data
7047
+ /* Detailed information about the reranker context including instance ID and processing status */
7048
+ contextDetails?: () => Data
7049
+ /* Result of the reranking operation containing scored and ranked documents */
7050
+ rerankResult?: () => Data
7051
+ /* Boolean indicating whether the reranker is currently processing a request */
7052
+ isProcessing?: () => Data
7053
+ }
7054
+ }
7055
+
7056
+ /* Local rerank based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
7057
+
7058
+ ## Notice
7059
+ - The device RAM must be larger than 8GB
7060
+ - iOS: Supported GPU acceleration, recommended use M1+ / A17+ chip device
7061
+ - macOS: Supported GPU acceleration, recommended use M1+ chip device
7062
+ - Android: Currently not supported GPU acceleration (Coming soon), recommended use Android 13+ system
7063
+ - Linux / Windows: Supported GPU acceleration, currently only Vulkan backend available */
7064
+ export type GeneratorReranker = Generator &
7065
+ GeneratorRerankerDef & {
7066
+ templateKey: 'GENERATOR_RERANKER'
7067
+ switches: Array<
7068
+ SwitchDef &
7069
+ GeneratorRerankerDef & {
7070
+ conds?: Array<{
7071
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
7072
+ cond:
7073
+ | SwitchCondInnerStateCurrentCanvas
7074
+ | SwitchCondData
7075
+ | {
7076
+ __typename: 'SwitchCondInnerStateOutlet'
7077
+ outlet:
7078
+ | 'contextState'
7079
+ | 'contextLoadProgress'
7080
+ | 'contextDetails'
7081
+ | 'rerankResult'
7082
+ | 'isProcessing'
7083
+ value: any
7084
+ }
7085
+ }>
7086
+ }
7087
+ >
7088
+ }
7089
+
6547
7090
  /* Load the model */
6548
7091
  export type GeneratorQnnLlmActionLoadModel = Action & {
6549
7092
  __actionName: 'GENERATOR_QNN_LLM_LOAD_MODEL'
package/types/system.ts CHANGED
@@ -467,6 +467,16 @@ export type SystemActionChannelPublish = ActionWithParams & {
467
467
  >
468
468
  }
469
469
 
470
+ /* Delay for a certain time between actions */
471
+ export type SystemActionDelay = ActionWithParams & {
472
+ __actionName: 'DELAY'
473
+ params?: Array<{
474
+ input: 'time'
475
+ value?: number | DataLink | EventProperty
476
+ mapping?: string
477
+ }>
478
+ }
479
+
470
480
  /* [Internal] Use a shared application */
471
481
  export type SystemActionUseShareApplication = ActionWithParams & {
472
482
  __actionName: 'USE_SHARE_APPLICATION'
package/utils/data.ts CHANGED
@@ -64,6 +64,7 @@ type SystemDataName =
64
64
  | 'workspaceName'
65
65
  | 'applicationInfo'
66
66
  | 'applicationName'
67
+ | 'deviceID'
67
68
  | 'macAddress'
68
69
  | 'bindDeviceCode'
69
70
  | 'bindDeviceCodeExpire'
@@ -343,6 +344,14 @@ export const systemDataList: Array<SystemDataInfo> = [
343
344
  type: 'string',
344
345
  value: '',
345
346
  },
347
+ {
348
+ name: 'deviceID',
349
+ id: 'PROPERTY_BANK_DATA_NODE_8b5c2d9e-f0a1-4b2c-8d3e-4f5a6b7c8d9e',
350
+ title: 'SYSTEM: Device ID',
351
+ description: 'Device ID of current device',
352
+ type: 'string',
353
+ value: 'unknown',
354
+ },
346
355
  {
347
356
  name: 'macAddress',
348
357
  id: 'PROPERTY_BANK_DATA_NODE_f01fcc78-0723-11ed-ac00-877339de1030',
@@ -761,6 +761,19 @@ export const templateEventPropsMap = {
761
761
  'GENERATOR_SPEECH_INFERENCE_TRANSCRIBE_TIME', // type: number
762
762
  ],
763
763
  },
764
+ GENERATOR_VAD_INFERENCE: {
765
+ onContextStateChange: [
766
+ 'GENERATOR_VAD_INFERENCE_CONTEXT_STATE', // type: string
767
+ 'GENERATOR_VAD_INFERENCE_CONTEXT_DETAILS', // type: object
768
+ ],
769
+ onError: [
770
+ 'GENERATOR_VAD_INFERENCE_ERROR', // type: string
771
+ ],
772
+ onDetected: [
773
+ 'GENERATOR_VAD_INFERENCE_DETECTION_SEGMENTS', // type: array
774
+ 'GENERATOR_VAD_INFERENCE_DETECTION_TIME', // type: number
775
+ ],
776
+ },
764
777
  GENERATOR_LLM: {
765
778
  onContextStateChange: [
766
779
  'GENERATOR_LLM_CONTEXT_STATE', // type: string
@@ -791,6 +804,15 @@ export const templateEventPropsMap = {
791
804
  'GENERATOR_LLM_COMPLETION_FUNCTION_DETAILS', // type: object
792
805
  ],
793
806
  },
807
+ GENERATOR_GGML_TTS: {
808
+ onContextStateChange: [
809
+ 'GENERATOR_GGML_TTS_CONTEXT_STATE', // type: string
810
+ ],
811
+ onError: [
812
+ 'GENERATOR_GGML_TTS_ERROR', // type: string
813
+ ],
814
+ },
815
+ GENERATOR_RERANKER: {},
794
816
  GENERATOR_QNN_LLM: {
795
817
  onContextStateChange: [
796
818
  'GENERATOR_QNN_LLM_CONTEXT_STATE', // type: string