Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger phrase is missing... Locale: 'en'. #21

Open
asarazan opened this issue Oct 5, 2020 · 3 comments
Open

Trigger phrase is missing... Locale: 'en'. #21

asarazan opened this issue Oct 5, 2020 · 3 comments

Comments

@asarazan
Copy link

asarazan commented Oct 5, 2020

It seems that gactions push isn't quite happy with the paths emitted by jovo-model: intents/en-US/Foo.yaml.

en      Trigger phrase is missing for custom intent 'Foo'. Locale: 'en'.             

If I take the entire contents of en-US and drop them directly into the intents folder, the push succeeds.

@rubenaeg
Copy link
Contributor

rubenaeg commented Oct 7, 2020

Hm, seems like that not en-US is the problem, but rather the locale en. What's your process here?

@asarazan
Copy link
Author

asarazan commented Oct 7, 2020

So now that I've figured out how to get jovo-cli to emit these files, I noticed that it duplicates them as both global and localized intents. It seems like jovo-model doesn't do that. Here's the script I wrote:

import { JovoModelGoogle } from "jovo-model-google";
import * as fs from "fs";
import * as path from "path";
import YAML from "yaml";

const jovoModelInstance = new JovoModelGoogle();
const jovoModelData = JSON.parse(
  fs.readFileSync("models/en-US.json").toString()
);
const locale = "en-US";
jovoModelInstance.importJovoModel(jovoModelData, locale);
const modelFiles = jovoModelInstance.exportNative();
fs.rmdirSync("platforms/googleAction2/custom", {
  recursive: true,
});

modelFiles!.forEach((value) => {
  value.path = value.path.map((value1) => value1.replace("AMAZON.", ""));
});

const paths = modelFiles!.map((value, index) => {
  return `${index}: ${value.path.join("/")}`;
});
console.log(`Paths: `, paths);
modelFiles!.forEach((value) => {
  const filepath = `platforms/googleAction2/${value.path.join("/")}`;
  const dirname = path.dirname(filepath);
  fs.mkdirSync(dirname, { recursive: true });
  const content = YAML.stringify(value.content);
  fs.writeFileSync(filepath, content);
});

// TODO prepend correct handler name to webhook file
// TODO purge invalid training phrases: yes, no, off
// TODO figure out what metadata is still missing

console.log(`DONE!`);

@rubenaeg
Copy link
Contributor

rubenaeg commented Oct 8, 2020

Yes, this is a bug that'll be fixed and deployed with the newest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants