mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Merge pull request #940 from Hexastack/fix/sync-nlp-value
fix: correct criteria format for nlp value update
This commit is contained in:
commit
f20fed6eb0
@ -48,7 +48,7 @@ export class NlpEntityRepository extends BaseRepository<
|
||||
* @param created - The newly created NLP entity document.
|
||||
*/
|
||||
async postCreate(_created: NlpEntityDocument): Promise<void> {
|
||||
if (!_created) {
|
||||
if (!_created.builtin) {
|
||||
// Bypass builtin entities (probably fixtures)
|
||||
this.eventEmitter.emit('hook:nlpEntity:create', _created);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Hexastack. All rights reserved.
|
||||
* Copyright © 2025 Hexastack. All rights reserved.
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
|
||||
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
|
||||
@ -42,9 +42,12 @@ export class NlpService {
|
||||
const helper = await this.helperService.getDefaultNluHelper();
|
||||
const foreignId = await helper.addEntity(entity);
|
||||
this.logger.debug('New entity successfully synced!', foreignId);
|
||||
return await this.nlpEntityService.updateOne(entity._id, {
|
||||
foreign_id: foreignId,
|
||||
});
|
||||
return await this.nlpEntityService.updateOne(
|
||||
{ _id: entity._id },
|
||||
{
|
||||
foreign_id: foreignId,
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
this.logger.error('Unable to sync a new entity', err);
|
||||
return entity;
|
||||
@ -104,9 +107,12 @@ export class NlpService {
|
||||
const helper = await this.helperService.getDefaultNluHelper();
|
||||
const foreignId = await helper.addValue(value);
|
||||
this.logger.debug('New value successfully synced!', foreignId);
|
||||
return await this.nlpValueService.updateOne(value._id, {
|
||||
foreign_id: foreignId,
|
||||
});
|
||||
return await this.nlpValueService.updateOne(
|
||||
{ _id: value._id },
|
||||
{
|
||||
foreign_id: foreignId,
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
this.logger.error('Unable to sync a new value', err);
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user