fixed app.py
Browse files
app.py
CHANGED
|
@@ -71,6 +71,13 @@ def respond(
|
|
| 71 |
response += delta
|
| 72 |
yield response
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
# ========== Gradio ChatInterface with extra sidebar inputs ==========
|
| 76 |
chatbot = gr.ChatInterface(
|
|
@@ -89,9 +96,9 @@ chatbot = gr.ChatInterface(
|
|
| 89 |
),
|
| 90 |
],
|
| 91 |
examples=[
|
| 92 |
-
["
|
| 93 |
-
["
|
| 94 |
-
["
|
| 95 |
],
|
| 96 |
description="输入你关于BangDream的问题,邦学家会基于资料库为你检索并作答",
|
| 97 |
title="Dr-Bang RAG QA Chatbot"
|
|
|
|
| 71 |
response += delta
|
| 72 |
yield response
|
| 73 |
|
| 74 |
+
print("\n=== Answer ===")
|
| 75 |
+
print(response)
|
| 76 |
+
print("\n=== retrieved documents ===")
|
| 77 |
+
for idx, (context, score, meta) in enumerate(expanded_results, 1):
|
| 78 |
+
print(f"\n--- document {idx} (Score={score:.4f}) ---\n{context[:200]}...")
|
| 79 |
+
print(meta)
|
| 80 |
+
|
| 81 |
|
| 82 |
# ========== Gradio ChatInterface with extra sidebar inputs ==========
|
| 83 |
chatbot = gr.ChatInterface(
|
|
|
|
| 96 |
),
|
| 97 |
],
|
| 98 |
examples=[
|
| 99 |
+
["乐奈喜欢什么?"],
|
| 100 |
+
["在水族馆里爱音和灯发生了什么?"],
|
| 101 |
+
["RAS的目标是什么?"],
|
| 102 |
],
|
| 103 |
description="输入你关于BangDream的问题,邦学家会基于资料库为你检索并作答",
|
| 104 |
title="Dr-Bang RAG QA Chatbot"
|