@tiledesk/tiledesk-server 2.10.2 → 2.10.3
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 +3 -0
- package/package.json +1 -1
- package/routes/openai.js +12 -8
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/routes/openai.js
CHANGED
@@ -43,15 +43,12 @@ router.post('/', async (req, res) => {
|
|
43
43
|
|
44
44
|
|
45
45
|
let json = {
|
46
|
-
|
47
|
-
|
48
|
-
{
|
49
|
-
"role": "user",
|
50
|
-
"content": body.question
|
51
|
-
}
|
46
|
+
model: body.model,
|
47
|
+
messages: [
|
48
|
+
{ role: "user", content: body.question }
|
52
49
|
],
|
53
|
-
|
54
|
-
|
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) => {
|