gmaterni commited on
Commit
881afe0
·
verified ·
1 Parent(s): 13d722a

Upload folder using huggingface_hub

Browse files
package-lock.json ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ragrqs",
3
+ "lockfileVersion": 3,
4
+ "requires": true,
5
+ "packages": {
6
+ "": {
7
+ "dependencies": {
8
+ "google-closure-compiler": "^20240317.0.0",
9
+ "lessc": "^1.0.2"
10
+ }
11
+ },
12
+ "node_modules/ansi-styles": {
13
+ "version": "4.3.0",
14
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
15
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
16
+ "dependencies": {
17
+ "color-convert": "^2.0.1"
18
+ },
19
+ "engines": {
20
+ "node": ">=8"
21
+ },
22
+ "funding": {
23
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
24
+ }
25
+ },
26
+ "node_modules/chalk": {
27
+ "version": "4.1.2",
28
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
29
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
30
+ "dependencies": {
31
+ "ansi-styles": "^4.1.0",
32
+ "supports-color": "^7.1.0"
33
+ },
34
+ "engines": {
35
+ "node": ">=10"
36
+ },
37
+ "funding": {
38
+ "url": "https://github.com/chalk/chalk?sponsor=1"
39
+ }
40
+ },
41
+ "node_modules/clone": {
42
+ "version": "2.1.2",
43
+ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
44
+ "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==",
45
+ "engines": {
46
+ "node": ">=0.8"
47
+ }
48
+ },
49
+ "node_modules/clone-buffer": {
50
+ "version": "1.0.0",
51
+ "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz",
52
+ "integrity": "sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==",
53
+ "engines": {
54
+ "node": ">= 0.10"
55
+ }
56
+ },
57
+ "node_modules/clone-stats": {
58
+ "version": "1.0.0",
59
+ "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz",
60
+ "integrity": "sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag=="
61
+ },
62
+ "node_modules/cloneable-readable": {
63
+ "version": "1.1.3",
64
+ "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.3.tgz",
65
+ "integrity": "sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==",
66
+ "dependencies": {
67
+ "inherits": "^2.0.1",
68
+ "process-nextick-args": "^2.0.0",
69
+ "readable-stream": "^2.3.5"
70
+ }
71
+ },
72
+ "node_modules/color-convert": {
73
+ "version": "2.0.1",
74
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
75
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
76
+ "dependencies": {
77
+ "color-name": "~1.1.4"
78
+ },
79
+ "engines": {
80
+ "node": ">=7.0.0"
81
+ }
82
+ },
83
+ "node_modules/color-name": {
84
+ "version": "1.1.4",
85
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
86
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
87
+ },
88
+ "node_modules/copy-anything": {
89
+ "version": "2.0.6",
90
+ "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz",
91
+ "integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==",
92
+ "dependencies": {
93
+ "is-what": "^3.14.1"
94
+ },
95
+ "funding": {
96
+ "url": "https://github.com/sponsors/mesqueeb"
97
+ }
98
+ },
99
+ "node_modules/core-util-is": {
100
+ "version": "1.0.3",
101
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
102
+ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
103
+ },
104
+ "node_modules/errno": {
105
+ "version": "0.1.8",
106
+ "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz",
107
+ "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==",
108
+ "optional": true,
109
+ "dependencies": {
110
+ "prr": "~1.0.1"
111
+ },
112
+ "bin": {
113
+ "errno": "cli.js"
114
+ }
115
+ },
116
+ "node_modules/google-closure-compiler": {
117
+ "version": "20240317.0.0",
118
+ "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20240317.0.0.tgz",
119
+ "integrity": "sha512-PlC5aU2vwsypKbxyFNXOW4psDZfhDoOr2dCwuo8VcgQji+HVIgRi2lviO66x2SfTi0ilm3kI6rq/RSdOMFczcQ==",
120
+ "dependencies": {
121
+ "chalk": "4.x",
122
+ "google-closure-compiler-java": "^20240317.0.0",
123
+ "minimist": "1.x",
124
+ "vinyl": "2.x",
125
+ "vinyl-sourcemaps-apply": "^0.2.0"
126
+ },
127
+ "bin": {
128
+ "google-closure-compiler": "cli.js"
129
+ },
130
+ "engines": {
131
+ "node": ">=10"
132
+ },
133
+ "optionalDependencies": {
134
+ "google-closure-compiler-linux": "^20240317.0.0",
135
+ "google-closure-compiler-osx": "^20240317.0.0",
136
+ "google-closure-compiler-windows": "^20240317.0.0"
137
+ }
138
+ },
139
+ "node_modules/google-closure-compiler-java": {
140
+ "version": "20240317.0.0",
141
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20240317.0.0.tgz",
142
+ "integrity": "sha512-oWURPChjcCrVfiQOuVtpSoUJVvtOYo41JGEQ2qtArsTGmk/DpWh40vS6hitwKRM/0YzJX/jYUuyt9ibuXXJKmg=="
143
+ },
144
+ "node_modules/google-closure-compiler-linux": {
145
+ "version": "20240317.0.0",
146
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20240317.0.0.tgz",
147
+ "integrity": "sha512-dYLtcbbJdbbBS0lTy9SzySdVv/aGkpyTekQiW4ADhT/i1p1b4r0wQTKj6kpVVmFvbZ6t9tW/jbXc9EXXNUahZw==",
148
+ "cpu": [
149
+ "x32",
150
+ "x64"
151
+ ],
152
+ "optional": true,
153
+ "os": [
154
+ "linux"
155
+ ]
156
+ },
157
+ "node_modules/google-closure-compiler-osx": {
158
+ "version": "20240317.0.0",
159
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20240317.0.0.tgz",
160
+ "integrity": "sha512-0mABwjD4HP11rikFd8JRIb9OgPqn9h3o3wS0otufMfmbwS7zRpnnoJkunifhORl3VoR1gFm6vcTC9YziTEFdOw==",
161
+ "cpu": [
162
+ "x32",
163
+ "x64",
164
+ "arm64"
165
+ ],
166
+ "optional": true,
167
+ "os": [
168
+ "darwin"
169
+ ]
170
+ },
171
+ "node_modules/google-closure-compiler-windows": {
172
+ "version": "20240317.0.0",
173
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20240317.0.0.tgz",
174
+ "integrity": "sha512-fTueVFzNOWURFlXZmrFkAB7yA+jzpA2TeDOYeBEFwVlVGHwi8PV3Q9vCIWlbkE8wLpukKEg5wfRHYrLwVPINCA==",
175
+ "cpu": [
176
+ "x32",
177
+ "x64"
178
+ ],
179
+ "optional": true,
180
+ "os": [
181
+ "win32"
182
+ ]
183
+ },
184
+ "node_modules/graceful-fs": {
185
+ "version": "4.2.11",
186
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
187
+ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
188
+ "optional": true
189
+ },
190
+ "node_modules/has-flag": {
191
+ "version": "4.0.0",
192
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
193
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
194
+ "engines": {
195
+ "node": ">=8"
196
+ }
197
+ },
198
+ "node_modules/image-size": {
199
+ "version": "0.5.5",
200
+ "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz",
201
+ "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==",
202
+ "optional": true,
203
+ "bin": {
204
+ "image-size": "bin/image-size.js"
205
+ },
206
+ "engines": {
207
+ "node": ">=0.10.0"
208
+ }
209
+ },
210
+ "node_modules/inherits": {
211
+ "version": "2.0.4",
212
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
213
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
214
+ },
215
+ "node_modules/is-what": {
216
+ "version": "3.14.1",
217
+ "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz",
218
+ "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA=="
219
+ },
220
+ "node_modules/isarray": {
221
+ "version": "1.0.0",
222
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
223
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
224
+ },
225
+ "node_modules/less": {
226
+ "version": "3.13.1",
227
+ "resolved": "https://registry.npmjs.org/less/-/less-3.13.1.tgz",
228
+ "integrity": "sha512-SwA1aQXGUvp+P5XdZslUOhhLnClSLIjWvJhmd+Vgib5BFIr9lMNlQwmwUNOjXThF/A0x+MCYYPeWEfeWiLRnTw==",
229
+ "dependencies": {
230
+ "copy-anything": "^2.0.1",
231
+ "tslib": "^1.10.0"
232
+ },
233
+ "bin": {
234
+ "lessc": "bin/lessc"
235
+ },
236
+ "engines": {
237
+ "node": ">=6"
238
+ },
239
+ "optionalDependencies": {
240
+ "errno": "^0.1.1",
241
+ "graceful-fs": "^4.1.2",
242
+ "image-size": "~0.5.0",
243
+ "make-dir": "^2.1.0",
244
+ "mime": "^1.4.1",
245
+ "native-request": "^1.0.5",
246
+ "source-map": "~0.6.0"
247
+ }
248
+ },
249
+ "node_modules/lessc": {
250
+ "version": "1.0.2",
251
+ "resolved": "https://registry.npmjs.org/lessc/-/lessc-1.0.2.tgz",
252
+ "integrity": "sha512-cv7EXQRiD3Cu2Vsy3S9C89G01kOv0TrLQMoWHxscCgkMYdhEvknhaINeQkZbPmUlJ87AEzjPm0y/14Cg9j7/ug==",
253
+ "dependencies": {
254
+ "less": "^3.9.0"
255
+ }
256
+ },
257
+ "node_modules/make-dir": {
258
+ "version": "2.1.0",
259
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
260
+ "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
261
+ "optional": true,
262
+ "dependencies": {
263
+ "pify": "^4.0.1",
264
+ "semver": "^5.6.0"
265
+ },
266
+ "engines": {
267
+ "node": ">=6"
268
+ }
269
+ },
270
+ "node_modules/mime": {
271
+ "version": "1.6.0",
272
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
273
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
274
+ "optional": true,
275
+ "bin": {
276
+ "mime": "cli.js"
277
+ },
278
+ "engines": {
279
+ "node": ">=4"
280
+ }
281
+ },
282
+ "node_modules/minimist": {
283
+ "version": "1.2.8",
284
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
285
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
286
+ "funding": {
287
+ "url": "https://github.com/sponsors/ljharb"
288
+ }
289
+ },
290
+ "node_modules/native-request": {
291
+ "version": "1.1.2",
292
+ "resolved": "https://registry.npmjs.org/native-request/-/native-request-1.1.2.tgz",
293
+ "integrity": "sha512-/etjwrK0J4Ebbcnt35VMWnfiUX/B04uwGJxyJInagxDqf2z5drSt/lsOvEMWGYunz1kaLZAFrV4NDAbOoDKvAQ==",
294
+ "optional": true
295
+ },
296
+ "node_modules/pify": {
297
+ "version": "4.0.1",
298
+ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
299
+ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
300
+ "optional": true,
301
+ "engines": {
302
+ "node": ">=6"
303
+ }
304
+ },
305
+ "node_modules/process-nextick-args": {
306
+ "version": "2.0.1",
307
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
308
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
309
+ },
310
+ "node_modules/prr": {
311
+ "version": "1.0.1",
312
+ "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
313
+ "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==",
314
+ "optional": true
315
+ },
316
+ "node_modules/readable-stream": {
317
+ "version": "2.3.8",
318
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
319
+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
320
+ "dependencies": {
321
+ "core-util-is": "~1.0.0",
322
+ "inherits": "~2.0.3",
323
+ "isarray": "~1.0.0",
324
+ "process-nextick-args": "~2.0.0",
325
+ "safe-buffer": "~5.1.1",
326
+ "string_decoder": "~1.1.1",
327
+ "util-deprecate": "~1.0.1"
328
+ }
329
+ },
330
+ "node_modules/remove-trailing-separator": {
331
+ "version": "1.1.0",
332
+ "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
333
+ "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw=="
334
+ },
335
+ "node_modules/replace-ext": {
336
+ "version": "1.0.1",
337
+ "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.1.tgz",
338
+ "integrity": "sha512-yD5BHCe7quCgBph4rMQ+0KkIRKwWCrHDOX1p1Gp6HwjPM5kVoCdKGNhN7ydqqsX6lJEnQDKZ/tFMiEdQ1dvPEw==",
339
+ "engines": {
340
+ "node": ">= 0.10"
341
+ }
342
+ },
343
+ "node_modules/safe-buffer": {
344
+ "version": "5.1.2",
345
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
346
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
347
+ },
348
+ "node_modules/semver": {
349
+ "version": "5.7.2",
350
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
351
+ "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
352
+ "optional": true,
353
+ "bin": {
354
+ "semver": "bin/semver"
355
+ }
356
+ },
357
+ "node_modules/source-map": {
358
+ "version": "0.6.1",
359
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
360
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
361
+ "optional": true,
362
+ "engines": {
363
+ "node": ">=0.10.0"
364
+ }
365
+ },
366
+ "node_modules/string_decoder": {
367
+ "version": "1.1.1",
368
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
369
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
370
+ "dependencies": {
371
+ "safe-buffer": "~5.1.0"
372
+ }
373
+ },
374
+ "node_modules/supports-color": {
375
+ "version": "7.2.0",
376
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
377
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
378
+ "dependencies": {
379
+ "has-flag": "^4.0.0"
380
+ },
381
+ "engines": {
382
+ "node": ">=8"
383
+ }
384
+ },
385
+ "node_modules/tslib": {
386
+ "version": "1.14.1",
387
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
388
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
389
+ },
390
+ "node_modules/util-deprecate": {
391
+ "version": "1.0.2",
392
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
393
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
394
+ },
395
+ "node_modules/vinyl": {
396
+ "version": "2.2.1",
397
+ "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz",
398
+ "integrity": "sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw==",
399
+ "dependencies": {
400
+ "clone": "^2.1.1",
401
+ "clone-buffer": "^1.0.0",
402
+ "clone-stats": "^1.0.0",
403
+ "cloneable-readable": "^1.0.0",
404
+ "remove-trailing-separator": "^1.0.1",
405
+ "replace-ext": "^1.0.0"
406
+ },
407
+ "engines": {
408
+ "node": ">= 0.10"
409
+ }
410
+ },
411
+ "node_modules/vinyl-sourcemaps-apply": {
412
+ "version": "0.2.1",
413
+ "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz",
414
+ "integrity": "sha512-+oDh3KYZBoZC8hfocrbrxbLUeaYtQK7J5WU5Br9VqWqmCll3tFJqKp97GC9GmMsVIL0qnx2DgEDVxdo5EZ5sSw==",
415
+ "dependencies": {
416
+ "source-map": "^0.5.1"
417
+ }
418
+ },
419
+ "node_modules/vinyl-sourcemaps-apply/node_modules/source-map": {
420
+ "version": "0.5.7",
421
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
422
+ "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",
423
+ "engines": {
424
+ "node": ">=0.10.0"
425
+ }
426
+ }
427
+ }
428
+ }
package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "dependencies": {
3
+ "google-closure-compiler": "^20240317.0.0",
4
+ "lessc": "^1.0.2"
5
+ }
6
+ }
static/javascript/rag_http.js CHANGED
@@ -1,8 +1,8 @@
1
  /** @format */
2
  "use strict";
3
 
4
- const model_name = "mistralai/Mistral-7B-Instruct-v0.3";
5
- // const model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1";
6
  // const model_name = "mistralai/Mixtral-8x22B-Instruct-v0.1"
7
 
8
  async function requestGet(url) {
 
1
  /** @format */
2
  "use strict";
3
 
4
+ // const model_name = "mistralai/Mistral-7B-Instruct-v0.3";
5
+ const model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1";
6
  // const model_name = "mistralai/Mixtral-8x22B-Instruct-v0.1"
7
 
8
  async function requestGet(url) {
static/javascript/rag_mgr.js CHANGED
@@ -18,7 +18,7 @@
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
  */
20
  "use strict";
21
- const MAX_PROMPT_LENGTH = 1024 * 80;
22
  // decremento dopo errore per tokens eccessivi
23
  const PROMPT_DECR = 1024 * 2;
24
 
 
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
  */
20
  "use strict";
21
+ const MAX_PROMPT_LENGTH = 1024 * 75;
22
  // decremento dopo errore per tokens eccessivi
23
  const PROMPT_DECR = 1024 * 2;
24
 
static/javascript/rag_prompts.js CHANGED
@@ -2,88 +2,6 @@
2
 
3
  "use strict";
4
 
5
- /*
6
- function promptDoc(testo, domanda, docName) {
7
- return `
8
- SYSTEM: Sei un assistente AI specializzato nell'analisi documentale e nell'estrazione mirata di informazioni. Rispondi esclusivamente in italiano.
9
-
10
- TASK: Analizza l'estratto del documento "${docName}" e identifica le informazioni rilevanti per rispondere alla domanda: "${domanda}".
11
-
12
- INSTRUCTIONS:
13
- 1. Esamina il testo e identifica le informazioni utili per costruire un contesto relativo alla domanda.
14
- 2. Per ogni informazione rilevante, fornisci una breve descrizione.
15
- 3. Elenca i punti chiave pertinenti per ogni informazione.
16
- 4. Riporta elementi specifici (dati, citazioni, eventi) se utili per il contesto.
17
- 5. Struttura la risposta secondo il formato di output specificato.
18
-
19
- DOMANDA: ${domanda}
20
-
21
- TESTO DA ANALIZZARE:
22
- <<<INIZIO_TESTO>>>
23
- ${testo}
24
- <<<FINE_TESTO>>>
25
-
26
- OUTPUT_FORMAT:
27
- - Informazione 1:
28
- Descrizione:
29
- Punti chiave:
30
- Elementi specifici:
31
-
32
- - Informazione 2:
33
- Descrizione:
34
- Punti chiave:
35
- Elementi specifici:
36
-
37
- (Ripeti il formato per ogni informazione identificata)
38
-
39
- RESPONSE:
40
- `;
41
- }
42
-
43
- function promptBuildContext(informazioni, domanda = "") {
44
- return `
45
- SYSTEM: Sei un assistente AI esperto nella sintesi e nell'organizzazione mirata di informazioni. Rispondi sempre ed esclusivamente in italiano.
46
-
47
- TASK: Organizza e sintetizza le informazioni estratte da frammenti di testo di un documento, creando un contesto utile per rispondere alla domanda: "${domanda}".
48
-
49
- INSTRUCTIONS:
50
- 1. Esamina tutte le informazioni fornite.
51
- 2. Seleziona e raggruppa le informazioni simili.
52
- 3. Per ogni gruppo di informazioni rilevanti, genera una descrizione concisa.
53
- 4. Elenca i punti chiave essenziali per comprendere il contesto.
54
- 5. Riporta elementi specifici (dati, citazioni, eventi) se utili.
55
- 6. Elimina le informazioni ridondanti, mantenendo solo la versione più completa.
56
- 7. Elabora inferenze logiche basate sulle informazioni, se rilevanti per il contesto.
57
- 8. Genera una sintesi finale del contesto.
58
-
59
- INFORMAZIONI:
60
- <<<INIZIO_INFORMAZIONI>>>
61
- ${informazioni}
62
- <<<FINE_INFORMAZIONI>>>
63
-
64
- OUTPUT_FORMAT:
65
- - Informazione 1:
66
- Descrizione:
67
- Punti chiave:
68
- Elementi rilevanti:
69
-
70
- - Informazione 2:
71
- Descrizione:
72
- Punti chiave:
73
- Elementi rilevanti:
74
-
75
- (Ripeti il formato per ogni gruppo di informazioni
76
-
77
- - Inferenze Logiche:
78
-
79
- - Sintesi Finale:
80
-
81
- RESPONSE:
82
- `;
83
- }
84
- */
85
- //////////////////////
86
-
87
  function promptDoc(testo, domanda, docName) {
88
  return `
89
  SYSTEM: Sei un assistente AI specializzato nell'analisi documentale e nell'estrazione mirata di informazioni. Rispondi esclusivamente in italiano.
@@ -111,7 +29,6 @@ RESPONSE:
111
  `;
112
  }
113
 
114
-
115
  function promptBuildContext(informazioni, domanda = "") {
116
  return `
117
  SYSTEM: Sei un assistente AI esperto nella sintesi e nell'organizzazione mirata di informazioni. Rispondi sempre ed esclusivamente in italiano.
@@ -139,54 +56,6 @@ RESPONSE:
139
  `;
140
  }
141
 
142
- ////////////////////////////////////////////////////
143
- /*
144
- function promptDoc(testo, domanda, docName) {
145
- return `
146
- RUOLO: Sei un assistente AI specializzato nell'analisi documentale e nell'estrazione mirata di informazioni. Rispondi esclusivamente in italiano.
147
-
148
- COMPITO: Analizza il testo estratto dal documento "${docName}" ed estrai tutti gli elementi (concetti, avvenimenti, temi, personaggi, date, luoghi, ecc.) utili per rispondere alla domanda: "${domanda}". Concentrati esclusivamente sulla selezione di elementi utili per rispondere alla domanda evitando commenti o divagazioni superflue. Evita di utilizzare markup, formattazione o altri artifizi grafici. Usa un linguaggio lineare e diretto, evitando ambiguità. Se non ci sono informazioni rilevanti, rispondi con "NESSUNA INFORMAZIONE RILEVANTE". Genera una risposta strutturata come un elenco nel quale ogni elemento è composto da un breve titolo e da una concisa ma completa descrizione. Ricorda di rispondere in italiano indipendentemente dal testo analizzato.
149
-
150
- DOMANDA:"${domanda}"
151
-
152
- TESTO DA ANALIZZARE:
153
- <<<INIZIO>>>
154
- ${testo}
155
- <<<FINE>>>
156
-
157
- RISPOSTA:
158
- `;
159
- }
160
-
161
- function promptBuildContext(informazioni, domanda = "") {
162
- return `
163
- RUOLO: Sei un assistente AI esperto nella sintesi e nell'organizzazione mirata di informazioni. Rispondi sempre ed esclusivamente in italiano.
164
-
165
- COMPITO: Analizza le informazioni fornite e riordinale logicamente raggruppando quelle simili. Concentrati sull'organizzazione della risposta in modo tale che sia utilizzabile come contesto per rispondere alla domanda: "${domanda}" e ad eventuali domande simili. Assicurati che non vada persa alcua informazione significativa. Evita di utilizzare markup, formattazione o caratteri grafici. Evita commenti e divagazioni superflue per il contesto. Usa un linguaggio lineare e diretto, evitando ambiguità. Genera una risposta strutturata come un elenco nel quale ogni elemento è cosituito da un breve titolo e da una descrizione concisa ma completa, alla fine dell'elenco aggiungi una sintesi globale ed eventuali inferenze logiche e collegamenti fra le varie informazioni.
166
-
167
- INFORMAZIONI:
168
- <<<INIZIO>>>
169
- ${informazioni}
170
- <<<FINE>>>
171
-
172
- RISPOSTA:
173
- `;
174
- }
175
- */
176
- //////////////////////////
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
  function promptWithContext(contesto, domanda) {
191
  return `
192
  SYSTEM: Sei un sistema AI specializzato nell'analisi di informazioni estratte da documenti.
@@ -336,7 +205,7 @@ function getPayloadBuildContext(prompt) {
336
  inputs: prompt,
337
  parameters: {
338
  task: "text2text-generation",
339
- max_new_tokens: 5000,
340
  num_return_sequences: 1,
341
  temperature: 0.7,
342
  top_p: 0.85,
@@ -390,7 +259,7 @@ function getPayloadThread(prompt) {
390
  inputs: prompt,
391
  parameters: {
392
  task: "text2text-generation",
393
- max_new_tokens: 4048,
394
  num_return_sequences: 1,
395
  temperature: 0.7,
396
  top_p: 0.85,
 
2
 
3
  "use strict";
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  function promptDoc(testo, domanda, docName) {
6
  return `
7
  SYSTEM: Sei un assistente AI specializzato nell'analisi documentale e nell'estrazione mirata di informazioni. Rispondi esclusivamente in italiano.
 
29
  `;
30
  }
31
 
 
32
  function promptBuildContext(informazioni, domanda = "") {
33
  return `
34
  SYSTEM: Sei un assistente AI esperto nella sintesi e nell'organizzazione mirata di informazioni. Rispondi sempre ed esclusivamente in italiano.
 
56
  `;
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  function promptWithContext(contesto, domanda) {
60
  return `
61
  SYSTEM: Sei un sistema AI specializzato nell'analisi di informazioni estratte da documenti.
 
205
  inputs: prompt,
206
  parameters: {
207
  task: "text2text-generation",
208
+ max_new_tokens: 6000,
209
  num_return_sequences: 1,
210
  temperature: 0.7,
211
  top_p: 0.85,
 
259
  inputs: prompt,
260
  parameters: {
261
  task: "text2text-generation",
262
+ max_new_tokens: 6048,
263
  num_return_sequences: 1,
264
  temperature: 0.7,
265
  top_p: 0.85,
static/javascript/rag_prompts_0.js ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** @format */
2
+
3
+ "use strict";
4
+
5
+ function promptDoc(testo, domanda, docName) {
6
+ return `
7
+ SYSTEM: Sei un assistente AI specializzato nell'analisi documentale e nell'estrazione mirata di informazioni. Rispondi esclusivamente in italiano.
8
+
9
+ TASK: Analizza il testo estratto dal documento "${docName}" e identifica gli elementi rilevanti per rispondere alla domanda: "${domanda}".
10
+
11
+ INSTRUCTIONS:
12
+ 1. Analizza attentamente il testo fornito.
13
+ 2. Identifica gli elementi utili per rispondere alla domanda ("${domanda}").
14
+ 3. Per ogni elemento individuato, fornisci un titolo ed una descrizione sintetica ma completa.
15
+ 4. Riporta dettagli specifici (dati, citazioni, eventi, personaggi, luoghi, ..) se corelati alla domanda.
16
+ 5. Se non ci sono informazioni rilevanti, rispondi con "NESSUNA INFORMAZIONE RILEVANTE".
17
+ 6. Assicurati di generare la risposta esattamente secondo il formato di output specificato.
18
+
19
+ DOMANDA: ${domanda}
20
+
21
+ TESTO DA ANALIZZARE:
22
+ <<<INIZIO_TESTO>>>
23
+ ${testo}
24
+ <<<FINE_TESTO>>>
25
+
26
+ OUTPUT_FORMAT: Genera una risposta strutturata come un elenco nel quale ogni elemento è costituito da un breve titolo e da una descrizione concisa ma completa.
27
+
28
+ RESPONSE:
29
+ `;
30
+ }
31
+
32
+ function promptBuildContext(informazioni, domanda = "") {
33
+ return `
34
+ SYSTEM: Sei un assistente AI esperto nella sintesi e nell'organizzazione mirata di informazioni. Rispondi sempre ed esclusivamente in italiano.
35
+
36
+ TASK: Organizza e sintetizza le informazioni estratte da frammenti di testo di un documento, creando un contesto utile per rispondere alla domanda: "${domanda}".
37
+
38
+ INSTRUCTIONS:
39
+ 1. Analizza tutte le informazioni fornite.
40
+ 2. Seleziona e raggruppa le informazioni simili.
41
+ 3. Per ogni informazioni, genera una descrizione concisa.
42
+ 4. Elenca i punti chiave essenziali per comprendere il contesto.
43
+ 5. Riporta elementi specifici (dati, citazioni, eventi, luoghi, personaggi, ..) se utili.
44
+ 6. Elabora inferenze logiche basate sulle informazioni, se rilevanti per il contesto.
45
+ 7. Genera una sintesi finale.
46
+ 8. Assicurati di strutturare la tua risposta esattamente secondo il formato di output specificato.
47
+
48
+ INFORMAZIONI:
49
+ <<<INIZIO_INFORMAZIONI>>>
50
+ ${informazioni}
51
+ <<<FINE_INFORMAZIONI>>>
52
+
53
+ OUTPUT_FORMAT: Genera una risposta strutturata come un elenco nel quale ogni elemento è costituito da un breve titolo e da una descrizione concisa ma completa, alla fine dell'elenco aggiungi una sintesi globale ed eventuali inferenze logiche e collegamenti fra le varie informazioni.
54
+
55
+ RESPONSE:
56
+ `;
57
+ }
58
+
59
+ function promptWithContext(contesto, domanda) {
60
+ return `
61
+ SYSTEM: Sei un sistema AI specializzato nell'analisi di informazioni estratte da documenti.
62
+
63
+ TASK: Elabora la risposta alla domanda "${domanda}" sulla base del contesto fornito.
64
+
65
+ INSTRUCTIONS:
66
+ 1. Analizza attentamente il contesto fornito, identificando le informazioni pertinenti alla domanda: "${domanda}".
67
+ 2. Estrai i concetti chiave e formula inferenze ragionevoli basate sulle informazioni disponibili.
68
+ 3. Inizia la risposta con una breve introduzione che presenta l'argomento e il contesto.
69
+ 4. Procedi con un'analisi dettagliata delle informazioni rilevanti trovate nel contesto.
70
+ 5. Concludi con una sintesi che riassume i punti chiave e fornisce una conclusione generale.
71
+ 6. Se richiesto, cita le fonti facendo riferimento al "documento fornito" per il contesto dato, distinguendolo chiaramente da eventuali altre fonti citate all'interno del contesto stesso.
72
+ 7. Mantieni uno stile di scrittura fluido durante tutta la risposta.
73
+ 8. Assicurati che la risposta sia completa e risponda direttamente alla domanda posta.
74
+
75
+ CONTESTO:
76
+ <<<INIZIO_CONTESTO>>>
77
+ ${contesto}
78
+ <<<FINE_CONTESTO>>>
79
+
80
+ DOMANDA: ${domanda}
81
+
82
+ OUTPUT_FORMAT: Fornisci la risposta in testo semplice e lineare suddiviso in paragrafi.
83
+
84
+ RESPONSE:
85
+ `;
86
+ }
87
+
88
+ function promptThread(contesto, conversazione, richiesta) {
89
+ return `
90
+ SYSTEM: Sei un assistente AI versatile progettato per gestire conversazioni dinamiche e adattarti a varie richieste. Rispondi sempre in italiano.
91
+
92
+ TASK: Elabora la risposta alla richiesta "${richiesta}" sulla base del contesto fornito e della conversazione.
93
+
94
+ INSTRUCTIONS:
95
+ 1. Analizza attentamente il contesto, la conversazione precedente e la richiesta: "${richiesta}".
96
+ 2. Interpreta l'intento dell'utente senza limitarti a categorie predefinite.
97
+ 3. Adatta la tua risposta in base all'intento percepito, sia esso una domanda, una richiesta di azione, un'istruzione specifica o altro.
98
+ 4. Mantieni una stretta coerenza con il contesto della conversazione.
99
+ 5. Basa la tua risposta sulle informazioni fornite nel contesto e nella conversazione.
100
+ 6. Evita divagazioni o argomentazioni non direttamente pertinenti alla richiesta o al contesto.
101
+ 7. Fai riferimento a informazioni precedenti quando sono pertinenti, citando specificamente la fonte.
102
+ 8. Se l'intento non è chiaro, chiedi gentilmente chiarimenti invece di fare supposizioni.
103
+ 9. Sii flessibile: se la richiesta implica un'azione specifica, adattati di conseguenza.
104
+ 10. Se è necessario integrare con conoscenze generali, specifica chiaramente quando lo stai facendo.
105
+
106
+ CONTESTO:
107
+ <<<BEGIN_CONTESTO>>>
108
+ ${contesto}
109
+ <<<END_CONTESTO>>>
110
+
111
+ <<<INIZIO_CONVERSAZIONE>>>
112
+ ${conversazione}
113
+ <<<FINE_CONVERSAZIONE>>>
114
+
115
+ RICHIESTA: ${richiesta}
116
+
117
+ OUTPUT_FORMAT: Fornisci la risposta in testo semplice e lineare suddiviso in paragrafi.
118
+
119
+ RESPONSE:
120
+ `;
121
+ }
122
+
123
+ /*
124
+ 1. max_new_tokens: 512
125
+ Questo è un valore ragionevole per risposte di lunghezza media.
126
+ Potrebbe essere aumentato a 1024 o più se si desiderano risposte più lunghe e dettagliate.
127
+
128
+ 2. temperature: 0.7
129
+ Questo valore offre un buon equilibrio tra creatività e coerenza.
130
+ Va bene per la maggior parte degli usi.
131
+
132
+ 3. top_k: 50
133
+ Un valore standard che limita la selezione alle 50 parole più probabili.
134
+ È appropriato per la maggior parte delle applicazioni.
135
+
136
+ 4. top_p: 0.85
137
+ Questo valore di nucleus sampling è buono per mantenere un buon equilibrio
138
+ tra diversità e coerenza.
139
+
140
+ 5. do_sample: true
141
+ Corretto per generare testo più vario.
142
+
143
+ 6. no_repeat_ngram_size: 3
144
+ Aiuta a evitare ripetizioni a breve termine.
145
+ Potrebbe essere aumentato a 4 o 5 per evitare ripetizioni più lunghe.
146
+
147
+ 7. num_beams: 5
148
+ Un buon valore per la beam search.
149
+ Aumentarlo potrebbe migliorare la qualità ma aumenterebbe anche il
150
+ tempo di elaborazione.
151
+
152
+ 8. repetition_penalty: 1.2
153
+ Un valore moderato per penalizzare le ripetizioni.
154
+ Potrebbe essere aumentato leggermente (es. 1.3 o 1.4) se si notano
155
+ ancora troppe ripetizioni.
156
+
157
+ 9. return_full_text: false
158
+ Corretto se si vuole solo il nuovo testo generato.
159
+
160
+ 10. max_time: 60.0
161
+ Un minuto è un tempo ragionevole. Potrebbe essere aumentato
162
+ se si stanno generando risposte molto lunghe o complesse.
163
+
164
+ 11. seed: 42
165
+ Un valore fisso per la riproducibilità.
166
+ Va bene se si desidera coerenza tra le esecuzioni.
167
+
168
+ Suggerimenti per l'ottimizzazione:
169
+ 1. Considera di aumentare max_new_tokens a 1024 o più se hai bisogno di risposte più lunghe.
170
+ 2. Potresti aumentare leggermente no_repeat_ngram_size a 4 per ridurre ulteriormente le ripetizioni.
171
+ 3. Se desideri risposte più precise e meno creative, potresti ridurre temperature a 0.6 e top_p a 0.8.
172
+ 4. Per risposte più diverse, potresti aumentare temperature a 0.8 e top_p a 0.9.
173
+ 5. Se noti ancora troppe ripetizioni, considera di aumentare repetition_penalty a 1.3 o 1.4.
174
+ */
175
+
176
+ function getPayloadDoc(prompt) {
177
+ const payload = {
178
+ inputs: prompt,
179
+ parameters: {
180
+ task: "text2text-generation",
181
+ max_new_tokens: 2000,
182
+ num_return_sequences: 1,
183
+ temperature: 0.4,
184
+ top_p: 0.85,
185
+ top_k: 30,
186
+ do_sample: false,
187
+ no_repeat_ngram_size: 3,
188
+ num_beams: 4,
189
+ repetition_penalty: 1.2,
190
+ return_full_text: false,
191
+ details: false,
192
+ max_time: 90.0,
193
+ seed: 42,
194
+ },
195
+ options: {
196
+ use_cache: false,
197
+ wait_for_model: true,
198
+ },
199
+ };
200
+ return payload;
201
+ }
202
+
203
+ function getPayloadBuildContext(prompt) {
204
+ const payload = {
205
+ inputs: prompt,
206
+ parameters: {
207
+ task: "text2text-generation",
208
+ max_new_tokens: 5000,
209
+ num_return_sequences: 1,
210
+ temperature: 0.7,
211
+ top_p: 0.85,
212
+ top_k: 30,
213
+ do_sample: false,
214
+ no_repeat_ngram_size: 4,
215
+ num_beams: 6,
216
+ repetition_penalty: 1.2,
217
+ return_full_text: false,
218
+ details: false,
219
+ max_time: 180.0,
220
+ seed: 42,
221
+ },
222
+ options: {
223
+ use_cache: false,
224
+ wait_for_model: true,
225
+ },
226
+ };
227
+ return payload;
228
+ }
229
+
230
+ function getPayloadWithContext(prompt) {
231
+ const payload = {
232
+ inputs: prompt,
233
+ parameters: {
234
+ task: "text2text-generation",
235
+ max_new_tokens: 4000,
236
+ num_return_sequences: 1,
237
+ temperature: 0.7,
238
+ top_p: 0.85,
239
+ top_k: 30,
240
+ do_sample: false,
241
+ no_repeat_ngram_size: 4,
242
+ num_beams: 5,
243
+ repetition_penalty: 1.4,
244
+ return_full_text: false,
245
+ details: false,
246
+ max_time: 120.0,
247
+ seed: 42,
248
+ },
249
+ options: {
250
+ use_cache: false,
251
+ wait_for_model: true,
252
+ },
253
+ };
254
+ return payload;
255
+ }
256
+
257
+ function getPayloadThread(prompt) {
258
+ const payload = {
259
+ inputs: prompt,
260
+ parameters: {
261
+ task: "text2text-generation",
262
+ max_new_tokens: 4048,
263
+ num_return_sequences: 1,
264
+ temperature: 0.7,
265
+ top_p: 0.85,
266
+ top_k: 30,
267
+ do_sample: false,
268
+ no_repeat_ngram_size: 4,
269
+ num_beams: 5,
270
+ repetition_penalty: 1.4,
271
+ return_full_text: false,
272
+ details: false,
273
+ max_time: 120.0,
274
+ seed: 42,
275
+ },
276
+ options: {
277
+ use_cache: false,
278
+ wait_for_model: true,
279
+ },
280
+ };
281
+ return payload;
282
+ }
static/javascript/rag_rqs.js CHANGED
@@ -19,7 +19,7 @@
19
  */
20
 
21
  "use strict";
22
- const VERS = "0.1.53 (21-09-2024)";
23
 
24
  var xlog = console.log;
25
  var xerror = console.error;
 
19
  */
20
 
21
  "use strict";
22
+ const VERS = "0.1.54 (10-11-2024)";
23
 
24
  var xlog = console.log;
25
  var xerror = console.error;
static/js/ragrqs.min.js CHANGED
@@ -5,7 +5,7 @@ function cleanResponse(a){try{return a=removeTag(a),a=a.replace(/[\u00AD\u200B\u
5
  function cleanOut(a){return a=a.replace(/\n{3,}/g,"\n\n")};const ID_RESPONSES="id_responses",ID_DOC_NAMES="id_doc_names",ID_DOCS="id_docs;",ID_RAG="id_rag",ID_THREAD="id_thread",UaDb={create(a,b){localStorage.getItem(a)?xerror(`ID ${a} already exists.`):localStorage.setItem(a,b)},read(a){const b=localStorage.getItem(a);return null===b?(xlog(`UaDb.read ${a} not found.`),""):b},update(a,b){localStorage.getItem(a)?localStorage.setItem(a,b):xlog(`UaDb.update ${a} not found.`)},delete(a){localStorage.getItem(a)?localStorage.removeItem(a):xerror(`ID ${a} not found.`)},
6
  save(a,b){localStorage.setItem(a,b)},getAllIds(){const a=[];for(let b=0;b<localStorage.length;b++)a.push(localStorage.key(b));return a},saveArray(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readArray(a){a=UaDb.read(a);return 0==a.trim().length?[]:JSON.parse(a)},saveJson(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readJson(a){return(a=UaDb.read(a))?JSON.parse(a):{}}},DataMgr={docs:[],doc_names:[],linkToName(a){a=a.split("/");return a[a.length-1]},async loadDoc(a){this.readDbDocNames();try{const b=await requestGet(a),
7
  c=cleanDoc(b),d=this.linkToName(a);if(this.doc_names.includes(d))alert(`Il docuento ${d} \u00e8 gi\u00e0 caricato`);else return this.doc_names.push(d),this.docs.push(c),this.saveDbDocs(),c}catch(b){alert("loadDoc()\n"+b+"\n"+a)}},addDoc(a,b){b=cleanDoc(b);this.docs.push(b);this.doc_names.push(a);this.saveDbDocs()},saveDbDocs(){UaDb.saveArray(ID_DOC_NAMES,this.doc_names);UaDb.saveArray(ID_DOCS,this.docs)},readDbDocs(){this.docs=UaDb.readArray(ID_DOCS)},readDbDocNames(){this.doc_names=UaDb.readArray(ID_DOC_NAMES)},
8
- deleteJsonDati(){const a=UaDb.getAllIds();for(const b of a)[ID_DOCS,ID_DOC_NAMES].includes(b)||UaDb.delete(b);Rag.ragQuery="";Rag.ragContext="";Rag.ragAnswer="";Rag.answers=[];Rag.prompts=[];ThreadMgr.rows=[]}};function umgm(){return["bWtkSGxRfVA=","aFN1b2dycm0=","WXBfclhfUGk=","TVhWTV1aW04=","fVJPa00="].map(a=>atob(a).split("").map(b=>String.fromCharCode((b.charCodeAt(0)-5+256)%256)).join("")).join("")};const model_name="mistralai/Mistral-7B-Instruct-v0.3";async function requestGet(a){try{var b=await fetch(a,{method:"GET",headers:{"Content-Type":"text/plain;charset=UTF-8"}});if(!b.ok)throw Error(`HTTP error! status: ${b.status}`);const c=await b.arrayBuffer();return(new TextDecoder("utf-8")).decode(c)}catch(c){throw console.error(c),b="AbortError"===c.name?"Request was aborted":c.message.includes("HTTP error! status")?c.message:"An error occurred",alert(`requestGet()\nurl: ${a}\n${b}`),c;}}
9
  const ERROR_TOKENS="ERROR_TOKENS",TIMEOUT_ERROR="TIMEOUT_ERROR",getErrorType=(a,b)=>500<=a?"SERVER_ERROR":400<=a&&500>a?"object"===typeof b&&"validation"===b.error_type?b.error.includes("tokens")?ERROR_TOKENS:"ERROR_VALIDATION":"CLIENT_ERROR":"UNKNOWN_ERROR",checkResponse=a=>a&&Array.isArray(a)&&0!==a.length?a[0].generated_text?"ok":"MISSING_GENERATED_TEXT":"INVALID_DATA",createErrorInfo=(a,b,c,d)=>JSON.stringify({status:a,statusText:b,errorType:d,message:c||"Errore sconosciuto"}),HfRequest={controller:null,
10
  isCancelled:!1,baseUrl:"https://api-inference.huggingface.co/models",async post(a,b=5E4){this.isCancelled=!1;this.controller=new AbortController;let c;try{const d=setTimeout(()=>{this.controller.abort()},b);c=await fetch(`${this.baseUrl}/${model_name}`,{method:"POST",headers:{Authorization:`Bearer ${tm}`,"Content-Type":"application/json"},body:JSON.stringify(a),signal:this.controller.signal});clearTimeout(d);if(this.isCancelled)return null;const e=await c.json();if(!c.ok){const g=getErrorType(c.status,
11
  e),k=createErrorInfo(c.status,c.statusText,e.error,g);throw Error(k);}const f=checkResponse(e);if("ok"!==f){const g=createErrorInfo(c.status,c.statusText,e.error,f);throw Error(g);}return e[0].generated_text.trim()}catch(d){if(this.isCancelled)return null;if("AbortError"===d.name)throw a=createErrorInfo(0,"Timeout","La richiesta \u00e8 scaduta",TIMEOUT_ERROR),Error(a);throw d;}},cancelRequest(){this.controller&&(this.isCancelled=!0,this.controller.abort())}};
@@ -31,7 +31,7 @@ function getErrorInfo(a){let b={};try{b=JSON.parse(a.message)}catch(c){a=`getErr
31
  You should have received a copy of the GNU General Public License
32
  along with this program. If not, see <https://www.gnu.org/licenses/>.
33
  */
34
- const MAX_PROMPT_LENGTH=81920,PROMPT_DECR=2048,TIMEOUT=6E4;function wait(a){return new Promise(b=>setTimeout(b,1E3*a))}async function example(){console.log("Inizio attesa...");await wait(5);console.log("Fine attesa!")}example();
35
  const truncInput=(a,b)=>a.substring(0,a.length-b),setMaxLen=a=>a.substring(0,MAX_PROMPT_LENGTH-1E3),getPartSize=(a,b,c)=>{c=MAX_PROMPT_LENGTH-c;a.length+b.length<c?c=a.length:(a=a.indexOf(".",c),a=(-1!=a?a:c)+1,a>c+100&&(a=c),c=a);return c},getPartDoc=(a,b)=>{const c=a.substring(0,b);a=a.substring(b).trim();return[c,a]},ragLog=(a,b,c,d)=>{const e=MAX_PROMPT_LENGTH;d=d.reduce((f,g)=>f+g.length,0);xlog(`${a} mx:${e} lft:${b} rgt:${c} arr:${d}`);a=formatRow([a,b,c,d],[8,-7,-7,-7]);UaLog.log(a)},Rag=
36
  {ragContext:"",ragQuery:"",ragAnswer:"",answers:[],docContextLst:[],prompts:[],doc:"",doc_part:"",init(){this.readRespsFromDb();this.readFromDb()},returnOk(){return 10<this.ragContext.length},saveToDb(){UaDb.saveJson(ID_RAG,{context:this.ragContext,ragquery:this.ragQuery,raganswer:this.ragAnswer});UaDb.saveArray(ID_THREAD,ThreadMgr.rows)},readFromDb(){const a=UaDb.readJson(ID_RAG);this.ragContext=a.context||"";this.ragQuery=a.ragquery||"";this.ragAnswer=a.raganswer||"";ThreadMgr.rows=UaDb.readArray(ID_THREAD)},
37
  saveRespToDb(){UaDb.saveArray(ID_RESPONSES,this.answers)},readRespsFromDb(){this.answers=UaDb.readArray(ID_RESPONSES)},async requestDocsRAG(a){DataMgr.deleteJsonDati();DataMgr.readDbDocNames();DataMgr.readDbDocs();this.ragQuery=a;this.saveToDb();var b=0;try{var c=1;for(let e=0;e<DataMgr.docs.length;e++){let f=DataMgr.docs[e];if(""==f.trim())continue;const g=DataMgr.doc_names[e],k=f.length;xlog(`${g} (${k}) `);UaLog.log(`${g} (${k}) `);++b;var d=1;let h=0,l="",t="",u="",m="",v=[];for(;;){let r=getPartSize(f,
@@ -147,7 +147,112 @@ RESPONSE:
147
  `}function getPayloadDoc(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:2E3,num_return_sequences:1,temperature:.4,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:3,num_beams:4,repetition_penalty:1.2,return_full_text:!1,details:!1,max_time:90,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
148
  function getPayloadBuildContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:5E3,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:6,repetition_penalty:1.2,return_full_text:!1,details:!1,max_time:180,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
149
  function getPayloadWithContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:4E3,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
150
- function getPayloadThread(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:4048,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}};const VERS="0.1.53 (21-09-2024)";var xlog=console.log,xerror=console.error;const cancelRequest=()=>{confirm("Confermi Cancellazione Richeista ?")&&(HfRequest.cancelRequest(),hideSpinner())},showSpinner=()=>{const a=document.getElementById("spinner");a.classList.add("show-spinner");a.addEventListener("click",cancelRequest)},hideSpinner=()=>{const a=document.getElementById("spinner");a.classList.remove("show-spinner");a.removeEventListener("click",cancelRequest)};var tm;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  function openApp(){setTimeout(()=>{tm=umgm();wnds.init();Menu.init();TextInput.init();TextOutput.init();Rag.init();document.querySelector(".menu-btn").checked=!1;release();showHistory()},10)}function showHistory(){const a=ThreadMgr.getThread();setOutText(a)}function release(){document.querySelector(".release").innerHTML=VERS}const op0=async function(a){a=await requestGet("./help1.html");wnds.wdiv.show(a)};function showQuery(a){wnds.wpre.show(`\n${Rag.ragQuery}`)}
152
  function showRagResponse(a){wnds.wpre.show(`\n${Rag.ragAnswer}`)}function showThread(a){a=ThreadMgr.getThread();wnds.wpre.show(a)}function elencoRisposte(a){a=[...Rag.answers];0==a.length&&(a=UaDb.readArray(ID_RESPONSES));0!=a.length&&(a=a.map((b,c)=>`\n[${c+1}]\n ${b.trim()}`).join("\n"),wnds.wpre.show(a))}function showContesto(a){wnds.wpre.show(`${Rag.ragContext}`)}
153
  function elencoDati(a){var b=UaDb.getAllIds();a=[];for(var c of b)b=UaDb.read(c).length,a.push(`${c} (${b})`);c=a.join("\n ");wnds.wpre.show(c)}const showT=a=>{wnds.wpre.show(DataMgr.docs[a])};function elencoDocs(){DataMgr.readDbDocs();DataMgr.readDbDocNames();var a=DataMgr.doc_names,b=UaJtfh();let c=0;b.append("<ul>");for(const g of a){a=b;var d=a.append,e=g,f=c++;d.call(a,`
 
5
  function cleanOut(a){return a=a.replace(/\n{3,}/g,"\n\n")};const ID_RESPONSES="id_responses",ID_DOC_NAMES="id_doc_names",ID_DOCS="id_docs;",ID_RAG="id_rag",ID_THREAD="id_thread",UaDb={create(a,b){localStorage.getItem(a)?xerror(`ID ${a} already exists.`):localStorage.setItem(a,b)},read(a){const b=localStorage.getItem(a);return null===b?(xlog(`UaDb.read ${a} not found.`),""):b},update(a,b){localStorage.getItem(a)?localStorage.setItem(a,b):xlog(`UaDb.update ${a} not found.`)},delete(a){localStorage.getItem(a)?localStorage.removeItem(a):xerror(`ID ${a} not found.`)},
6
  save(a,b){localStorage.setItem(a,b)},getAllIds(){const a=[];for(let b=0;b<localStorage.length;b++)a.push(localStorage.key(b));return a},saveArray(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readArray(a){a=UaDb.read(a);return 0==a.trim().length?[]:JSON.parse(a)},saveJson(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readJson(a){return(a=UaDb.read(a))?JSON.parse(a):{}}},DataMgr={docs:[],doc_names:[],linkToName(a){a=a.split("/");return a[a.length-1]},async loadDoc(a){this.readDbDocNames();try{const b=await requestGet(a),
7
  c=cleanDoc(b),d=this.linkToName(a);if(this.doc_names.includes(d))alert(`Il docuento ${d} \u00e8 gi\u00e0 caricato`);else return this.doc_names.push(d),this.docs.push(c),this.saveDbDocs(),c}catch(b){alert("loadDoc()\n"+b+"\n"+a)}},addDoc(a,b){b=cleanDoc(b);this.docs.push(b);this.doc_names.push(a);this.saveDbDocs()},saveDbDocs(){UaDb.saveArray(ID_DOC_NAMES,this.doc_names);UaDb.saveArray(ID_DOCS,this.docs)},readDbDocs(){this.docs=UaDb.readArray(ID_DOCS)},readDbDocNames(){this.doc_names=UaDb.readArray(ID_DOC_NAMES)},
8
+ deleteJsonDati(){const a=UaDb.getAllIds();for(const b of a)[ID_DOCS,ID_DOC_NAMES].includes(b)||UaDb.delete(b);Rag.ragQuery="";Rag.ragContext="";Rag.ragAnswer="";Rag.answers=[];Rag.prompts=[];ThreadMgr.rows=[]}};function umgm(){return["bWtkSGxRfVA=","aFN1b2dycm0=","WXBfclhfUGk=","TVhWTV1aW04=","fVJPa00="].map(a=>atob(a).split("").map(b=>String.fromCharCode((b.charCodeAt(0)-5+256)%256)).join("")).join("")};const model_name="mistralai/Mixtral-8x7B-Instruct-v0.1";async function requestGet(a){try{var b=await fetch(a,{method:"GET",headers:{"Content-Type":"text/plain;charset=UTF-8"}});if(!b.ok)throw Error(`HTTP error! status: ${b.status}`);const c=await b.arrayBuffer();return(new TextDecoder("utf-8")).decode(c)}catch(c){throw console.error(c),b="AbortError"===c.name?"Request was aborted":c.message.includes("HTTP error! status")?c.message:"An error occurred",alert(`requestGet()\nurl: ${a}\n${b}`),c;}}
9
  const ERROR_TOKENS="ERROR_TOKENS",TIMEOUT_ERROR="TIMEOUT_ERROR",getErrorType=(a,b)=>500<=a?"SERVER_ERROR":400<=a&&500>a?"object"===typeof b&&"validation"===b.error_type?b.error.includes("tokens")?ERROR_TOKENS:"ERROR_VALIDATION":"CLIENT_ERROR":"UNKNOWN_ERROR",checkResponse=a=>a&&Array.isArray(a)&&0!==a.length?a[0].generated_text?"ok":"MISSING_GENERATED_TEXT":"INVALID_DATA",createErrorInfo=(a,b,c,d)=>JSON.stringify({status:a,statusText:b,errorType:d,message:c||"Errore sconosciuto"}),HfRequest={controller:null,
10
  isCancelled:!1,baseUrl:"https://api-inference.huggingface.co/models",async post(a,b=5E4){this.isCancelled=!1;this.controller=new AbortController;let c;try{const d=setTimeout(()=>{this.controller.abort()},b);c=await fetch(`${this.baseUrl}/${model_name}`,{method:"POST",headers:{Authorization:`Bearer ${tm}`,"Content-Type":"application/json"},body:JSON.stringify(a),signal:this.controller.signal});clearTimeout(d);if(this.isCancelled)return null;const e=await c.json();if(!c.ok){const g=getErrorType(c.status,
11
  e),k=createErrorInfo(c.status,c.statusText,e.error,g);throw Error(k);}const f=checkResponse(e);if("ok"!==f){const g=createErrorInfo(c.status,c.statusText,e.error,f);throw Error(g);}return e[0].generated_text.trim()}catch(d){if(this.isCancelled)return null;if("AbortError"===d.name)throw a=createErrorInfo(0,"Timeout","La richiesta \u00e8 scaduta",TIMEOUT_ERROR),Error(a);throw d;}},cancelRequest(){this.controller&&(this.isCancelled=!0,this.controller.abort())}};
 
31
  You should have received a copy of the GNU General Public License
32
  along with this program. If not, see <https://www.gnu.org/licenses/>.
33
  */
34
+ const MAX_PROMPT_LENGTH=76800,PROMPT_DECR=2048,TIMEOUT=6E4;function wait(a){return new Promise(b=>setTimeout(b,1E3*a))}async function example(){console.log("Inizio attesa...");await wait(5);console.log("Fine attesa!")}example();
35
  const truncInput=(a,b)=>a.substring(0,a.length-b),setMaxLen=a=>a.substring(0,MAX_PROMPT_LENGTH-1E3),getPartSize=(a,b,c)=>{c=MAX_PROMPT_LENGTH-c;a.length+b.length<c?c=a.length:(a=a.indexOf(".",c),a=(-1!=a?a:c)+1,a>c+100&&(a=c),c=a);return c},getPartDoc=(a,b)=>{const c=a.substring(0,b);a=a.substring(b).trim();return[c,a]},ragLog=(a,b,c,d)=>{const e=MAX_PROMPT_LENGTH;d=d.reduce((f,g)=>f+g.length,0);xlog(`${a} mx:${e} lft:${b} rgt:${c} arr:${d}`);a=formatRow([a,b,c,d],[8,-7,-7,-7]);UaLog.log(a)},Rag=
36
  {ragContext:"",ragQuery:"",ragAnswer:"",answers:[],docContextLst:[],prompts:[],doc:"",doc_part:"",init(){this.readRespsFromDb();this.readFromDb()},returnOk(){return 10<this.ragContext.length},saveToDb(){UaDb.saveJson(ID_RAG,{context:this.ragContext,ragquery:this.ragQuery,raganswer:this.ragAnswer});UaDb.saveArray(ID_THREAD,ThreadMgr.rows)},readFromDb(){const a=UaDb.readJson(ID_RAG);this.ragContext=a.context||"";this.ragQuery=a.ragquery||"";this.ragAnswer=a.raganswer||"";ThreadMgr.rows=UaDb.readArray(ID_THREAD)},
37
  saveRespToDb(){UaDb.saveArray(ID_RESPONSES,this.answers)},readRespsFromDb(){this.answers=UaDb.readArray(ID_RESPONSES)},async requestDocsRAG(a){DataMgr.deleteJsonDati();DataMgr.readDbDocNames();DataMgr.readDbDocs();this.ragQuery=a;this.saveToDb();var b=0;try{var c=1;for(let e=0;e<DataMgr.docs.length;e++){let f=DataMgr.docs[e];if(""==f.trim())continue;const g=DataMgr.doc_names[e],k=f.length;xlog(`${g} (${k}) `);UaLog.log(`${g} (${k}) `);++b;var d=1;let h=0,l="",t="",u="",m="",v=[];for(;;){let r=getPartSize(f,
 
147
  `}function getPayloadDoc(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:2E3,num_return_sequences:1,temperature:.4,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:3,num_beams:4,repetition_penalty:1.2,return_full_text:!1,details:!1,max_time:90,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
148
  function getPayloadBuildContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:5E3,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:6,repetition_penalty:1.2,return_full_text:!1,details:!1,max_time:180,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
149
  function getPayloadWithContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:4E3,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
150
+ function getPayloadThread(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:4048,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}};function promptDoc(a,b,c){return`
151
+ SYSTEM: Sei un assistente AI specializzato nell'analisi documentale e nell'estrazione mirata di informazioni. Rispondi esclusivamente in italiano.
152
+
153
+ TASK: Analizza il testo estratto dal documento "${c}" e identifica gli elementi rilevanti per rispondere alla domanda: "${b}".
154
+
155
+ INSTRUCTIONS:
156
+ 1. Analizza attentamente il testo fornito.
157
+ 2. Identifica gli elementi utili per rispondere alla domanda ("${b}").
158
+ 3. Per ogni elemento individuato, fornisci un titolo ed una descrizione sintetica ma completa.
159
+ 4. Riporta dettagli specifici (dati, citazioni, eventi, personaggi, luoghi, ..) se corelati alla domanda.
160
+ 5. Se non ci sono informazioni rilevanti, rispondi con "NESSUNA INFORMAZIONE RILEVANTE".
161
+ 6. Assicurati di generare la risposta esattamente secondo il formato di output specificato.
162
+
163
+ DOMANDA: ${b}
164
+
165
+ TESTO DA ANALIZZARE:
166
+ <<<INIZIO_TESTO>>>
167
+ ${a}
168
+ <<<FINE_TESTO>>>
169
+
170
+ OUTPUT_FORMAT: Genera una risposta strutturata come un elenco nel quale ogni elemento \u00e8 costituito da un breve titolo e da una descrizione concisa ma completa.
171
+
172
+ RESPONSE:
173
+ `}function promptBuildContext(a,b=""){return`
174
+ SYSTEM: Sei un assistente AI esperto nella sintesi e nell'organizzazione mirata di informazioni. Rispondi sempre ed esclusivamente in italiano.
175
+
176
+ TASK: Organizza e sintetizza le informazioni estratte da frammenti di testo di un documento, creando un contesto utile per rispondere alla domanda: "${b}".
177
+
178
+ INSTRUCTIONS:
179
+ 1. Analizza tutte le informazioni fornite.
180
+ 2. Seleziona e raggruppa le informazioni simili.
181
+ 3. Per ogni informazioni, genera una descrizione concisa.
182
+ 4. Elenca i punti chiave essenziali per comprendere il contesto.
183
+ 5. Riporta elementi specifici (dati, citazioni, eventi, luoghi, personaggi, ..) se utili.
184
+ 6. Elabora inferenze logiche basate sulle informazioni, se rilevanti per il contesto.
185
+ 7. Genera una sintesi finale.
186
+ 8. Assicurati di strutturare la tua risposta esattamente secondo il formato di output specificato.
187
+
188
+ INFORMAZIONI:
189
+ <<<INIZIO_INFORMAZIONI>>>
190
+ ${a}
191
+ <<<FINE_INFORMAZIONI>>>
192
+
193
+ OUTPUT_FORMAT: Genera una risposta strutturata come un elenco nel quale ogni elemento \u00e8 costituito da un breve titolo e da una descrizione concisa ma completa, alla fine dell'elenco aggiungi una sintesi globale ed eventuali inferenze logiche e collegamenti fra le varie informazioni.
194
+
195
+ RESPONSE:
196
+ `}function promptWithContext(a,b){return`
197
+ SYSTEM: Sei un sistema AI specializzato nell'analisi di informazioni estratte da documenti.
198
+
199
+ TASK: Elabora la risposta alla domanda "${b}" sulla base del contesto fornito.
200
+
201
+ INSTRUCTIONS:
202
+ 1. Analizza attentamente il contesto fornito, identificando le informazioni pertinenti alla domanda: "${b}".
203
+ 2. Estrai i concetti chiave e formula inferenze ragionevoli basate sulle informazioni disponibili.
204
+ 3. Inizia la risposta con una breve introduzione che presenta l'argomento e il contesto.
205
+ 4. Procedi con un'analisi dettagliata delle informazioni rilevanti trovate nel contesto.
206
+ 5. Concludi con una sintesi che riassume i punti chiave e fornisce una conclusione generale.
207
+ 6. Se richiesto, cita le fonti facendo riferimento al "documento fornito" per il contesto dato, distinguendolo chiaramente da eventuali altre fonti citate all'interno del contesto stesso.
208
+ 7. Mantieni uno stile di scrittura fluido durante tutta la risposta.
209
+ 8. Assicurati che la risposta sia completa e risponda direttamente alla domanda posta.
210
+
211
+ CONTESTO:
212
+ <<<INIZIO_CONTESTO>>>
213
+ ${a}
214
+ <<<FINE_CONTESTO>>>
215
+
216
+ DOMANDA: ${b}
217
+
218
+ OUTPUT_FORMAT: Fornisci la risposta in testo semplice e lineare suddiviso in paragrafi.
219
+
220
+ RESPONSE:
221
+ `}function promptThread(a,b,c){return`
222
+ SYSTEM: Sei un assistente AI versatile progettato per gestire conversazioni dinamiche e adattarti a varie richieste. Rispondi sempre in italiano.
223
+
224
+ TASK: Elabora la risposta alla richiesta "${c}" sulla base del contesto fornito e della conversazione.
225
+
226
+ INSTRUCTIONS:
227
+ 1. Analizza attentamente il contesto, la conversazione precedente e la richiesta: "${c}".
228
+ 2. Interpreta l'intento dell'utente senza limitarti a categorie predefinite.
229
+ 3. Adatta la tua risposta in base all'intento percepito, sia esso una domanda, una richiesta di azione, un'istruzione specifica o altro.
230
+ 4. Mantieni una stretta coerenza con il contesto della conversazione.
231
+ 5. Basa la tua risposta sulle informazioni fornite nel contesto e nella conversazione.
232
+ 6. Evita divagazioni o argomentazioni non direttamente pertinenti alla richiesta o al contesto.
233
+ 7. Fai riferimento a informazioni precedenti quando sono pertinenti, citando specificamente la fonte.
234
+ 8. Se l'intento non \u00e8 chiaro, chiedi gentilmente chiarimenti invece di fare supposizioni.
235
+ 9. Sii flessibile: se la richiesta implica un'azione specifica, adattati di conseguenza.
236
+ 10. Se \u00e8 necessario integrare con conoscenze generali, specifica chiaramente quando lo stai facendo.
237
+
238
+ CONTESTO:
239
+ <<<BEGIN_CONTESTO>>>
240
+ ${a}
241
+ <<<END_CONTESTO>>>
242
+
243
+ <<<INIZIO_CONVERSAZIONE>>>
244
+ ${b}
245
+ <<<FINE_CONVERSAZIONE>>>
246
+
247
+ RICHIESTA: ${c}
248
+
249
+ OUTPUT_FORMAT: Fornisci la risposta in testo semplice e lineare suddiviso in paragrafi.
250
+
251
+ RESPONSE:
252
+ `}function getPayloadDoc(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:2E3,num_return_sequences:1,temperature:.4,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:3,num_beams:4,repetition_penalty:1.2,return_full_text:!1,details:!1,max_time:90,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
253
+ function getPayloadBuildContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:6E3,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:6,repetition_penalty:1.2,return_full_text:!1,details:!1,max_time:180,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
254
+ function getPayloadWithContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:4E3,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
255
+ function getPayloadThread(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:6048,num_return_sequences:1,temperature:.7,top_p:.85,top_k:30,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}};const VERS="0.1.54 (10-11-2024)";var xlog=console.log,xerror=console.error;const cancelRequest=()=>{confirm("Confermi Cancellazione Richeista ?")&&(HfRequest.cancelRequest(),hideSpinner())},showSpinner=()=>{const a=document.getElementById("spinner");a.classList.add("show-spinner");a.addEventListener("click",cancelRequest)},hideSpinner=()=>{const a=document.getElementById("spinner");a.classList.remove("show-spinner");a.removeEventListener("click",cancelRequest)};var tm;
256
  function openApp(){setTimeout(()=>{tm=umgm();wnds.init();Menu.init();TextInput.init();TextOutput.init();Rag.init();document.querySelector(".menu-btn").checked=!1;release();showHistory()},10)}function showHistory(){const a=ThreadMgr.getThread();setOutText(a)}function release(){document.querySelector(".release").innerHTML=VERS}const op0=async function(a){a=await requestGet("./help1.html");wnds.wdiv.show(a)};function showQuery(a){wnds.wpre.show(`\n${Rag.ragQuery}`)}
257
  function showRagResponse(a){wnds.wpre.show(`\n${Rag.ragAnswer}`)}function showThread(a){a=ThreadMgr.getThread();wnds.wpre.show(a)}function elencoRisposte(a){a=[...Rag.answers];0==a.length&&(a=UaDb.readArray(ID_RESPONSES));0!=a.length&&(a=a.map((b,c)=>`\n[${c+1}]\n ${b.trim()}`).join("\n"),wnds.wpre.show(a))}function showContesto(a){wnds.wpre.show(`${Rag.ragContext}`)}
258
  function elencoDati(a){var b=UaDb.getAllIds();a=[];for(var c of b)b=UaDb.read(c).length,a.push(`${c} (${b})`);c=a.join("\n ");wnds.wpre.show(c)}const showT=a=>{wnds.wpre.show(DataMgr.docs[a])};function elencoDocs(){DataMgr.readDbDocs();DataMgr.readDbDocNames();var a=DataMgr.doc_names,b=UaJtfh();let c=0;b.append("<ul>");for(const g of a){a=b;var d=a.append,e=g,f=c++;d.call(a,`