fboerncke / jovo-v4-community-plugin-spintax-output

A Jovo V4 framework plugin which adds spintax support for output strings.
Apache License 2.0
2 stars 0 forks source link

Error processing output object for `message` property #1

Open jrglg opened 2 years ago

jrglg commented 2 years ago

Hello.

I love this plugin :)

But an error is thrown when:

return this.$send({
  message: {
    speech: 'this is some speech',
    text: 'this is some text',
  }
});

I think this usage is pretty common.

Error log:

TypeError: text.replace is not a function
    at Object.processSpintaxExpression (.\app\app\node_modules\.pnpm\jovo-v4-community-plugin-spintax-output@1.0.2\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputProcessor.ts:32:17)
    at .\app\app\node_modules\.pnpm\jovo-v4-community-plugin-spintax-output@1.0.2\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputPlugin.ts:33:25
    at Proxy.forEach (<anonymous>)
    at SpintaxOutputPlugin.processSpintaxExpressionsInOutput (.\app\app\node_modules\.pnpm\jovo-v4-community-plugin-spintax-output@1.0.2\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputPlugin.ts:31:18)
    at Array.<anonymous> (.\app\app\node_modules\.pnpm\jovo-v4-community-plugin-spintax-output@1.0.2\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputPlugin.ts:25:14)
    at Middleware.run (.\app\app\node_modules\.pnpm\@jovotech+framework@4.2.18\node_modules\@jovotech\framework\src\Middleware.ts:24:24)
    at MiddlewareCollection.run (.\app\app\node_modules\.pnpm\@jovotech+framework@4.2.18\node_modules\@jovotech\framework\src\MiddlewareCollection.ts:108:25)
    at MiddlewareCollection.run (.\app\app\node_modules\.pnpm\@jovotech+framework@4.2.18\node_modules\@jovotech\framework\src\MiddlewareCollection.ts:104:20)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at App.handle (.\app\app\node_modules\.pnpm\@jovotech+framework@4.2.18\node_modules\@jovotech\framework\src\App.ts:213:7)

Versions: latest

fboerncke commented 2 years ago

You are the first to stumble over this bug, thanks for reporting!

I can reproduce the problem and confirm, that currently the spintax plugin does not work with the data structure shown in your code snippet (though it should).

Looking at the Jovo documentation I can see that in addition to your request also Arrays need support which doesn't work yet (though it should).

I will work on a fix to include all these topics.

fboerncke commented 2 years ago

@jrglg I published an updated version 1.0.3 of this plugin. Could you please check if this solves your problem?

fboerncke commented 2 years ago

Hello jrglg

could you please check, if the updated package 1.0.3 of the plugin solves your problem?

Frank

Am Mi., 22. Juni 2022 um 18:09 Uhr schrieb jrglg @.***>:

Hello.

I love this plugin :)

But an error is thrown when:

return this.$send({ message: { speech: 'this is some speech', text: ''this is some text', } });

I think usage is pretty common.

Error log:

TypeError: text.replace is not a function at Object.processSpintaxExpression @.\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputProcessor.ts:32:17) at .@.\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputPlugin.ts:33:25 at Proxy.forEach () at SpintaxOutputPlugin.processSpintaxExpressionsInOutput @.\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputPlugin.ts:31:18) at Array. @.\node_modules\jovo-v4-community-plugin-spintax-output\src\SpintaxOutputPlugin.ts:25:14) at Middleware.run @.**@*.**@*.\framework\src\Middleware.ts:24:24) at MiddlewareCollection.run @*.**@*.**@.\framework\src\MiddlewareCollection.ts:108:25) at MiddlewareCollection.run @.**@*.**@*.\framework\src\MiddlewareCollection.ts:104:20) at processTicksAndRejections (internal/process/task_queues.js:95:5) at App.handle @*.**@*.**@.\framework\src\App.ts:213:7)

Versions: latest

— Reply to this email directly, view it on GitHub https://github.com/fboerncke/jovo-v4-community-plugin-spintax-output/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFYQL2EW4VIIEP6CRFWWUU3VQM3C7ANCNFSM5ZQ2APYA . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

-- Dr. Frank Börncke • Java/Alexa: Beratung, Architektur, Entwicklung Margaretenstraße 6b • 82152 Krailling • Telefon: +49(89)9760548-0 Fax: +49(89)9760548-7 • @. @.> • www.applicate.de http://www.boerncke.de