aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorJohn Nduli2024-10-31 16:50:30 +0300
committerBonfaceKilz2024-11-04 12:22:43 +0300
commit992bdc78601183a71a240ccae8bd8c701d201266 (patch)
treee4f689ce4bbd714e7d4d44dc89de65cafce06e18 /gn2/wqflask
parent4b72138a541eec9dad101d42da2bba54e8e357fa (diff)
downloadgenenetwork2-992bdc78601183a71a240ccae8bd8c701d201266.tar.gz
fix: correct use of AI_SEARCH_ENABLED flag
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/templates/gsearch_gene.html25
-rw-r--r--gn2/wqflask/views.py9
2 files changed, 19 insertions, 15 deletions
diff --git a/gn2/wqflask/templates/gsearch_gene.html b/gn2/wqflask/templates/gsearch_gene.html
index 33d12cfc..35c39a3c 100644
--- a/gn2/wqflask/templates/gsearch_gene.html
+++ b/gn2/wqflask/templates/gsearch_gene.html
@@ -15,19 +15,20 @@
</h3>
</div>
-
- {% if do_ai_search %}
- <div class="row" id="ai_result_info">
- <div class="text-center" id="spinner">
- <i class="fa fa-spinner fa-spin fa-3x"></i>
+ {% if ai_search_enabled %}
+ {% if do_ai_search %}
+ <div class="row" id="ai_result_info">
+ <div class="text-center" id="spinner">
+ <i class="fa fa-spinner fa-spin fa-3x"></i>
+ </div>
</div>
- </div>
- {% else %}
- <div class="row" id="ai_result_info">
- <div class="col-sm-6">
- <div class="alert alert-warning">Please login to view LLM summary context</div>
+ {% else %}
+ <div class="row" id="ai_result_info">
+ <div class="col-sm-6">
+ <div class="alert alert-warning">Please login to view AI generated summary</div>
+ </div>
</div>
- </div>
+ {% endif %}
{% 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>
@@ -283,7 +284,7 @@
});
</script>
- {% if do_ai_search %}
+ {% if ai_search_enabled and do_ai_search %}
<script type='text/javascript'>
function ai_content_div(search_term, search_result, search_uri) {
let header_length = 40;
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py
index ab151c59..16c95ca7 100644
--- a/gn2/wqflask/views.py
+++ b/gn2/wqflask/views.py
@@ -248,10 +248,13 @@ def gsearchact():
search_type = request.args["type"]
is_user_logged_in = session_info().get("user", {}).get("logged_in", False)
- do_ai_search = current_app.config.get(
- "AI_SEARCH_ENABLED") and is_user_logged_in
+ ai_search_enabled = current_app.config.get("AI_SEARCH_ENABLED")
+ do_ai_search = ai_search_enabled and is_user_logged_in
if search_type == "gene":
- return render_template("gsearch_gene.html", **result, do_ai_search=do_ai_search, result=result)
+ return render_template("gsearch_gene.html", **result,
+ ai_search_enabled=ai_search_enabled,
+ do_ai_search=do_ai_search,
+ result=result)
elif search_type == "phenotype":
return render_template("gsearch_pheno.html", **result)