Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -134,7 +134,11 @@ async def chat(request: ChatRequest):
|
|
134 |
|
135 |
# Invoke the QA chain with the user question
|
136 |
result = qa.invoke(input=request.question)
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
|
139 |
if not answer or "The information is not available in the provided context" in answer:
|
140 |
answer = "I'm sorry, I couldn't find relevant information for your query. Please try rephrasing or providing more details."
|
|
|
134 |
|
135 |
# Invoke the QA chain with the user question
|
136 |
result = qa.invoke(input=request.question)
|
137 |
+
if isinstance(result, dict) and "answer" in result:
|
138 |
+
answer = result["answer"]
|
139 |
+
else:
|
140 |
+
answer = "I'm sorry, I couldn't find relevant information for your query."
|
141 |
+
|
142 |
|
143 |
if not answer or "The information is not available in the provided context" in answer:
|
144 |
answer = "I'm sorry, I couldn't find relevant information for your query. Please try rephrasing or providing more details."
|