Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -293,7 +293,19 @@ with gr.Blocks(theme=gr.themes.Soft(), title="💬 Level 0 IT Support Chatbot")
|
|
293 |
global chat_history
|
294 |
dense_retriever.similarity_top_k = k
|
295 |
bm25_retriever.similarity_top_k = k
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
ctx_text = "\n\n---\n\n".join([
|
298 |
f"**Source {i+1} (Score: {node.score:.4f})**\n{node.text}"
|
299 |
for i, node in enumerate(context_nodes)
|
|
|
293 |
global chat_history
|
294 |
dense_retriever.similarity_top_k = k
|
295 |
bm25_retriever.similarity_top_k = k
|
296 |
+
|
297 |
+
# Call the chat function and get its return value
|
298 |
+
chat_result = chat(message, temperature=temp, top_p=top_p)
|
299 |
+
|
300 |
+
# Check if the result is a tuple (the RAG case) or a single string
|
301 |
+
if isinstance(chat_result, tuple) and len(chat_result) == 2:
|
302 |
+
reply, context_nodes = chat_result
|
303 |
+
else:
|
304 |
+
# This handles the greeting and clarification cases
|
305 |
+
reply = chat_result
|
306 |
+
context_nodes = [] # Set context_nodes to an empty list
|
307 |
+
|
308 |
+
# This part of the code remains the same
|
309 |
ctx_text = "\n\n---\n\n".join([
|
310 |
f"**Source {i+1} (Score: {node.score:.4f})**\n{node.text}"
|
311 |
for i, node in enumerate(context_nodes)
|