From 8065be09ed522946ca53cd6d4a7c74f3a763f565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:10:47 -0300 Subject: [PATCH 1/3] Do not show error when prompt session id does not exists --- .../scripts/components/GenerateScriptTextPrompt.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/js/processes/scripts/components/GenerateScriptTextPrompt.vue b/resources/js/processes/scripts/components/GenerateScriptTextPrompt.vue index 217048a6d9..46ed6ebb97 100644 --- a/resources/js/processes/scripts/components/GenerateScriptTextPrompt.vue +++ b/resources/js/processes/scripts/components/GenerateScriptTextPrompt.vue @@ -138,11 +138,13 @@ export default { this.suggestionsPages = response.data.suggestions; this.loadingSuggestions = false; }).catch((error) => { - const errorMsg = error.response?.data?.message || error.message; - window.ProcessMaker.alert(errorMsg, "danger"); + if (error.response.status !== 404) { + const errorMsg = error.response?.data?.message || error.message; + window.ProcessMaker.alert(errorMsg, "danger"); + } this.loadingSuggestions = false; }); }, }, }; - \ No newline at end of file + From 0c749102d40c5320961817582afd65dfe4d9d2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:55:19 -0300 Subject: [PATCH 2/3] Add getScriptVersion endpoint --- .../scripts/components/ScriptEditor.vue | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/resources/js/processes/scripts/components/ScriptEditor.vue b/resources/js/processes/scripts/components/ScriptEditor.vue index 81820ec8d6..03032ee282 100644 --- a/resources/js/processes/scripts/components/ScriptEditor.vue +++ b/resources/js/processes/scripts/components/ScriptEditor.vue @@ -644,6 +644,7 @@ export default { window.ProcessMaker.alert(response.data.message, "danger"); } else { this.newCode = response.data.diff; + // this.getScriptVersion(response.data.scriptVersionId); this.progress.progress = 100; setTimeout(() => { this.loading = false; @@ -655,7 +656,27 @@ export default { }, ); }, + getScriptVersion(scriptVersionId) { + const url = "/package-ai/getScriptVersion"; + const params = { + server: window.location.host, + scriptVersionId, + }; + + ProcessMaker.apiClient + .post(url, params) + .then((response) => { + this.newCode = response.data.version.diff; + }) + .catch((error) => { + const errorMsg = error.response?.data?.message || error.message; + + if (error.response.status !== 404) { + window.ProcessMaker.alert(errorMsg, "danger"); + } + }); + }, diffEditorMounted() { }, resizeEditor() { From 75ba9db99432d26d830327d9edb158ed24c635cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Fri, 6 Oct 2023 09:42:37 -0300 Subject: [PATCH 3/3] Use endpoint instead passing the diff over the socket --- resources/js/processes/scripts/components/ScriptEditor.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/js/processes/scripts/components/ScriptEditor.vue b/resources/js/processes/scripts/components/ScriptEditor.vue index 03032ee282..d4b7a6f82a 100644 --- a/resources/js/processes/scripts/components/ScriptEditor.vue +++ b/resources/js/processes/scripts/components/ScriptEditor.vue @@ -643,8 +643,7 @@ export default { this.progress.progress = 0; window.ProcessMaker.alert(response.data.message, "danger"); } else { - this.newCode = response.data.diff; - // this.getScriptVersion(response.data.scriptVersionId); + this.getScriptVersion(response.data.scriptVersionId); this.progress.progress = 100; setTimeout(() => { this.loading = false;