Spaces:
Sleeping
Sleeping
Commit ·
bf671c6
1
Parent(s): ae52c57
debug
Browse files
app.py
CHANGED
|
@@ -95,10 +95,13 @@ def build_qwen_prompt(context: str, user_question: str) -> str:
|
|
| 95 |
# ---------- 4. Gradio playground ------------------------------------------
|
| 96 |
def store_doc(doc_text: str, user_id="demo"):
|
| 97 |
"""UI callback: take the textbox content and shove it into the KB."""
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
def answer(question: str, user_id="demo", history="None"):
|
| 104 |
"""UI callback: retrieve, build prompt with Qwen tags, generate answer."""
|
|
|
|
| 95 |
# ---------- 4. Gradio playground ------------------------------------------
|
| 96 |
def store_doc(doc_text: str, user_id="demo"):
|
| 97 |
"""UI callback: take the textbox content and shove it into the KB."""
|
| 98 |
+
try:
|
| 99 |
+
n = add_docs(user_id, [doc_text])
|
| 100 |
+
if n == 0:
|
| 101 |
+
return "Nothing stored (empty input)."
|
| 102 |
+
return f"Stored — KB now has {len(kb[user_id]['texts'])} passage(s)."
|
| 103 |
+
except Exception as e:
|
| 104 |
+
return f"Error during storing: {e}"
|
| 105 |
|
| 106 |
def answer(question: str, user_id="demo", history="None"):
|
| 107 |
"""UI callback: retrieve, build prompt with Qwen tags, generate answer."""
|