Skip to content

Commit

Permalink
🐛 Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
aswetlow committed Jan 31, 2024
1 parent 0c0c51d commit 9f1272d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/jovo-model-alexa/src/JovoModelAlexa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ export class JovoModelAlexa extends JovoModel {
}
}

const alexaLanguageModelIntents = _get(model, 'alexa.interactionModel.languageModel.intents') || [];
// convert alexa specific intents
if (_get(model, 'alexa.interactionModel.languageModel.intents')) {
for (const intent of _get(model, 'alexa.interactionModel.languageModel.intents')) {
if (alexaLanguageModelIntents) {
for (const intent of alexaLanguageModelIntents) {
alexaIntents.push(intent);
}
}
Expand Down
21 changes: 14 additions & 7 deletions packages/jovo-model-dialogflow/src/JovoModelDialogflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,11 @@ export class JovoModelDialogflow extends JovoModel {
});
}
}
// tslint:disable-next-line:no-any
const dialogFlowIntents =_get(model, 'dialogflow.intents') as any;
// dialogflow intents form locale.json
if (_get(model, 'dialogflow.intents')) {
for (const modelDialogflowIntent of _get(model, 'dialogflow.intents')) {
if (dialogFlowIntents) {
for (const modelDialogflowIntent of dialogFlowIntents) {
// user says
if (modelDialogflowIntent.userSays) {
returnFiles.push({
Expand All @@ -496,9 +498,11 @@ export class JovoModelDialogflow extends JovoModel {
}
}

// tslint:disable-next-line:no-any
const dialogFlowEntities = _get(model, 'dialogflow.entities') as any;
// dialogflow entities form locale.json
if (_get(model, 'dialogflow.entities')) {
for (const modelDialogflowEntity of _get(model, 'dialogflow.entities')) {
if (dialogFlowEntities) {
for (const modelDialogflowEntity of dialogFlowEntities) {
// entries
if (modelDialogflowEntity.entries) {
returnFiles.push({
Expand Down Expand Up @@ -606,13 +610,15 @@ export class JovoModelDialogflow extends JovoModel {
);
}

// tslint:disable-next-line:no-any
const dialogFlowIntentResponseMessages = _get(dialogFlowIntent, 'responses[0].messages') as any;
if (
!_isEqual(
_get(dialogFlowIntent, 'responses[0].messages'),
dialogFlowIntentResponseMessages,
_get(DEFAULT_INTENT, 'responses[0].messages'),
)
) {
for (const message of _get(dialogFlowIntent, 'responses[0].messages')) {
for (const message of dialogFlowIntentResponseMessages) {
if (_get(message, 'lang') === locale) {
const jovoIntentDialogflowMessages = _get(
jovoIntent,
Expand All @@ -621,7 +627,8 @@ export class JovoModelDialogflow extends JovoModel {
);

if (_get(message, 'speech', '').length > 0) {
jovoIntentDialogflowMessages.push(message);
// @ts-ignore
jovoIntentDialogflowMessages.push(message);
_set(jovoIntent, 'dialogflow.responses[0].messages', jovoIntentDialogflowMessages);
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/jovo-model-google/src/JovoModelGoogle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ export class JovoModelGoogle extends JovoModel {

jovoModel.entityTypes![modelName] = jovoEntity;
} else {
const props: GoogleActionLanguageModelProperty[] = _get(
// @ts-ignore
const props: GoogleActionLanguageModelProperty[] = _get(
jovoModel,
`googleAssistant.custom.${modelType}`,
{},
Expand Down

0 comments on commit 9f1272d

Please sign in to comment.