@vezlo/assistant-server 1.0.0

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.
Files changed (113) hide show
  1. package/Dockerfile +64 -0
  2. package/LICENSE +661 -0
  3. package/README.md +432 -0
  4. package/bin/vezlo-server.js +36 -0
  5. package/database-schema.sql +154 -0
  6. package/dist/knexfile.d.ts +6 -0
  7. package/dist/knexfile.d.ts.map +1 -0
  8. package/dist/knexfile.js +85 -0
  9. package/dist/knexfile.js.map +1 -0
  10. package/dist/src/config/database.d.ts +4 -0
  11. package/dist/src/config/database.d.ts.map +1 -0
  12. package/dist/src/config/database.js +30 -0
  13. package/dist/src/config/database.js.map +1 -0
  14. package/dist/src/config/global.d.ts +65 -0
  15. package/dist/src/config/global.d.ts.map +1 -0
  16. package/dist/src/config/global.js +113 -0
  17. package/dist/src/config/global.js.map +1 -0
  18. package/dist/src/config/knex.d.ts +9 -0
  19. package/dist/src/config/knex.d.ts.map +1 -0
  20. package/dist/src/config/knex.js +67 -0
  21. package/dist/src/config/knex.js.map +1 -0
  22. package/dist/src/config/logger.d.ts +4 -0
  23. package/dist/src/config/logger.d.ts.map +1 -0
  24. package/dist/src/config/logger.js +30 -0
  25. package/dist/src/config/logger.js.map +1 -0
  26. package/dist/src/config/swagger.d.ts +18 -0
  27. package/dist/src/config/swagger.d.ts.map +1 -0
  28. package/dist/src/config/swagger.js +230 -0
  29. package/dist/src/config/swagger.js.map +1 -0
  30. package/dist/src/controllers/ChatController.d.ts +16 -0
  31. package/dist/src/controllers/ChatController.d.ts.map +1 -0
  32. package/dist/src/controllers/ChatController.js +281 -0
  33. package/dist/src/controllers/ChatController.js.map +1 -0
  34. package/dist/src/controllers/KnowledgeController.d.ts +13 -0
  35. package/dist/src/controllers/KnowledgeController.d.ts.map +1 -0
  36. package/dist/src/controllers/KnowledgeController.js +210 -0
  37. package/dist/src/controllers/KnowledgeController.js.map +1 -0
  38. package/dist/src/middleware/errorHandler.d.ts +63 -0
  39. package/dist/src/middleware/errorHandler.d.ts.map +1 -0
  40. package/dist/src/middleware/errorHandler.js +226 -0
  41. package/dist/src/middleware/errorHandler.js.map +1 -0
  42. package/dist/src/migrations/001_initial_schema.d.ts +4 -0
  43. package/dist/src/migrations/001_initial_schema.d.ts.map +1 -0
  44. package/dist/src/migrations/001_initial_schema.js +144 -0
  45. package/dist/src/migrations/001_initial_schema.js.map +1 -0
  46. package/dist/src/schemas/ConversationSchemas.d.ts +132 -0
  47. package/dist/src/schemas/ConversationSchemas.d.ts.map +1 -0
  48. package/dist/src/schemas/ConversationSchemas.js +71 -0
  49. package/dist/src/schemas/ConversationSchemas.js.map +1 -0
  50. package/dist/src/schemas/FeedbackSchemas.d.ts +222 -0
  51. package/dist/src/schemas/FeedbackSchemas.d.ts.map +1 -0
  52. package/dist/src/schemas/FeedbackSchemas.js +116 -0
  53. package/dist/src/schemas/FeedbackSchemas.js.map +1 -0
  54. package/dist/src/schemas/KnowledgeSchemas.d.ts +266 -0
  55. package/dist/src/schemas/KnowledgeSchemas.d.ts.map +1 -0
  56. package/dist/src/schemas/KnowledgeSchemas.js +115 -0
  57. package/dist/src/schemas/KnowledgeSchemas.js.map +1 -0
  58. package/dist/src/schemas/MessageSchemas.d.ts +145 -0
  59. package/dist/src/schemas/MessageSchemas.d.ts.map +1 -0
  60. package/dist/src/schemas/MessageSchemas.js +79 -0
  61. package/dist/src/schemas/MessageSchemas.js.map +1 -0
  62. package/dist/src/schemas/index.d.ts +752 -0
  63. package/dist/src/schemas/index.d.ts.map +1 -0
  64. package/dist/src/schemas/index.js +31 -0
  65. package/dist/src/schemas/index.js.map +1 -0
  66. package/dist/src/server.d.ts +2 -0
  67. package/dist/src/server.d.ts.map +1 -0
  68. package/dist/src/server.js +609 -0
  69. package/dist/src/server.js.map +1 -0
  70. package/dist/src/services/AIService.d.ts +17 -0
  71. package/dist/src/services/AIService.d.ts.map +1 -0
  72. package/dist/src/services/AIService.js +174 -0
  73. package/dist/src/services/AIService.js.map +1 -0
  74. package/dist/src/services/ChatManager.d.ts +18 -0
  75. package/dist/src/services/ChatManager.d.ts.map +1 -0
  76. package/dist/src/services/ChatManager.js +174 -0
  77. package/dist/src/services/ChatManager.js.map +1 -0
  78. package/dist/src/services/KnowledgeBaseService.d.ts +72 -0
  79. package/dist/src/services/KnowledgeBaseService.d.ts.map +1 -0
  80. package/dist/src/services/KnowledgeBaseService.js +442 -0
  81. package/dist/src/services/KnowledgeBaseService.js.map +1 -0
  82. package/dist/src/storage/ConversationRepository.d.ts +15 -0
  83. package/dist/src/storage/ConversationRepository.d.ts.map +1 -0
  84. package/dist/src/storage/ConversationRepository.js +123 -0
  85. package/dist/src/storage/ConversationRepository.js.map +1 -0
  86. package/dist/src/storage/FeedbackRepository.d.ts +15 -0
  87. package/dist/src/storage/FeedbackRepository.d.ts.map +1 -0
  88. package/dist/src/storage/FeedbackRepository.js +141 -0
  89. package/dist/src/storage/FeedbackRepository.js.map +1 -0
  90. package/dist/src/storage/MessageRepository.d.ts +13 -0
  91. package/dist/src/storage/MessageRepository.d.ts.map +1 -0
  92. package/dist/src/storage/MessageRepository.js +165 -0
  93. package/dist/src/storage/MessageRepository.js.map +1 -0
  94. package/dist/src/storage/SupabaseStorage.d.ts +20 -0
  95. package/dist/src/storage/SupabaseStorage.d.ts.map +1 -0
  96. package/dist/src/storage/SupabaseStorage.js +347 -0
  97. package/dist/src/storage/SupabaseStorage.js.map +1 -0
  98. package/dist/src/storage/UnifiedStorage.d.ts +45 -0
  99. package/dist/src/storage/UnifiedStorage.d.ts.map +1 -0
  100. package/dist/src/storage/UnifiedStorage.js +94 -0
  101. package/dist/src/storage/UnifiedStorage.js.map +1 -0
  102. package/dist/src/storage/index.d.ts +11 -0
  103. package/dist/src/storage/index.d.ts.map +1 -0
  104. package/dist/src/storage/index.js +21 -0
  105. package/dist/src/storage/index.js.map +1 -0
  106. package/dist/src/types/index.d.ts +163 -0
  107. package/dist/src/types/index.d.ts.map +1 -0
  108. package/dist/src/types/index.js +3 -0
  109. package/dist/src/types/index.js.map +1 -0
  110. package/docker-compose.yml +32 -0
  111. package/env.example +46 -0
  112. package/knexfile.ts +86 -0
  113. package/package.json +92 -0
@@ -0,0 +1,752 @@
1
+ /**
2
+ * Schema Exports
3
+ * Central export point for all API schemas
4
+ */
5
+ import { ConversationSchemas } from './ConversationSchemas';
6
+ import { MessageSchemas } from './MessageSchemas';
7
+ import { KnowledgeSchemas } from './KnowledgeSchemas';
8
+ import { FeedbackSchemas } from './FeedbackSchemas';
9
+ export declare const AllSchemas: {
10
+ FeedbackRequest: {
11
+ type: string;
12
+ required: string[];
13
+ properties: {
14
+ message_uuid: {
15
+ type: string;
16
+ description: string;
17
+ };
18
+ user_uuid: {
19
+ type: string;
20
+ description: string;
21
+ default: number;
22
+ };
23
+ rating: {
24
+ type: string;
25
+ enum: string[];
26
+ description: string;
27
+ };
28
+ category: {
29
+ type: string;
30
+ enum: string[];
31
+ description: string;
32
+ };
33
+ comment: {
34
+ type: string;
35
+ description: string;
36
+ };
37
+ suggested_improvement: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ };
42
+ };
43
+ UpdateFeedbackRequest: {
44
+ type: string;
45
+ properties: {
46
+ rating: {
47
+ type: string;
48
+ enum: string[];
49
+ description: string;
50
+ };
51
+ category: {
52
+ type: string;
53
+ enum: string[];
54
+ description: string;
55
+ };
56
+ comment: {
57
+ type: string;
58
+ description: string;
59
+ };
60
+ suggested_improvement: {
61
+ type: string;
62
+ description: string;
63
+ };
64
+ };
65
+ };
66
+ FeedbackResponse: {
67
+ type: string;
68
+ properties: {
69
+ success: {
70
+ type: string;
71
+ };
72
+ feedback: {
73
+ type: string;
74
+ properties: {
75
+ uuid: {
76
+ type: string;
77
+ description: string;
78
+ };
79
+ message_uuid: {
80
+ type: string;
81
+ description: string;
82
+ };
83
+ user_uuid: {
84
+ type: string;
85
+ description: string;
86
+ };
87
+ rating: {
88
+ type: string;
89
+ description: string;
90
+ };
91
+ category: {
92
+ type: string;
93
+ description: string;
94
+ };
95
+ comment: {
96
+ type: string;
97
+ description: string;
98
+ };
99
+ suggested_improvement: {
100
+ type: string;
101
+ description: string;
102
+ };
103
+ created_at: {
104
+ type: string;
105
+ format: string;
106
+ };
107
+ updated_at: {
108
+ type: string;
109
+ format: string;
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ FeedbackListResponse: {
116
+ type: string;
117
+ properties: {
118
+ feedback: {
119
+ type: string;
120
+ items: {
121
+ type: string;
122
+ properties: {
123
+ uuid: {
124
+ type: string;
125
+ description: string;
126
+ };
127
+ message_uuid: {
128
+ type: string;
129
+ description: string;
130
+ };
131
+ user_uuid: {
132
+ type: string;
133
+ description: string;
134
+ };
135
+ rating: {
136
+ type: string;
137
+ description: string;
138
+ };
139
+ category: {
140
+ type: string;
141
+ description: string;
142
+ };
143
+ comment: {
144
+ type: string;
145
+ description: string;
146
+ };
147
+ suggested_improvement: {
148
+ type: string;
149
+ description: string;
150
+ };
151
+ created_at: {
152
+ type: string;
153
+ format: string;
154
+ };
155
+ updated_at: {
156
+ type: string;
157
+ format: string;
158
+ };
159
+ };
160
+ };
161
+ };
162
+ total: {
163
+ type: string;
164
+ description: string;
165
+ };
166
+ limit: {
167
+ type: string;
168
+ description: string;
169
+ };
170
+ offset: {
171
+ type: string;
172
+ description: string;
173
+ };
174
+ };
175
+ };
176
+ FeedbackStatsResponse: {
177
+ type: string;
178
+ properties: {
179
+ total_feedback: {
180
+ type: string;
181
+ description: string;
182
+ };
183
+ positive_count: {
184
+ type: string;
185
+ description: string;
186
+ };
187
+ negative_count: {
188
+ type: string;
189
+ description: string;
190
+ };
191
+ positive_percentage: {
192
+ type: string;
193
+ description: string;
194
+ };
195
+ categories: {
196
+ type: string;
197
+ description: string;
198
+ additionalProperties: {
199
+ type: string;
200
+ };
201
+ };
202
+ recent_feedback: {
203
+ type: string;
204
+ items: {
205
+ type: string;
206
+ properties: {
207
+ uuid: {
208
+ type: string;
209
+ };
210
+ rating: {
211
+ type: string;
212
+ };
213
+ category: {
214
+ type: string;
215
+ };
216
+ created_at: {
217
+ type: string;
218
+ format: string;
219
+ };
220
+ };
221
+ };
222
+ };
223
+ };
224
+ };
225
+ CreateKnowledgeItemRequest: {
226
+ type: string;
227
+ required: string[];
228
+ properties: {
229
+ parent_uuid: {
230
+ type: string;
231
+ description: string;
232
+ };
233
+ company_uuid: {
234
+ type: string;
235
+ description: string;
236
+ default: number;
237
+ };
238
+ title: {
239
+ type: string;
240
+ description: string;
241
+ };
242
+ description: {
243
+ type: string;
244
+ description: string;
245
+ };
246
+ type: {
247
+ type: string;
248
+ enum: string[];
249
+ description: string;
250
+ };
251
+ content: {
252
+ type: string;
253
+ description: string;
254
+ };
255
+ file_url: {
256
+ type: string;
257
+ description: string;
258
+ };
259
+ file_size: {
260
+ type: string;
261
+ description: string;
262
+ };
263
+ file_type: {
264
+ type: string;
265
+ description: string;
266
+ };
267
+ metadata: {
268
+ type: string;
269
+ description: string;
270
+ };
271
+ created_by_uuid: {
272
+ type: string;
273
+ description: string;
274
+ default: number;
275
+ };
276
+ };
277
+ };
278
+ UpdateKnowledgeItemRequest: {
279
+ type: string;
280
+ properties: {
281
+ title: {
282
+ type: string;
283
+ description: string;
284
+ };
285
+ description: {
286
+ type: string;
287
+ description: string;
288
+ };
289
+ content: {
290
+ type: string;
291
+ description: string;
292
+ };
293
+ file_url: {
294
+ type: string;
295
+ description: string;
296
+ };
297
+ file_size: {
298
+ type: string;
299
+ description: string;
300
+ };
301
+ file_type: {
302
+ type: string;
303
+ description: string;
304
+ };
305
+ metadata: {
306
+ type: string;
307
+ description: string;
308
+ };
309
+ };
310
+ };
311
+ KnowledgeSearchRequest: {
312
+ type: string;
313
+ required: string[];
314
+ properties: {
315
+ query: {
316
+ type: string;
317
+ description: string;
318
+ };
319
+ limit: {
320
+ type: string;
321
+ default: number;
322
+ description: string;
323
+ };
324
+ threshold: {
325
+ type: string;
326
+ default: number;
327
+ description: string;
328
+ };
329
+ type: {
330
+ type: string;
331
+ enum: string[];
332
+ default: string;
333
+ description: string;
334
+ };
335
+ company_uuid: {
336
+ type: string;
337
+ description: string;
338
+ default: number;
339
+ };
340
+ };
341
+ };
342
+ KnowledgeItemResponse: {
343
+ type: string;
344
+ properties: {
345
+ uuid: {
346
+ type: string;
347
+ description: string;
348
+ };
349
+ parent_uuid: {
350
+ type: string;
351
+ description: string;
352
+ };
353
+ company_uuid: {
354
+ type: string;
355
+ description: string;
356
+ default: number;
357
+ };
358
+ title: {
359
+ type: string;
360
+ description: string;
361
+ };
362
+ description: {
363
+ type: string;
364
+ description: string;
365
+ };
366
+ type: {
367
+ type: string;
368
+ description: string;
369
+ };
370
+ content: {
371
+ type: string;
372
+ description: string;
373
+ };
374
+ file_url: {
375
+ type: string;
376
+ description: string;
377
+ };
378
+ file_size: {
379
+ type: string;
380
+ description: string;
381
+ };
382
+ file_type: {
383
+ type: string;
384
+ description: string;
385
+ };
386
+ metadata: {
387
+ type: string;
388
+ description: string;
389
+ };
390
+ created_by_uuid: {
391
+ type: string;
392
+ description: string;
393
+ };
394
+ created_at: {
395
+ type: string;
396
+ format: string;
397
+ };
398
+ updated_at: {
399
+ type: string;
400
+ format: string;
401
+ };
402
+ };
403
+ };
404
+ KnowledgeItemListResponse: {
405
+ type: string;
406
+ properties: {
407
+ items: {
408
+ type: string;
409
+ items: {
410
+ $ref: string;
411
+ };
412
+ };
413
+ total: {
414
+ type: string;
415
+ description: string;
416
+ };
417
+ limit: {
418
+ type: string;
419
+ description: string;
420
+ };
421
+ offset: {
422
+ type: string;
423
+ description: string;
424
+ };
425
+ };
426
+ };
427
+ KnowledgeSearchResponse: {
428
+ type: string;
429
+ properties: {
430
+ query: {
431
+ type: string;
432
+ description: string;
433
+ };
434
+ results: {
435
+ type: string;
436
+ items: {
437
+ type: string;
438
+ properties: {
439
+ uuid: {
440
+ type: string;
441
+ description: string;
442
+ };
443
+ title: {
444
+ type: string;
445
+ description: string;
446
+ };
447
+ description: {
448
+ type: string;
449
+ description: string;
450
+ };
451
+ content: {
452
+ type: string;
453
+ description: string;
454
+ };
455
+ type: {
456
+ type: string;
457
+ description: string;
458
+ };
459
+ score: {
460
+ type: string;
461
+ description: string;
462
+ };
463
+ metadata: {
464
+ type: string;
465
+ description: string;
466
+ };
467
+ };
468
+ };
469
+ };
470
+ total: {
471
+ type: string;
472
+ description: string;
473
+ };
474
+ search_type: {
475
+ type: string;
476
+ description: string;
477
+ };
478
+ threshold: {
479
+ type: string;
480
+ description: string;
481
+ };
482
+ };
483
+ };
484
+ CreateMessageRequest: {
485
+ type: string;
486
+ required: string[];
487
+ properties: {
488
+ content: {
489
+ type: string;
490
+ description: string;
491
+ };
492
+ };
493
+ };
494
+ GenerateMessageRequest: {
495
+ type: string;
496
+ properties: {
497
+ regenerate: {
498
+ type: string;
499
+ description: string;
500
+ default: boolean;
501
+ };
502
+ context: {
503
+ type: string;
504
+ description: string;
505
+ };
506
+ };
507
+ };
508
+ MessageResponse: {
509
+ type: string;
510
+ properties: {
511
+ uuid: {
512
+ type: string;
513
+ description: string;
514
+ };
515
+ conversation_uuid: {
516
+ type: string;
517
+ description: string;
518
+ };
519
+ parent_message_uuid: {
520
+ type: string;
521
+ description: string;
522
+ };
523
+ type: {
524
+ type: string;
525
+ enum: string[];
526
+ description: string;
527
+ };
528
+ content: {
529
+ type: string;
530
+ description: string;
531
+ };
532
+ status: {
533
+ type: string;
534
+ enum: string[];
535
+ description: string;
536
+ };
537
+ metadata: {
538
+ type: string;
539
+ description: string;
540
+ };
541
+ created_at: {
542
+ type: string;
543
+ format: string;
544
+ };
545
+ updated_at: {
546
+ type: string;
547
+ format: string;
548
+ };
549
+ };
550
+ };
551
+ MessageListResponse: {
552
+ type: string;
553
+ properties: {
554
+ messages: {
555
+ type: string;
556
+ items: {
557
+ $ref: string;
558
+ };
559
+ };
560
+ total: {
561
+ type: string;
562
+ description: string;
563
+ };
564
+ limit: {
565
+ type: string;
566
+ description: string;
567
+ };
568
+ offset: {
569
+ type: string;
570
+ description: string;
571
+ };
572
+ };
573
+ };
574
+ GenerateMessageResponse: {
575
+ type: string;
576
+ properties: {
577
+ uuid: {
578
+ type: string;
579
+ description: string;
580
+ };
581
+ parent_message_uuid: {
582
+ type: string;
583
+ description: string;
584
+ };
585
+ type: {
586
+ type: string;
587
+ enum: string[];
588
+ description: string;
589
+ };
590
+ content: {
591
+ type: string;
592
+ description: string;
593
+ };
594
+ status: {
595
+ type: string;
596
+ enum: string[];
597
+ description: string;
598
+ };
599
+ metadata: {
600
+ type: string;
601
+ description: string;
602
+ properties: {
603
+ knowledge_sources: {
604
+ type: string;
605
+ items: {
606
+ type: string;
607
+ };
608
+ description: string;
609
+ };
610
+ generation_time: {
611
+ type: string;
612
+ description: string;
613
+ };
614
+ };
615
+ };
616
+ created_at: {
617
+ type: string;
618
+ format: string;
619
+ };
620
+ };
621
+ };
622
+ CreateConversationRequest: {
623
+ type: string;
624
+ required: string[];
625
+ properties: {
626
+ title: {
627
+ type: string;
628
+ description: string;
629
+ default: string;
630
+ };
631
+ user_uuid: {
632
+ type: string;
633
+ description: string;
634
+ default: number;
635
+ };
636
+ company_uuid: {
637
+ type: string;
638
+ description: string;
639
+ default: number;
640
+ };
641
+ };
642
+ };
643
+ UpdateConversationRequest: {
644
+ type: string;
645
+ properties: {
646
+ title: {
647
+ type: string;
648
+ description: string;
649
+ };
650
+ };
651
+ };
652
+ ConversationResponse: {
653
+ type: string;
654
+ properties: {
655
+ uuid: {
656
+ type: string;
657
+ description: string;
658
+ };
659
+ title: {
660
+ type: string;
661
+ description: string;
662
+ };
663
+ user_uuid: {
664
+ type: string;
665
+ description: string;
666
+ };
667
+ company_uuid: {
668
+ type: string;
669
+ description: string;
670
+ };
671
+ message_count: {
672
+ type: string;
673
+ description: string;
674
+ };
675
+ created_at: {
676
+ type: string;
677
+ format: string;
678
+ };
679
+ updated_at: {
680
+ type: string;
681
+ format: string;
682
+ };
683
+ };
684
+ };
685
+ ConversationWithMessages: {
686
+ type: string;
687
+ properties: {
688
+ uuid: {
689
+ type: string;
690
+ description: string;
691
+ };
692
+ title: {
693
+ type: string;
694
+ description: string;
695
+ };
696
+ user_uuid: {
697
+ type: string;
698
+ description: string;
699
+ };
700
+ company_uuid: {
701
+ type: string;
702
+ description: string;
703
+ };
704
+ message_count: {
705
+ type: string;
706
+ description: string;
707
+ };
708
+ created_at: {
709
+ type: string;
710
+ format: string;
711
+ };
712
+ updated_at: {
713
+ type: string;
714
+ format: string;
715
+ };
716
+ messages: {
717
+ type: string;
718
+ items: {
719
+ $ref: string;
720
+ };
721
+ };
722
+ };
723
+ };
724
+ ConversationListResponse: {
725
+ type: string;
726
+ properties: {
727
+ conversations: {
728
+ type: string;
729
+ items: {
730
+ $ref: string;
731
+ };
732
+ };
733
+ total: {
734
+ type: string;
735
+ description: string;
736
+ };
737
+ limit: {
738
+ type: string;
739
+ description: string;
740
+ };
741
+ offset: {
742
+ type: string;
743
+ description: string;
744
+ };
745
+ };
746
+ };
747
+ };
748
+ export { ConversationSchemas, MessageSchemas, KnowledgeSchemas, FeedbackSchemas };
749
+ export declare const SchemaValidators: {
750
+ validateConversationRequest: (data: any) => boolean;
751
+ };
752
+ //# sourceMappingURL=index.d.ts.map