aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn2/wqflask/templates/gnqa.html72
-rw-r--r--gn2/wqflask/templates/gnqa_answer.html22
-rw-r--r--gn2/wqflask/templates/gsearch_gene.html9
-rw-r--r--gn2/wqflask/views.py2
4 files changed, 56 insertions, 49 deletions
diff --git a/gn2/wqflask/templates/gnqa.html b/gn2/wqflask/templates/gnqa.html
index 158b0b4e..371ad7b3 100644
--- a/gn2/wqflask/templates/gnqa.html
+++ b/gn2/wqflask/templates/gnqa.html
@@ -80,10 +80,15 @@
background-color: #ccf;
}
+.linux-libertine-font{
+ font-family: 'Linux Libertine','Georgia','Times','Source Serif Pro', 'serif'
+}
+
</style>
{% endblock %}
{% block search %}{% endblock %}
{% block content %}
+
<!-- Start of body -->
<section class="container-fluid">
<header class="row">
@@ -119,39 +124,44 @@
autocomplete="on"
required
placeholder="Ask More Questions or Topics (E.g Genes)"
+ {% if query %}
+ value='{{ query }}'
+ {% else %}
value=''
+ {% endif %}
name="querygnqa" />
</div>
</form>
<article id="swap" class="row">
- <div class="row gnqa-copy">
- <div class="col-sm-10 col-sm-offset-1 col-md-offset-3 col-md-6">
- <p>
- Welcome to the GeneNetwork Question and Answer (GNQA)system. We utilize a large language model and 3000 scientific publications to make GNQA a subject matter expert in three areas: <b><a href="/">GeneNetwork.org</a></b>, <b>genomics/genetics with regards to diabetes</b> and <b>genomics/genetics with regards to agin.</b>.
- </p>
- <p>
- At the moment when you ask GNQA something it will attempt to return a sensible answer with <q>real</q> references. To this end we aim to reduce hallucinations and provide a knowledge launchpad for a researcher to enhance their knowledge on the relevant subject matter.
- </p>
- <p>GNQA is not a finished product as we are working diligently to improve it daily.</p>
- <p>
- <b>Thanks for using GNQA!</b>
- </p>
- <div></div>
- </article>
- </section>
- {% endblock %}
- {% block js %}
- <script src="{{ url_for('js', filename='jquery/jquery.min.js') }}"
- type="text/javascript"></script>
- <script language="javascript"
- type="text/javascript"
- src="{{ url_for('js', filename='jquery-ui/jquery-ui.min.js') }}"></script>
- <script language="javascript"
- type="text/javascript"
- src="{{ url_for('js', filename='htmx.min.js') }}"></script>
- <script type="text/javascript">
- document.addEventListener('DOMContentLoaded', function() {
- $('footer').hide()
- });
- </script>
- {% endblock %}
+ {% if answer %}
+ {% include 'gnqa_answer.html' %}
+ {% else %}
+
+ <div class="row gnqa-copy">
+ <div class="col-sm-10 col-sm-offset-1 col-md-offset-3 col-md-6">
+ <p>
+ Welcome to the GeneNetwork Question and Answer (GNQA)system. We utilize a large language model and 3000 scientific publications to make GNQA a subject matter expert in three areas: <b><a href="/">GeneNetwork.org</a></b>, <b>genomics/genetics with regards to diabetes</b> and <b>genomics/genetics with regards to agin.</b>.
+ </p>
+ <p>
+ At the moment when you ask GNQA something it will attempt to return a sensible answer with <q>real</q> references. To this end we aim to reduce hallucinations and provide a knowledge launchpad for a researcher to enhance their knowledge on the relevant subject matter.
+ </p>
+ <p>GNQA is not a finished product as we are working diligently to improve it daily.</p>
+ <p>
+ <b>Thanks for using GNQA!</b>
+ </p>
+ </div>
+ </div>
+ {% endif %}
+ </article>
+ </section>
+ {% endblock %}
+ {% block js %}
+ <script src="{{ url_for('js', filename='jquery/jquery.min.js') }}" type="text/javascript"></script>
+ <script src="{{ url_for('js', filename='jquery-ui/jquery-ui.min.js') }}" type="text/javascript"></script>
+ <script src="{{ url_for('js', filename='htmx.min.js') }}" type="text/javascript" ></script>
+ <script type="text/javascript">
+document.addEventListener('DOMContentLoaded', function() {
+ $('footer').hide()
+});
+ </script>
+ {% endblock %}
diff --git a/gn2/wqflask/templates/gnqa_answer.html b/gn2/wqflask/templates/gnqa_answer.html
index e2e39956..2e182375 100644
--- a/gn2/wqflask/templates/gnqa_answer.html
+++ b/gn2/wqflask/templates/gnqa_answer.html
@@ -1,15 +1,3 @@
-{% extends "base.html" %}
-
-{% block css %}
-<style>
-.linux-libertine-font{
- font-family: 'Linux Libertine','Georgia','Times','Source Serif Pro', 'serif'
-}
-</style>
-{% endblock %}
-
-{% block content %}
-<br/>
<section class="container-fluid answers gnqa-copy">
<div class="row container gnqa-answer" style="margin-bottom: 1em">
<p class="row lead">
@@ -155,9 +143,9 @@
</div>
</div>
</section>
-{% endblock %}
-{% block js %}
- <script>
+
+<script>
+$(document).ready(function() {
function updateRatingHandler(target, responseObj, args){
let {status, response} = responseObj.xhr
if (status == 200 && args == "upvote"){
@@ -189,5 +177,5 @@ htmx.on("#upvote", "click", function(evt){
handler: (target, obj)=> updateRatingHandler(target,obj, "downvote"),
swap:"innerHTML",
values: {'query': query, 'answer': answer}})});
- </script>
-{% endblock %}
+})
+</script>
diff --git a/gn2/wqflask/templates/gsearch_gene.html b/gn2/wqflask/templates/gsearch_gene.html
index 091cc435..80ed8b47 100644
--- a/gn2/wqflask/templates/gsearch_gene.html
+++ b/gn2/wqflask/templates/gsearch_gene.html
@@ -16,8 +16,14 @@
</h3>
</div>
+
+ {% if do_ai_search %}
<div class="row" id="ai_result">
+ <div class="text-center" id="spinner">
+ <i class="fa fa-spinner fa-spin fa-3x"></i>
+ </div>
</div>
+ {% endif %}
<p>To study a record, click on its Record ID below.<br />Check records below and click Add button to add to selection.</p>
<div>
@@ -306,6 +312,9 @@
success: function(result) {
let ai_div = ai_content_div(result.search_term, result.search_result, result.search_url)
$("#ai_result").append(ai_div);
+ },
+ complete: function() {
+ $("#spinner").hide();
}
})
})
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py
index e695b0d8..aaf40d41 100644
--- a/gn2/wqflask/views.py
+++ b/gn2/wqflask/views.py
@@ -324,7 +324,7 @@ def gnqna():
"search_url": f"/gnqna?{safe_query}",
}
return jsonify(ai_result)
- return render_template("gnqa_answer.html", **search_result)
+ return render_template("gnqa.html", **search_result)
else:
return render_template("gnqa.html")
if request.method == "POST":