@solidxai/core 0.1.5-beta.2 → 0.1.5-beta.3
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/commands/info.command.d.ts +3 -1
- package/dist/commands/info.command.d.ts.map +1 -1
- package/dist/commands/info.command.js +6 -2
- package/dist/commands/info.command.js.map +1 -1
- package/dist/controllers/info.controller.d.ts +7 -0
- package/dist/controllers/info.controller.d.ts.map +1 -0
- package/dist/controllers/info.controller.js +39 -0
- package/dist/controllers/info.controller.js.map +1 -0
- package/dist/entities/ai-interaction.entity.d.ts.map +1 -1
- package/dist/entities/ai-interaction.entity.js +1 -1
- package/dist/entities/ai-interaction.entity.js.map +1 -1
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +1 -1
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +1 -1
- package/dist/entities/dashboard-question.entity.d.ts.map +1 -1
- package/dist/entities/dashboard-question.entity.js.map +1 -1
- package/dist/entities/dashboard-variable.entity.d.ts.map +1 -1
- package/dist/entities/dashboard-variable.entity.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +1 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +1 -1
- package/dist/services/info.service.d.ts +18 -0
- package/dist/services/info.service.d.ts.map +1 -0
- package/dist/services/info.service.js +96 -0
- package/dist/services/info.service.js.map +1 -0
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js +6 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +4 -0
- package/dist/solid-core.module.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/info.command.ts +3 -0
- package/src/controllers/info.controller.ts +15 -0
- package/src/entities/ai-interaction.entity.ts +17 -2
- package/src/entities/dashboard-question-sql-dataset-config.entity.ts +9 -1
- package/src/entities/dashboard-question.entity.ts +10 -0
- package/src/entities/dashboard-variable.entity.ts +9 -0
- package/src/index.ts +2 -0
- package/src/interfaces.ts +1 -0
- package/src/seeders/seed-data/solid-core-metadata.json +1 -1
- package/src/services/info.service.ts +60 -0
- package/src/services/queues/rabbitmq-subscriber.service.ts +7 -1
- package/src/solid-core.module.ts +4 -0
|
@@ -4,6 +4,7 @@ import { ISolidDatabaseModule } from 'src/interfaces';
|
|
|
4
4
|
import { getDynamicModuleNames } from 'src/helpers/module.helper';
|
|
5
5
|
import { SolidRegistry } from 'src/helpers/solid-registry';
|
|
6
6
|
import { SettingService } from 'src/services/setting.service';
|
|
7
|
+
import { InfoService } from 'src/services/info.service';
|
|
7
8
|
|
|
8
9
|
interface InfoCommandOptions {
|
|
9
10
|
detailed?: boolean;
|
|
@@ -16,6 +17,7 @@ export class InfoCommand extends CommandRunner {
|
|
|
16
17
|
constructor(
|
|
17
18
|
private readonly solidRegistry: SolidRegistry,
|
|
18
19
|
private readonly settingService: SettingService,
|
|
20
|
+
private readonly infoService: InfoService,
|
|
19
21
|
) {
|
|
20
22
|
super();
|
|
21
23
|
}
|
|
@@ -25,6 +27,7 @@ export class InfoCommand extends CommandRunner {
|
|
|
25
27
|
const dataSources = this.getDataSources();
|
|
26
28
|
|
|
27
29
|
const output: Record<string, any> = {
|
|
30
|
+
packages: this.infoService.getPackageVersions(),
|
|
28
31
|
modules: {
|
|
29
32
|
count: enabledModules.length,
|
|
30
33
|
names: enabledModules,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Controller, Get } from '@nestjs/common';
|
|
2
|
+
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
|
3
|
+
import { InfoService } from '../services/info.service';
|
|
4
|
+
|
|
5
|
+
@ApiTags('Solid Core')
|
|
6
|
+
@ApiBearerAuth('jwt')
|
|
7
|
+
@Controller('info')
|
|
8
|
+
export class InfoController {
|
|
9
|
+
constructor(private readonly infoService: InfoService) {}
|
|
10
|
+
|
|
11
|
+
@Get('/versions')
|
|
12
|
+
getVersions() {
|
|
13
|
+
return this.infoService.getPackageVersions();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -5,38 +5,51 @@ import { User } from 'src/entities/user.entity'
|
|
|
5
5
|
@Entity("ss_ai_interactions")
|
|
6
6
|
export class AiInteraction extends CommonEntity {
|
|
7
7
|
@Index()
|
|
8
|
-
@ManyToOne(() => User, { nullable:
|
|
8
|
+
@ManyToOne(() => User, { nullable: true })
|
|
9
9
|
@JoinColumn()
|
|
10
10
|
user: User;
|
|
11
|
+
|
|
11
12
|
@Index()
|
|
12
13
|
@Column({ type: "varchar" })
|
|
13
14
|
threadId: string;
|
|
15
|
+
|
|
14
16
|
@Column({ type: "varchar" })
|
|
15
17
|
role: string;
|
|
18
|
+
|
|
16
19
|
@Column({ type: "text" })
|
|
17
20
|
message: string;
|
|
21
|
+
|
|
18
22
|
@Column({ type: "varchar", nullable: true })
|
|
19
23
|
contentType: string;
|
|
24
|
+
|
|
20
25
|
@Index()
|
|
21
26
|
@Column({ type: "varchar", nullable: true })
|
|
22
27
|
status: string;
|
|
28
|
+
|
|
23
29
|
@Column({ type: "text", nullable: true })
|
|
24
30
|
errorMessage: string;
|
|
31
|
+
|
|
25
32
|
@Column({ type: "varchar", nullable: true })
|
|
26
33
|
modelUsed: string;
|
|
34
|
+
|
|
27
35
|
@Column({ type: "integer", nullable: true })
|
|
28
36
|
responseTimeMs: number;
|
|
37
|
+
|
|
29
38
|
@Column({ type: "simple-json", nullable: true })
|
|
30
39
|
metadata: any;
|
|
40
|
+
|
|
31
41
|
@Column({ nullable: true, default: false })
|
|
32
42
|
isApplied: boolean = false;
|
|
43
|
+
|
|
33
44
|
@Index()
|
|
34
45
|
@ManyToOne(() => AiInteraction, { nullable: true })
|
|
35
46
|
@JoinColumn()
|
|
36
47
|
parentInteraction: AiInteraction;
|
|
48
|
+
|
|
37
49
|
@Index({ unique: true })
|
|
38
50
|
@Column({ type: "varchar" })
|
|
39
51
|
externalId: string;
|
|
52
|
+
|
|
40
53
|
@Column({ nullable: true, default: false })
|
|
41
54
|
isAutoApply: boolean = false;
|
|
42
55
|
|
|
@@ -48,8 +61,10 @@ export class AiInteraction extends CommonEntity {
|
|
|
48
61
|
|
|
49
62
|
@Column({ type: "integer", nullable: true })
|
|
50
63
|
totalTokens: number;
|
|
64
|
+
|
|
51
65
|
@Column({ type: "text", nullable: true })
|
|
52
66
|
originalMessage: string;
|
|
67
|
+
|
|
53
68
|
@Column({ nullable: true, default: false })
|
|
54
69
|
isEdited: boolean = false;
|
|
55
|
-
}
|
|
70
|
+
}
|
|
@@ -7,22 +7,30 @@ export class DashboardQuestionSqlDatasetConfig extends CommonEntity {
|
|
|
7
7
|
@Index({ unique: true })
|
|
8
8
|
@Column({ type: "varchar" })
|
|
9
9
|
datasetName: string;
|
|
10
|
+
|
|
10
11
|
@Column({ type: "varchar" })
|
|
11
12
|
datasetDisplayName: string;
|
|
13
|
+
|
|
12
14
|
@Column({ type: "text", nullable: true })
|
|
13
15
|
description: string;
|
|
16
|
+
|
|
14
17
|
@Column({ type: "text" })
|
|
15
18
|
sql: string;
|
|
19
|
+
|
|
16
20
|
@Column({ type: "varchar" })
|
|
17
21
|
labelColumnName: string;
|
|
22
|
+
|
|
18
23
|
@Column({ type: "varchar" })
|
|
19
24
|
valueColumnName: string;
|
|
25
|
+
|
|
20
26
|
@ManyToOne(() => DashboardQuestion, { nullable: false })
|
|
21
27
|
@JoinColumn()
|
|
22
28
|
question: DashboardQuestion;
|
|
29
|
+
|
|
23
30
|
@Column({ type: "text", nullable: true })
|
|
24
31
|
options: any;
|
|
32
|
+
|
|
25
33
|
@Index({ unique: true })
|
|
26
34
|
@Column({ type: "varchar", nullable: false })
|
|
27
35
|
externalId: string;
|
|
28
|
-
}
|
|
36
|
+
}
|
|
@@ -8,27 +8,37 @@ export class DashboardQuestion extends CommonEntity {
|
|
|
8
8
|
@Index({ unique: true })
|
|
9
9
|
@Column({ type: "varchar" })
|
|
10
10
|
name: string;
|
|
11
|
+
|
|
11
12
|
@Index()
|
|
12
13
|
@Column({})
|
|
13
14
|
sourceType: string;
|
|
15
|
+
|
|
14
16
|
@Index()
|
|
15
17
|
@Column({})
|
|
16
18
|
visualisedAs: string;
|
|
19
|
+
|
|
17
20
|
@Column({ type: "varchar", nullable: true })
|
|
18
21
|
providerName: string;
|
|
22
|
+
|
|
19
23
|
@ManyToOne(() => Dashboard, { nullable: true })
|
|
20
24
|
@JoinColumn()
|
|
21
25
|
dashboard: Dashboard;
|
|
26
|
+
|
|
22
27
|
@OneToMany(() => DashboardQuestionSqlDatasetConfig, dashboardQuestionSqlDatasetConfig => dashboardQuestionSqlDatasetConfig.question, { cascade: true })
|
|
23
28
|
questionSqlDatasetConfigs: DashboardQuestionSqlDatasetConfig[];
|
|
29
|
+
|
|
24
30
|
@Column({ type: "simple-json", nullable: true })
|
|
25
31
|
chartOptions: any;
|
|
32
|
+
|
|
26
33
|
@Column({ type: "text", nullable: true })
|
|
27
34
|
labelSql: string;
|
|
35
|
+
|
|
28
36
|
@Column({ type: "text", nullable: true })
|
|
29
37
|
kpiSql: string;
|
|
38
|
+
|
|
30
39
|
@Column({ type: "integer", nullable: true })
|
|
31
40
|
sequenceNumber: number;
|
|
41
|
+
|
|
32
42
|
@Index({ unique: true })
|
|
33
43
|
@Column({ type: "varchar", nullable: false })
|
|
34
44
|
externalId: string;
|
|
@@ -7,24 +7,33 @@ export class DashboardVariable extends CommonEntity {
|
|
|
7
7
|
@Index({ unique: true })
|
|
8
8
|
@Column({ type: "varchar" })
|
|
9
9
|
variableName: string;
|
|
10
|
+
|
|
10
11
|
@Index()
|
|
11
12
|
@Column({ type: "varchar" })
|
|
12
13
|
variableType: string;
|
|
14
|
+
|
|
13
15
|
@Column({ type: "simple-json", nullable: true })
|
|
14
16
|
selectionStaticValues: any;
|
|
17
|
+
|
|
15
18
|
@Column({ nullable: true })
|
|
16
19
|
selectionDynamicSourceType: string;
|
|
20
|
+
|
|
17
21
|
@Column({ type: "text", nullable: true })
|
|
18
22
|
selectionDynamicSQL: string;
|
|
23
|
+
|
|
19
24
|
@Column({ type: "varchar", nullable: true })
|
|
20
25
|
selectionDynamicProviderName: string;
|
|
26
|
+
|
|
21
27
|
@Column({ nullable: true, default: true })
|
|
22
28
|
isMultiSelect: boolean = true;
|
|
29
|
+
|
|
23
30
|
@ManyToOne(() => Dashboard, { nullable: true })
|
|
24
31
|
@JoinColumn()
|
|
25
32
|
dashboard: Dashboard;
|
|
33
|
+
|
|
26
34
|
@Column({ type: "text", nullable: true })
|
|
27
35
|
defaultValue: string;
|
|
36
|
+
|
|
28
37
|
@Column({ type: "varchar", nullable: true })
|
|
29
38
|
defaultOperator: string;
|
|
30
39
|
}
|
package/src/index.ts
CHANGED
|
@@ -264,6 +264,8 @@ export * from './services/user.service'
|
|
|
264
264
|
export * from './services/view-metadata.service'
|
|
265
265
|
export * from './services/whatsapp/Msg91WhatsappService' //rename
|
|
266
266
|
export * from './services/setting.service'
|
|
267
|
+
export * from './services/info.service'
|
|
268
|
+
export * from './controllers/info.controller'
|
|
267
269
|
export * from './services/settings/default-settings-provider.service'
|
|
268
270
|
export * from './services/security-rule.service'
|
|
269
271
|
export * from './services/request-context.service'
|
package/src/interfaces.ts
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
interface PackageVersionInfo {
|
|
6
|
+
repo: 'local' | 'npm';
|
|
7
|
+
version: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SolidVersionsInfo {
|
|
11
|
+
'solid-core': PackageVersionInfo;
|
|
12
|
+
'solid-core-ui': PackageVersionInfo;
|
|
13
|
+
'solid-code-builder': PackageVersionInfo;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Injectable()
|
|
17
|
+
export class InfoService {
|
|
18
|
+
private readonly logger = new Logger(InfoService.name);
|
|
19
|
+
|
|
20
|
+
getPackageVersions(): SolidVersionsInfo {
|
|
21
|
+
return {
|
|
22
|
+
'solid-core': this.getPackageInfo('@solidxai/core'),
|
|
23
|
+
'solid-core-ui': this.getPackageInfo('@solidxai/core-ui'),
|
|
24
|
+
'solid-code-builder': this.getPackageInfo('@solidxai/code-builder'),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private getPackageInfo(packageName: string): PackageVersionInfo {
|
|
29
|
+
const result = this.resolvePackageJson(packageName);
|
|
30
|
+
if (result) return result;
|
|
31
|
+
|
|
32
|
+
const siblingUiPath = path.resolve(process.cwd(), '..', 'solid-ui', 'node_modules', packageName, 'package.json');
|
|
33
|
+
const siblingResult = this.readPackageJson(siblingUiPath);
|
|
34
|
+
if (siblingResult) return siblingResult;
|
|
35
|
+
|
|
36
|
+
this.logger.warn(`Could not resolve package: ${packageName}`);
|
|
37
|
+
return { repo: 'npm', version: 'not installed' };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private resolvePackageJson(packageName: string): PackageVersionInfo | null {
|
|
41
|
+
try {
|
|
42
|
+
const pkgJsonPath = require.resolve(`${packageName}/package.json`);
|
|
43
|
+
return this.readPackageJson(pkgJsonPath);
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private readPackageJson(pkgJsonPath: string): PackageVersionInfo | null {
|
|
50
|
+
try {
|
|
51
|
+
if (!fs.existsSync(pkgJsonPath)) return null;
|
|
52
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
|
53
|
+
const version = pkgJson.version ? `v${pkgJson.version}` : 'unknown';
|
|
54
|
+
const repo = pkgJsonPath.includes(path.sep + 'node_modules' + path.sep) ? 'npm' : 'local';
|
|
55
|
+
return { repo, version };
|
|
56
|
+
} catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -97,6 +97,12 @@ export abstract class RabbitMqSubscriber<T> implements OnModuleInit, QueueSubscr
|
|
|
97
97
|
await this.cleanup();
|
|
98
98
|
this.logger.log(`RabbitMqSubscriber in connectAndConsume for queue: ${queueName} and url: ${this.url}`);
|
|
99
99
|
|
|
100
|
+
const options = this.options();
|
|
101
|
+
const prefetch = options.prefetch ?? 1;
|
|
102
|
+
if (prefetch < 1) {
|
|
103
|
+
throw new Error(`RabbitMqSubscriber prefetch must be >= 1 for queue ${queueName}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
100
106
|
let connection: amqp.Connection;
|
|
101
107
|
try {
|
|
102
108
|
connection = await this.establishConnection();
|
|
@@ -133,7 +139,7 @@ export abstract class RabbitMqSubscriber<T> implements OnModuleInit, QueueSubscr
|
|
|
133
139
|
});
|
|
134
140
|
|
|
135
141
|
// Process one message at a time per consumer to avoid parallel work on the same subscriber instance.
|
|
136
|
-
await channel.prefetch(
|
|
142
|
+
await channel.prefetch(prefetch);
|
|
137
143
|
|
|
138
144
|
// Use a direct exchange with a stable routing key so retry DLX can route back to the main queue.
|
|
139
145
|
const exchangeName = `${queueName}.exchange`;
|
package/src/solid-core.module.ts
CHANGED
|
@@ -145,6 +145,8 @@ import { SavedFiltersController } from './controllers/saved-filters.controller';
|
|
|
145
145
|
import { ScheduledJobController } from './controllers/scheduled-job.controller';
|
|
146
146
|
import { SecurityRuleController } from './controllers/security-rule.controller';
|
|
147
147
|
import { SettingController } from './controllers/setting.controller';
|
|
148
|
+
import { InfoController } from './controllers/info.controller';
|
|
149
|
+
import { InfoService } from './services/info.service';
|
|
148
150
|
import { UserActivityHistoryController } from './controllers/user-activity-history.controller';
|
|
149
151
|
import { UserViewMetadataController } from './controllers/user-view-metadata.controller';
|
|
150
152
|
import { UserController } from './controllers/user.controller';
|
|
@@ -436,6 +438,7 @@ import { ListOfRolesSelectionProvider } from './services/selection-providers/lis
|
|
|
436
438
|
SecurityRuleController,
|
|
437
439
|
ServiceController,
|
|
438
440
|
SettingController,
|
|
441
|
+
InfoController,
|
|
439
442
|
SmsTemplateController,
|
|
440
443
|
TestController,
|
|
441
444
|
TestQueueController,
|
|
@@ -475,6 +478,7 @@ import { ListOfRolesSelectionProvider } from './services/selection-providers/lis
|
|
|
475
478
|
RefreshModelCommand,
|
|
476
479
|
RefreshModuleCommand,
|
|
477
480
|
InfoCommand,
|
|
481
|
+
InfoService,
|
|
478
482
|
SolidIntrospectService,
|
|
479
483
|
DiscoveryService,
|
|
480
484
|
R2RHelperService,
|