# SPDX-FileCopyrightText: Hadad # SPDX-License-Identifier: Apache-2.0 # # ==== Model & Limits ==== # GEMINI_API_KEY 放在 Hugging Face Spaces 的 Secrets MODEL = "gemini-1.5-flash" # 若要更強推理可改 "gemini-1.5-pro" MAX_TOKENS = 8192 # 單次輸出上限 # ==== External Endpoints ==== SEARXNG_ENDPOINT = "https://searx.stream/search" # See https://searx.space BAIDU_ENDPOINT = "https://www.baidu.com/s" READER_ENDPOINT = "https://r.jina.ai/" REQUEST_TIMEOUT = 300 # 5 分鐘 # ==== Agent Rules ==== INSTRUCTIONS_START = """ You are ChatGPT (Gemini backend) with mandatory real-time web search, URL content extraction, cross-validation (≥3 credible sources), and professional summarization. Rules: - Always call tools (`web_search`, `read_url`) for every user request. - Do not rely on cached/internal knowledge; verify with tools. - Present clear structure, neutral tone, inline citations/links. - Prefer recent, authoritative sources; highlight disagreements. """ CONTENT_EXTRACTION = """ - Extract critical facts, data, and arguments from retrieved content. - Normalize terminology and emphasize clarity and logic. """ SEARCH_SELECTION = """ - Fetch full content using `read_url` for each top result. - Summarize professionally and list sources with Markdown links. """ INSTRUCTIONS_END = """ Now provide a comprehensive answer based ONLY on tool results. """ # ==== Creative layer: quick commands & styles ==== # #指令(用在訊息開頭),可快速生成任務模板 QUICK_COMMANDS = { "#news": "Find the latest news on: {topic}. Summarize key updates, timelines, stakeholders, and implications. Provide 6–10 bullet points with citations.", "#papers": "Survey recent academic papers about: {topic}. Extract methods, datasets, results, limitations. Provide 5–8 items with links.", "#compare": "Compare {a} vs {b} across capability, latency, cost, ecosystem, constraints. Give a pros/cons table and final recommendation.", "#howto": "Create a practical step-by-step guide for: {topic}, including pitfalls, checks, and quick-start commands.", "#brief": "Give a 5-bullet executive brief on: {topic}, with links for each bullet.", "#timeline": "Build a concise timeline for: {topic}, with dated milestones and sources.", "#faq": "Make a 10-question FAQ for: {topic}, each answer ≤3 sentences with a source.", "#earthquakes": "List earthquakes (Mw >= {mw}) from {start} to {end}, provide a table: time (UTC), region, Mw, depth, link." } # 風格標籤(夾在訊息中,如:[簡報][中英對照]) STYLE_TAGS = { "講義": "Output as a course handout: sections, definitions, examples, and a quick quiz (5 items).", "簡報": "Output as slide bullets: 6–10 concise slides with titles and 3 bullets each.", "條列": "Prefer bullet points over paragraphs; 7–12 bullets.", "表格": "Provide a comparative table first, then analysis.", "中英對照": "Provide bilingual output: Traditional Chinese first, then English line-by-line.", "行動清單": "End with an actionable checklist (5–8 items) prioritized by impact/effort.", "落地實作": "Include a ready-to-run snippet or command block with validation steps." } # ==== Sidebar HTML Description ==== DESCRIPTION = r"""

🔎 SearchGPT · Gemini 研究助理

即時搜尋、URL 擷取、≥3 來源交叉驗證,輸出結構化、可引用的專業摘要。

🚀 快速指令 #commands

#news
#papers
#compare
#howto
#timeline
#faq
#earthquakes

例:#news P-wave picking with AI

🎨 風格標籤 [tags]

[簡報]
[講義]
[條列]
[表格]
[中英對照]
[落地實作]

可混搭:#papers … [表格][中英對照]

depth:N 控制研究深度(1–5)  creative! 提升創意度

🧭 使用建議

  • 加入關鍵詞、時間範圍與地區,例如:#news Taiwan EEW 2024–2025
  • 需要課堂產出?加上 [簡報][講義]
  • 要中文/英文雙語,使用 [中英對照]

點選側欄下方的「示例」按鈕,會把文字自動填到輸入框;檢查後按 Enter 送出。

"""