Skip to content

Commit

Permalink
fix: convert incoming config to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbasten17 committed May 17, 2024
1 parent e9d9d69 commit bf50a5c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/botonic-plugin-flow-builder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion packages/botonic-plugin-flow-builder/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface BotonicPluginFlowBuilderOptions {
getKnowledgeBaseResponse?: (
request: ActionRequest
) => Promise<KnowledgeBaseResponse>
smartIntentsConfig?: { num_smart_intents_to_use: number }
smartIntentsConfig?: { numSmartIntentsToUse: number }
}

export interface FlowBuilderApiOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check warning on line 19 in packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts

View check run for this annotation

Codecov / codecov/patch

packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts#L19

Added line #L19 was not covered by tests
Expand All @@ -30,7 +31,8 @@ export class SmartIntentsApi {
const params = {

Check warning on line 31 in packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts

View check run for this annotation

Codecov / codecov/patch

packages/botonic-plugin-flow-builder/src/user-input/smart-intent.ts#L31

Added line #L31 was not covered by tests
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 {
Expand Down

0 comments on commit bf50a5c

Please sign in to comment.