Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -826,13 +826,13 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
|
|
826 |
|
827 |
if selected_document is not None:
|
828 |
# Remove the "/home/user/app/" part from the document name
|
829 |
-
modified_source = selected_document.metadata['source'].replace('/home/user/app/', '')
|
830 |
-
source_info = f"\n**
|
831 |
else:
|
832 |
source_info = "Primary source document: not determined"
|
833 |
|
834 |
#chat_messages = [(prompt_msg['content'], completion['content'])]
|
835 |
-
chat_messages = [(prompt, completion['content']['answer'] +
|
836 |
return '', chat_messages, state # total_tokens_used_msg,
|
837 |
|
838 |
|
|
|
826 |
|
827 |
if selected_document is not None:
|
828 |
# Remove the "/home/user/app/" part from the document name
|
829 |
+
modified_source = selected_document.metadata['source'].replace('/home/user/app/', '').replace('.pdf', '')
|
830 |
+
source_info = f"\n**Leading source:** {modified_source}, **Page:** {selected_document.metadata['page']}"
|
831 |
else:
|
832 |
source_info = "Primary source document: not determined"
|
833 |
|
834 |
#chat_messages = [(prompt_msg['content'], completion['content'])]
|
835 |
+
chat_messages = [(prompt, completion['content']['answer'] + source_info )]
|
836 |
return '', chat_messages, state # total_tokens_used_msg,
|
837 |
|
838 |
|