From 839a6a1289bbe86bbd4290682a06a66d6afb1709 Mon Sep 17 00:00:00 2001 From: Mark Tucker Date: Mon, 30 Oct 2023 17:23:12 -0700 Subject: [PATCH 1/2] :sparkles: Add regex entity type --- packages/jovo-model-nlpjs/src/Interfaces.ts | 2 +- packages/jovo-model-nlpjs/src/JovoModelNlpjs.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/jovo-model-nlpjs/src/Interfaces.ts b/packages/jovo-model-nlpjs/src/Interfaces.ts index abff889..ff218b1 100644 --- a/packages/jovo-model-nlpjs/src/Interfaces.ts +++ b/packages/jovo-model-nlpjs/src/Interfaces.ts @@ -16,5 +16,5 @@ export interface NlpjsModelFile { name: string; locale: string; data: NlpjsData[]; - entities?: Record; + entities?: Record; } diff --git a/packages/jovo-model-nlpjs/src/JovoModelNlpjs.ts b/packages/jovo-model-nlpjs/src/JovoModelNlpjs.ts index d6afc62..18c04e8 100644 --- a/packages/jovo-model-nlpjs/src/JovoModelNlpjs.ts +++ b/packages/jovo-model-nlpjs/src/JovoModelNlpjs.ts @@ -8,6 +8,8 @@ import { } from '@jovotech/model'; import { NlpjsData, NlpjsModelFile } from '.'; +const REGEX_PREFIX = 'regex:'; + export class JovoModelNlpjs extends JovoModel { static MODEL_KEY = 'nlpjs'; @@ -87,6 +89,12 @@ export class JovoModelNlpjs extends JovoModel { if (JovoModelHelper.hasEntityTypes(model)) { returnData.entities = {}; for (const [entityKey, entityTypeName] of Object.entries(entitiesMap)) { + + if (entityTypeName.startsWith(REGEX_PREFIX)) { + returnData.entities![entityKey] = entityTypeName.slice(REGEX_PREFIX.length); + continue; + } + const relatedEntityType = JovoModelHelper.getEntityTypeByName(model, entityTypeName); if (!relatedEntityType?.values?.length) { continue; From e85bdb0026aa95bae9417755c4865a7083923307 Mon Sep 17 00:00:00 2001 From: Joshua Sadlowski Date: Tue, 9 Jan 2024 09:45:09 +0100 Subject: [PATCH 2/2] :sparkles: Add alexa name-free interaction support --- packages/jovo-model-alexa/src/JovoModelAlexa.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/jovo-model-alexa/src/JovoModelAlexa.ts b/packages/jovo-model-alexa/src/JovoModelAlexa.ts index 43e5da0..785d4e8 100644 --- a/packages/jovo-model-alexa/src/JovoModelAlexa.ts +++ b/packages/jovo-model-alexa/src/JovoModelAlexa.ts @@ -330,6 +330,15 @@ export class JovoModelAlexa extends JovoModel { _set(alexaModel, 'interactionModel.dialog', _get(model, 'alexa.interactionModel.dialog')); } + // name-free interaction + if (_get(model, 'alexa.interactionModel._nameFreeInteraction')) { + _set( + alexaModel, + 'interactionModel._nameFreeInteraction', + _get(model, 'alexa.interactionModel._nameFreeInteraction') + ); + } + // types if (JovoModelHelper.hasEntityTypes(model)) { const entityTypes = JovoModelHelper.getEntityTypes(model);