diff --git a/api/src/channel/types.ts b/api/src/channel/types.ts index 4b9f3329..d4866688 100644 --- a/api/src/channel/types.ts +++ b/api/src/channel/types.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { SettingCreateDto } from '@/setting/dto/setting.dto'; export type ChannelSetting = Omit< diff --git a/api/src/chat/repositories/block.repository.ts b/api/src/chat/repositories/block.repository.ts index 5d1440db..1dd1b9b1 100644 --- a/api/src/chat/repositories/block.repository.ts +++ b/api/src/chat/repositories/block.repository.ts @@ -88,12 +88,26 @@ export class BlockRepository extends BaseRepository< Block, 'findOneAndUpdate' >, - _criteria: TFilterQuery, + criteria: TFilterQuery, _updates: | UpdateWithAggregationPipeline | UpdateQuery>, ): Promise { const updates: BlockUpdateDto = _updates?.['$set']; + if (updates?.category) { + const movedBlockId = criteria._id; + + // Find and update blocks that reference the moved block + await this.model.updateMany( + { nextBlocks: movedBlockId }, + { $pull: { nextBlocks: movedBlockId } }, + ); + + await this.model.updateMany( + { attachedBlock: movedBlockId }, + { $set: { attachedBlock: null } }, + ); + } this.checkDeprecatedAttachmentUrl(updates); } diff --git a/api/src/extensions/channels/live-chat-tester/index.d.ts b/api/src/extensions/channels/live-chat-tester/index.d.ts index 27efb2d0..d8b31c59 100644 --- a/api/src/extensions/channels/live-chat-tester/index.d.ts +++ b/api/src/extensions/channels/live-chat-tester/index.d.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { DEFAULT_LIVE_CHAT_TEST_SETTINGS, LIVE_CHAT_TEST_GROUP_NAME, diff --git a/api/src/extensions/channels/offline/index.d.ts b/api/src/extensions/channels/offline/index.d.ts index 39a1b26a..019b7248 100644 --- a/api/src/extensions/channels/offline/index.d.ts +++ b/api/src/extensions/channels/offline/index.d.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { DEFAULT_OFFLINE_SETTINGS, OFFLINE_GROUP_NAME } from './settings'; declare global { diff --git a/api/src/extensions/helpers/core-nlu/index.d.ts b/api/src/extensions/helpers/core-nlu/index.d.ts index 00c0d3c8..cf52fe1d 100644 --- a/api/src/extensions/helpers/core-nlu/index.d.ts +++ b/api/src/extensions/helpers/core-nlu/index.d.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { CORE_NLU_HELPER_GROUP, CORE_NLU_HELPER_SETTINGS } from './settings'; declare global { diff --git a/api/src/extensions/helpers/core-nlu/settings.ts b/api/src/extensions/helpers/core-nlu/settings.ts index 3a5f3d83..9df51a86 100644 --- a/api/src/extensions/helpers/core-nlu/settings.ts +++ b/api/src/extensions/helpers/core-nlu/settings.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { HelperSetting } from '@/helper/types'; import { SettingType } from '@/setting/schemas/types'; diff --git a/api/src/extensions/helpers/ollama/index.d.ts b/api/src/extensions/helpers/ollama/index.d.ts index e922cc4f..89793ffd 100644 --- a/api/src/extensions/helpers/ollama/index.d.ts +++ b/api/src/extensions/helpers/ollama/index.d.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { OLLAMA_HELPER_GROUP, OLLAMA_HELPER_SETTINGS } from './settings'; declare global { diff --git a/api/src/extensions/helpers/ollama/settings.ts b/api/src/extensions/helpers/ollama/settings.ts index 0d234134..6d64cdde 100644 --- a/api/src/extensions/helpers/ollama/settings.ts +++ b/api/src/extensions/helpers/ollama/settings.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { HelperSetting } from '@/helper/types'; import { SettingType } from '@/setting/schemas/types'; diff --git a/api/src/extensions/plugins/ollama/index.plugin.ts b/api/src/extensions/plugins/ollama/index.plugin.ts index bcf0ea10..ef5da5fb 100644 --- a/api/src/extensions/plugins/ollama/index.plugin.ts +++ b/api/src/extensions/plugins/ollama/index.plugin.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { Injectable } from '@nestjs/common'; import { Block } from '@/chat/schemas/block.schema'; diff --git a/api/src/extensions/plugins/ollama/settings.ts b/api/src/extensions/plugins/ollama/settings.ts index 4289d1cc..1d573080 100644 --- a/api/src/extensions/plugins/ollama/settings.ts +++ b/api/src/extensions/plugins/ollama/settings.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { PluginSetting } from '@/plugins/types'; import { SettingType } from '@/setting/schemas/types'; diff --git a/api/src/helper/types.ts b/api/src/helper/types.ts index e3820520..6ee89f20 100644 --- a/api/src/helper/types.ts +++ b/api/src/helper/types.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { SettingCreateDto } from '@/setting/dto/setting.dto'; import BaseHelper from './lib/base-helper'; diff --git a/api/src/setting/index.d.ts b/api/src/setting/index.d.ts index 90ea4a8a..fab71fb7 100644 --- a/api/src/setting/index.d.ts +++ b/api/src/setting/index.d.ts @@ -1,3 +1,11 @@ +/* + * Copyright © 2024 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + import { SettingByType } from './schemas/types'; import { DEFAULT_SETTINGS } from './seeds/setting.seed-model'; diff --git a/frontend/src/components/visual-editor/v2/Diagrams.tsx b/frontend/src/components/visual-editor/v2/Diagrams.tsx index 37837557..d8083d43 100644 --- a/frontend/src/components/visual-editor/v2/Diagrams.tsx +++ b/frontend/src/components/visual-editor/v2/Diagrams.tsx @@ -324,7 +324,7 @@ const Diagrams = () => { } }; const handleMoveButton = () => { - const selectedEntities = engine?.getModel().getSelectedEntities(); + const selectedEntities = engine?.getModel().getSelectedEntities().reverse(); const ids = selectedEntities?.map((model) => model.getID()); if (ids && selectedEntities) { @@ -453,10 +453,22 @@ const Diagrams = () => { if (ids) { for (const blockId of ids) { + const block = getBlockFromCache(blockId); + const updatedNextBlocks = block?.nextBlocks?.filter((nextBlockId) => + ids.includes(nextBlockId), + ); + const updatedAttachedBlock = ids.includes( + block?.attachedBlock as string, + ) + ? block?.attachedBlock + : null; + await updateBlock({ id: blockId, params: { category: newCategoryId, + nextBlocks: updatedNextBlocks, + attachedBlock: updatedAttachedBlock, }, }); }