-
Notifications
You must be signed in to change notification settings - Fork 110
Description
I need help. Menu is escaping/leaving Chatgpt
// Begin Flow ChatGPT Solar
const ASSISTANT_ID1 = process.env?.ASSISTANT_ID1 ?? "";
const flowSolar = addKeyword<Provider, Database>(EVENTS.ACTION).addAction(
async (ctx, { flowDynamic, state, provider }) => {
await typing(ctx, provider);
const response = await toAsk(ASSISTANT_ID1, ctx.body, state);
const chunks = response.split(/(?<!\d).\s+/g);
for (const chunk of chunks) {
await flowDynamic([{ body: chunk.trim() }]);
}
}
);
const flowMenu = addKeyword(["menu"]).addAnswer(
"Selecione o Prompt\n 1 - Solar\n 2 - Receitas",
{ capture: true },
async (ctx, { gotoFlow }) => {
if (ctx.body == "1") {
return gotoFlow(flowSolar);
}
if (ctx.body == "2") {
return gotoFlow(flowReceitas);
}
}
);
const main = async () => {
const adapterFlow = createFlow([flowMenu, flowSolar, flowReceitas]);