From b703c05935b255e9a13f5c0ccfc1c334856d4630 Mon Sep 17 00:00:00 2001 From: ExiRain Date: Mon, 27 Nov 2023 15:20:16 +0200 Subject: [PATCH 1/3] Updated slots service file to use proper link for slot deletion --- GUI/src/services/slots.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GUI/src/services/slots.ts b/GUI/src/services/slots.ts index caa2b8e3..cc162ac4 100644 --- a/GUI/src/services/slots.ts +++ b/GUI/src/services/slots.ts @@ -12,6 +12,6 @@ export async function editSlot(id: string | number, formData: SlotEditDTO) { } export async function deleteSlot(id: string | number) { - const { data } = await api.delete(`slots/${id}`); + const { data } = await api.post(`slots/delete`); return data; } From 037938cec112e39917f291d6e06cfd9235d804ff Mon Sep 17 00:00:00 2001 From: ExiRain Date: Tue, 28 Nov 2023 09:40:00 +0200 Subject: [PATCH 2/3] Updated GUI service to use proper link and send slot name for deletion. --- GUI/src/services/slots.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GUI/src/services/slots.ts b/GUI/src/services/slots.ts index cc162ac4..46a15f1f 100644 --- a/GUI/src/services/slots.ts +++ b/GUI/src/services/slots.ts @@ -11,7 +11,7 @@ export async function editSlot(id: string | number, formData: SlotEditDTO) { return data; } -export async function deleteSlot(id: string | number) { - const { data } = await api.post(`slots/delete`); +export async function deleteSlot(slot: string) { + const { data } = await api.post(`slots/delete`, {slot_name: slot}); return data; } From 0fdf5c1e3538ac1022f8ae550b62f9a5ea6795fc Mon Sep 17 00:00:00 2001 From: ExiRain Date: Tue, 28 Nov 2023 18:24:54 +0200 Subject: [PATCH 3/3] Updated delete DSL for slot, updated SLOT page to refresh after deletion, updated delete service --- DSL/Ruuter.private/POST/rasa/slots/delete.yml | 26 ++++++++++++------- GUI/src/pages/Training/Slots/index.tsx | 3 ++- GUI/src/services/slots.ts | 4 +-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/DSL/Ruuter.private/POST/rasa/slots/delete.yml b/DSL/Ruuter.private/POST/rasa/slots/delete.yml index cbf1a63b..b0cd4a1e 100644 --- a/DSL/Ruuter.private/POST/rasa/slots/delete.yml +++ b/DSL/Ruuter.private/POST/rasa/slots/delete.yml @@ -1,6 +1,6 @@ assign_values: assign: - parameters: ${incoming.body} + slot: ${incoming.body.slotName} next: getDomainFile getDomainFile: @@ -13,7 +13,7 @@ getDomainFile: validateSlots: switch: - - condition: ${domainData.response.body.response.slots[parameters.slot_name] != null} + - condition: ${domainData.response.body.response.slots[slot] != null && Object.keys(domainData.response.body.response.slots).includes(slot)} next: formSlots next: returnSlotIsMissing @@ -24,12 +24,12 @@ formSlots: headers: cookie: ${incoming.headers.cookie} body: - slot: ${parameters.slot_name} + slot: ${slot} result: formSlots validateFormSlots: switch: - - condition: ${formSlots.response.body.response.forms.length == 0} + - condition: ${formSlots.response.body.response.data.forms.length == 0} next: ruleSlots next: returnSlotHasDependencyToForms @@ -40,13 +40,13 @@ ruleSlots: headers: cookie: ${incoming.headers.cookie} body: - slot: ${parameters.slot_name} + slot: ${slot} type: "slots" result: ruleSlots validateRuleSlots: switch: - - condition: ${ruleSlots.response.body.response.rules.length == 0} + - condition: ${ruleSlots.response.body.response.data.rules.length == 0} next: storiesSlots next: returnSlotHasDependencyToRules @@ -57,13 +57,13 @@ storiesSlots: headers: cookie: ${incoming.headers.cookie} body: - slot: ${parameters.slot_name} + slot: ${slot} type: "slots" result: storiesSlots validateStoriesSlots: switch: - - condition: ${storiesSlots.response.body.response.stories.length == 0} + - condition: ${storiesSlots.response.body.response.data.stories.length == 0} next: deleteKey next: returnSlotHasDependencyToStories @@ -73,7 +73,7 @@ deleteKey: url: "[#TRAINING_DMAPPER]:[#TRAINING_DMAPPER_PORT]/merge/remove-key" body: object: ${domainData.response.body.response.slots} - key: ${parameters.slot_name} + key: ${slot} result: keyDeletedData convertJsonToYaml: @@ -107,6 +107,14 @@ saveDomainFile: file_path: ${fileLocations.response.body.response.domain_location} content: ${domainYaml.response.body.json} result: fileResult + +updateOpenSearch: + call: http.post + args: + url: "[#TRAINING_PIPELINE]:[#TRAINING_PIPELINE_PORT]/bulk/domain" + body: + input: ${domainYaml.response.body.json} + result: updateSearchResult next: returnSuccess returnSuccess: diff --git a/GUI/src/pages/Training/Slots/index.tsx b/GUI/src/pages/Training/Slots/index.tsx index 4a8c3e33..b738712b 100644 --- a/GUI/src/pages/Training/Slots/index.tsx +++ b/GUI/src/pages/Training/Slots/index.tsx @@ -18,7 +18,7 @@ const Slots: FC = () => { const queryClient = useQueryClient(); const [filter, setFilter] = useState(''); const [deletableSlot, setDeletableSlot] = useState(null); - const { data: slots } = useQuery({ + const { data: slots,refetch } = useQuery({ queryKey: ['slots'], }); @@ -26,6 +26,7 @@ const Slots: FC = () => { mutationFn: ({ id }: { id: string | number }) => deleteSlot(id), onSuccess: async () => { await queryClient.invalidateQueries(['slots']); + refetch() toast.open({ type: 'success', title: t('global.notification'), diff --git a/GUI/src/services/slots.ts b/GUI/src/services/slots.ts index 46a15f1f..2a452c22 100644 --- a/GUI/src/services/slots.ts +++ b/GUI/src/services/slots.ts @@ -11,7 +11,7 @@ export async function editSlot(id: string | number, formData: SlotEditDTO) { return data; } -export async function deleteSlot(slot: string) { - const { data } = await api.post(`slots/delete`, {slot_name: slot}); +export async function deleteSlot(slot: string | number) { + const { data } = await api.post(`slots/delete`, {slotName: slot}); return data; }