An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Support DeepSeek Search and Fetch APIs for agents https://github.com/siyuan-note/siyuan/issues/20659
Danielf10bdb894bc7
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.jsonindex cad6f4a1bb..bcfa76fa5b 100644--- a/app/appearance/langs/ar.json+++ b/app/appearance/langs/ar.json@@ -1,4 +1,12 @@{+ "aiWebTools": "البحث في الويب وجلب الصفحات",+ "aiWebSearchProvider": "مزود البحث",+ "aiWebSearchProviderTip": "يعيد DeepSeek خمسة ملخصات؛ اجلب الصفحات عند الحاجة إلى المحتوى الكامل",+ "aiWebFetchProvider": "مزود الجلب",+ "aiWebFetchProviderTip": "يجلب DeepSeek محتوى الصفحات فقط؛ ويدعم الجلب المباشر تنزيل الملفات أيضًا",+ "aiWebFetchDirect": "الجلب المباشر",+ "aiWebDeepSeekKey": "مفتاح API لـ DeepSeek",+ "aiWebDeepSeekKeyTip": "مشترك بين Search وFetch؛ تُرسل الاستعلامات وعناوين URL المستهدفة إلى DeepSeek وتُحسب الرسوم لكل طلب","automationCollectionReview": "مراجعة الإدخالات المجمعة","automationCollectionCleanup": "إزالة الإدخالات غير المطابقة في هذه الصفحة","automationCollectionReviewTip": "تُفحص جميع قواعد جمع الكتل المفعّلة؛ تكفي مطابقة قاعدة واحدة للاحتفاظ بالإدخال. تُفحص الروابط اليدوية والتلقائية بالتساوي، وتُحفظ الإدخالات غير المرتبطة أو غير المحددة",diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.jsonindex 6b3f2a6e7b..5f5372d06e 100644--- a/app/appearance/langs/de.json+++ b/app/appearance/langs/de.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Websuche und Seitenabruf",+ "aiWebSearchProvider": "Suchanbieter",+ "aiWebSearchProviderTip": "DeepSeek liefert 5 Zusammenfassungen; bei Bedarf den vollständigen Seiteninhalt abrufen",+ "aiWebFetchProvider": "Abrufanbieter",+ "aiWebFetchProviderTip": "DeepSeek ruft nur Seiteninhalte ab; der direkte Abruf lädt auch Dateien herunter",+ "aiWebFetchDirect": "Direkter Abruf",+ "aiWebDeepSeekKey": "DeepSeek-API-Schlüssel",+ "aiWebDeepSeekKeyTip": "Für Search und Fetch gemeinsam; Suchanfragen und Ziel-URLs werden an DeepSeek gesendet und Anfragen abgerechnet","automationCollectionReview": "Gesammelte Einträge prüfen","automationCollectionCleanup": "Nicht passende Einträge dieser Seite entfernen","automationCollectionReviewTip": "Alle aktiven Blocksammelregeln prüfen; ein Treffer genügt zum Behalten. Manuelle und automatische Bindungen werden gleich geprüft; ungebundene oder unbestimmbare Einträge bleiben erhalten",diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.jsonindex 300dc0d013..3bd501d718 100644--- a/app/appearance/langs/en.json+++ b/app/appearance/langs/en.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Web search and fetch",+ "aiWebSearchProvider": "Search provider",+ "aiWebSearchProviderTip": "DeepSeek returns 5 summaries; fetch pages when full content is needed",+ "aiWebFetchProvider": "Fetch provider",+ "aiWebFetchProviderTip": "DeepSeek retrieves page content only; direct fetch also downloads files",+ "aiWebFetchDirect": "Direct fetch",+ "aiWebDeepSeekKey": "DeepSeek API Key",+ "aiWebDeepSeekKeyTip": "Shared by Search and Fetch; queries and target URLs are sent to DeepSeek and requests are billed","automationCollectionReview": "Review collected entries","automationCollectionCleanup": "Remove unmatched entries on this page","automationCollectionReviewTip": "Check all enabled block collection rules; a match with any rule keeps the entry. Manual and automatic bindings are checked equally; detached or indeterminate entries are kept",diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.jsonindex 692a667d97..bb8fe4409b 100644--- a/app/appearance/langs/es.json+++ b/app/appearance/langs/es.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Búsqueda y obtención web",+ "aiWebSearchProvider": "Proveedor de búsqueda",+ "aiWebSearchProviderTip": "DeepSeek devuelve 5 resúmenes; obtén las páginas cuando necesites el contenido completo",+ "aiWebFetchProvider": "Proveedor de obtención",+ "aiWebFetchProviderTip": "DeepSeek solo obtiene el contenido de las páginas; la obtención directa también descarga archivos",+ "aiWebFetchDirect": "Obtención directa",+ "aiWebDeepSeekKey": "Clave API de DeepSeek",+ "aiWebDeepSeekKeyTip": "Compartida por Search y Fetch; las consultas y las URL de destino se envían a DeepSeek y se cobra por solicitud","automationCollectionReview": "Revisar entradas recopiladas","automationCollectionCleanup": "Quitar entradas no coincidentes de esta página","automationCollectionReviewTip": "Se comprueban todas las reglas activas de recopilación de bloques; basta con coincidir con una para conservar la entrada. Los enlaces manuales y automáticos se comprueban igual; las entradas sin enlace o indeterminadas se conservan",diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.jsonindex 771c31b6e5..f5697c8dd4 100644--- a/app/appearance/langs/fr.json+++ b/app/appearance/langs/fr.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Recherche et récupération web",+ "aiWebSearchProvider": "Service de recherche",+ "aiWebSearchProviderTip": "DeepSeek renvoie 5 résumés ; récupérez les pages si le contenu complet est nécessaire",+ "aiWebFetchProvider": "Service de récupération",+ "aiWebFetchProviderTip": "DeepSeek récupère uniquement le contenu des pages ; la récupération directe télécharge aussi des fichiers",+ "aiWebFetchDirect": "Récupération directe",+ "aiWebDeepSeekKey": "Clé API DeepSeek",+ "aiWebDeepSeekKeyTip": "Partagée entre Search et Fetch ; les requêtes et les URL cibles sont envoyées à DeepSeek, avec une facturation par requête","automationCollectionReview": "Vérifier les entrées collectées","automationCollectionCleanup": "Retirer les entrées non correspondantes de cette page","automationCollectionReviewTip": "Toutes les règles actives de collecte sont vérifiées ; une correspondance suffit à conserver l’entrée. Les liaisons manuelles et automatiques sont traitées de même ; les entrées non liées ou indéterminées sont conservées",diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.jsonindex ffeda84089..0f5ec72e8f 100644--- a/app/appearance/langs/he.json+++ b/app/appearance/langs/he.json@@ -1,4 +1,12 @@{+ "aiWebTools": "חיפוש ושליפת דפי אינטרנט",+ "aiWebSearchProvider": "ספק חיפוש",+ "aiWebSearchProviderTip": "DeepSeek מחזיר 5 תקצירים; יש לשלוף דפים כאשר נדרש התוכן המלא",+ "aiWebFetchProvider": "ספק שליפה",+ "aiWebFetchProviderTip": "DeepSeek שולף תוכן דפים בלבד; שליפה ישירה תומכת גם בהורדת קבצים",+ "aiWebFetchDirect": "שליפה ישירה",+ "aiWebDeepSeekKey": "מפתח API של DeepSeek",+ "aiWebDeepSeekKeyTip": "משותף ל־Search ול־Fetch; שאילתות וכתובות URL נשלחות ל־DeepSeek והחיוב הוא לפי בקשה","automationCollectionReview": "בדיקת הרשומות שנאספו","automationCollectionCleanup": "הסרת הרשומות שאינן תואמות בדף זה","automationCollectionReviewTip": "נבדקים כל כללי איסוף הבלוקים הפעילים; התאמה לכלל אחד מספיקה לשמירת הרשומה. קישורים ידניים ואוטומטיים נבדקים באופן שווה; רשומות לא מקושרות או לא ניתנות לקביעה נשמרות",diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.jsonindex a95cffe5de..f270bf196b 100644--- a/app/appearance/langs/hi.json+++ b/app/appearance/langs/hi.json@@ -1,4 +1,12 @@{+ "aiWebTools": "वेब खोज और सामग्री प्राप्ति",+ "aiWebSearchProvider": "खोज सेवा",+ "aiWebSearchProviderTip": "DeepSeek 5 सारांश देता है; पूरा पाठ चाहिए तो पृष्ठ की सामग्री प्राप्त करें",+ "aiWebFetchProvider": "सामग्री प्राप्ति सेवा",+ "aiWebFetchProviderTip": "DeepSeek केवल पृष्ठ का पाठ प्राप्त करता है; सीधे प्राप्त करने पर फ़ाइलें भी डाउनलोड होती हैं",+ "aiWebFetchDirect": "सीधे प्राप्त करें",+ "aiWebDeepSeekKey": "DeepSeek API कुंजी",+ "aiWebDeepSeekKeyTip": "Search और Fetch के लिए साझा कुंजी; खोज शब्द और लक्ष्य URL DeepSeek को भेजे जाते हैं और प्रति अनुरोध शुल्क लगता है","automationCollectionReview": "संग्रहित प्रविष्टियों की समीक्षा करें","automationCollectionCleanup": "इस पृष्ठ की बेमेल प्रविष्टियाँ हटाएँ","automationCollectionReviewTip": "सभी सक्षम ब्लॉक संग्रह नियम जाँचे जाते हैं; किसी एक से मेल खाने पर प्रविष्टि रखी जाती है। मैन्युअल और स्वचालित लिंक समान रूप से जाँचे जाते हैं; बिना लिंक वाली या अनिर्धारित प्रविष्टियाँ रखी जाती हैं",diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.jsonindex fe6cad8e16..b7f0c09c88 100644--- a/app/appearance/langs/id.json+++ b/app/appearance/langs/id.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Pencarian dan pengambilan web",+ "aiWebSearchProvider": "Penyedia pencarian",+ "aiWebSearchProviderTip": "DeepSeek mengembalikan 5 ringkasan; ambil halaman jika konten lengkap diperlukan",+ "aiWebFetchProvider": "Penyedia pengambilan",+ "aiWebFetchProviderTip": "DeepSeek hanya mengambil isi halaman; pengambilan langsung juga mengunduh berkas",+ "aiWebFetchDirect": "Pengambilan langsung",+ "aiWebDeepSeekKey": "Kunci API DeepSeek",+ "aiWebDeepSeekKeyTip": "Digunakan bersama oleh Search dan Fetch; kueri dan URL tujuan dikirim ke DeepSeek dan dikenai biaya per permintaan","automationCollectionReview": "Periksa entri yang dikumpulkan","automationCollectionCleanup": "Keluarkan entri yang tidak cocok di halaman ini","automationCollectionReviewTip": "Periksa semua aturan pengumpulan blok yang aktif; kecocokan dengan satu aturan mempertahankan entri. Tautan manual dan otomatis diperiksa sama; entri terlepas atau tidak dapat ditentukan dipertahankan",diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.jsonindex 9687adf849..718fa0b1a6 100644--- a/app/appearance/langs/it.json+++ b/app/appearance/langs/it.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Ricerca e recupero web",+ "aiWebSearchProvider": "Servizio di ricerca",+ "aiWebSearchProviderTip": "DeepSeek restituisce 5 riepiloghi; recupera le pagine quando serve il contenuto completo",+ "aiWebFetchProvider": "Servizio di recupero",+ "aiWebFetchProviderTip": "DeepSeek recupera solo il contenuto delle pagine; il recupero diretto scarica anche file",+ "aiWebFetchDirect": "Recupero diretto",+ "aiWebDeepSeekKey": "Chiave API DeepSeek",+ "aiWebDeepSeekKeyTip": "Condivisa da Search e Fetch; le ricerche e gli URL di destinazione sono inviati a DeepSeek con addebito per richiesta","automationCollectionReview": "Controlla le voci raccolte","automationCollectionCleanup": "Rimuovi le voci non corrispondenti di questa pagina","automationCollectionReviewTip": "Controlla tutte le regole di raccolta attive; una corrispondenza basta a conservare la voce. I collegamenti manuali e automatici sono controllati allo stesso modo; le voci scollegate o indeterminate vengono conservate",diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.jsonindex 389268e436..800ee5d0d1 100644--- a/app/appearance/langs/ja.json+++ b/app/appearance/langs/ja.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Web 検索と取得",+ "aiWebSearchProvider": "検索サービス",+ "aiWebSearchProviderTip": "DeepSeek は要約を 5 件返します。全文が必要な場合はページを取得します",+ "aiWebFetchProvider": "取得サービス",+ "aiWebFetchProviderTip": "DeepSeek はページ本文のみを取得します。直接取得ではファイルもダウンロードできます",+ "aiWebFetchDirect": "直接取得",+ "aiWebDeepSeekKey": "DeepSeek API キー",+ "aiWebDeepSeekKeyTip": "Search と Fetch で共有します。検索語と対象 URL は DeepSeek に送信され、リクエストごとに課金されます","automationCollectionReview": "収集結果を確認","automationCollectionCleanup": "このページの不一致項目を除外","automationCollectionReviewTip": "有効な通常ブロック収集ルールすべてで確認し、いずれかに一致すれば保持します。手動・自動のバインド項目を同様に確認し、未バインドや判定不能の項目は保持します",diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.jsonindex e4fa119d6a..db4e5e846c 100644--- a/app/appearance/langs/ko.json+++ b/app/appearance/langs/ko.json@@ -1,4 +1,12 @@{+ "aiWebTools": "웹 검색 및 가져오기",+ "aiWebSearchProvider": "검색 서비스",+ "aiWebSearchProviderTip": "DeepSeek은 요약 5개를 반환하며, 전체 내용이 필요하면 페이지를 가져옵니다",+ "aiWebFetchProvider": "가져오기 서비스",+ "aiWebFetchProviderTip": "DeepSeek은 페이지 본문만 가져오며, 직접 가져오기는 파일 다운로드도 지원합니다",+ "aiWebFetchDirect": "직접 가져오기",+ "aiWebDeepSeekKey": "DeepSeek API 키",+ "aiWebDeepSeekKeyTip": "Search와 Fetch에서 공유하며, 검색어와 대상 URL이 DeepSeek으로 전송되고 요청별로 요금이 부과됩니다","automationCollectionReview": "수집 결과 확인","automationCollectionCleanup": "이 페이지의 불일치 항목 제외","automationCollectionReviewTip": "활성화된 모든 블록 수집 규칙을 확인하며 하나라도 일치하면 유지합니다. 수동 및 자동 연결 항목을 동일하게 확인하며, 연결되지 않았거나 판단할 수 없는 항목은 유지합니다",diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.jsonindex 9e91f41e7b..766c4cb72b 100644--- a/app/appearance/langs/nl.json+++ b/app/appearance/langs/nl.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Webzoeken en pagina's ophalen",+ "aiWebSearchProvider": "Zoekdienst",+ "aiWebSearchProviderTip": "DeepSeek geeft 5 samenvattingen terug; haal pagina's op als de volledige inhoud nodig is",+ "aiWebFetchProvider": "Ophaaldienst",+ "aiWebFetchProviderTip": "DeepSeek haalt alleen pagina-inhoud op; direct ophalen kan ook bestanden downloaden",+ "aiWebFetchDirect": "Direct ophalen",+ "aiWebDeepSeekKey": "DeepSeek-API-sleutel",+ "aiWebDeepSeekKeyTip": "Gedeeld door Search en Fetch; zoekopdrachten en doel-URL's worden naar DeepSeek verzonden en per verzoek gefactureerd","automationCollectionReview": "Verzamelde items controleren","automationCollectionCleanup": "Niet-passende items op deze pagina verwijderen","automationCollectionReviewTip": "Controleer alle actieve regels voor blokverzameling; één overeenkomst is voldoende om een item te behouden. Handmatige en automatische koppelingen worden gelijk gecontroleerd; ontkoppelde of onbepaalde items blijven behouden",diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.jsonindex 24d6e167ad..d8c24c980a 100644--- a/app/appearance/langs/pl.json+++ b/app/appearance/langs/pl.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Wyszukiwanie i pobieranie stron",+ "aiWebSearchProvider": "Usługa wyszukiwania",+ "aiWebSearchProviderTip": "DeepSeek zwraca 5 podsumowań; pobierz strony, gdy potrzebna jest pełna treść",+ "aiWebFetchProvider": "Usługa pobierania",+ "aiWebFetchProviderTip": "DeepSeek pobiera tylko treść stron; bezpośrednie pobieranie obsługuje również pliki",+ "aiWebFetchDirect": "Pobieranie bezpośrednie",+ "aiWebDeepSeekKey": "Klucz API DeepSeek",+ "aiWebDeepSeekKeyTip": "Wspólny dla Search i Fetch; zapytania i docelowe adresy URL są wysyłane do DeepSeek, a opłaty naliczane za żądanie","automationCollectionReview": "Sprawdź zebrane wpisy","automationCollectionCleanup": "Usuń niepasujące wpisy z tej strony","automationCollectionReviewTip": "Sprawdzane są wszystkie aktywne reguły zbierania bloków; dopasowanie do jednej wystarcza, aby zachować wpis. Powiązania ręczne i automatyczne są sprawdzane tak samo; wpisy niepowiązane lub nieokreślone pozostają",diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.jsonindex f68a2ee76f..42f9550877 100644--- a/app/appearance/langs/pt-BR.json+++ b/app/appearance/langs/pt-BR.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Pesquisa e obtenção de páginas",+ "aiWebSearchProvider": "Provedor de pesquisa",+ "aiWebSearchProviderTip": "O DeepSeek retorna 5 resumos; obtenha as páginas quando precisar do conteúdo completo",+ "aiWebFetchProvider": "Provedor de obtenção",+ "aiWebFetchProviderTip": "O DeepSeek obtém apenas o conteúdo das páginas; a obtenção direta também baixa arquivos",+ "aiWebFetchDirect": "Obtenção direta",+ "aiWebDeepSeekKey": "Chave de API do DeepSeek",+ "aiWebDeepSeekKeyTip": "Compartilhada por Search e Fetch; consultas e URLs de destino são enviadas ao DeepSeek, com cobrança por solicitação","automationCollectionReview": "Verificar entradas coletadas","automationCollectionCleanup": "Remover entradas não correspondentes desta página","automationCollectionReviewTip": "Verifica todas as regras ativas de coleta de blocos; uma correspondência basta para manter a entrada. Vínculos manuais e automáticos são verificados igualmente; entradas desvinculadas ou indeterminadas são mantidas",diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.jsonindex 2a4427d925..62f79648c2 100644--- a/app/appearance/langs/ru.json+++ b/app/appearance/langs/ru.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Поиск и загрузка веб-страниц",+ "aiWebSearchProvider": "Сервис поиска",+ "aiWebSearchProviderTip": "DeepSeek возвращает 5 кратких описаний; при необходимости загрузите полный текст страниц",+ "aiWebFetchProvider": "Сервис загрузки",+ "aiWebFetchProviderTip": "DeepSeek получает только текст страниц; прямая загрузка также позволяет скачивать файлы",+ "aiWebFetchDirect": "Прямая загрузка",+ "aiWebDeepSeekKey": "Ключ API DeepSeek",+ "aiWebDeepSeekKeyTip": "Общий для Search и Fetch; запросы и целевые URL отправляются в DeepSeek, оплата взимается за запрос","automationCollectionReview": "Проверить собранные записи","automationCollectionCleanup": "Убрать неподходящие записи этой страницы","automationCollectionReviewTip": "Проверяются все включённые правила сбора блоков; совпадения с одним достаточно для сохранения записи. Ручные и автоматические привязки проверяются одинаково; непривязанные и неопределимые записи сохраняются",diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.jsonindex ad8bc222c6..6e56986639 100644--- a/app/appearance/langs/sk.json+++ b/app/appearance/langs/sk.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Vyhľadávanie a načítanie webu",+ "aiWebSearchProvider": "Poskytovateľ vyhľadávania",+ "aiWebSearchProviderTip": "DeepSeek vracia 5 súhrnov; ak potrebujete úplný obsah, načítajte stránky",+ "aiWebFetchProvider": "Poskytovateľ načítania",+ "aiWebFetchProviderTip": "DeepSeek načíta iba obsah stránok; priame načítanie umožňuje aj sťahovanie súborov",+ "aiWebFetchDirect": "Priame načítanie",+ "aiWebDeepSeekKey": "API kľúč DeepSeek",+ "aiWebDeepSeekKeyTip": "Spoločný pre Search a Fetch; dopyty a cieľové URL sa odosielajú do DeepSeek a účtujú sa za požiadavku","automationCollectionReview": "Skontrolovať zozbierané položky","automationCollectionCleanup": "Odstrániť nevyhovujúce položky tejto stránky","automationCollectionReviewTip": "Kontrolujú sa všetky aktívne pravidlá zbierania blokov; zhoda s jedným stačí na zachovanie položky. Ručné aj automatické prepojenia sa kontrolujú rovnako; neprepojené alebo neurčiteľné položky zostávajú",diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.jsonindex 84e1ee656d..c946a768a5 100644--- a/app/appearance/langs/sr.json+++ b/app/appearance/langs/sr.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Веб претрага и преузимање",+ "aiWebSearchProvider": "Услуга претраге",+ "aiWebSearchProviderTip": "DeepSeek враћа 5 сажетака; преузмите странице када је потребан цео садржај",+ "aiWebFetchProvider": "Услуга преузимања",+ "aiWebFetchProviderTip": "DeepSeek преузима само садржај страница; директно преузимање подржава и датотеке",+ "aiWebFetchDirect": "Директно преузимање",+ "aiWebDeepSeekKey": "DeepSeek API кључ",+ "aiWebDeepSeekKeyTip": "Заједнички за Search и Fetch; упити и циљни URL-ови шаљу се DeepSeek-у и наплаћују по захтеву","automationCollectionReview": "Провери прикупљене ставке","automationCollectionCleanup": "Уклони неподударне ставке са ове странице","automationCollectionReviewTip": "Проверавају се сва активна правила прикупљања блокова; подударање са једним чува ставку. Ручна и аутоматска повезивања проверавају се једнако; неповезане и неодредиве ставке се чувају",diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.jsonindex e9ff395f1e..3b980e9bb9 100644--- a/app/appearance/langs/th.json+++ b/app/appearance/langs/th.json@@ -1,4 +1,12 @@{+ "aiWebTools": "ค้นหาและดึงข้อมูลเว็บ",+ "aiWebSearchProvider": "ผู้ให้บริการค้นหา",+ "aiWebSearchProviderTip": "DeepSeek ส่งคืนสรุป 5 รายการ และดึงหน้าเว็บเมื่อต้องการเนื้อหาฉบับเต็ม",+ "aiWebFetchProvider": "ผู้ให้บริการดึงข้อมูล",+ "aiWebFetchProviderTip": "DeepSeek ดึงเฉพาะเนื้อหาหน้าเว็บ ส่วนการดึงโดยตรงรองรับการดาวน์โหลดไฟล์ด้วย",+ "aiWebFetchDirect": "ดึงข้อมูลโดยตรง",+ "aiWebDeepSeekKey": "คีย์ API ของ DeepSeek",+ "aiWebDeepSeekKeyTip": "ใช้ร่วมกันระหว่าง Search และ Fetch โดยส่งคำค้นและ URL เป้าหมายไปยัง DeepSeek และคิดค่าบริการต่อคำขอ","automationCollectionReview": "ตรวจสอบรายการที่รวบรวม","automationCollectionCleanup": "นำรายการที่ไม่ตรงเงื่อนไขในหน้านี้ออก","automationCollectionReviewTip": "ตรวจสอบกฎรวบรวมบล็อกที่เปิดใช้ทั้งหมด หากตรงกับกฎใดกฎหนึ่งจะเก็บรายการไว้ ตรวจสอบรายการที่ผูกด้วยตนเองและอัตโนมัติเท่าเทียมกัน และเก็บรายการที่ไม่ผูกหรือไม่สามารถระบุได้ไว้",diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.jsonindex d86812e57f..8e03cf7112 100644--- a/app/appearance/langs/tr.json+++ b/app/appearance/langs/tr.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Web araması ve içerik alma",+ "aiWebSearchProvider": "Arama sağlayıcısı",+ "aiWebSearchProviderTip": "DeepSeek 5 özet döndürür; tam içerik gerektiğinde sayfaları alın",+ "aiWebFetchProvider": "İçerik alma sağlayıcısı",+ "aiWebFetchProviderTip": "DeepSeek yalnızca sayfa içeriğini alır; doğrudan alma dosya indirmeyi de destekler",+ "aiWebFetchDirect": "Doğrudan alma",+ "aiWebDeepSeekKey": "DeepSeek API anahtarı",+ "aiWebDeepSeekKeyTip": "Search ve Fetch için ortaktır; sorgular ve hedef URL'ler DeepSeek'e gönderilir ve istek başına ücretlendirilir","automationCollectionReview": "Toplanan kayıtları incele","automationCollectionCleanup": "Bu sayfadaki eşleşmeyen kayıtları kaldır","automationCollectionReviewTip": "Etkin tüm blok toplama kuralları denetlenir; herhangi biriyle eşleşen kayıt korunur. Elle ve otomatik bağlanan kayıtlar aynı şekilde denetlenir; bağımsız veya belirlenemeyen kayıtlar korunur",diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.jsonindex da99b4c53a..42c6dbdacb 100644--- a/app/appearance/langs/uk.json+++ b/app/appearance/langs/uk.json@@ -1,4 +1,12 @@{+ "aiWebTools": "Пошук і завантаження вебсторінок",+ "aiWebSearchProvider": "Сервіс пошуку",+ "aiWebSearchProviderTip": "DeepSeek повертає 5 стислих описів; за потреби завантажте повний текст сторінок",+ "aiWebFetchProvider": "Сервіс завантаження",+ "aiWebFetchProviderTip": "DeepSeek отримує лише вміст сторінок; пряме завантаження також підтримує файли",+ "aiWebFetchDirect": "Пряме завантаження",+ "aiWebDeepSeekKey": "Ключ API DeepSeek",+ "aiWebDeepSeekKeyTip": "Спільний для Search і Fetch; запити й цільові URL надсилаються до DeepSeek, оплата стягується за запит","automationCollectionReview": "Перевірити зібрані записи","automationCollectionCleanup": "Прибрати невідповідні записи цієї сторінки","automationCollectionReviewTip": "Перевіряються всі ввімкнені правила збирання блоків; відповідності одному досить для збереження запису. Ручні й автоматичні прив’язки перевіряються однаково; непов’язані й невизначені записи зберігаються",diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.jsonindex 1766a55f82..74ba315be9 100644--- a/app/appearance/langs/zh-CN.json+++ b/app/appearance/langs/zh-CN.json@@ -1,4 +1,12 @@{+ "aiWebTools": "网页搜索与抓取",+ "aiWebSearchProvider": "搜索服务",+ "aiWebSearchProviderTip": "DeepSeek 返回 5 条摘要,需要正文时再抓取网页",+ "aiWebFetchProvider": "抓取服务",+ "aiWebFetchProviderTip": "DeepSeek 仅获取网页正文,直接抓取还支持下载文件",+ "aiWebFetchDirect": "直接抓取",+ "aiWebDeepSeekKey": "DeepSeek API 密钥",+ "aiWebDeepSeekKeyTip": "Search 与 Fetch 共用,搜索词和目标 URL 会发送给 DeepSeek,按请求计费","automationCollectionReview": "检查收集结果","automationCollectionCleanup": "移出本页不匹配条目","automationCollectionReviewTip": "按全部启用的普通块收集规则检查,符合任一规则即保留;手动和自动绑定条目统一检查,游离或无法判断的条目保留",diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.jsonindex 24ea47db78..59c8fbb0e0 100644--- a/app/appearance/langs/zh-TW.json+++ b/app/appearance/langs/zh-TW.json@@ -1,4 +1,12 @@{+ "aiWebTools": "網頁搜尋與擷取",+ "aiWebSearchProvider": "搜尋服務",+ "aiWebSearchProviderTip": "DeepSeek 傳回 5 筆摘要,需要正文時再擷取網頁",+ "aiWebFetchProvider": "擷取服務",+ "aiWebFetchProviderTip": "DeepSeek 僅取得網頁正文,直接擷取也支援下載檔案",+ "aiWebFetchDirect": "直接擷取",+ "aiWebDeepSeekKey": "DeepSeek API 金鑰",+ "aiWebDeepSeekKeyTip": "Search 與 Fetch 共用,搜尋詞和目標 URL 會傳送給 DeepSeek,按請求計費","automationCollectionReview": "檢查收集結果","automationCollectionCleanup": "移出本頁不相符項目","automationCollectionReviewTip": "依全部啟用的一般區塊收集規則檢查,符合任一規則即保留;手動和自動繫結項目統一檢查,游離或無法判斷的項目保留",diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.syindex 666355525c..fd145ad5cf 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20230304000547-ibldj1z/20260804171004-aiagt03.sy@@ -6,7 +6,7 @@"id": "20260804171004-aiagt03","title": "AI Agent","type": "doc",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{@@ -959,12 +959,12 @@"Type": "NodeHeading","Properties": {"id": "20261018102417-6nqgr74",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "Fetching web pages"+ "Data": "Web search and fetch"}],"HeadingLevel": 2@@ -974,12 +974,67 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-l4q1ks8",- "updated": "20261018102417"+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Ask the agent to search public web pages, read their content, and summarize it or save it to a note. web_search returns links and summaries; web_fetch reads a specific URL. Direct fetching uses HTTP without executing JavaScript. The desktop app also provides a separate rendered-page tool for content generated by JavaScript."+ }+ ]+ },+ {+ "ID": "20261018104335-58saaee",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-58saaee",+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "In "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Settings"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Artificial Intelligence"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Web search and fetch"+ },+ {+ "Type": "NodeText",+ "Data": ", choose the search and fetch providers separately. The defaults are Exa search and direct fetching. To use DeepSeek, enter a DeepSeek API Key shared by Search and Fetch; this setting is independent of your chat model. DeepSeek Search requests 5 results without page bodies, and limits each summary to 800 characters and total output to 8,000 characters. Fetch pages only when you need the full content."+ }+ ]+ },+ {+ "ID": "20261018104335-3wpzxw1",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-3wpzxw1",+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "Ask the agent to read a public web page and summarize it or save its content to a note. The web_fetch tool uses an HTTP request without executing JavaScript. In the desktop app, the agent can also fetch a rendered page when its content is generated by JavaScript."+ "Data": "DeepSeek Search sends the query and DeepSeek Fetch sends the target URL to DeepSeek, without browser cookies or login state. These requests may incur charges. DeepSeek Fetch retrieves page content only; select direct fetching to download files. Invalid credentials, insufficient balance, rate limits and unavailable pages return errors without automatically switching providers. Review external requests according to your tool permission settings."}]},@@ -1002,12 +1057,12 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-e6hvavx",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "Rendered fetching requires the desktop instance to remain connected. Browser, mobile, and external MCP clients continue to use HTTP fetching. Empty pages and timeouts return errors; long results are truncated to 50,000 characters. Pages requiring login, embedded frames, workers, or persistent browser connections may still be unavailable."+ "Data": "Rendered fetching requires the desktop instance to remain connected. Browser, mobile, and external MCP clients use the configured fetch provider. Empty pages and timeouts return errors; long results are truncated to 50,000 characters. Pages requiring login, embedded frames, workers, or persistent browser connections may still be unavailable."}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.syindex d854dde136..7e3e6b2589 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20230303235619-ex5l63e/20260804171000-aiagt01.sy@@ -6,7 +6,7 @@"id": "20260804171000-aiagt01","title": "AI 智能体","type": "doc",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{@@ -959,12 +959,12 @@"Type": "NodeHeading","Properties": {"id": "20261018102417-ch6z3dh",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "抓取网页"+ "Data": "网页搜索与抓取"}],"HeadingLevel": 2@@ -974,12 +974,67 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-czenpo4",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "可以让智能体读取公开网页,归纳内容或保存到笔记。web_fetch 工具通过 HTTP 请求获取内容,不执行 JavaScript。桌面应用中的智能体还可以抓取渲染后的网页,用于读取由 JavaScript 生成的正文。"+ "Data": "可以让智能体搜索公开网页、读取正文并归纳内容或保存到笔记。web_search 返回链接和摘要,web_fetch 读取指定 URL。直接抓取通过 HTTP 获取内容,不执行 JavaScript。桌面应用还提供独立的渲染抓取工具,用于读取由 JavaScript 生成的正文。"+ }+ ]+ },+ {+ "ID": "20261018104335-uga4jno",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-uga4jno",+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "在 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "设置"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "人工智能"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "网页搜索与抓取"+ },+ {+ "Type": "NodeText",+ "Data": " 中可以分别选择搜索和抓取服务,默认使用 Exa 搜索和直接抓取。使用 DeepSeek 时,填写 Search 和 Fetch 共用的 DeepSeek API 密钥,此设置与对话模型无关。DeepSeek Search 请求 5 条结果且不包含网页正文,单条摘要最多 800 个字符,总输出最多 8,000 个字符。需要正文时再抓取具体网页。"+ }+ ]+ },+ {+ "ID": "20261018104335-gteywdk",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-gteywdk",+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "DeepSeek Search 会将搜索词发送给 DeepSeek,DeepSeek Fetch 会将目标 URL 发送给 DeepSeek,不携带浏览器 Cookie 或登录状态,这些请求可能产生费用。DeepSeek Fetch 仅获取网页正文,下载文件时应选择直接抓取。密钥无效、余额不足、限流或网页不可用时会返回错误,不自动切换服务。请根据工具权限设置核对并确认外部请求。"}]},@@ -1002,12 +1057,12 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-770stzg",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "渲染抓取需要桌面实例保持连接。浏览器端、移动端和外部 MCP 客户端继续使用 HTTP 抓取。正文为空或超时时会返回错误,较长结果会截断至 50,000 个字符。需要登录、嵌入页面、工作线程或持续浏览器连接的网页仍可能无法读取。"+ "Data": "渲染抓取需要桌面实例保持连接。浏览器端、移动端和外部 MCP 客户端使用配置的抓取服务。正文为空或超时时会返回错误,较长结果会截断至 50,000 个字符。需要登录、嵌入页面、工作线程或持续浏览器连接的网页仍可能无法读取。"}]},diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.syindex 7ba6f190b2..a07ee067cf 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20230304000829-9jwu3po/20260804171002-aiagt02.sy@@ -6,7 +6,7 @@"id": "20260804171002-aiagt02","title": "AI 智能體","type": "doc",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{@@ -959,12 +959,12 @@"Type": "NodeHeading","Properties": {"id": "20261018102417-6a7ncw2",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "擷取網頁"+ "Data": "網頁搜尋與擷取"}],"HeadingLevel": 2@@ -974,12 +974,67 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-wpqqnpa",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "可以讓智能體讀取公開網頁,歸納內容或儲存到筆記。web_fetch 工具透過 HTTP 請求取得內容,不執行 JavaScript。桌面應用程式中的智能體也可以擷取渲染後的網頁,用於讀取由 JavaScript 產生的正文。"+ "Data": "可以讓智能體搜尋公開網頁、讀取正文並歸納內容或儲存到筆記。web_search 傳回連結和摘要,web_fetch 讀取指定 URL。直接擷取透過 HTTP 取得內容,不執行 JavaScript。桌面應用程式另有獨立的渲染擷取工具,用於讀取由 JavaScript 產生的正文。"+ }+ ]+ },+ {+ "ID": "20261018104335-t9urpxi",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-t9urpxi",+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "在 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "設定"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "人工智能"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "網頁搜尋與擷取"+ },+ {+ "Type": "NodeText",+ "Data": " 中可以分別選擇搜尋和擷取服務,預設使用 Exa 搜尋和直接擷取。使用 DeepSeek 時,填寫 Search 和 Fetch 共用的 DeepSeek API 金鑰,此設定與對話模型無關。DeepSeek Search 請求 5 筆結果且不包含網頁正文,單筆摘要最多 800 個字元,總輸出最多 8,000 個字元。需要正文時再擷取特定網頁。"+ }+ ]+ },+ {+ "ID": "20261018104335-16jvt70",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-16jvt70",+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "DeepSeek Search 會將搜尋詞傳送給 DeepSeek,DeepSeek Fetch 會將目標 URL 傳送給 DeepSeek,不攜帶瀏覽器 Cookie 或登入狀態,這些請求可能產生費用。DeepSeek Fetch 僅取得網頁正文,下載檔案時應選擇直接擷取。金鑰無效、餘額不足、限流或網頁無法使用時會傳回錯誤,不自動切換服務。請依工具權限設定核對並確認外部請求。"}]},@@ -1002,12 +1057,12 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-4dfvyxt",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "渲染擷取需要桌面實例保持連線。瀏覽器端、行動端和外部 MCP 用戶端繼續使用 HTTP 擷取。正文為空或逾時時會傳回錯誤,較長結果會截斷至 50,000 個字元。需要登入、嵌入頁面、工作執行緒或持續瀏覽器連線的網頁仍可能無法讀取。"+ "Data": "渲染擷取需要桌面實例保持連線。瀏覽器端、行動端和外部 MCP 用戶端使用設定的擷取服務。正文為空或逾時時會傳回錯誤,較長結果會截斷至 50,000 個字元。需要登入、嵌入頁面、工作執行緒或持續瀏覽器連線的網頁仍可能無法讀取。"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.syindex 0942d13a3d..39f00299ba 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-ei5t6tt/20260804171006-aiagt04.sy@@ -6,7 +6,7 @@"id": "20260804171006-aiagt04","title": "AI エージェント","type": "doc",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{@@ -956,12 +956,12 @@"Type": "NodeHeading","Properties": {"id": "20261018102417-5r3z242",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "Web ページの取得"+ "Data": "Web 検索と取得"}],"HeadingLevel": 2@@ -971,12 +971,63 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-kbspy6l",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "公開 Web ページを読み取り、内容を要約したりノートに保存したりするようエージェントに依頼できます。web_fetch ツールは HTTP リクエストで内容を取得し、JavaScript は実行しません。デスクトップアプリでは、JavaScript で生成される本文を取得するために、レンダリング後のページも読み取れます。"+ "Data": "公開 Web ページを検索し、本文を読み取って要約したりノートに保存したりするようエージェントに依頼できます。web_search はリンクと要約を返し、web_fetch は指定した URL を読み取ります。直接取得では HTTP を使用し、JavaScript は実行しません。デスクトップアプリでは、JavaScript で生成される本文を取得するための独立したレンダリング取得ツールも利用できます。"+ }+ ]+ },+ {+ "ID": "20261018104335-h974oif",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-h974oif",+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "設定"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "AI を呼び出す"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Web 検索と取得"+ },+ {+ "Type": "NodeText",+ "Data": " で検索サービスと取得サービスを個別に選択できます。既定では Exa 検索と直接取得を使用します。DeepSeek を使用する場合は、Search と Fetch で共有する DeepSeek API キーを入力します。この設定は対話モデルとは独立しています。DeepSeek Search は本文なしで 5 件の結果を要求し、各要約を 800 文字、出力全体を 8,000 文字に制限します。全文が必要な場合にページを取得してください。"+ }+ ]+ },+ {+ "ID": "20261018104335-6bib27g",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261018104335-6bib27g",+ "updated": "20261018104335"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "DeepSeek Search は検索語を、DeepSeek Fetch は対象 URL を DeepSeek に送信します。ブラウザーの Cookie やログイン状態は送信しません。これらのリクエストには料金が発生する場合があります。DeepSeek Fetch はページ本文のみを取得するため、ファイルのダウンロードには直接取得を選択してください。キーが無効、残高不足、レート制限、ページの取得不可などの場合はエラーを返し、サービスを自動で切り替えません。ツールの権限設定に従って外部リクエストを確認してください。"}]},@@ -999,12 +1050,12 @@"Type": "NodeParagraph","Properties": {"id": "20261018102417-o7p27lp",- "updated": "20261018102417"+ "updated": "20261018104335"},"Children": [{"Type": "NodeText",- "Data": "レンダリングによる取得には、デスクトップインスタンスの接続を維持する必要があります。ブラウザー版、モバイル版、外部 MCP クライアントでは引き続き HTTP による取得を使用します。本文が空の場合やタイムアウト時はエラーを返し、長い結果は 50,000 文字で切り詰めます。ログイン、埋め込みページ、ワーカー、継続的なブラウザー接続が必要なページは、取得できない場合があります。"+ "Data": "レンダリング取得には、デスクトップインスタンスの接続を維持する必要があります。ブラウザー版、モバイル版、外部 MCP クライアントは、設定された取得サービスを使用します。本文が空の場合やタイムアウト時はエラーを返し、長い結果は 50,000 文字で切り詰めます。ログイン、埋め込みページ、ワーカー、継続的なブラウザー接続が必要なページは、取得できない場合があります。"}]},diff --git a/app/src/config/tabs/ai/aiTab.ts b/app/src/config/tabs/ai/aiTab.tsindex 68d4d4e859..da294853f3 100644--- a/app/src/config/tabs/ai/aiTab.ts+++ b/app/src/config/tabs/ai/aiTab.ts@@ -35,6 +35,7 @@ import {openSkillManager} from "../../../ai/skills/manager";import {openAgentInstructions} from "./aiInstructions";import {genDecisionCardsHtml, mountDecisionCards} from "./aiDecisionUi";import {genMcpOAuthHtml, mountMcpOAuth} from "./mcpOAuthUi";+import {registerAiWebGroup} from "./aiWeb";const registerAiProvidersGroup = (tab: SettingTabBuilder) => {const group = tab.group("providers", window.siyuan.languages.apiProvider);@@ -382,6 +383,7 @@ export const registerAiTab = (tab: SettingTabBuilder) => {registerAiProvidersGroup(tab);registerAiEditingGroup(tab);registerAiAgentGroup(tab);+ registerAiWebGroup(tab);registerAiDecisionGroup(tab);registerAiSkillsGroup(tab);registerAiImageGenerationGroup(tab);diff --git a/app/src/config/tabs/ai/aiWeb.ts b/app/src/config/tabs/ai/aiWeb.tsnew file mode 100644index 0000000000..9104b4a9d4--- /dev/null+++ b/app/src/config/tabs/ai/aiWeb.ts@@ -0,0 +1,28 @@+import type {SettingTabBuilder} from "../../setting/builder";++export const registerAiWebGroup = (tab: SettingTabBuilder) => {+ const group = tab.group("web", window.siyuan.languages.aiWebTools);+ group.select("ai.web.searchProvider", {+ title: window.siyuan.languages.aiWebSearchProvider,+ desc: window.siyuan.languages.aiWebSearchProviderTip,+ options: [{value: "exa", label: "Exa"}, {value: "deepseek", label: "DeepSeek"}],+ });+ group.select("ai.web.fetchProvider", {+ title: window.siyuan.languages.aiWebFetchProvider,+ desc: window.siyuan.languages.aiWebFetchProviderTip,+ options: [{value: "direct", label: window.siyuan.languages.aiWebFetchDirect}, {value: "deepseek", label: "DeepSeek"}],+ });+ group.textBlock("ai.web.apiKey", {+ title: window.siyuan.languages.aiWebDeepSeekKey,+ desc: window.siyuan.languages.aiWebDeepSeekKeyTip,+ spellcheck: false,+ mode: "input-password",+ });+ group.number("ai.web.timeout", {+ title: window.siyuan.languages.apiTimeout,+ desc: window.siyuan.languages.apiTimeoutTip,+ min: 1,+ max: 600,+ unit: "s",+ });+};diff --git a/app/src/types/api/index.d.ts b/app/src/types/api/index.d.tsindex d8ad16bfca..d6223c76f7 100644--- a/app/src/types/api/index.d.ts+++ b/app/src/types/api/index.d.ts@@ -1858,7 +1858,7 @@ export type SearchWidgetData = { "k": string; "widgets": Array<SearchWidgetResulexport type SearchWidgetResult = { "content": string; "name": string; };-export type SetAIRequestInput = { "agent"?: SettingAgentInput | null; "decision"?: SettingDecisionInput | null; "editing"?: SettingEditingInput | null; "embedding"?: SettingEmbeddingInput | null; "imageGeneration"?: SettingImageGenerationInput | null; "mcp"?: SettingMCPInput | null; "providers"?: Array<SettingProviderInput | null> | null; "rerank"?: SettingRerankInput | null; };+export type SetAIRequestInput = { "agent"?: SettingAgentInput | null; "decision"?: SettingDecisionInput | null; "editing"?: SettingEditingInput | null; "embedding"?: SettingEmbeddingInput | null; "imageGeneration"?: SettingImageGenerationInput | null; "mcp"?: SettingMCPInput | null; "providers"?: Array<SettingProviderInput | null> | null; "rerank"?: SettingRerankInput | null; "web"?: SettingAIWebInput | null; };export type SetAppearanceRequestInput = { "bodyGradient"?: SettingBodyGradientInput | null; "closeButtonBehavior"?: number | null; "codeBlockThemeDark"?: string | null; "codeBlockThemeLight"?: string | null; "darkThemes"?: Array<SettingAppearanceThemeInput | null> | null; "entryVisibility"?: SettingEntryVisibilityInput | null; "globalFontFamilies"?: Array<SettingEditorFontInput | null> | null; "hideStatusBar"?: boolean | null; "hideToolbar"?: boolean | null; "icon"?: string | null; "iconVer"?: string | null; "icons"?: Array<SettingAppearanceIconInput | null> | null; "lang"?: string | null; "lightThemes"?: Array<SettingAppearanceThemeInput | null> | null; "mode"?: number | null; "modeOS"?: boolean | null; "notifications"?: SettingNotificationsInput | null; "statusBar"?: SettingStatusBarInput | null; "themeDark"?: string | null; "themeJS"?: boolean | null; "themeLight"?: string | null; "themeVer"?: string | null; };@@ -1936,9 +1936,13 @@ export type SetSyncWebDAVRequestInput = { "webdav": SyncWebDAVInput; };export type SetVariablesRequestInput = { "items"?: Array<SettingVariableInput | null> | null; };-export type SettingAI = { "agent": SettingAgent | null; "decision": SettingDecision | null; "editing": SettingEditing | null; "embedding": SettingEmbedding | null; "imageGeneration": SettingImageGeneration | null; "mcp": SettingMCP | null; "providers": Array<SettingProvider | null> | null; "rerank": SettingRerank | null; };+export type SettingAI = { "agent": SettingAgent | null; "decision": SettingDecision | null; "editing": SettingEditing | null; "embedding": SettingEmbedding | null; "imageGeneration": SettingImageGeneration | null; "mcp": SettingMCP | null; "providers": Array<SettingProvider | null> | null; "rerank": SettingRerank | null; "web": SettingAIWeb | null; };-export type SettingAIInput = { "agent"?: SettingAgentInput | null; "decision"?: SettingDecisionInput | null; "editing"?: SettingEditingInput | null; "embedding"?: SettingEmbeddingInput | null; "imageGeneration"?: SettingImageGenerationInput | null; "mcp"?: SettingMCPInput | null; "providers"?: Array<SettingProviderInput | null> | null; "rerank"?: SettingRerankInput | null; };+export type SettingAIInput = { "agent"?: SettingAgentInput | null; "decision"?: SettingDecisionInput | null; "editing"?: SettingEditingInput | null; "embedding"?: SettingEmbeddingInput | null; "imageGeneration"?: SettingImageGenerationInput | null; "mcp"?: SettingMCPInput | null; "providers"?: Array<SettingProviderInput | null> | null; "rerank"?: SettingRerankInput | null; "web"?: SettingAIWebInput | null; };++export type SettingAIWeb = { "apiKey": string; "fetchProvider": string; "searchProvider": string; "timeout": number; };++export type SettingAIWebInput = { "apiKey"?: string | null; "fetchProvider"?: string | null; "searchProvider"?: string | null; "timeout"?: number | null; };export type SettingAgent = { "approvalPolicy": SettingApprovalPolicy | null; "capabilityPolicy": SettingCapabilityPolicy | null; "confirmTimeout": number; "maxCompletionTokens": number; "maxRetries": number; "maxToolCallRounds": number; "modelId": string; "sessionTimeout": number; "skills": SettingAgentSkills | null; "streamIdleTimeout": number; "temperature": number; };@@ -6743,6 +6747,7 @@ export interface APIPOSTRoutes {};/*** 使用共享规范化规则;智能体确认超时负数回退 600 秒,0 保留无限等待语义。+ * web 省略时保留当前配置;初始搜索为 Exa、抓取为直接请求,可独立切换到共用密钥的 DeepSeek。* 工具调用轮数和输出 token 上限的负数归零;温度超出 0–2 回退 1。* 嵌入并发数和批大小省略、null 或小于 1 时分别使用 8 和 10,超过上限时分别限制为 64 和 128。* ChatGPT 账户绑定变化时与主配置一起可恢复提交,失败时回滚且不发布新配置;未变化时不访问绑定存储。diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.tsindex 1b3f88329a..25149d0d9f 100644--- a/app/src/types/config.d.ts+++ b/app/src/types/config.d.ts@@ -144,6 +144,7 @@ declare namespace Config {* Artificial Intelligence (AI) related configuration*/export interface IAI {+ web: IAIWeb;providers: IProvider[];editing: IEditing;agent: IAgent;@@ -154,6 +155,16 @@ declare namespace Config {decision: IDecision;}+ /** 网页服务独立于对话模型;省略配置时搜索使用 Exa、抓取使用直接请求。 */+ export interface IAIWeb {+ searchProvider: string;+ fetchProvider: string;+ /** DeepSeek Search 与 Fetch 共用的凭证,由内核加密保存。 */+ apiKey: string;+ /** DeepSeek 请求超时秒数,默认 30,范围 1–600。 */+ timeout: number;+ }+/*** AI agent global settings*/diff --git a/kernel/agent/web_test.go b/kernel/agent/web_test.gonew file mode 100644index 0000000000..ba51f0273c--- /dev/null+++ b/kernel/agent/web_test.go@@ -0,0 +1,31 @@+package agent++import (+ "testing"++ "github.com/siyuan-note/siyuan/kernel/conf"+ "github.com/siyuan-note/siyuan/kernel/model"+)++func TestWebToolProviderConfirmation(t *testing.T) {+ previous := model.Conf+ t.Cleanup(func() { model.Conf = previous })+ model.Conf = model.NewAppConf()+ model.Conf.AI.Store(conf.NewAI())+ for _, name := range []string{"web_search", "web_fetch"} {+ if needsConfirm(name, "", nil) || needsLocalSnapshot(name, "") {+ t.Fatal("legacy web provider confirmation changed")+ }+ }+ model.Conf.AI.Load().Web.SearchProvider = "deepseek"+ if !needsConfirm("web_search", "", nil) || needsConfirm("web_fetch", "", nil) {+ t.Fatal("search confirmation did not follow independent provider selection")+ }+ model.Conf.AI.Load().Web.FetchProvider = "deepseek"+ if !needsConfirm("web_fetch", "", nil) || needsLocalSnapshot("web_fetch", "") || needsLocalSnapshot("web_search", "") {+ t.Fatal("paid external web calls need confirmation without a local snapshot")+ }+ if needsConfirm("web_search", "", map[string]bool{"*": true}) {+ t.Fatal("existing explicit approval was ignored")+ }+}diff --git a/kernel/api/contract_setting_ai_web_test.go b/kernel/api/contract_setting_ai_web_test.gonew file mode 100644index 0000000000..7b15e11d0a--- /dev/null+++ b/kernel/api/contract_setting_ai_web_test.go@@ -0,0 +1,44 @@+package api++import (+ "encoding/json"+ "testing"++ "github.com/siyuan-note/siyuan/kernel/apicontract"+ "github.com/siyuan-note/siyuan/kernel/conf"+ "github.com/siyuan-note/siyuan/kernel/model"+ "github.com/siyuan-note/siyuan/kernel/util"+)++func TestAPIContractSettingAIWeb(t *testing.T) {+ previous, readonly, confDir := model.Conf, util.ReadOnly, util.ConfDir+ t.Cleanup(func() { model.Conf, util.ReadOnly, util.ConfDir = previous, readonly, confDir })+ util.ReadOnly, util.ConfDir = true, t.TempDir()+ model.Conf = model.NewAppConf()+ model.Conf.AI.Store(conf.NewAI())+ code, message, data := settingContractRequest(t, "setAI", setAI,+ `{"web":{"searchProvider":"deepseek","fetchProvider":"direct","apiKey":"test-key","timeout":900}}`)+ if code != 0 {+ t.Fatal(message)+ }+ var result apicontract.SettingAI+ if err := json.Unmarshal(data, &result); err != nil || result.Web == nil || result.Web.Timeout != 600 ||+ result.Web.SearchProvider != "deepseek" || result.Web.FetchProvider != "direct" || result.Web.APIKey != "test-key" {+ t.Fatalf("web settings response did not retain independent providers: %s %v", data, err)+ }+ before := model.Conf.AI.Load().Web+ code, message, _ = settingContractRequest(t, "setAI", setAI, `{"agent":{"maxRetries":2}}`)+ if code != 0 || *model.Conf.AI.Load().Web != *before || model.Conf.AI.Load().Web == before {+ t.Fatalf("legacy client lost or aliased web settings: %s", message)+ }+ code, message, _ = settingContractRequest(t, "patch", patchSetting, `{"ai":{"web":{"fetchProvider":"deepseek"}}}`)+ web := model.Conf.AI.Load().Web+ if code != 0 || web.FetchProvider != "deepseek" || web.SearchProvider != "deepseek" || web.APIKey != "test-key" || web.Timeout != 600 {+ t.Fatalf("partial web setting save lost another field: %s", message)+ }+ code, message, _ = settingContractRequest(t, "patch", patchSetting, `{"ai":{"web":{"apiKey":"","searchProvider":"exa"}}}`)+ web = model.Conf.AI.Load().Web+ if code != 0 || web.APIKey != "" || web.SearchProvider != "exa" || web.FetchProvider != "deepseek" {+ t.Fatalf("explicit key clearing or independent provider switch failed: %s", message)+ }+}diff --git a/kernel/api/setting.go b/kernel/api/setting.goindex b13bfc418f..2b3af3493c 100644--- a/kernel/api/setting.go+++ b/kernel/api/setting.go@@ -152,6 +152,10 @@ func applyAISetting(c *gin.Context, request apicontract.SetAIRequest) (ret apicoreturn}if model.Conf.AI.Load() != nil {+ if ai.Web == nil && model.Conf.AI.Load().Web != nil {+ previousWeb := *model.Conf.AI.Load().Web+ ai.Web = &previousWeb+ }if ai.Decision == nil {ai.Decision = model.Conf.AI.Load().Decision.Clone()} else {diff --git a/kernel/api/setting_contract.go b/kernel/api/setting_contract.goindex 4ec7ef4249..8a3216f010 100644--- a/kernel/api/setting_contract.go+++ b/kernel/api/setting_contract.go@@ -32,6 +32,10 @@ func settingAIPayload(value *conf.AI) *apicontract.SettingAI {return nil}result := &apicontract.SettingAI{}+ if value.Web != nil {+ result.Web = &apicontract.SettingAIWeb{SearchProvider: value.Web.SearchProvider,+ FetchProvider: value.Web.FetchProvider, APIKey: value.Web.APIKey, Timeout: value.Web.Timeout}+ }result.MCP = settingMCPPayload(value.MCP)result.Embedding = settingEmbeddingPayload(value.Embedding)result.Rerank = settingRerankPayload(value.Rerank)diff --git a/kernel/api/system.go b/kernel/api/system.goindex 9d1edd6d67..476cf3d187 100644--- a/kernel/api/system.go+++ b/kernel/api/system.go@@ -524,6 +524,9 @@ var exportConf = contractHandler(apicontract.SystemExportConf, func(c *gin.ConteclonedConf.OIDC.ClientSecret = ""}if nil != clonedConf.AI.Load() {+ if clonedConf.AI.Load().Web != nil {+ clonedConf.AI.Load().Web.APIKey = ""+ }for _, provider := range clonedConf.AI.Load().Providers {if nil != provider {provider.APIKey = ""@@ -755,6 +758,9 @@ func preserveImportedAISecrets(imported, current *conf.AI) {if imported == nil || current == nil {return}+ if imported.Web != nil && current.Web != nil && imported.Web.APIKey == "" {+ imported.Web.APIKey = current.Web.APIKey+ }currentProviders := map[string]*conf.Provider{}for _, provider := range current.Providers {diff --git a/kernel/api/system_export_secrets_test.go b/kernel/api/system_export_secrets_test.goindex 5e93e7e955..4224d89086 100644--- a/kernel/api/system_export_secrets_test.go+++ b/kernel/api/system_export_secrets_test.go@@ -23,6 +23,8 @@ func TestAPIContractSystemExportSecrets(t *testing.T) {model.Conf = model.NewAppConf()if populated {model.Conf.AI.Store(conf.NewAI())+ model.Conf.AI.Load().Web.APIKey = "export-test-web-secret"+ model.Conf.AI.Load().Web.FetchProvider = "deepseek"model.Conf.AI.Load().Decision.Profiles["typesafe"].APIKey = "export-test-decision-secret"model.Conf.AI.Load().Decision.Profiles["openai"].APIKey = "export-test-openai-secret"model.Conf.OIDC = conf.NewOIDC()@@ -66,11 +68,11 @@ func TestAPIContractSystemExportSecrets(t *testing.T) {t.Fatal(err)}if populated {- if exported.AI.Load().Decision.APIKey != "" || exported.AI.Load().Decision.Profiles["typesafe"].APIKey != "" || exported.AI.Load().Decision.Profiles["openai"].APIKey != "" || exported.OIDC.ClientSecret != "" ||+ if exported.AI.Load().Web.APIKey != "" || exported.AI.Load().Decision.APIKey != "" || exported.AI.Load().Decision.Profiles["typesafe"].APIKey != "" || exported.AI.Load().Decision.Profiles["openai"].APIKey != "" || exported.OIDC.ClientSecret != "" ||bytes.Contains(data, []byte("export-test-")) {t.Fatal("export retained secrets")}- if exported.AI.Load().Decision.Profiles["typesafe"].Name != model.Conf.AI.Load().Decision.Profiles["typesafe"].Name || exported.OIDC.ClientID != "test-client" {+ if exported.AI.Load().Web.FetchProvider != "deepseek" || exported.AI.Load().Decision.Profiles["typesafe"].Name != model.Conf.AI.Load().Decision.Profiles["typesafe"].Name || exported.OIDC.ClientID != "test-client" {t.Fatal("export lost non-secret settings")}}diff --git a/kernel/api/system_test.go b/kernel/api/system_test.goindex c397ae12fc..306b9564ac 100644--- a/kernel/api/system_test.go+++ b/kernel/api/system_test.go@@ -287,6 +287,7 @@ func TestGetConfUILayoutByRole(t *testing.T) {func TestPreserveImportedAISecrets(t *testing.T) {currentMCP := &conf.MCP{Servers: []conf.MCPServer{{ID: "server", Headers: map[string]string{"Authorization": "secret"}}}}current := &conf.AI{+ Web: &conf.AIWeb{APIKey: "web-key"},Providers: []*conf.Provider{{ID: "matching", APIKey: "local-key", BaseURL: "https://example.com", Protocol: "openai"},{ID: "changed-endpoint", APIKey: "endpoint-key", BaseURL: "https://local.example.com"},@@ -297,6 +298,7 @@ func TestPreserveImportedAISecrets(t *testing.T) {MCP: currentMCP,}imported := &conf.AI{+ Web: &conf.AIWeb{SearchProvider: "exa", FetchProvider: "deepseek"},Providers: []*conf.Provider{{ID: "matching", BaseURL: "https://example.com", Protocol: "openai"},{ID: "changed-endpoint", BaseURL: "https://imported.example.com"},@@ -308,6 +310,14 @@ func TestPreserveImportedAISecrets(t *testing.T) {}preserveImportedAISecrets(imported, current)+ if imported.Web.APIKey != "web-key" || imported.Web.FetchProvider != "deepseek" || imported.Web.SearchProvider != "exa" {+ t.Fatal("web credential or independent provider selection lost on import")+ }+ providedWeb := &conf.AI{Web: &conf.AIWeb{APIKey: "provided-web-key"}}+ preserveImportedAISecrets(providedWeb, current)+ if providedWeb.Web.APIKey != "provided-web-key" {+ t.Fatal("provided web credential was overwritten")+ }if imported.Providers[0].APIKey != "local-key" {t.Fatalf("matching provider key = %q, want local key", imported.Providers[0].APIKey)diff --git a/kernel/apicontract/contracts.go b/kernel/apicontract/contracts.goindex 971722aa26..2af7f7b6e3 100644--- a/kernel/apicontract/contracts.go+++ b/kernel/apicontract/contracts.go@@ -1118,6 +1118,7 @@ var SetConfSnippet = define[SetConfSnippetRequest, *SettingSnpt]("setConfSnippetvar SetBazaar = define[SetBazaarRequest, *SettingBazaar]("setBazaar", "/api/setting/setBazaar", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{Setting: SettingWrite{Namespace: "bazaar"}}, "POST")// SetAI 使用共享规范化规则;智能体确认超时负数回退 600 秒,0 保留无限等待语义。+// web 省略时保留当前配置;初始搜索为 Exa、抓取为直接请求,可独立切换到共用密钥的 DeepSeek。// 工具调用轮数和输出 token 上限的负数归零;温度超出 0–2 回退 1。// 嵌入并发数和批大小省略、null 或小于 1 时分别使用 8 和 10,超过上限时分别限制为 64 和 128。// ChatGPT 账户绑定变化时与主配置一起可恢复提交,失败时回滚且不发布新配置;未变化时不访问绑定存储。diff --git a/kernel/apicontract/schema.json b/kernel/apicontract/schema.jsonindex c978c6f31c..d23970e98f 100644--- a/kernel/apicontract/schema.json+++ b/kernel/apicontract/schema.json@@ -39748,6 +39748,16 @@"type": "null"}]+ },+ "web": {+ "anyOf": [+ {+ "$ref": "#/$defs/SettingAIWebInput"+ },+ {+ "type": "null"+ }+ ]}},"additionalProperties": false@@ -42616,6 +42626,16 @@"type": "null"}]+ },+ "web": {+ "anyOf": [+ {+ "$ref": "#/$defs/SettingAIWeb"+ },+ {+ "type": "null"+ }+ ]}},"required": [@@ -42626,7 +42646,8 @@"imageGeneration","mcp","providers",- "rerank"+ "rerank",+ "web"],"additionalProperties": false},@@ -42722,6 +42743,86 @@"type": "null"}]+ },+ "web": {+ "anyOf": [+ {+ "$ref": "#/$defs/SettingAIWebInput"+ },+ {+ "type": "null"+ }+ ]+ }+ },+ "additionalProperties": false+ },+ "SettingAIWeb": {+ "type": "object",+ "properties": {+ "apiKey": {+ "type": "string"+ },+ "fetchProvider": {+ "type": "string"+ },+ "searchProvider": {+ "type": "string"+ },+ "timeout": {+ "type": "integer"+ }+ },+ "required": [+ "apiKey",+ "fetchProvider",+ "searchProvider",+ "timeout"+ ],+ "additionalProperties": false+ },+ "SettingAIWebInput": {+ "type": "object",+ "properties": {+ "apiKey": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ]+ },+ "fetchProvider": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ]+ },+ "searchProvider": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ]+ },+ "timeout": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ]}},"additionalProperties": falsediff --git a/kernel/apicontract/setting.go b/kernel/apicontract/setting.goindex e794735f7f..987b5b0dde 100644--- a/kernel/apicontract/setting.go+++ b/kernel/apicontract/setting.go@@ -11,6 +11,7 @@ type SettingBazaar struct {}type SettingAI struct {+ Web *SettingAIWeb `json:"web" api:"optional,nullable"`MCP *SettingMCP `json:"mcp" api:"optional,nullable"`Embedding *SettingEmbedding `json:"embedding" api:"optional,nullable"`Rerank *SettingRerank `json:"rerank" api:"optional,nullable"`@@ -21,6 +22,17 @@ type SettingAI struct {Providers []*SettingProvider `json:"providers" api:"optional,nullable"`}+// SettingAIWeb 省略时沿用已保存的网页服务配置;初始搜索为 exa,抓取为 direct。+// 可分别选择 deepseek,共用独立 API 密钥;超时默认 30 秒,上限 600 秒。+// DeepSeek Search 返回 5 条摘要且不取正文;Fetch 仅获取网页正文,不下载文件。+// Search 发送查询词,Fetch 发送目标 URL;不发送原始问题、浏览器凭证或额外笔记内容。+type SettingAIWeb struct {+ SearchProvider string `json:"searchProvider" api:"optional,nullable"`+ FetchProvider string `json:"fetchProvider" api:"optional,nullable"`+ APIKey string `json:"apiKey" api:"optional,nullable"`+ Timeout int `json:"timeout" api:"optional,nullable"`+}+type SettingMCP struct {Servers []SettingMCPServer `json:"servers" api:"optional,nullable"`ExposurePolicy *SettingCapabilityPolicy `json:"exposurePolicy" api:"optional,nullable"`diff --git a/kernel/conf/ai.go b/kernel/conf/ai.goindex cd1dfcc2f1..b207a540f3 100644--- a/kernel/conf/ai.go+++ b/kernel/conf/ai.go@@ -32,6 +32,7 @@ import ()type AI struct {+ Web *AIWeb `json:"web"`MCP *MCP `json:"mcp"`Embedding *Embedding `json:"embedding"`Rerank *Rerank `json:"rerank"`@@ -42,6 +43,30 @@ type AI struct {Providers []*Provider `json:"providers"`}+// AIWeb 独立配置网页搜索和抓取,DeepSeek 两个接口共用凭证,不跟随对话模型切换。+type AIWeb struct {+ SearchProvider string `json:"searchProvider"`+ FetchProvider string `json:"fetchProvider"`+ APIKey string `json:"apiKey"`+ Timeout int `json:"timeout"`+}++func (web *AIWeb) Normalize() {+ web.SearchProvider = strings.TrimSpace(web.SearchProvider)+ web.FetchProvider = strings.TrimSpace(web.FetchProvider)+ if web.SearchProvider == "" {+ web.SearchProvider = "exa"+ }+ if web.FetchProvider == "" {+ web.FetchProvider = "direct"+ }+ web.APIKey = strings.TrimSpace(web.APIKey)+ if web.Timeout < 1 {+ web.Timeout = 30+ }+ web.Timeout = min(web.Timeout, 600)+}+// DefaultAgentConfirmTimeout 是智能体确认超时时间的默认值(秒),也用于智能体提问的等待时长。const DefaultAgentConfirmTimeout = 600@@ -438,6 +463,7 @@ func NewAI() *AI {Embedding: defaultEmbedding(),Rerank: defaultRerank(),Decision: defaultDecision(),+ Web: &AIWeb{SearchProvider: "exa", FetchProvider: "direct", Timeout: 30},Agent: defaultAgent(),Editing: defaultEditing(),ImageGeneration: defaultImageGeneration(),@@ -871,6 +897,10 @@ func (ai *AI) Normalize() {ai.Decision = defaultDecision()}ai.Decision.Normalize()+ if ai.Web == nil {+ ai.Web = &AIWeb{}+ }+ ai.Web.Normalize()if ai.Rerank.Timeout < 1 {ai.Rerank.Timeout = 30}@@ -954,6 +984,13 @@ func normalizeApprovalPolicy(policy *ApprovalPolicy) {}func (ai *AI) DecryptAPIKeys() {+ if ai.Web != nil && ai.Web.APIKey != "" {+ if dec := util.AESDecrypt(ai.Web.APIKey); dec != nil {+ if plain, err := hex.DecodeString(string(dec)); err == nil {+ ai.Web.APIKey = string(plain)+ }+ }+ }if ai.Decision != nil {decrypt := func(key *string) {if *key != "" {@@ -1005,6 +1042,9 @@ func (ai *AI) DecryptAPIKeys() {}func (ai *AI) EncryptAPIKeys() {+ if ai.Web != nil && ai.Web.APIKey != "" {+ ai.Web.APIKey = util.AESEncrypt(ai.Web.APIKey)+ }if ai.Decision != nil {ai.Decision.Normalize()for _, profile := range ai.Decision.Profiles {diff --git a/kernel/conf/ai_web_test.go b/kernel/conf/ai_web_test.gonew file mode 100644index 0000000000..ad98cf4a60--- /dev/null+++ b/kernel/conf/ai_web_test.go@@ -0,0 +1,36 @@+package conf++import (+ "encoding/json"+ "testing"+)++func TestAIWebConfiguration(t *testing.T) {+ ai := &AI{}+ ai.Normalize()+ if ai.Web.SearchProvider != "exa" || ai.Web.FetchProvider != "direct" || ai.Web.Timeout != 30 {+ t.Fatal("legacy defaults changed")+ }+ ai.Web = &AIWeb{SearchProvider: " deepseek ", FetchProvider: " direct ", APIKey: " test-key ", Timeout: 900}+ ai.Normalize()+ if ai.Web.SearchProvider != "deepseek" || ai.Web.FetchProvider != "direct" || ai.Web.Timeout != 600 || ai.Web.APIKey != "test-key" {+ t.Fatal("independent providers or limits lost")+ }+ ai.EncryptAPIKeys()+ if ai.Web.APIKey == "test-key" {+ t.Fatal("web credential saved in plaintext")+ }+ data, err := json.Marshal(ai)+ if err != nil {+ t.Fatal(err)+ }+ var restored AI+ if err = json.Unmarshal(data, &restored); err != nil {+ t.Fatal(err)+ }+ restored.DecryptAPIKeys()+ restored.Normalize()+ if restored.Web.APIKey != "test-key" || restored.Web.SearchProvider != "deepseek" || restored.Web.FetchProvider != "direct" {+ t.Fatal("web credentials or provider selection lost after reload")+ }+}diff --git a/kernel/mcp/tools/types.go b/kernel/mcp/tools/types.goindex 1f0f41587f..ba8eeed77e 100644--- a/kernel/mcp/tools/types.go+++ b/kernel/mcp/tools/types.go@@ -65,6 +65,8 @@ type Tool struct {EffectScope string `json:"effectScope,omitempty"`// ActionEffects 按 action 描述本地读写、数据外发与外部计费,供智能体精确执行确认和快照策略。ActionEffects map[string]ToolEffects `json:"-"`+ // ResolveEffects 在列出和确认能力时读取当前配置,未声明时沿用静态效果与既有确认规则。+ ResolveEffects func(string) (ToolEffects, bool) `json:"-"`Handler func(args map[string]any) (CallToolResult, error) `json:"-"`ContextHandler func(ctx context.Context, args map[string]any) (CallToolResult, error) `json:"-"`@@ -83,7 +85,15 @@ func (t *Tool) IsAvailable() bool {}func (t *Tool) EffectsFor(action string) (ToolEffects, bool) {- if t == nil || t.ActionEffects == nil {+ if t == nil {+ return ToolEffects{}, false+ }+ if t.ResolveEffects != nil {+ if effects, declared := t.ResolveEffects(action); declared {+ return effects, true+ }+ }+ if t.ActionEffects == nil {return ToolEffects{}, false}effects, ok := t.ActionEffects[action]diff --git a/kernel/mcp/tools/web.go b/kernel/mcp/tools/web.gonew file mode 100644index 0000000000..ddb48228de--- /dev/null+++ b/kernel/mcp/tools/web.go@@ -0,0 +1,21 @@+package tools++import (+ "github.com/siyuan-note/siyuan/kernel/conf"+ "github.com/siyuan-note/siyuan/kernel/model"+)++func webToolConfig() conf.AIWeb {+ ai := model.Conf.LoadAI()+ if ai != nil && ai.Web != nil {+ return *ai.Web+ }+ return conf.AIWeb{SearchProvider: "exa", FetchProvider: "direct", Timeout: 30}+}++func webToolEffects(provider string) (ToolEffects, bool) {+ if provider == "deepseek" {+ return ToolEffects{DataEgress: true, ExternalCost: true}, true+ }+ return ToolEffects{}, false+}diff --git a/kernel/mcp/tools/web_fetch.go b/kernel/mcp/tools/web_fetch.goindex 9089b1c9f3..a7bd773160 100644--- a/kernel/mcp/tools/web_fetch.go+++ b/kernel/mcp/tools/web_fetch.go@@ -17,12 +17,15 @@package toolsimport (+ "context"+ "fmt""github.com/siyuan-note/siyuan/kernel/util")var WebFetchTool = &Tool{- Name: "web_fetch",- Description: "Fetch a web page over raw HTTP without executing JavaScript or using a browser session, and convert to Markdown or text. url (http/https), format: markdown (default) or text. For client-rendered pages, use native/frontend/web_page_fetch when available in the desktop Electron app.",+ Name: "web_fetch",+ Description: "Fetch a public page using the configured provider (direct HTTP or DeepSeek), as markdown (default) or text. No browser session is used. DeepSeek receives the target URL, charges per successful request, and returns page content only; direct HTTP also downloads files. For client-rendered pages, use native/frontend/web_page_fetch when available in the desktop Electron app.",+ ResolveEffects: func(string) (ToolEffects, bool) { return webToolEffects(webToolConfig().FetchProvider) },InputSchema: ToolSchema{Type: "object",Properties: map[string]Property{@@ -31,21 +34,31 @@ var WebFetchTool = &Tool{},Required: []string{"url"},},- Handler: webFetchHandler,+ ContextHandler: webFetchHandler,}func init() {register(WebFetchTool)}-func webFetchHandler(args map[string]any) (CallToolResult, error) {+func webFetchHandler(ctx context.Context, args map[string]any) (CallToolResult, error) {rawURL, _ := args["url"].(string)format, _ := args["format"].(string)if format == "" {format = "markdown"}- result, err := util.WebFetch(rawURL, format)+ config := webToolConfig()+ var result string+ var err error+ switch config.FetchProvider {+ case "deepseek":+ result, err = util.DeepSeekWebFetch(ctx, util.DeepSeekWebOptions{APIKey: config.APIKey, Timeout: config.Timeout}, rawURL, format)+ case "direct", "":+ result, err = util.WebFetchContext(ctx, rawURL, format)+ default:+ err = fmt.Errorf("unknown web fetch provider: %s", config.FetchProvider)+ }if err != nil {return CallToolResult{Content: []ContentItem{{Type: "text", Text: "web_fetch error: " + err.Error()}},diff --git a/kernel/mcp/tools/web_search.go b/kernel/mcp/tools/web_search.goindex 6b43b5f5b5..49392c541a 100644--- a/kernel/mcp/tools/web_search.go+++ b/kernel/mcp/tools/web_search.go@@ -17,12 +17,15 @@package toolsimport (+ "context"+ "fmt""github.com/siyuan-note/siyuan/kernel/util")var WebSearchTool = &Tool{- Name: "web_search",- Description: "Web search via Exa, returns text results. Action: query(keywords).",+ Name: "web_search",+ Description: "Search the web using the configured provider (Exa or DeepSeek). Returns links and summaries; use web_fetch for page content. Query is sent externally; DeepSeek charges per successful request.",+ ResolveEffects: func(string) (ToolEffects, bool) { return webToolEffects(webToolConfig().SearchProvider) },InputSchema: ToolSchema{Type: "object",Properties: map[string]Property{@@ -30,17 +33,27 @@ var WebSearchTool = &Tool{},Required: []string{"query"},},- Handler: webSearchHandler,+ ContextHandler: webSearchHandler,}func init() {register(WebSearchTool)}-func webSearchHandler(args map[string]any) (CallToolResult, error) {+func webSearchHandler(ctx context.Context, args map[string]any) (CallToolResult, error) {query, _ := args["query"].(string)- result, err := util.WebSearch(query, "")+ config := webToolConfig()+ var result string+ var err error+ switch config.SearchProvider {+ case "deepseek":+ result, err = util.DeepSeekWebSearch(ctx, util.DeepSeekWebOptions{APIKey: config.APIKey, Timeout: config.Timeout}, query)+ case "exa", "":+ result, err = util.WebSearchContext(ctx, query, "")+ default:+ err = fmt.Errorf("unknown web search provider: %s", config.SearchProvider)+ }if err != nil {return CallToolResult{Content: []ContentItem{{Type: "text", Text: "web_search error: " + err.Error()}},diff --git a/kernel/mcp/tools/web_test.go b/kernel/mcp/tools/web_test.gonew file mode 100644index 0000000000..331dc61158--- /dev/null+++ b/kernel/mcp/tools/web_test.go@@ -0,0 +1,43 @@+package tools++import (+ "context"+ "testing"++ "github.com/siyuan-note/siyuan/kernel/conf"+ "github.com/siyuan-note/siyuan/kernel/model"+)++func TestWebToolProvidersAndEffects(t *testing.T) {+ previous := model.Conf+ t.Cleanup(func() { model.Conf = previous })+ model.Conf = model.NewAppConf()+ model.Conf.AI.Store(conf.NewAI())+ for _, tool := range []*Tool{WebSearchTool, WebFetchTool} {+ if _, declared := tool.EffectsFor(""); declared {+ t.Fatal("default provider confirmation behavior changed")+ }+ }+ model.Conf.AI.Load().Web.SearchProvider = "deepseek"+ if effects, declared := WebSearchTool.EffectsFor(""); !declared || !effects.DataEgress || !effects.ExternalCost || effects.LocalWrite {+ t.Fatal("DeepSeek search effects not declared")+ }+ if _, declared := WebFetchTool.EffectsFor(""); declared {+ t.Fatal("search provider unexpectedly changed fetch provider")+ }+ model.Conf.AI.Load().Web.FetchProvider = "deepseek"+ if effects, declared := WebFetchTool.EffectsFor(""); !declared || !effects.ExternalCost || !effects.DataEgress {+ t.Fatal("DeepSeek fetch effects not declared")+ }+ search, _ := webSearchHandler(context.Background(), map[string]any{"query": "test"})+ fetch, _ := webFetchHandler(context.Background(), map[string]any{"url": "https://8.8.8.8"})+ if !search.IsError || !fetch.IsError {+ t.Fatal("missing credentials silently fell back to another provider")+ }+ model.Conf.AI.Load().Web.SearchProvider, model.Conf.AI.Load().Web.FetchProvider = "unknown", "unknown"+ search, _ = webSearchHandler(context.Background(), map[string]any{"query": "test"})+ fetch, _ = webFetchHandler(context.Background(), map[string]any{"url": "https://8.8.8.8"})+ if !search.IsError || !fetch.IsError {+ t.Fatal("unknown provider silently used a different service")+ }+}diff --git a/kernel/model/conf_save_test.go b/kernel/model/conf_save_test.goindex e4d4d9be6e..004728219b 100644--- a/kernel/model/conf_save_test.go+++ b/kernel/model/conf_save_test.go@@ -40,11 +40,12 @@ func TestSaveUsesEncryptedSnapshot(t *testing.T) {app.System.Store(&appconf.System{SafeMode: true})app.AI.Store(appconf.NewAI())app.AI.Load().Providers = []*appconf.Provider{{APIKey: "plain-api-key"}}+ app.AI.Load().Web.APIKey = "plain-web-key"app.Secrets.Store(&appconf.Secrets{Items: []*appconf.Secret{{Name: "token", Value: "plain-secret"}}})app.MCPOAuth = "encrypted-oauth-data"app.Save()- if app.AI.Load().Providers[0].APIKey != "plain-api-key" || app.Secrets.Load().Items[0].Value != "plain-secret" || !app.System.Load().SafeMode {+ if app.AI.Load().Web.APIKey != "plain-web-key" || app.AI.Load().Providers[0].APIKey != "plain-api-key" || app.Secrets.Load().Items[0].Value != "plain-secret" || !app.System.Load().SafeMode {t.Fatalf("live configuration was mutated: %#v", app)}data, err := os.ReadFile(filepath.Join(util.ConfDir, "conf.json"))@@ -55,7 +56,7 @@ func TestSaveUsesEncryptedSnapshot(t *testing.T) {if err = gulu.JSON.UnmarshalJSON(data, stored); err != nil {t.Fatal(err)}- if stored.AI.Load().Providers[0].APIKey == "plain-api-key" || stored.Secrets.Load().Items[0].Value == "plain-secret" || stored.System.Load().SafeMode {+ if stored.AI.Load().Web.APIKey == "plain-web-key" || stored.AI.Load().Providers[0].APIKey == "plain-api-key" || stored.Secrets.Load().Items[0].Value == "plain-secret" || stored.System.Load().SafeMode {t.Fatalf("stored configuration was not sanitized: %#v", stored)}if stored.MCPOAuth != app.MCPOAuth {diff --git a/kernel/util/deepseek_web.go b/kernel/util/deepseek_web.gonew file mode 100644index 0000000000..96b894339a--- /dev/null+++ b/kernel/util/deepseek_web.go@@ -0,0 +1,183 @@+package util++import (+ "bytes"+ "context"+ "encoding/json"+ "errors"+ "fmt"+ "io"+ "net/http"+ "net/url"+ "strings"+ "time"+ "unicode/utf8"++ "github.com/siyuan-note/httpclient"+)++const deepSeekWebURL = "https://api.deepseek.com/v1/tools/"+const deepSeekSearchCount = 5+const deepSeekSearchChars = 8000++type DeepSeekWebOptions struct {+ APIKey string+ Timeout int+}++type deepSeekSearchResult struct {+ Title string `json:"title"`+ URL string `json:"url"`+ Date string `json:"date"`+ Summary string `json:"summary"`+ Snippet string `json:"snippet"`+}++var deepSeekWebHTTPClient = func() *http.Client {+ client := httpclient.NewUserAgentClient(nil)+ // 搜索词、目标网址和凭据仅发送到固定的官方端点,不跟随重定向。+ client.CheckRedirect = func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }+ return client+}()++func deepSeekWebRequest(ctx context.Context, options DeepSeekWebOptions, action string, payload, result any) error {+ key := strings.TrimSpace(options.APIKey)+ if key == "" {+ return errors.New("DeepSeek web API key is not configured")+ }+ timeout := options.Timeout+ if timeout < 1 {+ timeout = 30+ }+ timeout = min(timeout, 600)+ ctx, cancel := context.WithTimeout(ctx, time.Duration(timeout)*time.Second)+ defer cancel()+ body, err := json.Marshal(payload)+ if err != nil {+ return errors.New("could not encode DeepSeek web request")+ }+ req, err := http.NewRequestWithContext(ctx, http.MethodPost, deepSeekWebURL+action, bytes.NewReader(body))+ if err != nil {+ return errors.New("could not create DeepSeek web request")+ }+ req.Header.Set("Authorization", "Bearer "+key)+ req.Header.Set("Content-Type", "application/json")+ resp, err := deepSeekWebHTTPClient.Do(req)+ if err != nil {+ if ctx.Err() != nil {+ return ctx.Err()+ }+ return errors.New("DeepSeek web request failed; check the network")+ }+ defer resp.Body.Close()+ if resp.StatusCode != http.StatusOK {+ return fmt.Errorf("DeepSeek %s returned HTTP %d; check credentials, balance, limits and service availability", action, resp.StatusCode)+ }+ body, err = io.ReadAll(io.LimitReader(resp.Body, maxWebFetchBytes+1))+ if err != nil {+ if ctx.Err() != nil {+ return ctx.Err()+ }+ return errors.New("could not read DeepSeek web response")+ }+ if len(body) > maxWebFetchBytes {+ return errors.New("DeepSeek web response exceeds 5 MiB")+ }+ if !utf8.Valid(body) || json.Unmarshal(body, result) != nil {+ return errors.New("DeepSeek web API returned invalid JSON")+ }+ return nil+}++func DeepSeekWebSearch(ctx context.Context, options DeepSeekWebOptions, query string) (string, error) {+ if strings.TrimSpace(query) == "" || !utf8.ValidString(query) || utf8.RuneCountInString(query) > 128 {+ return "", errors.New("DeepSeek search query must contain 1 to 128 Unicode characters")+ }+ request := struct {+ Query string `json:"query"`+ Count int `json:"count"`+ NeedContent bool `json:"need_content"`+ }{query, deepSeekSearchCount, false}+ var response struct {+ Results []deepSeekSearchResult `json:"results"`+ }+ if err := deepSeekWebRequest(ctx, options, "search", request, &response); err != nil {+ return "", err+ }+ if response.Results == nil {+ return "", errors.New("DeepSeek search response is missing results")+ }+ if len(response.Results) == 0 {+ return "No search results found. Please try a different query.", nil+ }+ var output strings.Builder+ remaining := deepSeekSearchChars+ for _, item := range response.Results[:min(len(response.Results), deepSeekSearchCount)] {+ u, err := url.Parse(item.URL)+ if err != nil || u.Host == "" || u.User != nil || u.Scheme != "http" && u.Scheme != "https" {+ continue+ }+ // 保留完整链接;预算不足时略过该条,不能把截断的网址交给模型继续抓取。+ header := fmt.Sprintf("Title: %s\nURL: %s\nDate: %s\nSummary: ",+ clipWebText(item.Title, 200), item.URL, clipWebText(item.Date, 64))+ headerChars := utf8.RuneCountInString(header) + 2+ if headerChars >= remaining {+ continue+ }+ summary := item.Summary+ if strings.TrimSpace(summary) == "" {+ summary = item.Snippet+ }+ entry := header + clipWebText(summary, min(800, remaining-headerChars)) + "\n\n"+ output.WriteString(entry)+ remaining -= utf8.RuneCountInString(entry)+ }+ if output.Len() == 0 {+ return "", errors.New("DeepSeek search returned no usable result links")+ }+ return output.String(), nil+}++func clipWebText(text string, limit int) string {+ runes := []rune(text)+ if len(runes) <= limit {+ return text+ }+ marker := strings.Repeat(".", min(3, max(0, limit)))+ return string(runes[:max(0, limit-len(marker))]) + marker+}++func DeepSeekWebFetch(ctx context.Context, options DeepSeekWebOptions, rawURL, format string) (string, error) {+ u, err := url.Parse(rawURL)+ if err != nil || u.Host == "" || u.User != nil || u.Scheme != "http" && u.Scheme != "https" ||+ utf8.RuneCountInString(rawURL) > 8192 {+ return "", errors.New("DeepSeek fetch requires an HTTP/HTTPS URL without credentials, up to 8192 characters")+ }+ if err = CheckHostSSRF(u.Hostname()); err != nil {+ return "", err+ }+ var response struct {+ Title string `json:"title"`+ Content *string `json:"content"`+ }+ if err = deepSeekWebRequest(ctx, options, "fetch", struct {+ URL string `json:"url"`+ }{rawURL}, &response); err != nil {+ return "", err+ }+ if response.Content == nil || strings.TrimSpace(*response.Content) == "" {+ return "", errors.New("DeepSeek fetch returned no page content; use direct fetch for file downloads")+ }+ result := *response.Content+ if format == "text" {+ engine := NewLute()+ result, err = safeHTML2Text(engine, SanitizeHTML(engine.MarkdownStr("", result)))+ if err != nil {+ return "", errors.New("DeepSeek Markdown to text conversion failed")+ }+ }+ if strings.TrimSpace(result) == "" {+ return "", errors.New("DeepSeek fetch returned no meaningful page text")+ }+ return truncateRunes(result, maxWebFetchChars), nil+}diff --git a/kernel/util/deepseek_web_test.go b/kernel/util/deepseek_web_test.gonew file mode 100644index 0000000000..0a70c2dc04--- /dev/null+++ b/kernel/util/deepseek_web_test.go@@ -0,0 +1,165 @@+package util++import (+ "context"+ "encoding/json"+ "errors"+ "io"+ "net/http"+ "strconv"+ "strings"+ "testing"+ "unicode/utf8"+)++type deepSeekWebTestTransport func(*http.Request) (*http.Response, error)++func (transport deepSeekWebTestTransport) RoundTrip(request *http.Request) (*http.Response, error) {+ return transport(request)+}++func mockDeepSeekWeb(t *testing.T, status int, body string, inspect func(*http.Request)) {+ t.Helper()+ previous := deepSeekWebHTTPClient+ t.Cleanup(func() { deepSeekWebHTTPClient = previous })+ deepSeekWebHTTPClient = &http.Client{Transport: deepSeekWebTestTransport(func(request *http.Request) (*http.Response, error) {+ if request.Method != http.MethodPost || request.Header.Get("Authorization") != "Bearer test-key" ||+ request.Header.Get("Content-Type") != "application/json" || !strings.HasPrefix(request.URL.String(), deepSeekWebURL) {+ t.Fatal("invalid authenticated request")+ }+ if inspect != nil {+ inspect(request)+ }+ return &http.Response{StatusCode: status, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body))}, nil+ })}+}++func TestDeepSeekWebSearchBudgetAndRequest(t *testing.T) {+ rows := make([]map[string]string, 8)+ for index := range rows {+ rows[index] = map[string]string{"title": "标题", "url": "https://example.com/page", "date": "2026-10-18",+ "summary": strings.Repeat("摘要", 1000), "snippet": "short", "content": "must not reach the model"}+ }+ rows[0]["summary"], rows[0]["snippet"] = " ", "fallback snippet"+ rows[1]["url"] = "https://example.com/" + strings.Repeat("a", deepSeekSearchChars)+ body, _ := json.Marshal(map[string]any{"results": rows})+ mockDeepSeekWeb(t, 200, string(body), func(request *http.Request) {+ var payload map[string]any+ if err := json.NewDecoder(request.Body).Decode(&payload); err != nil {+ t.Fatal(err)+ }+ if request.URL.Path != "/v1/tools/search" || len(payload) != 3 || payload["query"] != "关键词" ||+ payload["count"] != float64(5) || payload["need_content"] != false {+ t.Fatal("search sent unexpected fields or fetched full content")+ }+ })+ text, err := DeepSeekWebSearch(context.Background(), DeepSeekWebOptions{APIKey: "test-key"}, "关键词")+ if err != nil || !utf8.ValidString(text) || utf8.RuneCountInString(text) > deepSeekSearchChars ||+ !strings.Contains(text, "fallback snippet") || strings.Contains(text, strings.Repeat("摘要", 401)) ||+ strings.Contains(text, "must not reach the model") || strings.Count(text, "URL:") != 4 {+ t.Fatalf("search result normalization failed: length=%d err=%v", utf8.RuneCountInString(text), err)+ }+}++func TestDeepSeekWebSearchResponses(t *testing.T) {+ for _, entry := range []struct {+ body string+ ok bool+ }{+ {`{"results":[]}`, true},+ {`{}`, false},+ {`{"results":null}`, false},+ {`{"results":"invalid"}`, false},+ {`{"results":[{"url":"javascript:alert(1)"}]}`, false},+ {`{"results":[{"url":"https://user:[email protected]"}]}`, false},+ {`{"results":[{"title":"page","url":"https://example.com","snippet":"summary"}]}`, true},+ {`{"error":{"message":"secret provider details"}}`, false},+ {`invalid JSON`, false},+ } {+ t.Run(entry.body, func(t *testing.T) {+ mockDeepSeekWeb(t, 200, entry.body, nil)+ _, err := DeepSeekWebSearch(context.Background(), DeepSeekWebOptions{APIKey: "test-key"}, "test")+ if (err == nil) != entry.ok {+ t.Fatalf("unexpected response handling: %v", err)+ }+ })+ }+ for _, query := range []string{"", " \t", strings.Repeat("字", 129)} {+ if _, err := DeepSeekWebSearch(context.Background(), DeepSeekWebOptions{}, query); err == nil {+ t.Fatal("invalid query accepted")+ }+ }+ if _, err := DeepSeekWebSearch(context.Background(), DeepSeekWebOptions{}, "test"); err == nil {+ t.Fatal("missing key accepted")+ }+}++func TestDeepSeekWebFetchFormatsAndBoundaries(t *testing.T) {+ for _, format := range []string{"markdown", "text"} {+ t.Run(format, func(t *testing.T) {+ mockDeepSeekWeb(t, 200, `{"title":"Title","content":"# Heading\n\n**正文** [link](https://example.com)"}`, func(request *http.Request) {+ var payload map[string]string+ if err := json.NewDecoder(request.Body).Decode(&payload); err != nil {+ t.Fatal(err)+ }+ if request.URL.Path != "/v1/tools/fetch" || len(payload) != 1 || payload["url"] != "https://8.8.8.8/page" {+ t.Fatal("fetch sent unexpected fields")+ }+ })+ text, err := DeepSeekWebFetch(context.Background(), DeepSeekWebOptions{APIKey: "test-key"}, "https://8.8.8.8/page", format)+ if err != nil || !strings.Contains(text, "正文") || !strings.Contains(text, "Heading") ||+ (format == "text" && strings.Contains(text, "**")) || (format == "markdown" && !strings.Contains(text, "**正文**")) {+ t.Fatalf("fetch conversion failed: %q %v", text, err)+ }+ })+ }+ for _, rawURL := range []string{"file:///tmp/page", "https://user:[email protected]", "http://127.0.0.1", "http://[::1]", "https://", "https://example.com/" + strings.Repeat("x", 8192)} {+ if _, err := DeepSeekWebFetch(context.Background(), DeepSeekWebOptions{APIKey: "test-key"}, rawURL, "markdown"); err == nil {+ t.Fatal("invalid or private URL accepted")+ }+ }+ for _, body := range []string{`{}`, `{"content":null}`, `{"content":" "}`} {+ t.Run(body, func(t *testing.T) {+ mockDeepSeekWeb(t, 200, body, nil)+ if _, err := DeepSeekWebFetch(context.Background(), DeepSeekWebOptions{APIKey: "test-key"}, "https://8.8.8.8", "markdown"); err == nil {+ t.Fatal("empty fetch result accepted")+ }+ })+ }+}++func TestDeepSeekWebFailureCancellationAndSize(t *testing.T) {+ if deepSeekWebHTTPClient.CheckRedirect(nil, nil) != http.ErrUseLastResponse {+ t.Fatal("authenticated redirects must be rejected")+ }+ for _, status := range []int{301, 400, 401, 402, 403, 404, 429, 500, 504} {+ t.Run(http.StatusText(status), func(t *testing.T) {+ calls := 0+ mockDeepSeekWeb(t, status, `{"error":{"message":"test-key"}}`, func(*http.Request) { calls++ })+ _, err := DeepSeekWebSearch(context.Background(), DeepSeekWebOptions{APIKey: "test-key"}, "test")+ if err == nil || !strings.Contains(err.Error(), "HTTP "+strconv.Itoa(status)) || strings.Contains(err.Error(), "test-key") || calls != 1 {+ t.Fatalf("provider failure retried, hidden or leaked: %v calls=%d", err, calls)+ }+ })+ }+ t.Run("oversize", func(t *testing.T) {+ mockDeepSeekWeb(t, 200, strings.Repeat("x", maxWebFetchBytes+1), nil)+ if _, err := DeepSeekWebSearch(context.Background(), DeepSeekWebOptions{APIKey: "test-key"}, "test"); err == nil || !strings.Contains(err.Error(), "5 MiB") {+ t.Fatal("oversize response accepted")+ }+ })+ t.Run("cancel", func(t *testing.T) {+ previous := deepSeekWebHTTPClient+ t.Cleanup(func() { deepSeekWebHTTPClient = previous })+ deepSeekWebHTTPClient = &http.Client{Transport: deepSeekWebTestTransport(func(request *http.Request) (*http.Response, error) {+ <-request.Context().Done()+ return nil, request.Context().Err()+ })}+ ctx, cancel := context.WithCancel(context.Background())+ cancel()+ _, err := DeepSeekWebSearch(ctx, DeepSeekWebOptions{APIKey: "test-key"}, "test")+ if !errors.Is(err, context.Canceled) {+ t.Fatalf("request did not propagate cancellation: %v", err)+ }+ })+}diff --git a/kernel/util/webfetch.go b/kernel/util/webfetch.goindex ea2c5f8ebb..701b5d5a41 100644--- a/kernel/util/webfetch.go+++ b/kernel/util/webfetch.go@@ -17,6 +17,7 @@package utilimport (+ "context""errors""fmt""io"@@ -39,6 +40,10 @@ const ()func WebFetch(rawURL, format string) (string, error) {+ return WebFetchContext(context.Background(), rawURL, format)+}++func WebFetchContext(ctx context.Context, rawURL, format string) (string, error) {u, err := url.Parse(rawURL)if err != nil || (u.Scheme != "http" && u.Scheme != "https") {return "", errors.New("URL must start with http:// or https://")@@ -51,7 +56,7 @@ func WebFetch(rawURL, format string) (string, error) {return "", err}- req, err := http.NewRequest(http.MethodGet, rawURL, nil)+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, rawURL, nil)if err != nil {return "", err}diff --git a/kernel/util/websearch.go b/kernel/util/websearch.goindex 5497b70126..fe93fa7872 100644--- a/kernel/util/websearch.go+++ b/kernel/util/websearch.go@@ -17,6 +17,7 @@package utilimport (+ "context""encoding/json""errors""fmt"@@ -67,6 +68,10 @@ type mcpContent struct {}func WebSearch(query, exaApiKey string) (string, error) {+ return WebSearchContext(context.Background(), query, exaApiKey)+}++func WebSearchContext(ctx context.Context, query, exaApiKey string) (string, error) {exaURL := defaultExaURLif exaApiKey != "" {exaURL += "?exaApiKey=" + url.QueryEscape(exaApiKey)@@ -87,7 +92,7 @@ func WebSearch(query, exaApiKey string) (string, error) {},}- resp, err := httpclient.NewBrowserRequest().SetHeader("Accept", "application/json, text/event-stream").SetBody(reqBody).Post(exaURL)+ resp, err := httpclient.NewBrowserRequest().SetContext(ctx).SetHeader("Accept", "application/json, text/event-stream").SetBody(reqBody).Post(exaURL)if err != nil {return "", errors.New("web search failed: " + err.Error())}