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 + diff --git a/resources/js/processes/scripts/components/ScriptEditor.vue b/resources/js/processes/scripts/components/ScriptEditor.vue index 81820ec8d6..d4b7a6f82a 100644 --- a/resources/js/processes/scripts/components/ScriptEditor.vue +++ b/resources/js/processes/scripts/components/ScriptEditor.vue @@ -643,7 +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.progress.progress = 100; setTimeout(() => { this.loading = false; @@ -655,7 +655,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() {