diff --git a/plugins/hitl/plugin.definition.ts b/plugins/hitl/plugin.definition.ts index 4878f5a5acc..730de24ba13 100644 --- a/plugins/hitl/plugin.definition.ts +++ b/plugins/hitl/plugin.definition.ts @@ -77,6 +77,13 @@ const PLUGIN_CONFIG_SCHEMA = sdk.z.object({ .nonnegative() .optional() .placeholder('0'), + useHumanAgentInfo: sdk.z + .boolean() + .default(true) + .title('Use Human Agent Info') + .describe( + '(Works only with webchat) Enable this to use the human agent name and photo (if available) as the bot name and photo while in HITL mode.' + ), flowOnHitlStopped: sdk.z .boolean() .default(true) diff --git a/plugins/hitl/src/webchat.ts b/plugins/hitl/src/webchat.ts index 2f2ad7f0ec0..cbff5fc1683 100644 --- a/plugins/hitl/src/webchat.ts +++ b/plugins/hitl/src/webchat.ts @@ -1,3 +1,4 @@ +import * as configuration from './configuration' import * as bp from '.botpress' type WebchatGetOrCreateUserInput = { @@ -40,11 +41,16 @@ export const tryLinkWebchatUser = async ( id: upstreamConversationId, }) + const sessionConfig = await configuration.retrieveSessionConfig({ + ...props, + upstreamConversationId, + }) + const { conversation: { integration: upstreamIntegration }, } = upstreamConversation - if (upstreamIntegration !== 'webchat') { + if (upstreamIntegration !== 'webchat' || !sessionConfig.useHumanAgentInfo) { // this only works when the hitl frontend is webchat return undefined } diff --git a/readme.md b/readme.md index 6d534e42cf5..d1d93df45dd 100644 --- a/readme.md +++ b/readme.md @@ -65,7 +65,7 @@ _This step can be executed in any directory and git repository of your choice. Y You can then modify both the definition and implementation of your integration respectively located in the `integration.definition.ts` and `src/index.ts` files. -For more information on how to develop an integration, please refer to the [Documentation](https://botpress.com/docs/getting-started-1). +For more information on how to develop an integration, please refer to the [Documentation](https://botpress.com/docs/for-developers/sdk/integration/getting-started). ### Integration Deployment