@tiledesk/tiledesk-server 2.10.1 → 2.10.3

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.10.3
9
+ - Added support for formatType in openai completions
10
+
11
+ # 2.10.2
12
+ - Updated tybot-connector to 0.2.113
13
+
8
14
  # 2.10.1
9
15
  - Bugfix: try to read fully_abandoned of request without attributes
10
16
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.10.1",
4
+ "version": "2.10.3",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -48,7 +48,7 @@
48
48
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
49
49
  "@tiledesk/tiledesk-telegram-connector": "^0.1.14",
50
50
  "@tiledesk/tiledesk-train-jobworker": "^0.0.11",
51
- "@tiledesk/tiledesk-tybot-connector": "^0.2.112",
51
+ "@tiledesk/tiledesk-tybot-connector": "^0.2.113",
52
52
  "@tiledesk/tiledesk-whatsapp-connector": "^0.1.73",
53
53
  "@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.8",
54
54
  "@tiledesk/tiledesk-sms-connector": "^0.1.10",
package/routes/openai.js CHANGED
@@ -43,15 +43,12 @@ router.post('/', async (req, res) => {
43
43
 
44
44
 
45
45
  let json = {
46
- "model": body.model,
47
- "messages": [
48
- {
49
- "role": "user",
50
- "content": body.question
51
- }
46
+ model: body.model,
47
+ messages: [
48
+ { role: "user", content: body.question }
52
49
  ],
53
- "max_tokens": body.max_tokens,
54
- "temperature": body.temperature
50
+ max_tokens: body.max_tokens,
51
+ temperature: body.temperature
55
52
  }
56
53
 
57
54
  let message = { role: "", content: "" };
@@ -61,6 +58,12 @@ router.post('/', async (req, res) => {
61
58
  json.messages.unshift(message);
62
59
  }
63
60
 
61
+ if (body.formatType && body.formatType !== 'none') {
62
+ json.response_format = {
63
+ type: body.formatType
64
+ }
65
+ }
66
+
64
67
  let multiplier = MODELS_MULTIPLIER[json.model];
65
68
  if (!multiplier) {
66
69
  multiplier = 1;
@@ -73,6 +76,7 @@ router.post('/', async (req, res) => {
73
76
  let incremented_key = await quoteManager.incrementTokenCount(req.project, data);
74
77
  winston.verbose("Tokens quota incremented for key " + incremented_key);
75
78
  }
79
+
76
80
  res.status(200).send(response.data);
77
81
 
78
82
  }).catch((err) => {