@solidstarters/solid-core 1.2.135 → 1.2.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/ai-interaction.controller.d.ts +3 -1
- package/dist/controllers/ai-interaction.controller.d.ts.map +1 -1
- package/dist/controllers/ai-interaction.controller.js +27 -3
- package/dist/controllers/ai-interaction.controller.js.map +1 -1
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts +43 -0
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts.map +1 -0
- package/dist/controllers/{question-sql-dataset-config.controller.js → dashboard-question-sql-dataset-config.controller.js} +30 -30
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.js.map +1 -0
- package/dist/controllers/dashboard-question.controller.d.ts +45 -0
- package/dist/controllers/dashboard-question.controller.d.ts.map +1 -0
- package/dist/controllers/{question.controller.js → dashboard-question.controller.js} +31 -31
- package/dist/controllers/dashboard-question.controller.js.map +1 -0
- package/dist/dtos/{create-question-sql-dataset-config.dto.d.ts → create-dashboard-question-sql-dataset-config.dto.d.ts} +2 -2
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts.map +1 -0
- package/dist/dtos/{create-question-sql-dataset-config.dto.js → create-dashboard-question-sql-dataset-config.dto.js} +13 -13
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js.map +1 -0
- package/dist/dtos/create-dashboard-question.dto.d.ts +17 -0
- package/dist/dtos/create-dashboard-question.dto.d.ts.map +1 -0
- package/dist/dtos/{create-question.dto.js → create-dashboard-question.dto.js} +25 -19
- package/dist/dtos/create-dashboard-question.dto.js.map +1 -0
- package/dist/dtos/create-dashboard.dto.d.ts +2 -2
- package/dist/dtos/create-dashboard.dto.d.ts.map +1 -1
- package/dist/dtos/create-dashboard.dto.js +3 -3
- package/dist/dtos/create-dashboard.dto.js.map +1 -1
- package/dist/dtos/{update-question-sql-dataset-config.dto.d.ts → update-dashboard-question-sql-dataset-config.dto.d.ts} +2 -2
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts.map +1 -0
- package/dist/dtos/{update-question-sql-dataset-config.dto.js → update-dashboard-question-sql-dataset-config.dto.js} +14 -14
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js.map +1 -0
- package/dist/dtos/update-dashboard-question.dto.d.ts +18 -0
- package/dist/dtos/update-dashboard-question.dto.d.ts.map +1 -0
- package/dist/dtos/{update-question.dto.js → update-dashboard-question.dto.js} +26 -20
- package/dist/dtos/update-dashboard-question.dto.js.map +1 -0
- package/dist/dtos/update-dashboard.dto.d.ts +2 -2
- package/dist/dtos/update-dashboard.dto.d.ts.map +1 -1
- package/dist/dtos/update-dashboard.dto.js +3 -3
- package/dist/dtos/update-dashboard.dto.js.map +1 -1
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts +13 -0
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +1 -0
- package/dist/entities/{question-sql-dataset-config.entity.js → dashboard-question-sql-dataset-config.entity.js} +19 -19
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +1 -0
- package/dist/entities/dashboard-question.entity.d.ts +16 -0
- package/dist/entities/dashboard-question.entity.d.ts.map +1 -0
- package/dist/entities/{question.entity.js → dashboard-question.entity.js} +23 -19
- package/dist/entities/dashboard-question.entity.js.map +1 -0
- package/dist/entities/dashboard.entity.d.ts +2 -2
- package/dist/entities/dashboard.entity.d.ts.map +1 -1
- package/dist/entities/dashboard.entity.js +3 -3
- package/dist/entities/dashboard.entity.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +21 -2
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.d.ts +11 -0
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.d.ts.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.js +39 -0
- package/dist/jobs/database/trigger-mcp-client-publisher-database.service.js.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.d.ts +8 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.d.ts.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.js +10 -0
- package/dist/jobs/database/trigger-mcp-client-queue-options.js.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts +16 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts.map +1 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js +91 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js.map +1 -0
- package/dist/repository/dashboard.repository.d.ts +1 -3
- package/dist/repository/dashboard.repository.d.ts.map +1 -1
- package/dist/repository/dashboard.repository.js +42 -37
- package/dist/repository/dashboard.repository.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +88 -131
- package/dist/services/ai-interaction.service.d.ts +13 -2
- package/dist/services/ai-interaction.service.d.ts.map +1 -1
- package/dist/services/ai-interaction.service.js +84 -19
- package/dist/services/ai-interaction.service.js.map +1 -1
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +8 -6
- package/dist/services/chatter-message.service.js.map +1 -1
- package/dist/services/{question-sql-dataset-config.service.d.ts → dashboard-question-sql-dataset-config.service.d.ts} +5 -5
- package/dist/services/dashboard-question-sql-dataset-config.service.d.ts.map +1 -0
- package/dist/services/{question-sql-dataset-config.service.js → dashboard-question-sql-dataset-config.service.js} +9 -9
- package/dist/services/dashboard-question-sql-dataset-config.service.js.map +1 -0
- package/dist/services/{question.service.d.ts → dashboard-question.service.d.ts} +5 -5
- package/dist/services/dashboard-question.service.d.ts.map +1 -0
- package/dist/services/{question.service.js → dashboard-question.service.js} +10 -10
- package/dist/services/dashboard-question.service.js.map +1 -0
- package/dist/services/field-metadata.service.d.ts.map +1 -1
- package/dist/services/field-metadata.service.js +1 -0
- package/dist/services/field-metadata.service.js.map +1 -1
- package/dist/services/import-transaction.service.d.ts +3 -1
- package/dist/services/import-transaction.service.d.ts.map +1 -1
- package/dist/services/import-transaction.service.js +22 -0
- package/dist/services/import-transaction.service.js.map +1 -1
- package/dist/services/list-of-values.service.d.ts +1 -0
- package/dist/services/list-of-values.service.d.ts.map +1 -1
- package/dist/services/list-of-values.service.js +3 -0
- package/dist/services/list-of-values.service.js.map +1 -1
- package/dist/services/mcp-tool-response-handlers/mcp-tool-response-handler-factory.service.d.ts +9 -0
- package/dist/services/mcp-tool-response-handlers/mcp-tool-response-handler-factory.service.d.ts.map +1 -0
- package/dist/services/mcp-tool-response-handlers/mcp-tool-response-handler-factory.service.js +40 -0
- package/dist/services/mcp-tool-response-handlers/mcp-tool-response-handler-factory.service.js.map +1 -0
- package/dist/services/mcp-tool-response-handlers/solid-create-module-mcp-tool-response-handler.service.d.ts +11 -0
- package/dist/services/mcp-tool-response-handlers/solid-create-module-mcp-tool-response-handler.service.d.ts.map +1 -0
- package/dist/services/mcp-tool-response-handlers/solid-create-module-mcp-tool-response-handler.service.js +46 -0
- package/dist/services/mcp-tool-response-handlers/solid-create-module-mcp-tool-response-handler.service.js.map +1 -0
- package/dist/services/module-metadata.service.d.ts.map +1 -1
- package/dist/services/module-metadata.service.js.map +1 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts +2 -2
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts.map +1 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js +11 -7
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js.map +1 -1
- package/dist/services/question-data-providers/helpers.d.ts +5 -2
- package/dist/services/question-data-providers/helpers.d.ts.map +1 -1
- package/dist/services/question-data-providers/helpers.js +18 -3
- package/dist/services/question-data-providers/helpers.js.map +1 -1
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts +2 -2
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts.map +1 -1
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js +10 -4
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js.map +1 -1
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts +2 -2
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts.map +1 -1
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js +11 -3
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js.map +1 -1
- package/dist/services/queues/publisher-factory.service.js +1 -1
- package/dist/services/queues/publisher-factory.service.js.map +1 -1
- package/dist/services/scheduled-jobs/scheduled-job.interface.d.ts +1 -1
- package/dist/services/scheduled-jobs/scheduled-job.interface.d.ts.map +1 -1
- package/dist/services/scheduled-jobs/scheduled-job.interface.js.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.service.js +1 -6
- package/dist/services/scheduled-jobs/scheduler.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +56 -39
- package/dist/solid-core.module.js.map +1 -1
- package/dist/subscribers/{question-sql-dataset-config.subscriber.d.ts → dashboard-question-sql-dataset-config.subscriber.d.ts} +6 -6
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts.map +1 -0
- package/dist/subscribers/{question-sql-dataset-config.subscriber.js → dashboard-question-sql-dataset-config.subscriber.js} +10 -10
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js.map +1 -0
- package/dist/subscribers/{question.subscriber.d.ts → dashboard-question.subscriber.d.ts} +7 -7
- package/dist/subscribers/dashboard-question.subscriber.d.ts.map +1 -0
- package/dist/subscribers/{question.subscriber.js → dashboard-question.subscriber.js} +8 -8
- package/dist/subscribers/dashboard-question.subscriber.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/controllers/ai-interaction.controller.ts +14 -2
- package/src/controllers/{question-sql-dataset-config.controller.ts → dashboard-question-sql-dataset-config.controller.ts} +10 -10
- package/src/controllers/{question.controller.ts → dashboard-question.controller.ts} +10 -10
- package/src/dtos/{create-question-sql-dataset-config.dto.ts → create-dashboard-question-sql-dataset-config.dto.ts} +1 -1
- package/src/dtos/{create-question.dto.ts → create-dashboard-question.dto.ts} +9 -4
- package/src/dtos/create-dashboard.dto.ts +3 -3
- package/src/dtos/{update-question-sql-dataset-config.dto.ts → update-dashboard-question-sql-dataset-config.dto.ts} +1 -1
- package/src/dtos/{update-question.dto.ts → update-dashboard-question.dto.ts} +9 -4
- package/src/dtos/update-dashboard.dto.ts +3 -3
- package/src/entities/{question-sql-dataset-config.entity.ts → dashboard-question-sql-dataset-config.entity.ts} +5 -5
- package/src/entities/{question.entity.ts → dashboard-question.entity.ts} +8 -5
- package/src/entities/dashboard.entity.ts +3 -3
- package/src/index.ts +7 -4
- package/src/interfaces.ts +24 -2
- package/src/jobs/database/trigger-mcp-client-publisher-database.service.ts +22 -0
- package/src/jobs/database/trigger-mcp-client-queue-options.ts +9 -0
- package/src/jobs/database/trigger-mcp-client-subscriber-database.service.ts +89 -0
- package/src/repository/dashboard.repository.ts +54 -53
- package/src/seeders/seed-data/solid-core-metadata.json +88 -131
- package/src/services/ai-interaction.service.ts +117 -33
- package/src/services/chatter-message.service.ts +12 -6
- package/src/services/{question-sql-dataset-config.service.ts → dashboard-question-sql-dataset-config.service.ts} +5 -5
- package/src/services/{question.service.ts → dashboard-question.service.ts} +6 -6
- package/src/services/field-metadata.service.ts +1 -0
- package/src/services/import-transaction.service.ts +29 -1
- package/src/services/list-of-values.service.ts +5 -0
- package/src/services/mcp-tool-response-handlers/mcp-tool-response-handler-factory.service.ts +36 -0
- package/src/services/mcp-tool-response-handlers/solid-create-module-mcp-tool-response-handler.service.ts +52 -0
- package/src/services/module-metadata.service.ts +0 -5
- package/src/services/question-data-providers/chartjs-sql-data-provider.service.ts +14 -10
- package/src/services/question-data-providers/helpers.ts +23 -4
- package/src/services/question-data-providers/prime-react-datatable-sql-data-provider.service.ts +12 -6
- package/src/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.ts +14 -5
- package/src/services/question-data-providers/test.sql +1 -0
- package/src/services/queues/publisher-factory.service.ts +1 -1
- package/src/services/scheduled-jobs/scheduled-job.interface.ts +1 -1
- package/src/services/scheduled-jobs/scheduler.service.ts +6 -6
- package/src/solid-core.module.ts +59 -39
- package/src/subscribers/{question-sql-dataset-config.subscriber.ts → dashboard-question-sql-dataset-config.subscriber.ts} +8 -10
- package/src/subscribers/{question.subscriber.ts → dashboard-question.subscriber.ts} +7 -10
- package/dist/controllers/question-sql-dataset-config.controller.d.ts +0 -43
- package/dist/controllers/question-sql-dataset-config.controller.d.ts.map +0 -1
- package/dist/controllers/question-sql-dataset-config.controller.js.map +0 -1
- package/dist/controllers/question.controller.d.ts +0 -45
- package/dist/controllers/question.controller.d.ts.map +0 -1
- package/dist/controllers/question.controller.js.map +0 -1
- package/dist/dtos/create-question-sql-dataset-config.dto.d.ts.map +0 -1
- package/dist/dtos/create-question-sql-dataset-config.dto.js.map +0 -1
- package/dist/dtos/create-question.dto.d.ts +0 -16
- package/dist/dtos/create-question.dto.d.ts.map +0 -1
- package/dist/dtos/create-question.dto.js.map +0 -1
- package/dist/dtos/update-question-sql-dataset-config.dto.d.ts.map +0 -1
- package/dist/dtos/update-question-sql-dataset-config.dto.js.map +0 -1
- package/dist/dtos/update-question.dto.d.ts +0 -17
- package/dist/dtos/update-question.dto.d.ts.map +0 -1
- package/dist/dtos/update-question.dto.js.map +0 -1
- package/dist/entities/question-sql-dataset-config.entity.d.ts +0 -13
- package/dist/entities/question-sql-dataset-config.entity.d.ts.map +0 -1
- package/dist/entities/question-sql-dataset-config.entity.js.map +0 -1
- package/dist/entities/question.entity.d.ts +0 -15
- package/dist/entities/question.entity.d.ts.map +0 -1
- package/dist/entities/question.entity.js.map +0 -1
- package/dist/services/question-sql-dataset-config.service.d.ts.map +0 -1
- package/dist/services/question-sql-dataset-config.service.js.map +0 -1
- package/dist/services/question.service.d.ts.map +0 -1
- package/dist/services/question.service.js.map +0 -1
- package/dist/subscribers/question-sql-dataset-config.subscriber.d.ts.map +0 -1
- package/dist/subscribers/question-sql-dataset-config.subscriber.js.map +0 -1
- package/dist/subscribers/question.subscriber.d.ts.map +0 -1
- package/dist/subscribers/question.subscriber.js.map +0 -1
- package/src/services/1. Create a context menu option i.py +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidstarters/solid-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.137",
|
|
4
4
|
"description": "This module is a NestJS module containing all the required core providers required by a Solid application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -91,8 +91,20 @@ export class AiInteractionController {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
@ApiBearerAuth("jwt")
|
|
94
|
-
@Post('/
|
|
95
|
-
async
|
|
94
|
+
@Post('/trigger-mcp-client-job')
|
|
95
|
+
async triggerMcpClientJob(@Body() dto: InvokeAiPromptDto) {
|
|
96
|
+
return this.service.triggerMcpClientJob(dto.prompt);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@ApiBearerAuth("jwt")
|
|
100
|
+
@Post(':id/apply-solid-ai-interaction')
|
|
101
|
+
async applySolidAiInteraction(@Param('id') id: number) {
|
|
102
|
+
return this.service.applySolidAiInteraction(+id);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@ApiBearerAuth("jwt")
|
|
106
|
+
@Post('/run-mcp-prompt')
|
|
107
|
+
async runMcpPrompt(@Body() dto: InvokeAiPromptDto) {
|
|
96
108
|
return this.service.runMcpPrompt(dto.prompt);
|
|
97
109
|
}
|
|
98
110
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch } from '@nestjs/common';
|
|
2
2
|
import { AnyFilesInterceptor } from "@nestjs/platform-express";
|
|
3
3
|
import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { DashboardQuestionSqlDatasetConfigService } from '../services/dashboard-question-sql-dataset-config.service';
|
|
5
|
+
import { CreateDashboardQuestionSqlDatasetConfigDto } from '../dtos/create-dashboard-question-sql-dataset-config.dto';
|
|
6
|
+
import { UpdateDashboardQuestionSqlDatasetConfigDto } from '../dtos/update-dashboard-question-sql-dataset-config.dto';
|
|
7
7
|
|
|
8
8
|
enum ShowSoftDeleted {
|
|
9
9
|
INCLUSIVE = "inclusive",
|
|
@@ -11,21 +11,21 @@ enum ShowSoftDeleted {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@ApiTags('Solid Core')
|
|
14
|
-
@Controller('question-sql-dataset-config')
|
|
15
|
-
export class
|
|
16
|
-
constructor(private readonly service:
|
|
14
|
+
@Controller('dashboard-question-sql-dataset-config')
|
|
15
|
+
export class DashboardQuestionSqlDatasetConfigController {
|
|
16
|
+
constructor(private readonly service: DashboardQuestionSqlDatasetConfigService) {}
|
|
17
17
|
|
|
18
18
|
@ApiBearerAuth("jwt")
|
|
19
19
|
@Post()
|
|
20
20
|
@UseInterceptors(AnyFilesInterceptor())
|
|
21
|
-
create(@Body() createDto:
|
|
21
|
+
create(@Body() createDto: CreateDashboardQuestionSqlDatasetConfigDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
22
22
|
return this.service.create(createDto, files);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@ApiBearerAuth("jwt")
|
|
26
26
|
@Post('/bulk')
|
|
27
27
|
@UseInterceptors(AnyFilesInterceptor())
|
|
28
|
-
insertMany(@Body() createDtos:
|
|
28
|
+
insertMany(@Body() createDtos: CreateDashboardQuestionSqlDatasetConfigDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {
|
|
29
29
|
return this.service.insertMany(createDtos, filesArray);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -33,14 +33,14 @@ export class QuestionSqlDatasetConfigController {
|
|
|
33
33
|
@ApiBearerAuth("jwt")
|
|
34
34
|
@Put(':id')
|
|
35
35
|
@UseInterceptors(AnyFilesInterceptor())
|
|
36
|
-
update(@Param('id') id: number, @Body() updateDto:
|
|
36
|
+
update(@Param('id') id: number, @Body() updateDto: UpdateDashboardQuestionSqlDatasetConfigDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
37
37
|
return this.service.update(id, updateDto, files);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@ApiBearerAuth("jwt")
|
|
41
41
|
@Patch(':id')
|
|
42
42
|
@UseInterceptors(AnyFilesInterceptor())
|
|
43
|
-
partialUpdate(@Param('id') id: number, @Body() updateDto:
|
|
43
|
+
partialUpdate(@Param('id') id: number, @Body() updateDto: UpdateDashboardQuestionSqlDatasetConfigDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
44
44
|
return this.service.update(id, updateDto, files, true);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch } from '@nestjs/common';
|
|
2
2
|
import { AnyFilesInterceptor } from "@nestjs/platform-express";
|
|
3
3
|
import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { DashboardQuestionService } from '../services/dashboard-question.service';
|
|
5
|
+
import { CreateDashboardQuestionDto } from '../dtos/create-dashboard-question.dto';
|
|
6
|
+
import { UpdateDashboardQuestionDto } from '../dtos/update-dashboard-question.dto';
|
|
7
7
|
import { SqlExpression } from 'src/services/question-data-providers/chartjs-sql-data-provider.service';
|
|
8
8
|
|
|
9
9
|
enum ShowSoftDeleted {
|
|
@@ -12,21 +12,21 @@ enum ShowSoftDeleted {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
@ApiTags('Solid Core')
|
|
15
|
-
@Controller('question')
|
|
16
|
-
export class
|
|
17
|
-
constructor(private readonly service:
|
|
15
|
+
@Controller('dashboard-question')
|
|
16
|
+
export class DashboardQuestionController {
|
|
17
|
+
constructor(private readonly service: DashboardQuestionService) { }
|
|
18
18
|
|
|
19
19
|
@ApiBearerAuth("jwt")
|
|
20
20
|
@Post()
|
|
21
21
|
@UseInterceptors(AnyFilesInterceptor())
|
|
22
|
-
create(@Body() createDto:
|
|
22
|
+
create(@Body() createDto: CreateDashboardQuestionDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
23
23
|
return this.service.create(createDto, files);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@ApiBearerAuth("jwt")
|
|
27
27
|
@Post('/bulk')
|
|
28
28
|
@UseInterceptors(AnyFilesInterceptor())
|
|
29
|
-
insertMany(@Body() createDtos:
|
|
29
|
+
insertMany(@Body() createDtos: CreateDashboardQuestionDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {
|
|
30
30
|
return this.service.insertMany(createDtos, filesArray);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -34,14 +34,14 @@ export class QuestionController {
|
|
|
34
34
|
@ApiBearerAuth("jwt")
|
|
35
35
|
@Put(':id')
|
|
36
36
|
@UseInterceptors(AnyFilesInterceptor())
|
|
37
|
-
update(@Param('id') id: number, @Body() updateDto:
|
|
37
|
+
update(@Param('id') id: number, @Body() updateDto: UpdateDashboardQuestionDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
38
38
|
return this.service.update(id, updateDto, files);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@ApiBearerAuth("jwt")
|
|
42
42
|
@Patch(':id')
|
|
43
43
|
@UseInterceptors(AnyFilesInterceptor())
|
|
44
|
-
partialUpdate(@Param('id') id: number, @Body() updateDto:
|
|
44
|
+
partialUpdate(@Param('id') id: number, @Body() updateDto: UpdateDashboardQuestionDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
45
45
|
return this.service.update(id, updateDto, files, true);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
|
|
|
2
2
|
import { IsString } from 'class-validator';
|
|
3
3
|
import { IsNotEmpty, IsOptional, IsInt, IsJSON } from 'class-validator';
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class CreateDashboardQuestionSqlDatasetConfigDto {
|
|
6
6
|
@IsNotEmpty()
|
|
7
7
|
@IsString()
|
|
8
8
|
@ApiProperty()
|
|
@@ -2,9 +2,9 @@ import { ApiProperty } from '@nestjs/swagger';
|
|
|
2
2
|
import { IsString } from 'class-validator';
|
|
3
3
|
import { IsNotEmpty, IsOptional, IsJSON, IsInt, ValidateNested, IsArray } from 'class-validator';
|
|
4
4
|
import { Type } from 'class-transformer';
|
|
5
|
-
import {
|
|
5
|
+
import { UpdateDashboardQuestionSqlDatasetConfigDto } from 'src/dtos/update-dashboard-question-sql-dataset-config.dto';
|
|
6
6
|
|
|
7
|
-
export class
|
|
7
|
+
export class CreateDashboardQuestionDto {
|
|
8
8
|
@IsNotEmpty()
|
|
9
9
|
@IsString()
|
|
10
10
|
@ApiProperty()
|
|
@@ -33,8 +33,8 @@ export class CreateQuestionDto {
|
|
|
33
33
|
@ApiProperty({ description: "Related Question SQL Dataset Config Model" })
|
|
34
34
|
@IsArray()
|
|
35
35
|
@ValidateNested({ each: true })
|
|
36
|
-
@Type(() =>
|
|
37
|
-
questionSqlDatasetConfigs:
|
|
36
|
+
@Type(() => UpdateDashboardQuestionSqlDatasetConfigDto)
|
|
37
|
+
questionSqlDatasetConfigs: UpdateDashboardQuestionSqlDatasetConfigDto[];
|
|
38
38
|
@IsOptional()
|
|
39
39
|
@IsArray()
|
|
40
40
|
@ApiProperty({ description: "Related Question SQL Dataset Config Model" })
|
|
@@ -55,4 +55,9 @@ export class CreateQuestionDto {
|
|
|
55
55
|
@IsString()
|
|
56
56
|
@ApiProperty({ description: "This is the SQL query to fetch the KPI value for the question" })
|
|
57
57
|
kpiSql: string;
|
|
58
|
+
|
|
59
|
+
@IsOptional()
|
|
60
|
+
@IsInt()
|
|
61
|
+
@ApiProperty()
|
|
62
|
+
sequenceNumber: number;
|
|
58
63
|
}
|
|
@@ -3,7 +3,7 @@ import { IsString } from 'class-validator';
|
|
|
3
3
|
import { IsNotEmpty, ValidateNested, IsArray, IsOptional, IsJSON, IsInt } from 'class-validator';
|
|
4
4
|
import { Type } from 'class-transformer';
|
|
5
5
|
import { UpdateDashboardVariableDto } from 'src/dtos/update-dashboard-variable.dto';
|
|
6
|
-
import {
|
|
6
|
+
import { UpdateDashboardQuestionDto } from 'src/dtos/update-dashboard-question.dto';
|
|
7
7
|
|
|
8
8
|
export class CreateDashboardDto {
|
|
9
9
|
@IsNotEmpty()
|
|
@@ -32,8 +32,8 @@ export class CreateDashboardDto {
|
|
|
32
32
|
@ApiProperty()
|
|
33
33
|
@IsArray()
|
|
34
34
|
@ValidateNested({ each: true })
|
|
35
|
-
@Type(() =>
|
|
36
|
-
questions:
|
|
35
|
+
@Type(() => UpdateDashboardQuestionDto)
|
|
36
|
+
questions: UpdateDashboardQuestionDto[];
|
|
37
37
|
@IsOptional()
|
|
38
38
|
@IsArray()
|
|
39
39
|
@ApiProperty()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IsInt, IsOptional, IsString, IsNotEmpty, IsJSON } from 'class-validator';
|
|
2
2
|
import { ApiProperty } from '@nestjs/swagger';
|
|
3
3
|
|
|
4
|
-
export class
|
|
4
|
+
export class UpdateDashboardQuestionSqlDatasetConfigDto {
|
|
5
5
|
@IsOptional()
|
|
6
6
|
@IsInt()
|
|
7
7
|
id: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IsInt,IsOptional, IsString, IsNotEmpty, IsJSON, ValidateNested, IsArray } from 'class-validator';
|
|
2
2
|
import { ApiProperty } from '@nestjs/swagger';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
|
-
import {
|
|
4
|
+
import { UpdateDashboardQuestionSqlDatasetConfigDto } from 'src/dtos/update-dashboard-question-sql-dataset-config.dto';
|
|
5
5
|
|
|
6
|
-
export class
|
|
6
|
+
export class UpdateDashboardQuestionDto {
|
|
7
7
|
@IsOptional()
|
|
8
8
|
@IsInt()
|
|
9
9
|
id: number;
|
|
@@ -38,8 +38,8 @@ export class UpdateQuestionDto {
|
|
|
38
38
|
@ApiProperty({ description: "Related Question SQL Dataset Config Model" })
|
|
39
39
|
@IsArray()
|
|
40
40
|
@ValidateNested({ each: true })
|
|
41
|
-
@Type(() =>
|
|
42
|
-
questionSqlDatasetConfigs:
|
|
41
|
+
@Type(() => UpdateDashboardQuestionSqlDatasetConfigDto)
|
|
42
|
+
questionSqlDatasetConfigs: UpdateDashboardQuestionSqlDatasetConfigDto[];
|
|
43
43
|
@IsOptional()
|
|
44
44
|
@IsArray()
|
|
45
45
|
@ApiProperty({ description: "Related Question SQL Dataset Config Model" })
|
|
@@ -60,4 +60,9 @@ export class UpdateQuestionDto {
|
|
|
60
60
|
@IsString()
|
|
61
61
|
@ApiProperty({ description: "This is the SQL query to fetch the KPI value for the question" })
|
|
62
62
|
kpiSql: string;
|
|
63
|
+
|
|
64
|
+
@IsOptional()
|
|
65
|
+
@IsInt()
|
|
66
|
+
@ApiProperty()
|
|
67
|
+
sequenceNumber: number;
|
|
63
68
|
}
|
|
@@ -2,7 +2,7 @@ import { IsInt,IsOptional, IsString, IsNotEmpty, ValidateNested, IsArray, IsJSON
|
|
|
2
2
|
import { ApiProperty } from '@nestjs/swagger';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
4
|
import { UpdateDashboardVariableDto } from 'src/dtos/update-dashboard-variable.dto';
|
|
5
|
-
import {
|
|
5
|
+
import { UpdateDashboardQuestionDto } from 'src/dtos/update-dashboard-question.dto';
|
|
6
6
|
|
|
7
7
|
export class UpdateDashboardDto {
|
|
8
8
|
@IsOptional()
|
|
@@ -36,8 +36,8 @@ export class UpdateDashboardDto {
|
|
|
36
36
|
@ApiProperty()
|
|
37
37
|
@IsArray()
|
|
38
38
|
@ValidateNested({ each: true })
|
|
39
|
-
@Type(() =>
|
|
40
|
-
questions:
|
|
39
|
+
@Type(() => UpdateDashboardQuestionDto)
|
|
40
|
+
questions: UpdateDashboardQuestionDto[];
|
|
41
41
|
@IsOptional()
|
|
42
42
|
@IsArray()
|
|
43
43
|
@ApiProperty()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
2
|
import { Entity, Column, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
3
|
-
import {
|
|
3
|
+
import { DashboardQuestion } from 'src/entities/dashboard-question.entity'
|
|
4
4
|
|
|
5
|
-
@Entity("
|
|
6
|
-
export class
|
|
5
|
+
@Entity("ss_dashboard_question_sql_dataset_config")
|
|
6
|
+
export class DashboardQuestionSqlDatasetConfig extends CommonEntity {
|
|
7
7
|
@Index({ unique: true })
|
|
8
8
|
@Column({ type: "varchar" })
|
|
9
9
|
datasetName: string;
|
|
@@ -17,9 +17,9 @@ export class QuestionSqlDatasetConfig extends CommonEntity {
|
|
|
17
17
|
labelColumnName: string;
|
|
18
18
|
@Column({ type: "varchar" })
|
|
19
19
|
valueColumnName: string;
|
|
20
|
-
@ManyToOne(() =>
|
|
20
|
+
@ManyToOne(() => DashboardQuestion, { onDelete: "CASCADE", nullable: false })
|
|
21
21
|
@JoinColumn()
|
|
22
|
-
question:
|
|
22
|
+
question: DashboardQuestion;
|
|
23
23
|
@Column({ type: "text", nullable: true })
|
|
24
24
|
options: any;
|
|
25
25
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
2
|
import { Entity, Column, Index, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
|
|
3
3
|
import { Dashboard } from 'src/entities/dashboard.entity';
|
|
4
|
-
import {
|
|
4
|
+
import { DashboardQuestionSqlDatasetConfig } from 'src/entities/dashboard-question-sql-dataset-config.entity'
|
|
5
5
|
|
|
6
|
-
@Entity("
|
|
7
|
-
export class
|
|
6
|
+
@Entity("ss_dashboard_question")
|
|
7
|
+
export class DashboardQuestion extends CommonEntity {
|
|
8
8
|
@Index({ unique: true })
|
|
9
9
|
@Column({ type: "varchar" })
|
|
10
10
|
name: string;
|
|
@@ -19,12 +19,15 @@ export class Question extends CommonEntity {
|
|
|
19
19
|
@ManyToOne(() => Dashboard, { onDelete: "CASCADE", nullable: true })
|
|
20
20
|
@JoinColumn()
|
|
21
21
|
dashboard: Dashboard;
|
|
22
|
-
@OneToMany(() =>
|
|
23
|
-
questionSqlDatasetConfigs:
|
|
22
|
+
@OneToMany(() => DashboardQuestionSqlDatasetConfig, dashboardQuestionSqlDatasetConfig => dashboardQuestionSqlDatasetConfig.question, { cascade: true })
|
|
23
|
+
questionSqlDatasetConfigs: DashboardQuestionSqlDatasetConfig[];
|
|
24
24
|
@Column({ type: "jsonb", nullable: true })
|
|
25
25
|
chartOptions: any;
|
|
26
26
|
@Column({ type: "text", nullable: true })
|
|
27
27
|
labelSql: string;
|
|
28
28
|
@Column({ type: "text", nullable: true })
|
|
29
29
|
kpiSql: string;
|
|
30
|
+
|
|
31
|
+
@Column({ type: "integer", nullable: true })
|
|
32
|
+
sequenceNumber: number;
|
|
30
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
2
|
import { Entity, Column, Index, OneToMany, JoinColumn, ManyToOne } from 'typeorm';
|
|
3
3
|
import { DashboardVariable } from 'src/entities/dashboard-variable.entity';
|
|
4
|
-
import {
|
|
4
|
+
import { DashboardQuestion } from 'src/entities/dashboard-question.entity';
|
|
5
5
|
import { ModuleMetadata } from 'src/entities/module-metadata.entity'
|
|
6
6
|
|
|
7
7
|
@Entity("ss_dashboard")
|
|
@@ -13,8 +13,8 @@ export class Dashboard extends CommonEntity {
|
|
|
13
13
|
layoutJson: any;
|
|
14
14
|
@OneToMany(() => DashboardVariable, dashboardVariable => dashboardVariable.dashboard, { cascade: true })
|
|
15
15
|
dashboardVariables: DashboardVariable[];
|
|
16
|
-
@OneToMany(() =>
|
|
17
|
-
questions:
|
|
16
|
+
@OneToMany(() => DashboardQuestion, dashboardQuestion => dashboardQuestion.dashboard, { cascade: true })
|
|
17
|
+
questions: DashboardQuestion[];
|
|
18
18
|
@ManyToOne(() => ModuleMetadata, { onDelete: "CASCADE", nullable: false })
|
|
19
19
|
@JoinColumn()
|
|
20
20
|
module: ModuleMetadata;
|
package/src/index.ts
CHANGED
|
@@ -127,8 +127,8 @@ export * from './entities/locale.entity'
|
|
|
127
127
|
export * from './entities/user-activity-history.entity'
|
|
128
128
|
export * from './entities/dashboard.entity'
|
|
129
129
|
export * from './entities/dashboard-variable.entity'
|
|
130
|
-
export * from './entities/question.entity'
|
|
131
|
-
export * from './entities/question-sql-dataset-config.entity'
|
|
130
|
+
export * from './entities/dashboard-question.entity'
|
|
131
|
+
export * from './entities/dashboard-question-sql-dataset-config.entity'
|
|
132
132
|
export * from './entities/ai-interaction.entity'
|
|
133
133
|
|
|
134
134
|
export * from './enums/auth-type.enum'
|
|
@@ -164,7 +164,7 @@ export * from './helpers/field-crud-managers/SelectionDynamicFieldCrudManager' /
|
|
|
164
164
|
export * from './helpers/field-crud-managers/SelectionStaticFieldCrudManager' //rename
|
|
165
165
|
export * from './helpers/field-crud-managers/ShortTextFieldCrudManager' //rename
|
|
166
166
|
export * from './helpers/field-crud-managers/UUIDFieldCrudManager' //rename
|
|
167
|
-
|
|
167
|
+
export * from './services/crud.service'
|
|
168
168
|
export * from './interceptors/logging.interceptor'
|
|
169
169
|
export * from './interceptors/wrap-response.interceptor'
|
|
170
170
|
|
|
@@ -253,7 +253,10 @@ export * from './services/chatter-message.service'
|
|
|
253
253
|
export * from './services/chatter-message-details.service'
|
|
254
254
|
export * from './services/locale.service'
|
|
255
255
|
export * from './services/user-activity-history.service'
|
|
256
|
-
|
|
256
|
+
export * from './services/import-transaction.service'
|
|
257
|
+
export * from './services/import-transaction-error-log.service'
|
|
258
|
+
export * from './services/excel.service'
|
|
259
|
+
export * from './services/csv.service'
|
|
257
260
|
// Repositories
|
|
258
261
|
export * from './repository/solid-base.repository'
|
|
259
262
|
export * from './repository/security-rule.repository'
|
package/src/interfaces.ts
CHANGED
|
@@ -9,10 +9,11 @@ import { CreateRoleMetadataDto } from './dtos/create-role-metadata.dto';
|
|
|
9
9
|
import { CreateSecurityRuleDto } from './dtos/create-security-rule.dto';
|
|
10
10
|
import { FieldMetadata } from './entities/field-metadata.entity';
|
|
11
11
|
import { Media } from './entities/media.entity';
|
|
12
|
-
import {
|
|
12
|
+
import { DashboardQuestion } from './entities/dashboard-question.entity';
|
|
13
13
|
import { ComputedFieldMetadata } from './helpers/solid-registry';
|
|
14
14
|
import { SqlExpression } from './services/question-data-providers/chartjs-sql-data-provider.service';
|
|
15
15
|
import { CreateDashboardDto } from './dtos/create-dashboard.dto';
|
|
16
|
+
import { AiInteraction } from './entities/ai-interaction.entity';
|
|
16
17
|
|
|
17
18
|
export interface FieldCrudManager {
|
|
18
19
|
// fieldMetadata: FieldMetadata;
|
|
@@ -63,6 +64,23 @@ export interface CodeGenerationOptions {
|
|
|
63
64
|
dryRun?: boolean;
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
export interface TriggerMcpClientOptions {
|
|
68
|
+
aiInteractionId: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface McpResponse {
|
|
72
|
+
success: boolean;
|
|
73
|
+
request: string;
|
|
74
|
+
response: string;
|
|
75
|
+
model?: string;
|
|
76
|
+
tools_invoked?: string[];
|
|
77
|
+
tool_calls?: any[];
|
|
78
|
+
duration_ms?: number;
|
|
79
|
+
errors?: string[];
|
|
80
|
+
trace?: string[];
|
|
81
|
+
content_type?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
66
84
|
export interface ISelectionProviderContext {
|
|
67
85
|
// query: string;
|
|
68
86
|
}
|
|
@@ -85,12 +103,16 @@ export interface ISelectionProvider<T extends ISelectionProviderContext> {
|
|
|
85
103
|
export interface IDashboardVariableSelectionProvider<T extends ISelectionProviderContext> extends ISelectionProvider<T> {
|
|
86
104
|
}
|
|
87
105
|
|
|
106
|
+
export interface IMcpToolResponseHandler {
|
|
107
|
+
apply(aiInteraction: AiInteraction);
|
|
108
|
+
}
|
|
109
|
+
|
|
88
110
|
export interface IDashboardQuestionDataProvider<TContext, TData> {
|
|
89
111
|
help(): string;
|
|
90
112
|
|
|
91
113
|
name(): string;
|
|
92
114
|
|
|
93
|
-
getData(question:
|
|
115
|
+
getData(question: DashboardQuestion, expressions?: SqlExpression[], ctxt?: TContext): Promise<TData[] | TData>;
|
|
94
116
|
}
|
|
95
117
|
|
|
96
118
|
/**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Injectable } from "@nestjs/common";
|
|
2
|
+
import { QueuesModuleOptions, TriggerMcpClientOptions } from "src/interfaces";
|
|
3
|
+
import { MqMessageQueueService } from "src/services/mq-message-queue.service";
|
|
4
|
+
import { MqMessageService } from "src/services/mq-message.service";
|
|
5
|
+
import { DatabasePublisher } from "src/services/queues/database-publisher.service";
|
|
6
|
+
import triggerMcpClientQueueOptions from "./trigger-mcp-client-queue-options";
|
|
7
|
+
|
|
8
|
+
@Injectable()
|
|
9
|
+
export class TriggerMcpClientPublisherDatabase extends DatabasePublisher<TriggerMcpClientOptions> {
|
|
10
|
+
constructor(
|
|
11
|
+
protected readonly mqMessageService: MqMessageService,
|
|
12
|
+
protected readonly mqMessageQueueService: MqMessageQueueService,
|
|
13
|
+
) {
|
|
14
|
+
super(mqMessageService, mqMessageQueueService);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
options(): QueuesModuleOptions {
|
|
18
|
+
return {
|
|
19
|
+
...triggerMcpClientQueueOptions
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { QueueMessage } from 'src/interfaces/mq';
|
|
4
|
+
import { MqMessageService } from '../../services/mq-message.service';
|
|
5
|
+
import { MqMessageQueueService } from '../../services/mq-message-queue.service';
|
|
6
|
+
import { QueuesModuleOptions, TriggerMcpClientOptions } from "../../interfaces";
|
|
7
|
+
import { DatabaseSubscriber } from 'src/services/queues/database-subscriber.service';
|
|
8
|
+
import triggerMcpClientQueueOptions from "./trigger-mcp-client-queue-options";
|
|
9
|
+
import { AiInteractionService } from 'src/services/ai-interaction.service';
|
|
10
|
+
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class TriggerMcpClientSubscriberDatabase extends DatabaseSubscriber<TriggerMcpClientOptions> {
|
|
13
|
+
private readonly triggerMcpClientSubscriberLogger = new Logger(TriggerMcpClientSubscriberDatabase.name);
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
readonly mqMessageService: MqMessageService,
|
|
17
|
+
readonly mqMessageQueueService: MqMessageQueueService,
|
|
18
|
+
readonly aiInteractionService: AiInteractionService,
|
|
19
|
+
) {
|
|
20
|
+
super(mqMessageService, mqMessageQueueService);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
options(): QueuesModuleOptions {
|
|
24
|
+
return {
|
|
25
|
+
...triggerMcpClientQueueOptions
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async subscribe(message: QueueMessage<TriggerMcpClientOptions>) {
|
|
30
|
+
this.triggerMcpClientSubscriberLogger.debug(`Received message: ${JSON.stringify(message)}`);
|
|
31
|
+
|
|
32
|
+
const codeGnerationOptions = message.payload;
|
|
33
|
+
|
|
34
|
+
const aiInteraction = await this.aiInteractionService.findOne(codeGnerationOptions.aiInteractionId, {
|
|
35
|
+
populate: ['user']
|
|
36
|
+
});
|
|
37
|
+
if (!aiInteraction) {
|
|
38
|
+
const m = `Unable to identified the aiInteraction entry that triggered this job... using id: ${codeGnerationOptions.aiInteractionId}`
|
|
39
|
+
this.triggerMcpClientSubscriberLogger.log(m);
|
|
40
|
+
throw new Error(m);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The message contains the users prompt.
|
|
44
|
+
const prompt = aiInteraction.message;
|
|
45
|
+
|
|
46
|
+
// Use this to invoke our mcp client
|
|
47
|
+
const aiResponse = await this.aiInteractionService.runMcpPrompt(prompt);
|
|
48
|
+
this.triggerMcpClientSubscriberLogger.log(`aiResponse: `);
|
|
49
|
+
this.triggerMcpClientSubscriberLogger.log(JSON.stringify(aiResponse));
|
|
50
|
+
|
|
51
|
+
if (!aiResponse.success) {
|
|
52
|
+
this.triggerMcpClientSubscriberLogger.log(`Gen ai has returned with a false status code`);
|
|
53
|
+
|
|
54
|
+
const errorsStr = aiResponse.errors.join('; ');
|
|
55
|
+
|
|
56
|
+
await this.aiInteractionService.create({
|
|
57
|
+
userId: aiInteraction.user.id,
|
|
58
|
+
threadId: aiInteraction.threadId,
|
|
59
|
+
role: 'gen-ai',
|
|
60
|
+
message: '-',
|
|
61
|
+
contentType: aiResponse.content_type,
|
|
62
|
+
errorMessage: errorsStr,
|
|
63
|
+
modelUsed: aiResponse.model,
|
|
64
|
+
responseTimeMs: aiResponse.duration_ms,
|
|
65
|
+
metadata: JSON.stringify(aiResponse)
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// update the job entry with failure... raising an error will lead the job to be marked as failed...
|
|
69
|
+
throw new Error(errorsStr);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
let nestedResponse = aiResponse.response.trim();
|
|
73
|
+
|
|
74
|
+
await this.aiInteractionService.create({
|
|
75
|
+
userId: aiInteraction.user.id,
|
|
76
|
+
threadId: aiInteraction.threadId,
|
|
77
|
+
role: 'gen-ai',
|
|
78
|
+
message: nestedResponse,
|
|
79
|
+
contentType: aiResponse.content_type,
|
|
80
|
+
errorMessage: '',
|
|
81
|
+
modelUsed: aiResponse.model,
|
|
82
|
+
responseTimeMs: aiResponse.duration_ms,
|
|
83
|
+
metadata: JSON.stringify(aiResponse)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return aiResponse;
|
|
88
|
+
}
|
|
89
|
+
}
|