Merge pull request #2 from AbrahamCordova96/patch-1

app.ts
This commit is contained in:
Leifer Mendez
2024-05-16 08:51:17 -06:00
committed by GitHub

View File

@@ -13,10 +13,10 @@ const welcomeFlow = addKeyword<Provider, Database>(EVENTS.WELCOME)
.addAction(async (ctx, { flowDynamic, state, provider }) => {
await typing(ctx, provider)
const response = await toAsk(ASSISTANT_ID, ctx.body, state)
const chunks = response.split(/(?<!\d)\.\s+/g);
for (const chunk of chunks) {
await flowDynamic([{ body: chunk.trim() }]);
}
const chunks = response.split(/\n\n+/);
for (const chunk of chunks) {
await flowDynamic([{ body: chunk.trim() }]);
}
})
const main = async () => {