@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,230 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.swaggerUiOptions = exports.swaggerUi = exports.specs = void 0;
7
+ const swagger_jsdoc_1 = __importDefault(require("swagger-jsdoc"));
8
+ const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
9
+ exports.swaggerUi = swagger_ui_express_1.default;
10
+ const global_1 = require("./global");
11
+ const schemas_1 = require("../schemas");
12
+ const options = {
13
+ definition: {
14
+ openapi: '3.0.0',
15
+ info: {
16
+ title: global_1.config.swagger.title,
17
+ version: global_1.config.swagger.version,
18
+ description: global_1.config.swagger.description
19
+ },
20
+ servers: [
21
+ {
22
+ url: 'http://localhost:3000',
23
+ description: 'Development server'
24
+ }
25
+ ],
26
+ components: {
27
+ schemas: {
28
+ // ============================================================================
29
+ // IMPORTED CONTROLLER-SPECIFIC SCHEMAS
30
+ // ============================================================================
31
+ ...schemas_1.AllSchemas,
32
+ // ============================================================================
33
+ // COMMON/GLOBAL SCHEMAS (Keep these here)
34
+ // ============================================================================
35
+ Error: {
36
+ type: 'object',
37
+ properties: {
38
+ error: {
39
+ type: 'object',
40
+ properties: {
41
+ code: { type: 'string', description: 'Error code' },
42
+ message: { type: 'string', description: 'Error message' },
43
+ details: { type: 'object', description: 'Additional error details' },
44
+ timestamp: { type: 'string', format: 'date-time', description: 'Error timestamp' },
45
+ path: { type: 'string', description: 'Request path' },
46
+ method: { type: 'string', description: 'HTTP method' }
47
+ }
48
+ },
49
+ success: { type: 'boolean', example: false }
50
+ }
51
+ },
52
+ SuccessResponse: {
53
+ type: 'object',
54
+ properties: {
55
+ success: { type: 'boolean', example: true },
56
+ message: { type: 'string', description: 'Success message' },
57
+ data: { type: 'object', description: 'Response data' }
58
+ }
59
+ },
60
+ HealthCheck: {
61
+ type: 'object',
62
+ properties: {
63
+ status: { type: 'string', example: 'healthy' },
64
+ checks: {
65
+ type: 'object',
66
+ properties: {
67
+ server: { type: 'string', example: 'healthy' },
68
+ supabase: { type: 'string', example: 'connected' },
69
+ openai: { type: 'string', example: 'connected' },
70
+ timestamp: { type: 'string', format: 'date-time' }
71
+ }
72
+ },
73
+ uptime: { type: 'number', description: 'Server uptime in seconds' },
74
+ version: { type: 'string', description: 'API version' }
75
+ }
76
+ },
77
+ PaginationMeta: {
78
+ type: 'object',
79
+ properties: {
80
+ total: { type: 'integer', description: 'Total number of items' },
81
+ limit: { type: 'integer', description: 'Items per page' },
82
+ offset: { type: 'integer', description: 'Items skipped' },
83
+ page: { type: 'integer', description: 'Current page number' },
84
+ pages: { type: 'integer', description: 'Total number of pages' }
85
+ }
86
+ }
87
+ },
88
+ // ============================================================================
89
+ // SECURITY SCHEMES
90
+ // ============================================================================
91
+ securitySchemes: {
92
+ BearerAuth: {
93
+ type: 'http',
94
+ scheme: 'bearer',
95
+ bearerFormat: 'JWT',
96
+ description: 'JWT token for authentication'
97
+ },
98
+ ApiKeyAuth: {
99
+ type: 'apiKey',
100
+ in: 'header',
101
+ name: 'X-API-Key',
102
+ description: 'API key for authentication'
103
+ }
104
+ },
105
+ // ============================================================================
106
+ // COMMON PARAMETERS
107
+ // ============================================================================
108
+ parameters: {
109
+ LimitParam: {
110
+ name: 'limit',
111
+ in: 'query',
112
+ description: 'Number of items to return',
113
+ schema: {
114
+ type: 'integer',
115
+ minimum: 1,
116
+ maximum: 100,
117
+ default: 20
118
+ }
119
+ },
120
+ OffsetParam: {
121
+ name: 'offset',
122
+ in: 'query',
123
+ description: 'Number of items to skip',
124
+ schema: {
125
+ type: 'integer',
126
+ minimum: 0,
127
+ default: 0
128
+ }
129
+ },
130
+ CompanyUuidParam: {
131
+ name: 'company_uuid',
132
+ in: 'query',
133
+ description: 'Filter by company UUID',
134
+ schema: {
135
+ type: 'integer',
136
+ default: 67890
137
+ }
138
+ }
139
+ },
140
+ // ============================================================================
141
+ // COMMON RESPONSES
142
+ // ============================================================================
143
+ responses: {
144
+ BadRequest: {
145
+ description: 'Bad request - Invalid input data',
146
+ content: {
147
+ 'application/json': {
148
+ schema: { $ref: '#/components/schemas/Error' }
149
+ }
150
+ }
151
+ },
152
+ Unauthorized: {
153
+ description: 'Unauthorized - Authentication required',
154
+ content: {
155
+ 'application/json': {
156
+ schema: { $ref: '#/components/schemas/Error' }
157
+ }
158
+ }
159
+ },
160
+ Forbidden: {
161
+ description: 'Forbidden - Insufficient permissions',
162
+ content: {
163
+ 'application/json': {
164
+ schema: { $ref: '#/components/schemas/Error' }
165
+ }
166
+ }
167
+ },
168
+ NotFound: {
169
+ description: 'Not found - Resource does not exist',
170
+ content: {
171
+ 'application/json': {
172
+ schema: { $ref: '#/components/schemas/Error' }
173
+ }
174
+ }
175
+ },
176
+ Conflict: {
177
+ description: 'Conflict - Resource already exists',
178
+ content: {
179
+ 'application/json': {
180
+ schema: { $ref: '#/components/schemas/Error' }
181
+ }
182
+ }
183
+ },
184
+ RateLimitExceeded: {
185
+ description: 'Rate limit exceeded',
186
+ content: {
187
+ 'application/json': {
188
+ schema: { $ref: '#/components/schemas/Error' }
189
+ }
190
+ }
191
+ },
192
+ InternalServerError: {
193
+ description: 'Internal server error',
194
+ content: {
195
+ 'application/json': {
196
+ schema: { $ref: '#/components/schemas/Error' }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }
202
+ },
203
+ apis: [
204
+ __dirname + '/../server.js',
205
+ __dirname + '/../controllers/*.js'
206
+ ]
207
+ };
208
+ exports.specs = (0, swagger_jsdoc_1.default)(options);
209
+ exports.swaggerUiOptions = {
210
+ explorer: false,
211
+ customSiteTitle: 'AI Assistant API Docs',
212
+ customCss: `
213
+ .swagger-ui .topbar { display: none !important; }
214
+ .swagger-ui .topbar-wrapper { display: none !important; }
215
+ .swagger-ui .topbar-wrapper .topbar { display: none !important; }
216
+ .swagger-ui .topbar-wrapper .topbar .download-url-wrapper { display: none !important; }
217
+ .swagger-ui .topbar-wrapper .topbar .download-url-button { display: none !important; }
218
+ .swagger-ui .topbar-wrapper .topbar .topbar-wrapper { display: none !important; }
219
+ `,
220
+ swaggerOptions: {
221
+ docExpansion: 'list',
222
+ filter: false,
223
+ showRequestDuration: true,
224
+ defaultModelsExpandDepth: 2,
225
+ defaultModelExpandDepth: 2,
226
+ displayOperationId: false,
227
+ displayRequestDuration: true
228
+ }
229
+ };
230
+ //# sourceMappingURL=swagger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../../src/config/swagger.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAyC;AACzC,4EAA2C;AAiNlC,oBAjNF,4BAAS,CAiNE;AAhNlB,qCAAkC;AAClC,wCAAwC;AAExC,MAAM,OAAO,GAAG;IACd,UAAU,EAAE;QACV,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK,EAAE,eAAM,CAAC,OAAO,CAAC,KAAK;YAC3B,OAAO,EAAE,eAAM,CAAC,OAAO,CAAC,OAAO;YAC/B,WAAW,EAAE,eAAM,CAAC,OAAO,CAAC,WAAW;SACxC;QACD,OAAO,EAAE;YACP;gBACE,GAAG,EAAE,uBAAuB;gBAC5B,WAAW,EAAE,oBAAoB;aAClC;SACF;QACD,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,+EAA+E;gBAC/E,uCAAuC;gBACvC,+EAA+E;gBAC/E,GAAG,oBAAU;gBAEb,+EAA+E;gBAC/E,0CAA0C;gBAC1C,+EAA+E;gBAC/E,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ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ACjD,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAClB,MAAM,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE;yBAC/C;qBACF;iBACF;gBACD,iBAAiB,EAAE;oBACjB,WAAW,EAAE,qBAAqB;oBAClC,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAClB,MAAM,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE;yBAC/C;qBACF;iBACF;gBACD,mBAAmB,EAAE;oBACnB,WAAW,EAAE,uBAAuB;oBACpC,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAClB,MAAM,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE;yBAC/C;qBACF;iBACF;aACF;SACF;KACF;IACD,IAAI,EAAE;QACJ,SAAS,GAAG,eAAe;QAC3B,SAAS,GAAG,sBAAsB;KACnC;CACF,CAAC;AAEW,QAAA,KAAK,GAAG,IAAA,uBAAY,EAAC,OAAO,CAAC,CAAC;AAE9B,QAAA,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,uBAAuB;IACxC,SAAS,EAAE;;;;;;;GAOV;IACD,cAAc,EAAE;QACd,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,KAAK;QACb,mBAAmB,EAAE,IAAI;QACzB,wBAAwB,EAAE,CAAC;QAC3B,uBAAuB,EAAE,CAAC;QAC1B,kBAAkB,EAAE,KAAK;QACzB,sBAAsB,EAAE,IAAI;KAC7B;CACF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Request, Response } from 'express';
2
+ import { ChatManager } from '../services/ChatManager';
3
+ import { UnifiedStorage } from '../storage/UnifiedStorage';
4
+ export declare class ChatController {
5
+ private chatManager;
6
+ private storage;
7
+ constructor(chatManager: ChatManager, storage: UnifiedStorage);
8
+ createConversation(req: Request, res: Response): Promise<void>;
9
+ createUserMessage(req: Request, res: Response): Promise<void>;
10
+ generateResponse(req: Request, res: Response): Promise<void>;
11
+ getConversation(req: Request, res: Response): Promise<void>;
12
+ getUserConversations(req: Request, res: Response): Promise<void>;
13
+ deleteConversation(req: Request, res: Response): Promise<void>;
14
+ submitFeedback(req: Request, res: Response): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=ChatController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatController.d.ts","sourceRoot":"","sources":["../../../src/controllers/ChatController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,qBAAa,cAAc;IACzB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,OAAO,CAAiB;gBAEpB,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc;IAMvD,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA0C9D,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiD7D,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAqE5D,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAwC3D,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAgChE,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB9D,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAkDjE"}
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChatController = void 0;
7
+ const logger_1 = __importDefault(require("../config/logger"));
8
+ class ChatController {
9
+ constructor(chatManager, storage) {
10
+ this.chatManager = chatManager;
11
+ this.storage = storage;
12
+ }
13
+ // Create a new conversation
14
+ async createConversation(req, res) {
15
+ try {
16
+ const { title, user_uuid, company_uuid } = req.body;
17
+ if (!user_uuid) {
18
+ res.status(400).json({ error: 'user_uuid is required' });
19
+ return;
20
+ }
21
+ // Generate a unique thread ID for the conversation
22
+ const threadId = `conv_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
23
+ const conversation = await this.storage.saveConversation({
24
+ threadId,
25
+ userId: user_uuid.toString(),
26
+ organizationId: company_uuid?.toString(),
27
+ title: title || 'New Conversation',
28
+ messageCount: 0,
29
+ createdAt: new Date(),
30
+ updatedAt: new Date()
31
+ });
32
+ res.json({
33
+ uuid: conversation.id,
34
+ title: conversation.title,
35
+ user_uuid: conversation.userId,
36
+ company_uuid: conversation.organizationId,
37
+ message_count: conversation.messageCount,
38
+ created_at: conversation.createdAt,
39
+ updated_at: conversation.updatedAt
40
+ });
41
+ }
42
+ catch (error) {
43
+ logger_1.default.error('Create conversation error:', error);
44
+ res.status(500).json({
45
+ error: 'Failed to create conversation',
46
+ message: error instanceof Error ? error.message : 'Unknown error'
47
+ });
48
+ }
49
+ }
50
+ // Create a user message in a conversation
51
+ async createUserMessage(req, res) {
52
+ try {
53
+ const { uuid } = req.params;
54
+ const { content } = req.body;
55
+ if (!content) {
56
+ res.status(400).json({ error: 'content is required' });
57
+ return;
58
+ }
59
+ // Check if conversation exists
60
+ const conversation = await this.storage.getConversation(uuid);
61
+ if (!conversation) {
62
+ res.status(404).json({ error: 'Conversation not found' });
63
+ return;
64
+ }
65
+ // Create user message
66
+ const userMessage = await this.storage.saveMessage({
67
+ conversationId: uuid,
68
+ threadId: conversation.threadId,
69
+ role: 'user',
70
+ content,
71
+ createdAt: new Date()
72
+ });
73
+ // Update conversation message count
74
+ await this.storage.updateConversation(uuid, {
75
+ messageCount: conversation.messageCount + 1
76
+ });
77
+ res.json({
78
+ uuid: userMessage.id,
79
+ conversation_uuid: uuid,
80
+ type: userMessage.role,
81
+ content: userMessage.content,
82
+ created_at: userMessage.createdAt
83
+ });
84
+ }
85
+ catch (error) {
86
+ logger_1.default.error('Create user message error:', error);
87
+ res.status(500).json({
88
+ error: 'Failed to create user message',
89
+ message: error instanceof Error ? error.message : 'Unknown error'
90
+ });
91
+ }
92
+ }
93
+ // Generate AI response for a user message
94
+ async generateResponse(req, res) {
95
+ try {
96
+ const { uuid } = req.params;
97
+ // Get the user message by ID using the repository
98
+ const userMessage = await this.storage.getMessageById(uuid);
99
+ if (!userMessage) {
100
+ res.status(404).json({ error: 'Message not found' });
101
+ return;
102
+ }
103
+ const conversationId = userMessage.conversationId;
104
+ const userMessageContent = userMessage.content;
105
+ // Get conversation context (recent messages)
106
+ const messages = await this.storage.getMessages(conversationId, 10);
107
+ // Build context for AI
108
+ const chatContext = {
109
+ conversationHistory: messages.map(msg => ({
110
+ role: msg.role,
111
+ content: msg.content,
112
+ createdAt: msg.createdAt
113
+ }))
114
+ };
115
+ // Generate AI response using the actual user message content
116
+ const response = await this.chatManager.aiService.generateResponse(userMessageContent, chatContext);
117
+ // Save AI message to database
118
+ // Note: The storage layer will handle UUID to internal ID conversion
119
+ const assistantMessage = await this.storage.saveMessage({
120
+ conversationId: conversationId, // This is the conversation UUID
121
+ threadId: conversationId,
122
+ role: 'assistant',
123
+ content: response.content,
124
+ parentMessageId: uuid, // This is the parent message UUID
125
+ toolResults: response.toolResults,
126
+ createdAt: new Date()
127
+ });
128
+ // Update conversation message count
129
+ const conversation = await this.storage.getConversation(conversationId);
130
+ if (conversation) {
131
+ await this.storage.updateConversation(conversationId, {
132
+ messageCount: conversation.messageCount + 1
133
+ });
134
+ }
135
+ res.json({
136
+ uuid: assistantMessage.id,
137
+ parent_message_uuid: uuid,
138
+ type: 'assistant',
139
+ content: response.content,
140
+ status: 'completed',
141
+ created_at: assistantMessage.createdAt.toISOString()
142
+ });
143
+ }
144
+ catch (error) {
145
+ logger_1.default.error('Generate response error:', error);
146
+ res.status(500).json({
147
+ error: 'Failed to generate response',
148
+ message: error instanceof Error ? error.message : 'Unknown error'
149
+ });
150
+ }
151
+ }
152
+ // Get conversation details with messages
153
+ async getConversation(req, res) {
154
+ try {
155
+ const { uuid } = req.params;
156
+ const conversation = await this.storage.getConversation(uuid);
157
+ if (!conversation) {
158
+ res.status(404).json({ error: 'Conversation not found' });
159
+ return;
160
+ }
161
+ const messages = await this.storage.getMessages(uuid, 50);
162
+ res.json({
163
+ uuid: conversation.id,
164
+ title: conversation.title,
165
+ user_uuid: conversation.userId,
166
+ company_uuid: conversation.organizationId,
167
+ message_count: conversation.messageCount,
168
+ created_at: conversation.createdAt,
169
+ updated_at: conversation.updatedAt,
170
+ messages: messages.map(msg => ({
171
+ uuid: msg.id,
172
+ parent_message_uuid: msg.parentMessageId,
173
+ type: msg.role,
174
+ content: msg.content,
175
+ status: 'completed',
176
+ created_at: msg.createdAt
177
+ }))
178
+ });
179
+ }
180
+ catch (error) {
181
+ logger_1.default.error('Get conversation error:', error);
182
+ res.status(500).json({
183
+ error: 'Failed to get conversation',
184
+ message: error instanceof Error ? error.message : 'Unknown error'
185
+ });
186
+ }
187
+ }
188
+ // Get user conversations (renamed from getUserConversations)
189
+ async getUserConversations(req, res) {
190
+ try {
191
+ const { uuid } = req.params;
192
+ const { company_uuid } = req.query;
193
+ const conversations = await this.storage.getUserConversations(uuid, company_uuid);
194
+ res.json({
195
+ conversations: conversations.map(conversation => ({
196
+ uuid: conversation.id,
197
+ title: conversation.title,
198
+ user_uuid: conversation.userId,
199
+ company_uuid: conversation.organizationId,
200
+ message_count: conversation.messageCount,
201
+ created_at: conversation.createdAt,
202
+ updated_at: conversation.updatedAt
203
+ }))
204
+ });
205
+ }
206
+ catch (error) {
207
+ logger_1.default.error('Get user conversations error:', error);
208
+ res.status(500).json({
209
+ error: 'Failed to get user conversations',
210
+ message: error instanceof Error ? error.message : 'Unknown error'
211
+ });
212
+ }
213
+ }
214
+ // Delete conversation
215
+ async deleteConversation(req, res) {
216
+ try {
217
+ const { uuid } = req.params;
218
+ const success = await this.storage.deleteConversation(uuid);
219
+ if (!success) {
220
+ res.status(404).json({ error: 'Conversation not found or could not be deleted' });
221
+ return;
222
+ }
223
+ res.json({ success: true });
224
+ }
225
+ catch (error) {
226
+ logger_1.default.error('Delete conversation error:', error);
227
+ res.status(500).json({
228
+ error: 'Failed to delete conversation',
229
+ message: error instanceof Error ? error.message : 'Unknown error'
230
+ });
231
+ }
232
+ }
233
+ // Submit message feedback
234
+ async submitFeedback(req, res) {
235
+ try {
236
+ const { message_uuid, user_uuid, rating, category, comment, suggested_improvement } = req.body;
237
+ if (!message_uuid || !user_uuid || !rating) {
238
+ res.status(400).json({ error: 'message_uuid, user_uuid, and rating are required' });
239
+ return;
240
+ }
241
+ // Get the message to find its conversationId
242
+ const message = await this.storage.getMessageById(message_uuid);
243
+ if (!message) {
244
+ res.status(404).json({ error: 'Message not found' });
245
+ return;
246
+ }
247
+ const feedback = await this.storage.saveFeedback({
248
+ messageId: message_uuid,
249
+ conversationId: message.conversationId, // Use the actual conversationId from the message
250
+ userId: user_uuid.toString(),
251
+ rating,
252
+ category,
253
+ comment,
254
+ suggestedImprovement: suggested_improvement,
255
+ createdAt: new Date()
256
+ });
257
+ res.json({
258
+ success: true,
259
+ feedback: {
260
+ uuid: feedback.id,
261
+ message_uuid: feedback.messageId,
262
+ user_uuid: feedback.userId,
263
+ rating: feedback.rating,
264
+ category: feedback.category,
265
+ comment: feedback.comment,
266
+ suggested_improvement: feedback.suggestedImprovement,
267
+ created_at: feedback.createdAt
268
+ }
269
+ });
270
+ }
271
+ catch (error) {
272
+ logger_1.default.error('Submit feedback error:', error);
273
+ res.status(500).json({
274
+ error: 'Failed to submit feedback',
275
+ message: error instanceof Error ? error.message : 'Unknown error'
276
+ });
277
+ }
278
+ }
279
+ }
280
+ exports.ChatController = ChatController;
281
+ //# sourceMappingURL=ChatController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatController.js","sourceRoot":"","sources":["../../../src/controllers/ChatController.ts"],"names":[],"mappings":";;;;;;AAGA,8DAAsC;AAEtC,MAAa,cAAc;IAIzB,YAAY,WAAwB,EAAE,OAAuB;QAC3D,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,4BAA4B;IAC5B,KAAK,CAAC,kBAAkB,CAAC,GAAY,EAAE,GAAa;QAClD,IAAI,CAAC;YACH,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;YAEpD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;gBACzD,OAAO;YACT,CAAC;YAED,mDAAmD;YACnD,MAAM,QAAQ,GAAG,QAAQ,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YAEjF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;gBACvD,QAAQ;gBACR,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE;gBAC5B,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE;gBACxC,KAAK,EAAE,KAAK,IAAI,kBAAkB;gBAClC,YAAY,EAAE,CAAC;gBACf,SAAS,EAAE,IAAI,IAAI,EAAE;gBACr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AC,QAAQ,EAAE;gBAC5B,MAAM;gBACN,QAAQ;gBACR,OAAO;gBACP,oBAAoB,EAAE,qBAAqB;gBAC3C,SAAS,EAAE,IAAI,IAAI,EAAE;aACtB,CAAC,CAAC;YAEH,GAAG,CAAC,IAAI,CAAC;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ,CAAC,EAAE;oBACjB,YAAY,EAAE,QAAQ,CAAC,SAAS;oBAChC,SAAS,EAAE,QAAQ,CAAC,MAAM;oBAC1B,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;oBAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;oBACzB,qBAAqB,EAAE,QAAQ,CAAC,oBAAoB;oBACpD,UAAU,EAAE,QAAQ,CAAC,SAAS;iBAC/B;aACF,CAAC,CAAC;QAEL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gBAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAC9C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,2BAA2B;gBAClC,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAClE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CAEF;AA1TD,wCA0TC"}
@@ -0,0 +1,13 @@
1
+ import { Request, Response } from 'express';
2
+ import { KnowledgeBaseService } from '../services/KnowledgeBaseService';
3
+ export declare class KnowledgeController {
4
+ private knowledgeBase;
5
+ constructor(knowledgeBase: KnowledgeBaseService);
6
+ createItem(req: Request, res: Response): Promise<void>;
7
+ getItem(req: Request, res: Response): Promise<void>;
8
+ listItems(req: Request, res: Response): Promise<void>;
9
+ updateItem(req: Request, res: Response): Promise<void>;
10
+ deleteItem(req: Request, res: Response): Promise<void>;
11
+ search(req: Request, res: Response): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=KnowledgeController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnowledgeController.d.ts","sourceRoot":"","sources":["../../../src/controllers/KnowledgeController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAGxE,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,aAAa,CAAuB;gBAEhC,aAAa,EAAE,oBAAoB;IAIzC,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAmEtD,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCnD,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAgDrD,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCtD,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBtD,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAqCzD"}