diff --git a/src/components/ShellView/CypherEditor.vue b/src/components/ShellView/CypherEditor.vue index 9fc30d7..13a394f 100644 --- a/src/components/ShellView/CypherEditor.vue +++ b/src/components/ShellView/CypherEditor.vue @@ -108,7 +108,7 @@ export default { default: false, }, }, -emits: ['remove', 'evaluateCypher', 'toggleMaximize', 'generateAndEvaluateQuery'], + emits: ['remove', 'evaluateCypher', 'toggleMaximize', 'generateAndEvaluateQuery'], data: () => { return { name: "CypherEditor", @@ -229,10 +229,15 @@ emits: ['remove', 'evaluateCypher', 'toggleMaximize', 'generateAndEvaluateQuery' removeCell() { this.$emit("remove"); }, - isActive(){ + isActive() { return (this.isQueryGenerationMode && this.$refs.gptQuestionTextArea === document.activeElement) || (!this.isQueryGenerationMode && this.editor && this.editor.hasTextFocus()); - } + }, + loadFromHistory(history) { + this.isQueryGenerationMode = history.isQueryGenerationMode; + this.gptQuestion = history.gptQuestion; + this.setEditorContent(history.cypherQuery); + }, }, } diff --git a/src/components/ShellView/ShellCell.vue b/src/components/ShellView/ShellCell.vue index c314e27..981d3b2 100644 --- a/src/components/ShellView/ShellCell.vue +++ b/src/components/ShellView/ShellCell.vue @@ -85,12 +85,21 @@ export default { isActive() { return this.$refs.editor.isActive(); }, + loadEditorFromHistory(history) { + this.isEvaluated = true; + this.$refs.editor.loadFromHistory(history); + }, evaluateCypher(query) { this.queryResult = null; this.errorMessage = ""; this.isLoading = true; this.loadingText = "Evaluating query..."; - Axios.post("/api/cypher", { query }) + Axios.post("/api/cypher", + { + query, + uuid: this.cellId, + isQueryGenerationMode: this.$refs.editor.isQueryGenerationMode + }) .then((res) => { this.queryResult = res.data; this.queryString = query; @@ -158,6 +167,8 @@ export default { question, token, model, + uuid: this.cellId, + isQueryGenerationMode: this.$refs.editor.isQueryGenerationMode }; Axios.post(url, data) .then((res) => { diff --git a/src/components/ShellView/ShellMainView.vue b/src/components/ShellView/ShellMainView.vue index d6a6bdc..2bce1d1 100644 --- a/src/components/ShellView/ShellMainView.vue +++ b/src/components/ShellView/ShellMainView.vue @@ -23,6 +23,7 @@