@fugood/bricks-project 2.21.0-beta.27 → 2.21.0-beta.28

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.
@@ -557,4 +557,31 @@ export const templateActionNameMap = {
557
557
  sessionCustomKey: 'GENERATOR_LLM_SESSION_CUSTOM_KEY',
558
558
  },
559
559
  },
560
+ GENERATOR_ASSISTANT: {
561
+ GENERATOR_ASSISTANT_ADD_MESSAGE: {
562
+ role: 'GENERATOR_ASSISTANT_ROLE',
563
+ content: 'GENERATOR_ASSISTANT_CONTENT',
564
+ payload: 'GENERATOR_ASSISTANT_PAYLOAD',
565
+ },
566
+ GENERATOR_ASSISTANT_UPDATE_MESSAGE_AT_INDEX: {
567
+ index: 'GENERATOR_ASSISTANT_INDEX',
568
+ content: 'GENERATOR_ASSISTANT_CONTENT',
569
+ payload: 'GENERATOR_ASSISTANT_PAYLOAD',
570
+ },
571
+ GENERATOR_ASSISTANT_ADD_AUDIO_MESSAGE: {
572
+ role: 'GENERATOR_ASSISTANT_ROLE',
573
+ contentFile: 'GENERATOR_ASSISTANT_CONTENT_FILE',
574
+ contentBase64: 'GENERATOR_ASSISTANT_CONTENT_BASE64',
575
+ payload: 'GENERATOR_ASSISTANT_PAYLOAD',
576
+ },
577
+ GENERATOR_ASSISTANT_UPDATE_AUDIO_MESSAGE_AT_INDEX: {
578
+ index: 'GENERATOR_ASSISTANT_INDEX',
579
+ contentFile: 'GENERATOR_ASSISTANT_CONTENT_FILE',
580
+ contentBase64: 'GENERATOR_ASSISTANT_CONTENT_BASE64',
581
+ payload: 'GENERATOR_ASSISTANT_PAYLOAD',
582
+ },
583
+ GENERATOR_ASSISTANT_REMOVE_MESSAGE_AT_INDEX: {
584
+ index: 'GENERATOR_ASSISTANT_INDEX',
585
+ },
586
+ },
560
587
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.21.0-beta.27",
3
+ "version": "2.21.0-beta.28",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "build": "node scripts/build.js"
@@ -13,5 +13,5 @@
13
13
  "lodash": "^4.17.4",
14
14
  "uuid": "^8.3.1"
15
15
  },
16
- "gitHead": "85b6bb3416b693de316511738097112f89e764e7"
16
+ "gitHead": "fcdff86f963446d3489e4b1cccd697e6d04e4f39"
17
17
  }
@@ -3588,121 +3588,6 @@ export type GeneratorWebRTC = Generator &
3588
3588
  >
3589
3589
  }
3590
3590
 
3591
- interface GeneratorTensorFlowInferenceDef {
3592
- /*
3593
- Default property:
3594
- {
3595
- "inputType": "camera",
3596
- "minScore": 0.5,
3597
- "objectLimit": 20,
3598
- "imageChannelFormat": "rgb",
3599
- "imageNormalize": "off",
3600
- "cameraInit": false,
3601
- "cameraFps": 10,
3602
- "cameraRotate": 0
3603
- }
3604
- */
3605
- property?: {
3606
- /* URL to download TF.js graph model
3607
- You can find pre-trained model on [TensorFlow Hub](https://tfhub.dev) */
3608
- modelUrl?: string | DataLink
3609
- /* MD5 of model JSON */
3610
- modelMd5?: string | DataLink
3611
- /* Model input source */
3612
- inputType?: 'raw' | 'media-image' | 'camera' | DataLink
3613
- /* Model output type
3614
- label: Classification problem (model output number or score array)
3615
- object-boxes: Object detection (model output [labels, boxes])
3616
- raw: No transform */
3617
- outputType?: 'label' | 'object-boxes' | 'raw' | DataLink
3618
- /* Model output labels */
3619
- labels?: Array<string | DataLink> | DataLink
3620
- /* Download labels from URL */
3621
- labelsUrl?: string | DataLink
3622
- /* MD5 checksum of label file */
3623
- labelsMd5?: string | DataLink
3624
- /* Output score limit */
3625
- minScore?: number | DataLink
3626
- /* Object limit for object detection */
3627
- objectLimit?: number | DataLink
3628
- /* Input channel format */
3629
- imageChannelFormat?: 'rgb' | 'grayscale' | DataLink
3630
- /* Input data format of the model is channel first (Commonly is channel last) */
3631
- imageChannelFirst?: boolean | DataLink
3632
- /* Resize to input layer height */
3633
- imageResizeHeight?: number | DataLink
3634
- /* Resize to input layer width */
3635
- imageResizeWidth?: number | DataLink
3636
- /* Input data normalize */
3637
- imageNormalize?: 'off' | '0~1' | '-1~1' | DataLink
3638
- /* Start infer on camera when initialized */
3639
- cameraInit?: boolean | DataLink
3640
- /* Target Camera brick ID */
3641
- cameraTarget?: string | DataLink
3642
- /* Infer fps, 0 is unlimited */
3643
- cameraFps?: number | DataLink
3644
- /* Camera rotate correction */
3645
- cameraRotate?: number | DataLink
3646
- /* Show detect object bounding box on Camera brick */
3647
- cameraShowObjectBox?: boolean | DataLink
3648
- /* Bonding box border size */
3649
- cameraBoxBorderSize?: number | DataLink
3650
- /* Bonding box border color */
3651
- cameraBoxBorderColor?: Array<string | DataLink> | DataLink
3652
- /* The URL of image to infer */
3653
- mediaImageUrl?: string | DataLink
3654
- /* MD5 checksum of image */
3655
- mediaImageMd5?: string | DataLink
3656
- /* The data input to infer */
3657
- rawInput?: any
3658
- }
3659
- events?: {
3660
- /* Event of TensorFlow inference error */
3661
- onError?: Array<
3662
- EventAction & {
3663
- eventPropertyMapping?: {
3664
- errorMessage: {
3665
- type: 'string'
3666
- path: string
3667
- }
3668
- }
3669
- }
3670
- >
3671
- }
3672
- outlets?: {
3673
- /* Model inference spend time in ms */
3674
- modelPerformance?: () => Data
3675
- /* Model state */
3676
- modelState?: () => Data
3677
- /* Transformed infer result */
3678
- result?: () => Data
3679
- /* Raw infer result */
3680
- rawResult?: () => Data
3681
- }
3682
- }
3683
-
3684
- /* TensorFlow Inference */
3685
- export type GeneratorTensorFlowInference = Generator &
3686
- GeneratorTensorFlowInferenceDef & {
3687
- templateKey: 'GENERATOR_TENSORFLOW_INFERENCE'
3688
- switches: Array<
3689
- SwitchDef &
3690
- GeneratorTensorFlowInferenceDef & {
3691
- conds?: Array<{
3692
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
3693
- cond:
3694
- | SwitchCondInnerStateCurrentCanvas
3695
- | SwitchCondData
3696
- | {
3697
- __typename: 'SwitchCondInnerStateOutlet'
3698
- outlet: 'modelPerformance' | 'modelState' | 'result' | 'rawResult'
3699
- value: any
3700
- }
3701
- }>
3702
- }
3703
- >
3704
- }
3705
-
3706
3591
  /* Run Crawler request with defined properties */
3707
3592
  export type GeneratorWebCrawlerActionRunRequest = Action & {
3708
3593
  __actionName: 'GENERATOR_WEB_CRAWLER_RUN_REQUEST'
@@ -3853,6 +3738,17 @@ Default property:
3853
3738
  }
3854
3739
  }
3855
3740
  >
3741
+ /* Event for recorded file */
3742
+ recorded?: Array<
3743
+ EventAction & {
3744
+ eventPropertyMapping?: {
3745
+ recordedPath: {
3746
+ type: 'string'
3747
+ path: string
3748
+ }
3749
+ }
3750
+ }
3751
+ >
3856
3752
  }
3857
3753
  outlets?: {
3858
3754
  /* Is recording */
@@ -6491,6 +6387,10 @@ Default property:
6491
6387
  onCompletion?: Array<
6492
6388
  EventAction & {
6493
6389
  eventPropertyMapping?: {
6390
+ completionSessionKey: {
6391
+ type: 'string'
6392
+ path: string
6393
+ }
6494
6394
  completionResult: {
6495
6395
  type: 'string'
6496
6396
  path: string
@@ -6510,6 +6410,10 @@ Default property:
6510
6410
  onCompletionFinished?: Array<
6511
6411
  EventAction & {
6512
6412
  eventPropertyMapping?: {
6413
+ completionSessionKey: {
6414
+ type: 'string'
6415
+ path: string
6416
+ }
6513
6417
  completionResult: {
6514
6418
  type: 'string'
6515
6419
  path: string
@@ -6529,6 +6433,10 @@ Default property:
6529
6433
  onCompletionFunctionCall?: Array<
6530
6434
  EventAction & {
6531
6435
  eventPropertyMapping?: {
6436
+ completionSessionKey: {
6437
+ type: 'string'
6438
+ path: string
6439
+ }
6532
6440
  completionFunctionCallName: {
6533
6441
  type: 'string'
6534
6442
  path: string
@@ -6610,3 +6518,239 @@ export type GeneratorLLM = Generator &
6610
6518
  }
6611
6519
  >
6612
6520
  }
6521
+
6522
+ /* Add a message to the assistant */
6523
+ export type GeneratorAssistantActionAddMessage = ActionWithParams & {
6524
+ __actionName: 'GENERATOR_ASSISTANT_ADD_MESSAGE'
6525
+ params?: Array<
6526
+ | {
6527
+ input: 'role'
6528
+ value?: string | DataLink
6529
+ mapping?: string
6530
+ }
6531
+ | {
6532
+ input: 'content'
6533
+ value?: string | DataLink
6534
+ mapping?: string
6535
+ }
6536
+ | {
6537
+ input: 'payload'
6538
+ value?: {} | DataLink
6539
+ mapping?: string
6540
+ }
6541
+ >
6542
+ }
6543
+
6544
+ /* Update a message at a specific index */
6545
+ export type GeneratorAssistantActionUpdateMessageAtIndex = ActionWithParams & {
6546
+ __actionName: 'GENERATOR_ASSISTANT_UPDATE_MESSAGE_AT_INDEX'
6547
+ params?: Array<
6548
+ | {
6549
+ input: 'index'
6550
+ value?: number | DataLink
6551
+ mapping?: string
6552
+ }
6553
+ | {
6554
+ input: 'content'
6555
+ value?: string | DataLink
6556
+ mapping?: string
6557
+ }
6558
+ | {
6559
+ input: 'payload'
6560
+ value?: {} | DataLink
6561
+ mapping?: string
6562
+ }
6563
+ >
6564
+ }
6565
+
6566
+ /* Add an audio message and convert it to text to the assistant (if STT enabled) */
6567
+ export type GeneratorAssistantActionAddAudioMessage = ActionWithParams & {
6568
+ __actionName: 'GENERATOR_ASSISTANT_ADD_AUDIO_MESSAGE'
6569
+ params?: Array<
6570
+ | {
6571
+ input: 'role'
6572
+ value?: string | DataLink
6573
+ mapping?: string
6574
+ }
6575
+ | {
6576
+ input: 'contentFile'
6577
+ value?: string | DataLink
6578
+ mapping?: string
6579
+ }
6580
+ | {
6581
+ input: 'contentBase64'
6582
+ value?: string | DataLink
6583
+ mapping?: string
6584
+ }
6585
+ | {
6586
+ input: 'payload'
6587
+ value?: {} | DataLink
6588
+ mapping?: string
6589
+ }
6590
+ >
6591
+ }
6592
+
6593
+ /* Update a audio message at a specific index */
6594
+ export type GeneratorAssistantActionUpdateAudioMessageAtIndex = ActionWithParams & {
6595
+ __actionName: 'GENERATOR_ASSISTANT_UPDATE_AUDIO_MESSAGE_AT_INDEX'
6596
+ params?: Array<
6597
+ | {
6598
+ input: 'index'
6599
+ value?: number | DataLink
6600
+ mapping?: string
6601
+ }
6602
+ | {
6603
+ input: 'contentFile'
6604
+ value?: string | DataLink
6605
+ mapping?: string
6606
+ }
6607
+ | {
6608
+ input: 'contentBase64'
6609
+ value?: string | DataLink
6610
+ mapping?: string
6611
+ }
6612
+ | {
6613
+ input: 'payload'
6614
+ value?: {} | DataLink
6615
+ mapping?: string
6616
+ }
6617
+ >
6618
+ }
6619
+
6620
+ /* Remove a message at a specific index */
6621
+ export type GeneratorAssistantActionRemoveMessageAtIndex = ActionWithParams & {
6622
+ __actionName: 'GENERATOR_ASSISTANT_REMOVE_MESSAGE_AT_INDEX'
6623
+ params?: Array<{
6624
+ input: 'index'
6625
+ value?: number | DataLink
6626
+ mapping?: string
6627
+ }>
6628
+ }
6629
+
6630
+ /* Reset all messages of the assistant */
6631
+ export type GeneratorAssistantActionResetMessages = Action & {
6632
+ __actionName: 'GENERATOR_ASSISTANT_RESET_MESSAGES'
6633
+ }
6634
+
6635
+ /* Submit the assistant */
6636
+ export type GeneratorAssistantActionSubmit = Action & {
6637
+ __actionName: 'GENERATOR_ASSISTANT_SUBMIT'
6638
+ }
6639
+
6640
+ /* Cancel the assistant responding */
6641
+ export type GeneratorAssistantActionCancel = Action & {
6642
+ __actionName: 'GENERATOR_ASSISTANT_CANCEL'
6643
+ }
6644
+
6645
+ interface GeneratorAssistantDef {
6646
+ /*
6647
+ Default property:
6648
+ {
6649
+ "initialMessages": [
6650
+ null
6651
+ ],
6652
+ "cacheMessages": false,
6653
+ "llmLivePolicy": "only-in-use",
6654
+ "llmSessionKey": "default-assistant",
6655
+ "sttEnabled": true,
6656
+ "sttLivePolicy": "only-in-use",
6657
+ "ttsEnabled": false,
6658
+ "ttsLivePolicy": "only-in-use"
6659
+ }
6660
+ */
6661
+ property?: {
6662
+ /* Messages */
6663
+ initialMessages?:
6664
+ | Array<
6665
+ | DataLink
6666
+ | {
6667
+ role?: string | DataLink
6668
+ content?: string | DataLink
6669
+ }
6670
+ >
6671
+ | DataLink
6672
+ /* Whether to cache messages */
6673
+ cacheMessages?: boolean | DataLink
6674
+ /* LLM Generator (Currently only support `LLM (GGML)` generator) */
6675
+ llmGeneratorId?: string | DataLink
6676
+ /* LLM Live Policy. If the policy is `only-in-use`, the LLM context will be released when the assistant is not in use. */
6677
+ llmLivePolicy?: 'only-in-use' | 'manual' | DataLink
6678
+ /* LLM main session key */
6679
+ llmSessionKey?: string | DataLink
6680
+ /* STT Generator use for transcribing audio message (Currently only support `STT (GGML)` generator) */
6681
+ sttGeneratorId?: string | DataLink
6682
+ /* STT Enabled */
6683
+ sttEnabled?: boolean | DataLink
6684
+ /* STT Live Policy. If the policy is `only-in-use`, the STT context will be released when the assistant is not in use. */
6685
+ sttLivePolicy?: 'only-in-use' | 'manual' | DataLink
6686
+ /* TTS Generator use for generating LLM response audio message (Currently only support `TTS (ONNX)` generator) */
6687
+ ttsGeneratorId?: string | DataLink
6688
+ /* TTS Enabled */
6689
+ ttsEnabled?: boolean | DataLink
6690
+ /* TTS Live Policy. If the policy is `only-in-use`, the TTS context will be released when the assistant is not in use. */
6691
+ ttsLivePolicy?: 'only-in-use' | 'manual' | DataLink
6692
+ }
6693
+ events?: {
6694
+ /* Error event */
6695
+ onError?: Array<
6696
+ EventAction & {
6697
+ eventPropertyMapping?: {
6698
+ error: {
6699
+ type: 'string'
6700
+ path: string
6701
+ }
6702
+ }
6703
+ }
6704
+ >
6705
+ /* Log event */
6706
+ onLogs?: Array<
6707
+ EventAction & {
6708
+ eventPropertyMapping?: {
6709
+ logs: {
6710
+ type: 'array'
6711
+ path: string
6712
+ }
6713
+ }
6714
+ }
6715
+ >
6716
+ /* Messages update event */
6717
+ onMessagesUpdate?: Array<
6718
+ EventAction & {
6719
+ eventPropertyMapping?: {
6720
+ messages: {
6721
+ type: 'array'
6722
+ path: string
6723
+ }
6724
+ }
6725
+ }
6726
+ >
6727
+ }
6728
+ outlets?: {
6729
+ /* Whether the assistant is responding */
6730
+ isResponding?: () => Data
6731
+ /* Messages of the assistant */
6732
+ messages?: () => Data
6733
+ }
6734
+ }
6735
+
6736
+ /* AI Assistant */
6737
+ export type GeneratorAssistant = Generator &
6738
+ GeneratorAssistantDef & {
6739
+ templateKey: 'GENERATOR_ASSISTANT'
6740
+ switches: Array<
6741
+ SwitchDef &
6742
+ GeneratorAssistantDef & {
6743
+ conds?: Array<{
6744
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
6745
+ cond:
6746
+ | SwitchCondInnerStateCurrentCanvas
6747
+ | SwitchCondData
6748
+ | {
6749
+ __typename: 'SwitchCondInnerStateOutlet'
6750
+ outlet: 'isResponding' | 'messages'
6751
+ value: any
6752
+ }
6753
+ }>
6754
+ }
6755
+ >
6756
+ }
package/types/system.ts CHANGED
@@ -475,3 +475,8 @@ export type SystemActionThrowException = ActionWithParams & {
475
475
  }
476
476
  >
477
477
  }
478
+
479
+ /* Dismiss keyboard */
480
+ export type SystemActionDismissKeyboard = Action & {
481
+ __actionName: 'DISMISS_KEYBOARD'
482
+ }