Spaces:
Sleeping
Sleeping
Upload 16 files
Browse files- ui/layouts.py +24 -12
ui/layouts.py
CHANGED
|
@@ -59,32 +59,44 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
|
|
| 59 |
seismo_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
|
| 60 |
|
| 61 |
with gr.TabItem("🤖 AI 課程助教"):
|
| 62 |
-
# Use gr.Group for backward compatibility with older Gradio versions
|
| 63 |
with gr.Group():
|
| 64 |
-
gr.Markdown("### 🤖 AI 課程助教 (
|
|
|
|
|
|
|
| 65 |
gr.Markdown("""
|
| 66 |
-
歡迎使用課程 AI
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
-
|
| 71 |
-
-
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
""")
|
| 75 |
|
| 76 |
custom_textbox = gr.Textbox(
|
| 77 |
-
placeholder="
|
| 78 |
show_label=False,
|
| 79 |
-
container=False,
|
| 80 |
)
|
| 81 |
|
| 82 |
gr.ChatInterface(
|
| 83 |
callbacks.ai_chatbot_with_kb,
|
| 84 |
chatbot=gr.Chatbot(height=450, type="messages", avatar_images=(None, "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png")),
|
| 85 |
title="課程AI助教",
|
| 86 |
-
description="
|
| 87 |
-
textbox=custom_textbox,
|
| 88 |
)
|
| 89 |
|
| 90 |
# --- Connect Buttons to Backend Functions ---
|
|
|
|
| 59 |
seismo_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
|
| 60 |
|
| 61 |
with gr.TabItem("🤖 AI 課程助教"):
|
|
|
|
| 62 |
with gr.Group():
|
| 63 |
+
gr.Markdown("### 🤖 AI 課程助教 (知識庫 & 即時資訊強化版)")
|
| 64 |
+
|
| 65 |
+
# --- ✨ REWRITTEN DESCRIPTION ---
|
| 66 |
gr.Markdown("""
|
| 67 |
+
歡迎使用課程 AI 助教!我整合了靜態的課程知識與多種即時資訊來源,您可以隨時向我提問。
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
|
| 71 |
+
#### 📚 **課程知識庫**
|
| 72 |
+
我可以回答關於本課程的各種問題,試著問我:
|
| 73 |
+
- **課程資訊**:`「這門課的評分標準是什麼?」` 或 `「期末專題有什麼建議主題?」`
|
| 74 |
+
- **技術工具**:`「什麼是版本控制?」` 或 `「Colab 和 Codespaces 有什麼差別?」`
|
| 75 |
+
- **地球物理**:`「解釋一下什麼是折射震測」` 或 `「地熱發電有什麼優點?」`
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
|
| 79 |
+
#### ⚡ **即時資訊查詢**
|
| 80 |
+
我還能幫您查詢最新的動態資訊,試著問我:
|
| 81 |
+
- **📰 今日新聞**:`「今天有什麼重要新聞?」`
|
| 82 |
+
- **🚨 地震報告**:`「最新的 CWA 顯著地震報告」` 或 `「最近全球有哪些大地震?」`
|
| 83 |
+
- **📢 災害預警**:`「現在有地震預警嗎?」` 或 `「最新的 PWS 地震警報」`
|
| 84 |
+
|
| 85 |
+
我能理解部分錯別字或不完全精確的提問,請隨意發問!
|
| 86 |
""")
|
| 87 |
|
| 88 |
custom_textbox = gr.Textbox(
|
| 89 |
+
placeholder="對課程有什麼問題嗎?或查詢即時資訊...",
|
| 90 |
show_label=False,
|
| 91 |
+
container=False,
|
| 92 |
)
|
| 93 |
|
| 94 |
gr.ChatInterface(
|
| 95 |
callbacks.ai_chatbot_with_kb,
|
| 96 |
chatbot=gr.Chatbot(height=450, type="messages", avatar_images=(None, "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png")),
|
| 97 |
title="課程AI助教",
|
| 98 |
+
description="由結構化知識庫與即時工具驅動的問答機器人",
|
| 99 |
+
textbox=custom_textbox,
|
| 100 |
)
|
| 101 |
|
| 102 |
# --- Connect Buttons to Backend Functions ---
|