diff --git a/application/app.py b/application/app.py index 847f189..b49ae9c 100644 --- a/application/app.py +++ b/application/app.py @@ -44,15 +44,12 @@ def api_answer(): vectorstore = "vectors/" + data["active_docs"] if data['active_docs'] == "default": vectorstore = "" - else: vectorstore = "" - # loading the index and the store and the prompt template index = faiss.read_index(f"{vectorstore}docs.index") - with open(f"{vectorstore}faiss_store.pkl", "rb") as f: store = pickle.load(f) @@ -72,8 +69,6 @@ def api_answer(): # "answer": "The answer is 42", # "sources": ["https://en.wikipedia.org/wiki/42_(number)", "https://en.wikipedia.org/wiki/42_(number)"] # } - - return result @app.route("/api/docs_check", methods=["POST"]) diff --git a/application/static/src/chat.js b/application/static/src/chat.js index 862aba3..832b8e2 100644 --- a/application/static/src/chat.js +++ b/application/static/src/chat.js @@ -13,6 +13,9 @@ if (el) { document.getElementById("message-input").value = ""; document.getElementById("button-submit").innerHTML = ' Thinking...'; document.getElementById("button-submit").disabled = true; + if (localStorage.getItem('activeDocs') == null) { + localStorage.setItem('activeDocs', 'default') + } fetch('/api/answer', { method: 'POST', @@ -22,7 +25,7 @@ if (el) { body: JSON.stringify({question: message, api_key: localStorage.getItem('apiKey'), - active_docs: localStorage.getItem('activeDocs'),}), + active_docs: localStorage.getItem('activeDocs')}), }) .then(response => response.json()) .then(data => {