Updating folder name

This commit is contained in:
Peter Morton 2025-08-07 11:12:00 -05:00
parent 5a722a4d65
commit db79b2147b
4 changed files with 20 additions and 41 deletions

View File

@ -27,9 +27,7 @@ const app = {
console.log(`Checking route: ${route.regexp}`);
console.log(`Against path: ${path}`);
if (route.regexp.test(path)) {
console.log(`Running route: ${route.regexp}`);
console.log(`Path: ${path}`);
console.log(`Function: ${route.function.name}`);
console.log(`Matched route: ${route.regexp}`);
route.function(req, res, route.regexp.exec(path));
return;
}
@ -104,7 +102,7 @@ const axioshelper = (message, config, callback, retries = 3, delay = 100) => {
app.route("^(?:/userId/([^/]+))(?:/$)?$", async (req, res, match) => {
try {
console.log("Received request for userId:", match[1]);
console.log(`Received request for userId: ${match[1]}`);
const modelName =
req.params?.modelName || proactive_agent_settings.modelName;
if (match.length > 1) {
@ -249,36 +247,34 @@ app.route("^(?:/userId/([^/]+))(?:/$)?$", async (req, res, match) => {
app.route("/", async (req, res) => {
const sessionId = req.body.event?.conversationId;
const params = req.body.event?.params || {};
const modelName =
params?.modelName || settings_667ef98d3ee8930a5debcbdb.nlu.modelName;
const env = params?.env;
const postBack = req.body.event?.postBack;
const metadata = {
...req.body.event?.metadata,
userId: req.body.event?.sentBy?.userId,
};
const configuration = req.body.event?.configuration;
try {
const umStr = redisKey(metadata.userId);
if (sessionId && metadata.userId) {
const umStr = redisKey(metadata.userId);
await redis.hSet(umStr, "sessionId", sessionId);
await redis.expire(umStr, 3600);
await redis.hSet(umStr, "sessionId", sessionId);
await redis.expire(umStr, 3600);
await axioshelper("messenger join", {
method: "post",
url: `${msgrSettings.messenger.apiBaseURL}Conversation/join`,
headers: studioToken,
data: {
_id: sessionId,
participant: bot_user,
},
});
await axioshelper("messenger join", {
method: "post",
url: `${msgrSettings.messenger.apiBaseURL}Conversation/join`,
headers: studioToken,
data: {
_id: sessionId,
participant: bot_user,
},
});
res.send();
res.send();
} else {
res.send({ error: "sessionId or userId not found on event." });
}
} catch (error) {
console.log(error.message);
console.log(error);
res.send({
answers: ["Something went wrong. Please try again."],
outputs: {},

View File

@ -1,17 +0,0 @@
(async () => {
proactive_agent.joinConversation(conversationData.id);
})()
.catch((error) => {
console.log(error.message);
recognizedObject.answers.push("");
recognizedObject.errorInfo = {
...recognizedObject.errorInfo,
label: {
data: error.toJSON ? error.toJSON() : {},
message: error.message,
},
};
})
.finally(() => {
next();
});