diff --git a/backend/src/main.py b/backend/src/main.py index da6af2c6..bf78c0cc 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -74,24 +74,6 @@ def proteins_enrichment(): json_str = json.dumps(list_enrichment.to_dict("records"), ensure_ascii=False, separators=(",", ":")) return Response(json_str, mimetype="application/json") -@app.route("/api/subgraph/chatbot", methods=["POST"]) -def proteins_chatbot(): - message = request.form.get("message") - - g4f.debug.logging = True # enable logging - g4f.check_version = False # Disable automatic version checking - print(g4f.version) # check version - print(g4f.Provider.Ails.params) # supported args - - # normal response - response = g4f.ChatCompletion.create( - model="gpt-3.5-turbo", - provider=g4f.Provider.Yqcloud, - messages=[{"role": "user", "content": message}] - ) # alternative model setting# - if response != None: - return Response(str(response), mimetype="application/json") - # ====================== Subgraph API ====================== # request comes from home.js # TODO Refactor this diff --git a/frontend/src/components/pane/modules/node/ChatbotInformation.vue b/frontend/src/components/pane/modules/node/ChatbotInformation.vue index 743587f8..b974f237 100644 --- a/frontend/src/components/pane/modules/node/ChatbotInformation.vue +++ b/frontend/src/components/pane/modules/node/ChatbotInformation.vue @@ -1,17 +1,6 @@ @@ -23,50 +12,16 @@ export default { data() { return { protein_information: "", - protein_questions:"", - await_answer:false, - protein_name:'' } }, watch:{ active_node(){ - - if (this.active_node == null) { - return; - } - - this.protein_name = this.active_node.attributes["Name"] - this.protein_information = "" - this.generate_informations(`What is Gene/Protein ${this.protein_name} in 2 Sentences?`, false) - this.generate_informations(`Give me 2 common corrolated questions to Gene ${this.protein_name} with maximum 7 Words!`, true) - - } + if (this.active_node == null) return + this.protein_information = this.active_node.attributes['Description'] + }, }, methods:{ - generate_informations(message, question){ - var com = this - //Adding proteins and species to formdata - var formData = new FormData() - formData.append('message', message) - - this.await_answer = true - //POST request for generating pathways - com.sourceToken = this.axios.CancelToken.source(); - com.axios - .post("api/subgraph/chatbot", formData, { cancelToken: com.sourceToken.token }) - .then((response) => { - if(!question) { - this.protein_information = response.data - this.await_answer = false - } - else this.protein_questions = response.data.split(/\d+\.\s+/).filter(question => question !== ''); - }) - }, - ask_question(message){ - this.generate_informations(`${message} in correlation with Gene ${this.protein_name}. Do a short answer` , false) - this.generate_informations(`Give me 2 question with maximal 7 words correlated to your previous answer: ${this.protein_information}` , true) - } } } @@ -82,15 +37,10 @@ export default { padding: 0% 2% 2% 2%; } -#chatbot .loading_pane { - margin-top: 40%; - -} - #chatbot .text { width: 100%; top: 16%; - height: 50%; + height: 80%; overflow-y: scroll; position: absolute; padding: 0 5% 0 2%; @@ -100,18 +50,6 @@ export default { display: none; } - -#chatbot #search-1 { - position: absolute; - top: 72%; - width:100%; -} -#chatbot #search-2 { - position: absolute; - top: 84%; - width:100%; -} - #chatbot #search-1 span, #chatbot #search-2 span { margin-left: 10%; diff --git a/frontend/src/components/pane/modules/node/NetworkStatistics.vue b/frontend/src/components/pane/modules/node/NetworkStatistics.vue index 2a9e6d51..2262070e 100644 --- a/frontend/src/components/pane/modules/node/NetworkStatistics.vue +++ b/frontend/src/components/pane/modules/node/NetworkStatistics.vue @@ -60,7 +60,7 @@ export default { #statistics { width: 100%; height: 100%; - top: 16.35%; + top: 20.35%; position: absolute; font-family: 'ABeeZee', sans-serif; padding: 0% 2% 2% 2%; @@ -103,7 +103,7 @@ export default { } #statistics .network-results { - height: 69%; + height: 67%; overflow: scroll; } diff --git a/frontend/src/components/pane/modules/node/NodeConnections.vue b/frontend/src/components/pane/modules/node/NodeConnections.vue index f525d205..a0cdba4a 100644 --- a/frontend/src/components/pane/modules/node/NodeConnections.vue +++ b/frontend/src/components/pane/modules/node/NodeConnections.vue @@ -40,14 +40,14 @@ export default { #connect { width: 100%; height: 100%; - top: 16.35%; + top: 18.35%; position: absolute; font-family: 'ABeeZee', sans-serif; padding: 0% 2% 2% 2%; } #connect .network-results { - height: 70%; + height: 68%; overflow: scroll; } \ No newline at end of file diff --git a/frontend/src/components/pane/modules/node/NodePane.vue b/frontend/src/components/pane/modules/node/NodePane.vue index bf4438b5..21f57d5f 100644 --- a/frontend/src/components/pane/modules/node/NodePane.vue +++ b/frontend/src/components/pane/modules/node/NodePane.vue @@ -38,6 +38,10 @@ routing
+
@@ -48,6 +52,7 @@ import NetworkStatistics from '@/components/pane/modules/node/NetworkStatistics.vue' import NodeConnections from '@/components/pane/modules/node/NodeConnections.vue' import ChatbotInformation from '@/components/pane/modules/node/ChatbotInformation.vue' +import RoutingNode from '@/components/pane/modules/node/RoutingNode.vue' export default { name: 'NodePane', @@ -56,7 +61,8 @@ export default { components: { NetworkStatistics, ChatbotInformation, - NodeConnections + NodeConnections, + RoutingNode }, data() { @@ -70,9 +76,6 @@ export default { imageSrc: require('@/assets/pane/protein-icon.png') }, nodes: this.gephi_data.nodes, - selected_protein: null, - path: true, - protein_name:"" } }, watch: { @@ -116,22 +119,8 @@ export default { select_node(value) { this.emitter.emit("searchNode", value); }, - retrieve_path() { - this.path = true - if(this.selected_protein == null) { - this.emitter.emit("reset_protein", this.active_node) - return - } - this.emitter.emit("searchPathway", {"source":this.active_node.id ,"target": this.selected_protein.id}); - }, }, - mounted(){ - this.emitter.on("emptySet", (state) => { - this.path = state - }); - - } } @@ -196,7 +185,7 @@ export default { } #routing { - height: 18%; + height: 20%; } #network { diff --git a/frontend/src/components/pane/modules/node/RoutingNode.vue b/frontend/src/components/pane/modules/node/RoutingNode.vue new file mode 100644 index 00000000..6e812714 --- /dev/null +++ b/frontend/src/components/pane/modules/node/RoutingNode.vue @@ -0,0 +1,108 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/visualization/MainVis.vue b/frontend/src/components/visualization/MainVis.vue index 6a692d13..6059ad52 100644 --- a/frontend/src/components/visualization/MainVis.vue +++ b/frontend/src/components/visualization/MainVis.vue @@ -848,6 +848,7 @@ export default { const endNode = sigma_instance.graph.getNodeFromIndex(endID); const paths = new Set(sigma_instance.graph.astar(startNode.id, endNode.id)); if(paths.size == 0) this.emitter.emit("emptySet", false); + else this.emitter.emit("emptySet", true); sigma_instance.graph.nodes().forEach(n =>{ if(paths.has(n)){