Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -96,10 +96,10 @@ def generate_response(
|
|
| 96 |
# If file content exists, add it to the last user message
|
| 97 |
#if files:
|
| 98 |
file_contents = []
|
| 99 |
-
for file in files:
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
if file_contents:
|
| 104 |
if formatted_history and formatted_history[-1]["role"] == "user":
|
| 105 |
formatted_history[-1]["content"] += "\n\n" + "\n\n".join(file_contents)
|
|
@@ -124,7 +124,7 @@ def generate_response(
|
|
| 124 |
stream=True
|
| 125 |
)
|
| 126 |
|
| 127 |
-
st.write(pdf_text)
|
| 128 |
for chunk in stream:
|
| 129 |
if hasattr(chunk.choices[0].delta, 'content') and chunk.choices[0].delta.content:
|
| 130 |
yield chunk.choices[0].delta.content
|
|
|
|
| 96 |
# If file content exists, add it to the last user message
|
| 97 |
#if files:
|
| 98 |
file_contents = []
|
| 99 |
+
#for file in files:
|
| 100 |
+
content = pdf_text # process_file(file)
|
| 101 |
+
if content:
|
| 102 |
+
file_contents.append(f"File content:\n{content}")
|
| 103 |
if file_contents:
|
| 104 |
if formatted_history and formatted_history[-1]["role"] == "user":
|
| 105 |
formatted_history[-1]["content"] += "\n\n" + "\n\n".join(file_contents)
|
|
|
|
| 124 |
stream=True
|
| 125 |
)
|
| 126 |
|
| 127 |
+
#st.write(pdf_text)
|
| 128 |
for chunk in stream:
|
| 129 |
if hasattr(chunk.choices[0].delta, 'content') and chunk.choices[0].delta.content:
|
| 130 |
yield chunk.choices[0].delta.content
|