@tiledesk/tiledesk-server 2.14.12 → 2.14.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/pubmodules/canned/cannedResponseRoute.js +1 -1
- package/pubmodules/rules/conciergeBot.js +2 -2
- package/routes/kb.js +5 -3
- package/routes/llm.js +1 -1
- package/routes/openai.js +1 -1
- package/routes/quotes.js +1 -1
- package/services/aiManager.js +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
|
7
7
|
|
|
8
|
+
# 2.14.13
|
|
9
|
+
- Added sitemap scheduling in aiManager
|
|
10
|
+
- Updated import route to use sitemap scheduling functionality
|
|
11
|
+
|
|
8
12
|
# 2.14.12
|
|
9
13
|
- Updated handling of unresponsive requests to close based on the updatedAt field instead of createdAt
|
|
10
14
|
|
package/package.json
CHANGED
|
@@ -196,7 +196,7 @@ router.delete('/:cannedResponseid/physical', async function (req, res) {
|
|
|
196
196
|
router.get('/:cannedResponseid', function (req, res) {
|
|
197
197
|
winston.debug(req.body);
|
|
198
198
|
let user_id = req.user.id;
|
|
199
|
-
|
|
199
|
+
winston.verbose("CannedResponseRoute: user_id: " + user_id);
|
|
200
200
|
|
|
201
201
|
CannedResponse.findById(req.params.cannedResponseid, function (err, cannedResponse) {
|
|
202
202
|
if (err) {
|
|
@@ -80,9 +80,9 @@ devi mandare un messaggio welcome tu altrimenti il bot inserito successivamente
|
|
|
80
80
|
//apply only if the status is temp and no bot is available. with agent you must reroute to assign temp request to an agent
|
|
81
81
|
winston.debug("rerouting");
|
|
82
82
|
// reroute(request_id, id_project, nobot)
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
requestService.reroute(message.request.request_id, message.request.id_project, false ).then(function() {
|
|
85
|
-
|
|
85
|
+
winston.debug("reroute successful from event message.create");
|
|
86
86
|
}).catch((err) => {
|
|
87
87
|
winston.error("ConciergeBot error reroute: " + err);
|
|
88
88
|
});
|
package/routes/kb.js
CHANGED
|
@@ -397,7 +397,7 @@ router.post('/qa', async (req, res) => {
|
|
|
397
397
|
let multiplier = MODELS_MULTIPLIER[data.model];
|
|
398
398
|
if (!multiplier) {
|
|
399
399
|
multiplier = 1;
|
|
400
|
-
winston.info("No multiplier found for AI model")
|
|
400
|
+
winston.info("No multiplier found for AI model (qa) " + data.model);
|
|
401
401
|
}
|
|
402
402
|
obj.multiplier = multiplier;
|
|
403
403
|
obj.tokens = answer.prompt_token_size;
|
|
@@ -1731,6 +1731,8 @@ router.post('/sitemap/import', async (req, res) => {
|
|
|
1731
1731
|
return res.status(500).send({ success: false, error: err });
|
|
1732
1732
|
}
|
|
1733
1733
|
|
|
1734
|
+
|
|
1735
|
+
|
|
1734
1736
|
const options = {
|
|
1735
1737
|
sitemap_origin_id: saved_content._id,
|
|
1736
1738
|
sitemap_origin: saved_content.source,
|
|
@@ -1739,9 +1741,9 @@ router.post('/sitemap/import', async (req, res) => {
|
|
|
1739
1741
|
refresh_rate: saved_content.refresh_rate
|
|
1740
1742
|
}
|
|
1741
1743
|
|
|
1742
|
-
let result;
|
|
1743
1744
|
try {
|
|
1744
|
-
|
|
1745
|
+
await aiManager.scheduleSitemap(namespace, saved_content, options);
|
|
1746
|
+
let result = await aiManager.addMultipleUrls(namespace, urls, options);
|
|
1745
1747
|
if (process.env.NODE_ENV === 'test') {
|
|
1746
1748
|
result.result.push(saved_content);
|
|
1747
1749
|
return res.status(200).send(result);
|
package/routes/llm.js
CHANGED
|
@@ -97,7 +97,7 @@ router.post('/preview', async (req, res) => {
|
|
|
97
97
|
let multiplier = MODELS_MULTIPLIER[json.model];
|
|
98
98
|
if (!multiplier) {
|
|
99
99
|
multiplier = 1;
|
|
100
|
-
winston.info("No multiplier found for AI model " + json.model)
|
|
100
|
+
winston.info("No multiplier found for AI model (llm) " + json.model)
|
|
101
101
|
}
|
|
102
102
|
obj.multiplier = multiplier;
|
|
103
103
|
obj.tokens = response.data?.prompt_token_info?.total_tokens || 0;
|
package/routes/openai.js
CHANGED
|
@@ -67,7 +67,7 @@ router.post('/', async (req, res) => {
|
|
|
67
67
|
let multiplier = MODELS_MULTIPLIER[json.model];
|
|
68
68
|
if (!multiplier) {
|
|
69
69
|
multiplier = 1;
|
|
70
|
-
winston.info("No multiplier found for AI model")
|
|
70
|
+
winston.info("No multiplier found for AI model (openai) " + json.model)
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
aiService.completions(json, gptkey).then(async (response) => {
|
package/routes/quotes.js
CHANGED
|
@@ -47,7 +47,7 @@ router.post('/incr/:type', async (req, res) => {
|
|
|
47
47
|
let multiplier = MODELS_MULTIPLIER[data.model];
|
|
48
48
|
if (!multiplier) {
|
|
49
49
|
multiplier = 1;
|
|
50
|
-
winston.info("No multiplier found for AI model")
|
|
50
|
+
winston.info("No multiplier found for AI model (incr) " + data.model)
|
|
51
51
|
}
|
|
52
52
|
data.multiplier = multiplier;
|
|
53
53
|
data.createdAt = new Date();
|
package/services/aiManager.js
CHANGED
|
@@ -115,6 +115,32 @@ class AiManager {
|
|
|
115
115
|
})
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
async scheduleSitemap(namespace, sitemap_content, options) {
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
120
|
+
|
|
121
|
+
let kb = {
|
|
122
|
+
id: sitemap_content._id,
|
|
123
|
+
source: sitemap_content.source,
|
|
124
|
+
type: 'sitemap',
|
|
125
|
+
content: "",
|
|
126
|
+
namespace: namespace.id,
|
|
127
|
+
refresh_rate: options.refresh_rate,
|
|
128
|
+
engine: namespace.engine,
|
|
129
|
+
embedding: namespace.embedding,
|
|
130
|
+
hybrid: namespace.hybrid,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (process.env.NODE_ENV === 'test') {
|
|
134
|
+
resolve(kb);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.scheduleScrape([kb], namespace.hybrid);
|
|
139
|
+
resolve(kb);
|
|
140
|
+
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
118
144
|
async checkNamespace(id_project, namespace_id) {
|
|
119
145
|
return new Promise( async (resolve, reject) => {
|
|
120
146
|
|