From bf50a5cb7a97994ee81e97801028140cb7c3189b Mon Sep 17 00:00:00 2001 From: vanbasten17 Date: Fri, 17 May 2024 16:21:54 +0200 Subject: [PATCH] fix: convert incoming config to camelCase --- packages/botonic-plugin-flow-builder/src/index.ts | 2 +- packages/botonic-plugin-flow-builder/src/types.ts | 2 +- .../src/user-input/smart-intent.ts | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/botonic-plugin-flow-builder/src/index.ts b/packages/botonic-plugin-flow-builder/src/index.ts index 4be0262432..c46f9f7b57 100644 --- a/packages/botonic-plugin-flow-builder/src/index.ts +++ b/packages/botonic-plugin-flow-builder/src/index.ts @@ -67,7 +67,7 @@ export default class BotonicPluginFlowBuilder implements Plugin { this.getKnowledgeBaseResponse = options.getKnowledgeBaseResponse this.smartIntentsConfig = { ...options?.smartIntentsConfig, - use_latest: jsonVersion === FlowBuilderJSONVersion.LATEST, + useLatest: jsonVersion === FlowBuilderJSONVersion.LATEST, } const customFunctions = options.customFunctions || {} this.functions = { ...DEFAULT_FUNCTIONS, ...customFunctions } diff --git a/packages/botonic-plugin-flow-builder/src/types.ts b/packages/botonic-plugin-flow-builder/src/types.ts index 47685b8704..65d7160234 100644 --- a/packages/botonic-plugin-flow-builder/src/types.ts +++ b/packages/botonic-plugin-flow-builder/src/types.ts @@ -18,7 +18,7 @@ export interface BotonicPluginFlowBuilderOptions { getKnowledgeBaseResponse?: ( request: ActionRequest ) => Promise - smartIntentsConfig?: { num_smart_intents_to_use: number } + smartIntentsConfig?: { numSmartIntentsToUse: number } } export interface FlowBuilderApiOptions { diff --git a/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts b/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts index 59cd6a9972..a235f85291 100644 --- a/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts +++ b/packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts @@ -4,15 +4,16 @@ import axios from 'axios' import { FlowBuilderApi } from '../api' import { HtSmartIntentNode } from '../content-fields/hubtype-fields/smart-intent' -export interface SmartIntentsInferenceParams - extends SmartIntentsInferenceConfig { +export interface SmartIntentsInferenceParams { bot_id: string text: string + num_smart_intents_to_use?: number + use_latest: boolean } export interface SmartIntentsInferenceConfig { - use_latest: boolean - num_smart_intents_to_use?: number + useLatest: boolean + numSmartIntentsToUse?: number } export class SmartIntentsApi { @@ -30,7 +31,8 @@ export class SmartIntentsApi { const params = { bot_id: this.currentRequest.session.bot.id, text: this.currentRequest.input.data, - ...this.smartIntentsConfig, + num_smart_intents_to_use: this.smartIntentsConfig.numSmartIntentsToUse, + use_latest: this.smartIntentsConfig.useLatest, } try {