MarshallCN
commited on
Commit
·
fc4713d
1
Parent(s):
90e1b1d
set RAG default as False
Browse files
app.py
CHANGED
|
@@ -43,9 +43,8 @@ from utils import mk_msg_dir, _as_dir, persist_messages
|
|
| 43 |
|
| 44 |
# ===================== Paths & Constants =====================
|
| 45 |
assistant_name = "Nova"
|
| 46 |
-
user_name = "Marshall"
|
| 47 |
persona = (
|
| 48 |
-
f"Your name is {assistant_name}.
|
| 49 |
f"put code in fenced blocks with a language tag."
|
| 50 |
).strip()
|
| 51 |
|
|
@@ -542,8 +541,8 @@ with gr.Blocks(title="Qwen Chat with RAG (CPU Space)") as demo:
|
|
| 542 |
top_p = gr.Slider(0.1, 1.0, value=0.95, step=0.01, label="top_p")
|
| 543 |
max_new_tokens = gr.Slider(16, 512, value=256, step=16, label="max_new_tokens")
|
| 544 |
repetition_penalty = gr.Slider(1.0, 2.0, value=1.07, step=0.01, label="repetition_penalty")
|
| 545 |
-
with gr.Accordion("RAG settings", open=
|
| 546 |
-
use_rag = gr.Checkbox(value=
|
| 547 |
db_selector = gr.Dropdown(label="Vector DB", choices=list_vector_dbs(), value="<New Vector DB>")
|
| 548 |
top_k = gr.Slider(1, 20, value=DEFAULT_TOPK, step=1, label="Retrieve top‑k")
|
| 549 |
rerank_take = gr.Slider(1, 10, value=DEFAULT_RERANK_TAKE, step=1, label="Rerank keep (Top‑N)")
|
|
@@ -553,14 +552,14 @@ with gr.Blocks(title="Qwen Chat with RAG (CPU Space)") as demo:
|
|
| 553 |
add_btn = gr.Button("📚 Add to Vector DB")
|
| 554 |
|
| 555 |
session_list = gr.Radio(choices=[], value=None, label="Conversations", interactive=True)
|
| 556 |
-
new_btn = gr.Button("New
|
| 557 |
-
del_btn = gr.Button("Delete
|
| 558 |
dl_btn = gr.Button("Download JSON", variant="secondary")
|
| 559 |
dl_file = gr.File(label="", interactive=False, visible=False)
|
| 560 |
|
| 561 |
with gr.Column(scale=9):
|
| 562 |
chat = gr.Chatbot(label="Chat", height=560, render_markdown=True, type="messages")
|
| 563 |
-
rag_ctx = gr.Textbox(label="📄 RAG context (Top‑N)", lines=8, interactive=False, show_copy_button=True)
|
| 564 |
user_box = gr.Textbox(label="Your message", placeholder="Type and press Enter…", autofocus=True)
|
| 565 |
send = gr.Button("Send", variant="primary")
|
| 566 |
|
|
|
|
| 43 |
|
| 44 |
# ===================== Paths & Constants =====================
|
| 45 |
assistant_name = "Nova"
|
|
|
|
| 46 |
persona = (
|
| 47 |
+
f"Your name is {assistant_name}. Use Markdown; "
|
| 48 |
f"put code in fenced blocks with a language tag."
|
| 49 |
).strip()
|
| 50 |
|
|
|
|
| 541 |
top_p = gr.Slider(0.1, 1.0, value=0.95, step=0.01, label="top_p")
|
| 542 |
max_new_tokens = gr.Slider(16, 512, value=256, step=16, label="max_new_tokens")
|
| 543 |
repetition_penalty = gr.Slider(1.0, 2.0, value=1.07, step=0.01, label="repetition_penalty")
|
| 544 |
+
with gr.Accordion("RAG settings", open=True):
|
| 545 |
+
use_rag = gr.Checkbox(value=False, label="Use RAG for replies")
|
| 546 |
db_selector = gr.Dropdown(label="Vector DB", choices=list_vector_dbs(), value="<New Vector DB>")
|
| 547 |
top_k = gr.Slider(1, 20, value=DEFAULT_TOPK, step=1, label="Retrieve top‑k")
|
| 548 |
rerank_take = gr.Slider(1, 10, value=DEFAULT_RERANK_TAKE, step=1, label="Rerank keep (Top‑N)")
|
|
|
|
| 552 |
add_btn = gr.Button("📚 Add to Vector DB")
|
| 553 |
|
| 554 |
session_list = gr.Radio(choices=[], value=None, label="Conversations", interactive=True)
|
| 555 |
+
new_btn = gr.Button("New chat", variant="secondary")
|
| 556 |
+
del_btn = gr.Button("Delete chat", variant="stop")
|
| 557 |
dl_btn = gr.Button("Download JSON", variant="secondary")
|
| 558 |
dl_file = gr.File(label="", interactive=False, visible=False)
|
| 559 |
|
| 560 |
with gr.Column(scale=9):
|
| 561 |
chat = gr.Chatbot(label="Chat", height=560, render_markdown=True, type="messages")
|
| 562 |
+
rag_ctx = gr.Textbox(label="📄 RAG context (Top‑N)", lines=8, interactive=False, show_copy_button=True, visible=False)
|
| 563 |
user_box = gr.Textbox(label="Your message", placeholder="Type and press Enter…", autofocus=True)
|
| 564 |
send = gr.Button("Send", variant="primary")
|
| 565 |
|