Commit
·
b3de330
1
Parent(s):
349cde4
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,13 +38,13 @@ class ChatWrapper:
|
|
| 38 |
vectorstore = pickle.load(f)
|
| 39 |
os.environ["OPENAI_API_KEY"] = api_key
|
| 40 |
qa_chain = get_chain(vectorstore)
|
| 41 |
-
chat_history = []
|
| 42 |
print("Chat with your docs!")
|
| 43 |
while True:
|
| 44 |
print("Human:")
|
|
|
|
| 45 |
import openai
|
| 46 |
openai.api_key = api_key
|
| 47 |
-
output = qa_chain({"question": inp, "chat_history": history})
|
| 48 |
history.append((inp, output))
|
| 49 |
print("AI:")
|
| 50 |
print(output["answer"])
|
|
|
|
| 38 |
vectorstore = pickle.load(f)
|
| 39 |
os.environ["OPENAI_API_KEY"] = api_key
|
| 40 |
qa_chain = get_chain(vectorstore)
|
|
|
|
| 41 |
print("Chat with your docs!")
|
| 42 |
while True:
|
| 43 |
print("Human:")
|
| 44 |
+
history = history or []
|
| 45 |
import openai
|
| 46 |
openai.api_key = api_key
|
| 47 |
+
output = qa_chain({"question": inp, "chat_history": history})["answer"]
|
| 48 |
history.append((inp, output))
|
| 49 |
print("AI:")
|
| 50 |
print(output["answer"])
|