fix: widget re-render issues, ws, build + rename pkg

This commit is contained in:
Mohamed Marrouchi
2024-10-12 19:43:34 +01:00
parent b08ee24fc3
commit 04ce4df348
19 changed files with 152 additions and 129 deletions

View File

@@ -63,6 +63,10 @@ export class BlockService extends BaseService<Block, BlockPopulate, BlockFull> {
blocks: BlockFull[],
event: EventWrapper<any, any>,
): Promise<BlockFull | undefined> {
if (!blocks.length) {
return undefined;
}
// Search for block matching a given event
let block: BlockFull | undefined = undefined;
const payload = event.getPayload();

View File

@@ -443,7 +443,7 @@ export class BotService {
});
if (!blocks.length) {
return this.logger.debug('No starting message blocks was found');
this.logger.debug('No starting message blocks was found');
}
// Search for a block match

View File

@@ -67,7 +67,7 @@ export const settingModels: SettingCreateDto[] = [
{
group: 'nlp_settings',
label: 'threshold',
value: 0.9,
value: 0.1,
type: SettingType.number,
config: {
min: 0,

View File

@@ -68,11 +68,8 @@ describe('WebsocketGateway', () => {
it('should connect successfully', async () => {
ioClient.connect();
await new Promise<void>((resolve) => {
// ioClient.on('connect', () => {
// console.log('connected');
// });
ioClient.on('message', (data) => {
expect(data.statusCode).toBe(200);
ioClient.on('connect', () => {
expect(true).toBe(true);
resolve();
});
});

View File

@@ -255,22 +255,6 @@ export class WebsocketGateway
this.logger.debug(`Number of connected clients: ${sockets?.size}`);
this.eventEmitter.emit(`hook:websocket:connection`, client);
// @TODO : Revisit once we don't use anymore in frontend
const response = new SocketResponse();
client.send(
response
.setHeaders({
'access-control-allow-origin':
config.security.cors.allowOrigins.join(','),
vary: 'Origin',
'access-control-allow-credentials':
config.security.cors.allowCredentials.toString(),
})
.status(200)
.json({
success: true,
}),
);
}
async handleDisconnect(client: Socket): Promise<void> {