@fugood/bricks-project 2.21.0-beta.26 → 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.
@@ -208,6 +208,27 @@ export const templateActionNameMap = {
208
208
  },
209
209
  },
210
210
 
211
+ BRICK_RIVE: {
212
+ BRICK_RIVE_PLAY: {
213
+ animationName: 'BRICK_RIVE_ANIMATION_NAME',
214
+ loop: 'BRICK_RIVE_LOOP',
215
+ direction: 'BRICK_RIVE_DIRECTION',
216
+ isStateMachine: 'BRICK_RIVE_IS_STATE_MACHINE',
217
+ },
218
+ BRICK_RIVE_FIRE_STATE: {
219
+ stateMachineName: 'BRICK_RIVE_STATE_MACHINE_NAME',
220
+ inputName: 'BRICK_RIVE_INPUT_NAME',
221
+ },
222
+ BRICK_RIVE_SET_INPUT_STATE: {
223
+ stateMachineName: 'BRICK_RIVE_STATE_MACHINE_NAME',
224
+ inputName: 'BRICK_RIVE_INPUT_NAME',
225
+ value: 'BRICK_RIVE_VALUE',
226
+ },
227
+ BRICK_RIVE_SET_TEXT_RUN_VALUE: {
228
+ textRunName: 'BRICK_RIVE_TEXT_RUN_NAME',
229
+ value: 'BRICK_RIVE_VALUE',
230
+ },
231
+ },
211
232
  BRICK_WEBVIEW: {
212
233
  BRICK_WEBVIEW_INJECT_JAVASCRIPT: {
213
234
  javascriptCode: 'BRICK_WEBVIEW_JAVASCRIPT_CODE',
@@ -512,6 +533,11 @@ export const templateActionNameMap = {
512
533
  topP: 'GENERATOR_LLM_TOP_P',
513
534
  xtcThreshold: 'GENERATOR_LLM_XTC_THRESHOLD',
514
535
  xtcProbability: 'GENERATOR_LLM_XTC_PROBABILITY',
536
+ dryMultiplier: 'GENERATOR_LLM_DRY_MULTIPLIER',
537
+ dryBase: 'GENERATOR_LLM_DRY_BASE',
538
+ dryAllowedLength: 'GENERATOR_LLM_DRY_ALLOWED_LENGTH',
539
+ dryPenaltyLastN: 'GENERATOR_LLM_DRY_PENALTY_LAST_N',
540
+ drySequenceBreakers: 'GENERATOR_LLM_DRY_SEQUENCE_BREAKERS',
515
541
  mirostat: 'GENERATOR_LLM_MIROSTAT',
516
542
  mirostatTau: 'GENERATOR_LLM_MIROSTAT_TAU',
517
543
  mirostatEta: 'GENERATOR_LLM_MIROSTAT_ETA',
@@ -531,4 +557,31 @@ export const templateActionNameMap = {
531
557
  sessionCustomKey: 'GENERATOR_LLM_SESSION_CUSTOM_KEY',
532
558
  },
533
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
+ },
534
587
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.21.0-beta.26",
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": "7983dcaadfdfdc326a1376a65be42368f08abf96"
16
+ "gitHead": "fcdff86f963446d3489e4b1cccd697e6d04e4f39"
17
17
  }
@@ -2,6 +2,16 @@
2
2
  import { app, BrowserWindow } from 'electron'
3
3
  import { readFile } from 'fs/promises'
4
4
  import { watchFile } from 'fs'
5
+ import { parseArgs } from 'util'
6
+
7
+ const { values } = parseArgs({
8
+ args: process.argv,
9
+ options: {
10
+ 'clear-cache': { type: 'boolean' },
11
+ },
12
+ strict: true,
13
+ allowPositionals: true,
14
+ })
5
15
 
6
16
  const cwd = process.cwd()
7
17
 
@@ -36,6 +46,11 @@ app.on('ready', () => {
36
46
 
37
47
  mainWindow.webContents.once('dom-ready', sendConfig)
38
48
 
49
+ if (values['clear-cache']) {
50
+ console.log('Clearing cache')
51
+ mainWindow.webContents.session.clearCache()
52
+ }
53
+
39
54
  mainWindow.on('close', () => app.quit())
40
55
 
41
56
  watchFile(
package/tools/preview.ts CHANGED
@@ -9,6 +9,9 @@ const { values } = parseArgs({
9
9
  'skip-typecheck': {
10
10
  type: 'boolean',
11
11
  },
12
+ 'clear-cache': {
13
+ type: 'boolean',
14
+ },
12
15
  },
13
16
  strict: true,
14
17
  allowPositionals: true,
@@ -34,5 +37,11 @@ const watcher = watch(`${cwd}/subspaces`, { recursive: true }, async (event, fil
34
37
 
35
38
  const app = await Bun.file(`${cwd}/application.json`).json()
36
39
 
37
- await $`BRICKS_STAGE=${app.stage || 'production'} bunx electron ${__dirname}/preview-main.mjs`
40
+
41
+ if (values['clear-cache']) {
42
+ await $`BRICKS_STAGE=${app.stage || 'production'} bunx --bun electron ${__dirname}/preview-main.mjs --clear-cache`
43
+ } else {
44
+ await $`BRICKS_STAGE=${app.stage || 'production'} bunx --bun electron ${__dirname}/preview-main.mjs`
45
+ }
46
+
38
47
  watcher.close()
package/types/bricks.ts CHANGED
@@ -2489,6 +2489,314 @@ export type BrickLottie = Brick &
2489
2489
  >
2490
2490
  }
2491
2491
 
2492
+ /* Play animation */
2493
+ export type BrickRiveActionPlay = ActionWithParams & {
2494
+ __actionName: 'BRICK_RIVE_PLAY'
2495
+ params?: Array<
2496
+ | {
2497
+ input: 'animationName'
2498
+ value?: string | DataLink
2499
+ mapping?: string
2500
+ }
2501
+ | {
2502
+ input: 'loop'
2503
+ value?: 'auto' | 'oneShot' | 'loop' | 'pingPong' | DataLink
2504
+ mapping?: string
2505
+ }
2506
+ | {
2507
+ input: 'direction'
2508
+ value?: 'auto' | 'backwards' | 'forwards' | DataLink
2509
+ mapping?: string
2510
+ }
2511
+ | {
2512
+ input: 'isStateMachine'
2513
+ value?: boolean | DataLink
2514
+ mapping?: string
2515
+ }
2516
+ >
2517
+ }
2518
+
2519
+ /* Pause animation */
2520
+ export type BrickRiveActionPause = Action & {
2521
+ __actionName: 'BRICK_RIVE_PAUSE'
2522
+ }
2523
+
2524
+ /* Stop animation */
2525
+ export type BrickRiveActionStop = Action & {
2526
+ __actionName: 'BRICK_RIVE_STOP'
2527
+ }
2528
+
2529
+ /* Reset animation */
2530
+ export type BrickRiveActionReset = Action & {
2531
+ __actionName: 'BRICK_RIVE_RESET'
2532
+ }
2533
+
2534
+ /* Fire state */
2535
+ export type BrickRiveActionFireState = ActionWithParams & {
2536
+ __actionName: 'BRICK_RIVE_FIRE_STATE'
2537
+ params?: Array<
2538
+ | {
2539
+ input: 'stateMachineName'
2540
+ value?: string | DataLink
2541
+ mapping?: string
2542
+ }
2543
+ | {
2544
+ input: 'inputName'
2545
+ value?: string | DataLink
2546
+ mapping?: string
2547
+ }
2548
+ >
2549
+ }
2550
+
2551
+ /* Set input state */
2552
+ export type BrickRiveActionSetInputState = ActionWithParams & {
2553
+ __actionName: 'BRICK_RIVE_SET_INPUT_STATE'
2554
+ params?: Array<
2555
+ | {
2556
+ input: 'stateMachineName'
2557
+ value?: string | DataLink
2558
+ mapping?: string
2559
+ }
2560
+ | {
2561
+ input: 'inputName'
2562
+ value?: string | DataLink
2563
+ mapping?: string
2564
+ }
2565
+ | {
2566
+ input: 'value'
2567
+ value?: any
2568
+ mapping?: string
2569
+ }
2570
+ >
2571
+ }
2572
+
2573
+ /* Set text run value. Text Run name need to defined as unique name in Rive file. (Ref: https://rive.app/community/doc/text/docn2E6y1lXo) */
2574
+ export type BrickRiveActionSetTextRunValue = ActionWithParams & {
2575
+ __actionName: 'BRICK_RIVE_SET_TEXT_RUN_VALUE'
2576
+ params?: Array<
2577
+ | {
2578
+ input: 'textRunName'
2579
+ value?: string | DataLink
2580
+ mapping?: string
2581
+ }
2582
+ | {
2583
+ input: 'value'
2584
+ value?: any
2585
+ mapping?: string
2586
+ }
2587
+ >
2588
+ }
2589
+
2590
+ interface BrickRiveDef {
2591
+ /*
2592
+ Default property:
2593
+ {
2594
+ "autoplay": true,
2595
+ "alignment": "center",
2596
+ "fit": "contain"
2597
+ }
2598
+ */
2599
+ property?: BrickBasicProperty & {
2600
+ /* Rive file url */
2601
+ url?: string | DataLink
2602
+ /* The checksum of `url` */
2603
+ md5?: string | DataLink
2604
+ /* Autoplay the animation */
2605
+ autoplay?: boolean | DataLink
2606
+ /* Alignment of the animation */
2607
+ alignment?:
2608
+ | 'topLeft'
2609
+ | 'topCenter'
2610
+ | 'topRight'
2611
+ | 'centerLeft'
2612
+ | 'center'
2613
+ | 'centerRight'
2614
+ | 'bottomLeft'
2615
+ | 'bottomCenter'
2616
+ | 'bottomRight'
2617
+ | DataLink
2618
+ /* Fit mode of the animation */
2619
+ fit?:
2620
+ | 'cover'
2621
+ | 'contain'
2622
+ | 'fill'
2623
+ | 'fitWidth'
2624
+ | 'fitHeight'
2625
+ | 'none'
2626
+ | 'scaleDown'
2627
+ | 'layout'
2628
+ | DataLink
2629
+ /* Artboard name */
2630
+ artboardName?: string | DataLink
2631
+ /* Animation name */
2632
+ animationName?: string | DataLink
2633
+ /* State machine name */
2634
+ stateMachineName?: string | DataLink
2635
+ }
2636
+ events?: BrickBasicEvents & {
2637
+ /* Event of animation play */
2638
+ onPlay?: Array<
2639
+ EventAction & {
2640
+ eventPropertyMapping?: {
2641
+ animationName: {
2642
+ type: 'string'
2643
+ path: string
2644
+ }
2645
+ isStateMachine: {
2646
+ type: 'bool'
2647
+ path: string
2648
+ }
2649
+ }
2650
+ }
2651
+ >
2652
+ /* Event of animation pause */
2653
+ onPause?: Array<
2654
+ EventAction & {
2655
+ eventPropertyMapping?: {
2656
+ animationName: {
2657
+ type: 'string'
2658
+ path: string
2659
+ }
2660
+ isStateMachine: {
2661
+ type: 'bool'
2662
+ path: string
2663
+ }
2664
+ }
2665
+ }
2666
+ >
2667
+ /* Event of animation stop */
2668
+ onStop?: Array<
2669
+ EventAction & {
2670
+ eventPropertyMapping?: {
2671
+ animationName: {
2672
+ type: 'string'
2673
+ path: string
2674
+ }
2675
+ isStateMachine: {
2676
+ type: 'bool'
2677
+ path: string
2678
+ }
2679
+ }
2680
+ }
2681
+ >
2682
+ /* Event of animation loop end */
2683
+ onLoopEnd?: Array<
2684
+ EventAction & {
2685
+ eventPropertyMapping?: {
2686
+ animationName: {
2687
+ type: 'string'
2688
+ path: string
2689
+ }
2690
+ isStateMachine: {
2691
+ type: 'bool'
2692
+ path: string
2693
+ }
2694
+ }
2695
+ }
2696
+ >
2697
+ /* Event of state changed */
2698
+ onStateChanged?: Array<
2699
+ EventAction & {
2700
+ eventPropertyMapping?: {
2701
+ stateMachineName: {
2702
+ type: 'string'
2703
+ path: string
2704
+ }
2705
+ stateName: {
2706
+ type: 'string'
2707
+ path: string
2708
+ }
2709
+ }
2710
+ }
2711
+ >
2712
+ /* Event of error */
2713
+ onError?: Array<
2714
+ EventAction & {
2715
+ eventPropertyMapping?: {
2716
+ error: {
2717
+ type: 'string'
2718
+ path: string
2719
+ }
2720
+ }
2721
+ }
2722
+ >
2723
+ /* Event of Rive general event received */
2724
+ onRiveGeneralEvent?: Array<
2725
+ EventAction & {
2726
+ eventPropertyMapping?: {
2727
+ eventName: {
2728
+ type: 'string'
2729
+ path: string
2730
+ }
2731
+ eventDelay: {
2732
+ type: 'number'
2733
+ path: string
2734
+ }
2735
+ eventProperties: {
2736
+ type: 'object'
2737
+ path: string
2738
+ }
2739
+ }
2740
+ }
2741
+ >
2742
+ /* Event of Rive open-url event received */
2743
+ onRiveOpenUrlEvent?: Array<
2744
+ EventAction & {
2745
+ eventPropertyMapping?: {
2746
+ eventName: {
2747
+ type: 'string'
2748
+ path: string
2749
+ }
2750
+ eventDelay: {
2751
+ type: 'number'
2752
+ path: string
2753
+ }
2754
+ eventUrl: {
2755
+ type: 'string'
2756
+ path: string
2757
+ }
2758
+ eventTarget: {
2759
+ type: 'string'
2760
+ path: string
2761
+ }
2762
+ }
2763
+ }
2764
+ >
2765
+ }
2766
+ animation?: AnimationBasicEvents & {
2767
+ onPlay?: Animation
2768
+ onPause?: Animation
2769
+ onStop?: Animation
2770
+ onLoopEnd?: Animation
2771
+ onStateChanged?: Animation
2772
+ onError?: Animation
2773
+ onRiveGeneralEvent?: Animation
2774
+ onRiveOpenUrlEvent?: Animation
2775
+ }
2776
+ }
2777
+
2778
+ /* Rive file component */
2779
+ export type BrickRive = Brick &
2780
+ BrickRiveDef & {
2781
+ templateKey: 'BRICK_RIVE'
2782
+ switches: Array<
2783
+ SwitchDef &
2784
+ BrickRiveDef & {
2785
+ conds?: Array<{
2786
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
2787
+ cond:
2788
+ | SwitchCondInnerStateCurrentCanvas
2789
+ | SwitchCondData
2790
+ | {
2791
+ __typename: 'SwitchCondInnerStateOutlet'
2792
+ outlet: ''
2793
+ value: any
2794
+ }
2795
+ }>
2796
+ }
2797
+ >
2798
+ }
2799
+
2492
2800
  /* Run Javascript on the WebView */
2493
2801
  export type BrickWebViewActionInjectJavascript = ActionWithParams & {
2494
2802
  __actionName: 'BRICK_WEBVIEW_INJECT_JAVASCRIPT'
@@ -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 */
@@ -6148,6 +6044,31 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
6148
6044
  value?: number | DataLink
6149
6045
  mapping?: string
6150
6046
  }
6047
+ | {
6048
+ input: 'dryMultiplier'
6049
+ value?: number | DataLink
6050
+ mapping?: string
6051
+ }
6052
+ | {
6053
+ input: 'dryBase'
6054
+ value?: number | DataLink
6055
+ mapping?: string
6056
+ }
6057
+ | {
6058
+ input: 'dryAllowedLength'
6059
+ value?: number | DataLink
6060
+ mapping?: string
6061
+ }
6062
+ | {
6063
+ input: 'dryPenaltyLastN'
6064
+ value?: number | DataLink
6065
+ mapping?: string
6066
+ }
6067
+ | {
6068
+ input: 'drySequenceBreakers'
6069
+ value?: Array<any> | DataLink
6070
+ mapping?: string
6071
+ }
6151
6072
  | {
6152
6073
  input: 'mirostat'
6153
6074
  value?: number | DataLink
@@ -6287,6 +6208,15 @@ Default property:
6287
6208
  "completionTopK": 40,
6288
6209
  "completionTopP": 0.5,
6289
6210
  "completionMinP": 0.05,
6211
+ "completionDryMultiplier": 0,
6212
+ "completionDryBase": 1.75,
6213
+ "completionDryAllowedLength": 2,
6214
+ "completionDrySequenceBreakers": [
6215
+ "\n",
6216
+ ":",
6217
+ "\"",
6218
+ "*"
6219
+ ],
6290
6220
  "completionMirostat": 0,
6291
6221
  "completionMirostatTau": 5,
6292
6222
  "completionMirostatEta": 0.1,
@@ -6393,6 +6323,16 @@ Default property:
6393
6323
  completionXtcThreshold?: number | DataLink
6394
6324
  /* Sets the chance for token removal (checked once on sampler start) */
6395
6325
  completionXtcProbability?: number | DataLink
6326
+ /* Set the DRY (Don't Repeat Yourself) repetition penalty multiplier. Default: `0.0`, which is disabled. */
6327
+ completionDryMultiplier?: number | DataLink
6328
+ /* Set the DRY repetition penalty base value. Default: `1.75` */
6329
+ completionDryBase?: number | DataLink
6330
+ /* Tokens that extend repetition beyond this receive exponentially increasing penalty: multiplier * base ^ (length of repeating sequence before token - allowed length). Default: `2` */
6331
+ completionDryAllowedLength?: number | DataLink
6332
+ /* How many tokens to scan for repetitions. Default: `-1`, where `0` is disabled and `-1` is context size. */
6333
+ completionDryPenaltyLastN?: number | DataLink
6334
+ /* Specify an array of sequence breakers for DRY sampling. Only a JSON array of strings is accepted. Default: `['\n', ':', '"', '*']` */
6335
+ completionDrySequenceBreakers?: Array<string | DataLink> | DataLink
6396
6336
  /* Use Mirostat sampling. Top K, Nucleus, Tail Free and Locally Typical samplers are ignored if used. */
6397
6337
  completionMirostat?: number | DataLink
6398
6338
  /* Mirostat target entropy, parameter tau */
@@ -6447,6 +6387,10 @@ Default property:
6447
6387
  onCompletion?: Array<
6448
6388
  EventAction & {
6449
6389
  eventPropertyMapping?: {
6390
+ completionSessionKey: {
6391
+ type: 'string'
6392
+ path: string
6393
+ }
6450
6394
  completionResult: {
6451
6395
  type: 'string'
6452
6396
  path: string
@@ -6466,6 +6410,10 @@ Default property:
6466
6410
  onCompletionFinished?: Array<
6467
6411
  EventAction & {
6468
6412
  eventPropertyMapping?: {
6413
+ completionSessionKey: {
6414
+ type: 'string'
6415
+ path: string
6416
+ }
6469
6417
  completionResult: {
6470
6418
  type: 'string'
6471
6419
  path: string
@@ -6485,6 +6433,10 @@ Default property:
6485
6433
  onCompletionFunctionCall?: Array<
6486
6434
  EventAction & {
6487
6435
  eventPropertyMapping?: {
6436
+ completionSessionKey: {
6437
+ type: 'string'
6438
+ path: string
6439
+ }
6488
6440
  completionFunctionCallName: {
6489
6441
  type: 'string'
6490
6442
  path: string
@@ -6566,3 +6518,239 @@ export type GeneratorLLM = Generator &
6566
6518
  }
6567
6519
  >
6568
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
+ }