wingbot 3.76.0 → 3.76.1-alpha.1
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/.claude/settings.local.json +11 -0
- package/package.json +2 -2
- package/src/ChatGpt.js +10 -2
- package/.opencode/goals/state.json +0 -4
- package/test.json +0 -330
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(npx mocha:*)",
|
|
5
|
+
"Bash(npx tsc *)",
|
|
6
|
+
"Bash(npm test *)",
|
|
7
|
+
"Bash(node -e \"const p = require\\('./bot/plugins/BTMLLM'\\); console.log\\('factory type:', typeof p\\); console.log\\('factory name:', p.name\\);\")",
|
|
8
|
+
"Bash(grep -n \"prompt\\\\`\\\\|tagged\\\\|render\\\\|compile\\\\|hbs\" /Users/ondrejveres/Wingbot/wingbot-llm/src/prompt.js)"
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wingbot",
|
|
3
|
-
"version": "3.76.
|
|
3
|
+
"version": "3.76.1-alpha.1",
|
|
4
4
|
"description": "Enterprise Messaging Bot Conversation Engine",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -76,4 +76,4 @@
|
|
|
76
76
|
"axios": "^1.6.4",
|
|
77
77
|
"handlebars": "^4.0.0"
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}
|
package/src/ChatGpt.js
CHANGED
|
@@ -31,6 +31,7 @@ const LLM = require('./LLM');
|
|
|
31
31
|
* @prop {string} [apiVersion]
|
|
32
32
|
* @prop {string} [apiKey] // for microsoft services
|
|
33
33
|
* @prop {string} [authorization] // for chat gpt api
|
|
34
|
+
* @prop {number} [timeout=15000] - request timeout in ms; set to 0 to disable
|
|
34
35
|
*/
|
|
35
36
|
|
|
36
37
|
/** @typedef {'gpt-3.5-turbo'|'gpt-4'|'gpt-4-32k'|'gpt-3.5-turbo-16k'|string} ChatGPTModel */
|
|
@@ -189,11 +190,13 @@ class ChatGpt {
|
|
|
189
190
|
openAiEndpoint = 'https://api.openai.com/v1',
|
|
190
191
|
apiKey,
|
|
191
192
|
authorization,
|
|
193
|
+
timeout = 15000,
|
|
192
194
|
...rest
|
|
193
195
|
} = options;
|
|
194
196
|
|
|
195
197
|
this._apiKey = apiKey;
|
|
196
198
|
this._authorization = authorization;
|
|
199
|
+
this._timeout = timeout;
|
|
197
200
|
|
|
198
201
|
this._fetch = fetch;
|
|
199
202
|
|
|
@@ -446,14 +449,19 @@ class ChatGpt {
|
|
|
446
449
|
? { 'api-key': this._apiKey }
|
|
447
450
|
: { Authorization: `Bearer ${this._authorization}` })
|
|
448
451
|
},
|
|
449
|
-
body: JSON.stringify(body)
|
|
452
|
+
body: JSON.stringify(body),
|
|
453
|
+
...(this._timeout > 0 ? { timeout: this._timeout } : {})
|
|
450
454
|
});
|
|
451
455
|
|
|
452
456
|
({ status, statusText } = response);
|
|
453
457
|
|
|
454
458
|
responseText = await response.text();
|
|
455
459
|
/** @type {ChatGPTResponse} */
|
|
456
|
-
|
|
460
|
+
try {
|
|
461
|
+
responseData = JSON.parse(responseText);
|
|
462
|
+
} catch {
|
|
463
|
+
throw new Error(`Chat GPT ${status} (non-JSON): ${responseText.slice(0, 200)}`);
|
|
464
|
+
}
|
|
457
465
|
|
|
458
466
|
if (status !== 200
|
|
459
467
|
|| !Array.isArray(responseData.choices)) {
|
package/test.json
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"nlpModel": null,
|
|
3
|
-
"aiToken": null,
|
|
4
|
-
"locked": false,
|
|
5
|
-
"botId": "d3d638ef-880c-47af-be32-0677fd84daf5",
|
|
6
|
-
"name": "development",
|
|
7
|
-
"url": null,
|
|
8
|
-
"type": null,
|
|
9
|
-
"blocks": [
|
|
10
|
-
{
|
|
11
|
-
"isRoot": true,
|
|
12
|
-
"blockName": "Root",
|
|
13
|
-
"staticBlockId": "AJzahxmkr2V41diCjMdYsZ",
|
|
14
|
-
"routes": [
|
|
15
|
-
{
|
|
16
|
-
"id": "AJzai2BXN2V41diCjMdYsZ",
|
|
17
|
-
"path": "start",
|
|
18
|
-
"name": "Start",
|
|
19
|
-
"skill": null,
|
|
20
|
-
"isEntryPoint": true,
|
|
21
|
-
"isFallback": false,
|
|
22
|
-
"replies": [],
|
|
23
|
-
"resolvers": [
|
|
24
|
-
{
|
|
25
|
-
"type": "botbuild.message",
|
|
26
|
-
"params": {
|
|
27
|
-
"text": [
|
|
28
|
-
{
|
|
29
|
-
"l": "cs",
|
|
30
|
-
"t": [
|
|
31
|
-
"We just started talkin"
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"l": "en",
|
|
36
|
-
"t": ""
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
"replies": [],
|
|
40
|
-
"type": "message",
|
|
41
|
-
"llmContextType": "default"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"aiTags": [],
|
|
46
|
-
"aiTitle": null,
|
|
47
|
-
"aiGlobal": true
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"path": "cars",
|
|
51
|
-
"id": "AHSwFpGqn2VLxPDKVL4XKZ",
|
|
52
|
-
"resolvers": [
|
|
53
|
-
{
|
|
54
|
-
"id": "AHSwFpGqn2VLxPDKVL4XKZ",
|
|
55
|
-
"type": "botbuild.include",
|
|
56
|
-
"params": {
|
|
57
|
-
"staticBlockId": "AHSwFpGqn2VLxPDKVL4XKZ",
|
|
58
|
-
"items": {}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"path": "weather",
|
|
65
|
-
"id": "IMb1IDCxl2VMWusudBybZW",
|
|
66
|
-
"resolvers": [
|
|
67
|
-
{
|
|
68
|
-
"id": "IMb1IDCxl2VMWusudBybZW",
|
|
69
|
-
"type": "botbuild.include",
|
|
70
|
-
"params": {
|
|
71
|
-
"staticBlockId": "IMb1IDCxl2VMWusudBybZW",
|
|
72
|
-
"items": {}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"id": "AJzaiAz6P2V41diCjMdYsZ",
|
|
79
|
-
"path": "fallback",
|
|
80
|
-
"name": "Fallback",
|
|
81
|
-
"skill": null,
|
|
82
|
-
"isEntryPoint": false,
|
|
83
|
-
"isFallback": true,
|
|
84
|
-
"replies": [],
|
|
85
|
-
"resolvers": [
|
|
86
|
-
{
|
|
87
|
-
"type": "botbuild.message",
|
|
88
|
-
"params": {
|
|
89
|
-
"text": [
|
|
90
|
-
{
|
|
91
|
-
"l": "cs",
|
|
92
|
-
"t": [
|
|
93
|
-
"Sorry, but i don't understand"
|
|
94
|
-
]
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"l": "en",
|
|
98
|
-
"t": [
|
|
99
|
-
"aaaaa"
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
"hasCondition": false,
|
|
104
|
-
"replies": [
|
|
105
|
-
{
|
|
106
|
-
"targetRouteId": "AJzai2BXN2V41diCjMdYsZ",
|
|
107
|
-
"title": [
|
|
108
|
-
{
|
|
109
|
-
"l": "cs",
|
|
110
|
-
"t": "Back to Start"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"l": "en",
|
|
114
|
-
"t": "sefsef"
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
"llmRouting": {
|
|
125
|
-
"prompt": "Use user's last message to decide, if they want's to change context of conversation.\nReturn one of following routing actions:\n\n- `-not-changed-`: context not changed or can't decide\n{{{actionListString}}}",
|
|
126
|
-
"scope": "global",
|
|
127
|
-
"bounce": "fallback"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"blockName": "cars",
|
|
132
|
-
"staticBlockId": "AHSwFpGqn2VLxPDKVL4XKZ",
|
|
133
|
-
"routes": [
|
|
134
|
-
{
|
|
135
|
-
"id": "96GRoJH3h2VKYdPJ7k12sDM",
|
|
136
|
-
"path": "cars",
|
|
137
|
-
"name": "Cars",
|
|
138
|
-
"skill": "cars",
|
|
139
|
-
"isEntryPoint": true,
|
|
140
|
-
"isFallback": false,
|
|
141
|
-
"replies": [],
|
|
142
|
-
"resolvers": [
|
|
143
|
-
{
|
|
144
|
-
"type": "botbuild.message",
|
|
145
|
-
"params": {
|
|
146
|
-
"text": [
|
|
147
|
-
{
|
|
148
|
-
"l": "cs",
|
|
149
|
-
"t": [
|
|
150
|
-
"We are talking about cars. What would you like to know about cars?"
|
|
151
|
-
]
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"l": "en",
|
|
155
|
-
"t": ""
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
"replies": [],
|
|
159
|
-
"type": "message",
|
|
160
|
-
"llmContextType": "default"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
"aiTags": [],
|
|
165
|
-
"aiTitle": null,
|
|
166
|
-
"aiGlobal": true,
|
|
167
|
-
"llmRouting": {
|
|
168
|
-
"scope": "global",
|
|
169
|
-
"classificationDescription": "user wants to talk about cars, or anything car related"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"id": "7QOQxgYFt2VM9DTyPZpSKs",
|
|
174
|
-
"path": "carburators",
|
|
175
|
-
"name": "carburators",
|
|
176
|
-
"skill": "cars",
|
|
177
|
-
"isEntryPoint": true,
|
|
178
|
-
"isFallback": false,
|
|
179
|
-
"replies": [],
|
|
180
|
-
"resolvers": [
|
|
181
|
-
{
|
|
182
|
-
"type": "botbuild.message",
|
|
183
|
-
"params": {
|
|
184
|
-
"text": [
|
|
185
|
-
{
|
|
186
|
-
"l": "cs",
|
|
187
|
-
"t": [
|
|
188
|
-
"Talk about carburators."
|
|
189
|
-
]
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"l": "en",
|
|
193
|
-
"t": ""
|
|
194
|
-
}
|
|
195
|
-
],
|
|
196
|
-
"replies": [],
|
|
197
|
-
"type": "prompt",
|
|
198
|
-
"llmContextType": "default"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
],
|
|
202
|
-
"aiTags": [],
|
|
203
|
-
"aiTitle": null,
|
|
204
|
-
"aiGlobal": true,
|
|
205
|
-
"llmRouting": {
|
|
206
|
-
"scope": "local",
|
|
207
|
-
"classificationDescription": "when user wants to speak about carburators"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"id": "9dIsbyWUD2VM9DTyPZpSKs",
|
|
212
|
-
"path": "fallback",
|
|
213
|
-
"name": "Fallback",
|
|
214
|
-
"skill": "cars",
|
|
215
|
-
"isEntryPoint": false,
|
|
216
|
-
"isFallback": true,
|
|
217
|
-
"replies": [],
|
|
218
|
-
"resolvers": [
|
|
219
|
-
{
|
|
220
|
-
"type": "botbuild.message",
|
|
221
|
-
"params": {
|
|
222
|
-
"text": [
|
|
223
|
-
{
|
|
224
|
-
"l": "cs",
|
|
225
|
-
"t": [
|
|
226
|
-
"Answer the users question, or just talk to him based on what he/she said."
|
|
227
|
-
]
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"l": "en",
|
|
231
|
-
"t": ""
|
|
232
|
-
}
|
|
233
|
-
],
|
|
234
|
-
"replies": [],
|
|
235
|
-
"type": "prompt",
|
|
236
|
-
"llmContextType": "default"
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"type": "botbuild.message",
|
|
241
|
-
"params": {
|
|
242
|
-
"text": [
|
|
243
|
-
{
|
|
244
|
-
"l": "cs",
|
|
245
|
-
"t": [
|
|
246
|
-
"This was fallbacked"
|
|
247
|
-
]
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
"l": "en",
|
|
251
|
-
"t": ""
|
|
252
|
-
}
|
|
253
|
-
],
|
|
254
|
-
"replies": [],
|
|
255
|
-
"type": "message",
|
|
256
|
-
"llmContextType": "default"
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
],
|
|
260
|
-
"aiTags": [],
|
|
261
|
-
"aiTitle": [
|
|
262
|
-
{
|
|
263
|
-
"l": "cs",
|
|
264
|
-
"t": ""
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
"l": "en",
|
|
268
|
-
"t": ""
|
|
269
|
-
}
|
|
270
|
-
],
|
|
271
|
-
"aiGlobal": true
|
|
272
|
-
}
|
|
273
|
-
]
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"blockName": "weather",
|
|
277
|
-
"staticBlockId": "IMb1IDCxl2VMWusudBybZW",
|
|
278
|
-
"routes": [
|
|
279
|
-
{
|
|
280
|
-
"id": "IRs920neD2VMWusudBybZW",
|
|
281
|
-
"path": "weather",
|
|
282
|
-
"name": "weather",
|
|
283
|
-
"skill": "weather",
|
|
284
|
-
"isEntryPoint": true,
|
|
285
|
-
"isFallback": false,
|
|
286
|
-
"replies": [],
|
|
287
|
-
"resolvers": [
|
|
288
|
-
{
|
|
289
|
-
"type": "botbuild.message",
|
|
290
|
-
"params": {
|
|
291
|
-
"text": [
|
|
292
|
-
{
|
|
293
|
-
"l": "cs",
|
|
294
|
-
"t": [
|
|
295
|
-
"We are talking about weather"
|
|
296
|
-
]
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"l": "en",
|
|
300
|
-
"t": ""
|
|
301
|
-
}
|
|
302
|
-
],
|
|
303
|
-
"replies": [],
|
|
304
|
-
"type": "message",
|
|
305
|
-
"llmContextType": "default"
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"type": "botbuild.postback",
|
|
310
|
-
"params": {
|
|
311
|
-
"routeId": "AJzai2BXN2V41diCjMdYsZ"
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
],
|
|
315
|
-
"aiTags": [],
|
|
316
|
-
"aiTitle": null,
|
|
317
|
-
"aiGlobal": true,
|
|
318
|
-
"llmRouting": {
|
|
319
|
-
"scope": "global",
|
|
320
|
-
"classificationDescription": "user wants to talk about weather"
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
]
|
|
324
|
-
}
|
|
325
|
-
],
|
|
326
|
-
"deployedConfiguration": null,
|
|
327
|
-
"lastmod": 1779356722025,
|
|
328
|
-
"id": "development",
|
|
329
|
-
"handlerUrl": null
|
|
330
|
-
}
|