Update config.py
Browse files
config.py
CHANGED
|
@@ -4,14 +4,14 @@
|
|
| 4 |
|
| 5 |
# ==== Model & Limits ====
|
| 6 |
# GEMINI_API_KEY 放在 Hugging Face Spaces 的 Secrets
|
| 7 |
-
MODEL = "gemini-1.5-flash" #
|
| 8 |
-
MAX_TOKENS = 8192 #
|
| 9 |
|
| 10 |
# ==== External Endpoints ====
|
| 11 |
SEARXNG_ENDPOINT = "https://searx.stream/search" # See https://searx.space
|
| 12 |
BAIDU_ENDPOINT = "https://www.baidu.com/s"
|
| 13 |
READER_ENDPOINT = "https://r.jina.ai/"
|
| 14 |
-
REQUEST_TIMEOUT = 300 # 5
|
| 15 |
|
| 16 |
# ==== Agent Rules ====
|
| 17 |
INSTRUCTIONS_START = """
|
|
@@ -67,12 +67,63 @@ STYLE_TAGS = {
|
|
| 67 |
"落地實作": "Include a ready-to-run snippet or command block with validation steps."
|
| 68 |
}
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
<
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
"""
|
|
|
|
| 4 |
|
| 5 |
# ==== Model & Limits ====
|
| 6 |
# GEMINI_API_KEY 放在 Hugging Face Spaces 的 Secrets
|
| 7 |
+
MODEL = "gemini-1.5-flash" # 若要更強推理可改 "gemini-1.5-pro"
|
| 8 |
+
MAX_TOKENS = 8192 # 單次輸出上限
|
| 9 |
|
| 10 |
# ==== External Endpoints ====
|
| 11 |
SEARXNG_ENDPOINT = "https://searx.stream/search" # See https://searx.space
|
| 12 |
BAIDU_ENDPOINT = "https://www.baidu.com/s"
|
| 13 |
READER_ENDPOINT = "https://r.jina.ai/"
|
| 14 |
+
REQUEST_TIMEOUT = 300 # 5 分鐘
|
| 15 |
|
| 16 |
# ==== Agent Rules ====
|
| 17 |
INSTRUCTIONS_START = """
|
|
|
|
| 67 |
"落地實作": "Include a ready-to-run snippet or command block with validation steps."
|
| 68 |
}
|
| 69 |
|
| 70 |
+
# ==== Sidebar HTML Description ====
|
| 71 |
+
DESCRIPTION = r"""
|
| 72 |
+
<style>
|
| 73 |
+
.sbx { font-family: ui-sans-serif, system-ui, "Noto Sans TC", "Segoe UI", Roboto, Helvetica, Arial; }
|
| 74 |
+
.bx { background: #0f172a; color: #e2e8f0; border-radius: 14px; padding: 16px; box-shadow: 0 6px 18px rgba(2,6,23,.35); }
|
| 75 |
+
.k { display:inline-block; padding:2px 8px; border-radius:8px; background:#1e293b; color:#a5b4fc; font-weight:600; }
|
| 76 |
+
.tag{ display:inline-block; padding:2px 8px; border-radius:8px; background:#0ea5e9; color:#0b1020; margin-right:4px; font-weight:700; }
|
| 77 |
+
.pill{ display:inline-block; padding:6px 10px; border-radius:999px; background:#1f2937; color:#d1d5db; margin:4px 6px 0 0; font-size:12px; font-weight:600; }
|
| 78 |
+
.grid { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
|
| 79 |
+
.ok { color:#34d399; font-weight:700; }
|
| 80 |
+
.muted{ color:#94a3b8; }
|
| 81 |
+
</style>
|
| 82 |
+
|
| 83 |
+
<div class="sbx">
|
| 84 |
+
<div class="bx">
|
| 85 |
+
<h2>🔎 SearchGPT · <span class="ok">Gemini</span> 研究助理</h2>
|
| 86 |
+
<p class="muted">即時搜尋、URL 擷取、≥3 來源交叉驗證,輸出結構化、可引用的專業摘要。</p>
|
| 87 |
+
|
| 88 |
+
<div class="grid" style="margin-top:10px;">
|
| 89 |
+
<div>
|
| 90 |
+
<h4>🚀 快速指令 <span class="k">#commands</span></h4>
|
| 91 |
+
<div class="pill">#news</div>
|
| 92 |
+
<div class="pill">#papers</div>
|
| 93 |
+
<div class="pill">#compare</div>
|
| 94 |
+
<div class="pill">#howto</div>
|
| 95 |
+
<div class="pill">#timeline</div>
|
| 96 |
+
<div class="pill">#faq</div>
|
| 97 |
+
<div class="pill">#earthquakes</div>
|
| 98 |
+
<p class="muted" style="margin-top:8px;">例:<code>#news P-wave picking with AI</code></p>
|
| 99 |
+
</div>
|
| 100 |
+
<div>
|
| 101 |
+
<h4>🎨 風格標籤 <span class="k">[tags]</span></h4>
|
| 102 |
+
<div class="pill">[簡報]</div>
|
| 103 |
+
<div class="pill">[講義]</div>
|
| 104 |
+
<div class="pill">[條列]</div>
|
| 105 |
+
<div class="pill">[表格]</div>
|
| 106 |
+
<div class="pill">[中英對照]</div>
|
| 107 |
+
<div class="pill">[落地實作]</div>
|
| 108 |
+
<p class="muted" style="margin-top:8px;">可混搭:<code>#papers … [表格][中英對照]</code></p>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<div style="margin-top:10px;">
|
| 113 |
+
<span class="tag">depth:N</span> 控制研究深度(1–5)
|
| 114 |
+
<span class="tag">creative!</span> 提升創意度
|
| 115 |
+
</div>
|
| 116 |
+
|
| 117 |
+
<hr style="border-color:#1f2937; margin:16px 0;">
|
| 118 |
+
|
| 119 |
+
<h4>🧭 使用建議</h4>
|
| 120 |
+
<ul>
|
| 121 |
+
<li>加入關鍵詞、時間範圍與地區,例如:<code>#news Taiwan EEW 2024–2025</code></li>
|
| 122 |
+
<li>需要課堂產出?加上 <code>[簡報]</code> 或 <code>[講義]</code>。</li>
|
| 123 |
+
<li>要中文/英文雙語,使用 <code>[中英對照]</code>。</li>
|
| 124 |
+
</ul>
|
| 125 |
+
|
| 126 |
+
<p class="muted">點選側欄下方的「示例」按鈕,會把文字自動填到輸入框;檢查後按 <b>Enter</b> 送出。</p>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
"""
|