Spaces:
Runtime error
Runtime error
Commit
·
53e540a
1
Parent(s):
2d57076
Update app.py
Browse files
app.py
CHANGED
|
@@ -160,8 +160,8 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
|
|
| 160 |
# new_docsearch = pickle.load(f)
|
| 161 |
|
| 162 |
docsearch = FAISS.from_texts(texts, embeddings)
|
| 163 |
-
|
| 164 |
-
|
| 165 |
docs = docsearch.similarity_search(query)
|
| 166 |
#print(docs[0].page_content)
|
| 167 |
|
|
@@ -189,9 +189,9 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
|
|
| 189 |
|
| 190 |
total_tokens_used_msg = f"Total tokens used: {state['total_tokens']}"
|
| 191 |
|
| 192 |
-
|
| 193 |
|
| 194 |
-
chat_messages = [(history[-2]['content'], history[-1]['content'])]
|
| 195 |
|
| 196 |
return '', chat_messages, total_tokens_used_msg, state
|
| 197 |
|
|
|
|
| 160 |
# new_docsearch = pickle.load(f)
|
| 161 |
|
| 162 |
docsearch = FAISS.from_texts(texts, embeddings)
|
| 163 |
+
query = str(system_prompt + history[-context_length*2:] + [prompt_msg])
|
| 164 |
+
|
| 165 |
docs = docsearch.similarity_search(query)
|
| 166 |
#print(docs[0].page_content)
|
| 167 |
|
|
|
|
| 189 |
|
| 190 |
total_tokens_used_msg = f"Total tokens used: {state['total_tokens']}"
|
| 191 |
|
| 192 |
+
chat_messages = [(history[i]['content'], history[i+1]['content']) for i in range(0, len(history)-1, 2)]
|
| 193 |
|
| 194 |
+
#chat_messages = [(history[-2]['content'], history[-1]['content'])]
|
| 195 |
|
| 196 |
return '', chat_messages, total_tokens_used_msg, state
|
| 197 |
|