diff --git a/app/client/platforms/alibaba.ts b/app/client/platforms/alibaba.ts index 46cc3f908..ce88f6d53 100644 --- a/app/client/platforms/alibaba.ts +++ b/app/client/platforms/alibaba.ts @@ -58,6 +58,7 @@ interface RequestParam { top_p: number; max_tokens?: number; tools?: FunctionToolItem[]; + enable_search?: boolean; } interface RequestPayload { model: string; @@ -199,6 +200,7 @@ export class QwenApi implements LLMApi { temperature: modelConfig.temperature, // max_tokens: modelConfig.max_tokens, top_p: modelConfig.top_p === 1 ? 0.99 : modelConfig.top_p, // qwen top_p is should be < 1 + enable_search: modelConfig.enableNetWork, }, }; diff --git a/app/components/chat.tsx b/app/components/chat.tsx index d9362ca90..9f7357e43 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -48,6 +48,7 @@ import PluginIcon from "../icons/plugin.svg"; import ShortcutkeyIcon from "../icons/shortcutkey.svg"; import McpToolIcon from "../icons/tool.svg"; import HeadphoneIcon from "../icons/headphone.svg"; +import NetWorkIcon from "../icons/network.svg"; import { BOT_HELLO, ChatMessage, @@ -75,6 +76,7 @@ import { useMobileScreen, selectOrCopy, showPlugins, + canUseNetWork, } from "../utils"; import { uploadImage as uploadImageRemote } from "@/app/utils/chat"; @@ -510,6 +512,7 @@ export function ChatActions(props: { // switch themes const theme = config.theme; + const enableNetWork = config.modelConfig.enableNetWork; function nextTheme() { const themes = [Theme.Auto, Theme.Light, Theme.Dark]; @@ -519,6 +522,13 @@ export function ChatActions(props: { config.update((config) => (config.theme = nextTheme)); } + function nextNetWork() { + config.update( + (config) => + (config.modelConfig.enableNetWork = !config.modelConfig.enableNetWork), + ); + } + // stop all responses const couldStop = ChatControllerPool.hasPending(); const stopAll = () => ChatControllerPool.stopAll(); @@ -831,6 +841,16 @@ export function ChatActions(props: { /> )} {!isMobileScreen && } + + {canUseNetWork(currentModel) && ( + } + /> + )}
{config.realtimeConfig.enable && ( diff --git a/app/icons/network.svg b/app/icons/network.svg new file mode 100644 index 000000000..cf98a3587 --- /dev/null +++ b/app/icons/network.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/locales/ar.ts b/app/locales/ar.ts index 6237e11b3..addb59a31 100644 --- a/app/locales/ar.ts +++ b/app/locales/ar.ts @@ -72,6 +72,10 @@ const ar: PartialLocaleType = { light: "الوضع الفاتح", dark: "الوضع الداكن", }, + NetWork: { + on: "تفعيل البحث عبر الإنترنت", + off: "إيقاف البحث عبر الإنترنت", + }, Prompt: "الأوامر السريعة", Masks: "جميع الأقنعة", Clear: "مسح الدردشة", diff --git a/app/locales/bn.ts b/app/locales/bn.ts index 6ec3606f3..614f1ac78 100644 --- a/app/locales/bn.ts +++ b/app/locales/bn.ts @@ -72,6 +72,10 @@ const bn: PartialLocaleType = { light: "আলোর মোড", dark: "অন্ধকার মোড", }, + NetWork: { + on: "ওয়েব অনুসন্ধান সক্রিয় করুন", + off: "ওয়েব অনুসন্ধান নিষ্ক্রিয় করুন", + }, Prompt: "সংক্ষিপ্ত নির্দেশনা", Masks: "সমস্ত মাস্ক", Clear: "চ্যাট পরিষ্কার করুন", diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 2cb7dd1e5..cc03490ab 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -76,6 +76,10 @@ const cn = { light: "亮色模式", dark: "深色模式", }, + NetWork: { + on: "开启联网搜索", + off: "关闭联网搜索", + }, Prompt: "快捷指令", Masks: "所有面具", Clear: "清除聊天", diff --git a/app/locales/cs.ts b/app/locales/cs.ts index c4ce2653a..e84e2dfc5 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -72,6 +72,10 @@ const cs: PartialLocaleType = { light: "Světelný režim", dark: "Tmavý režim", }, + NetWork: { + on: "Povolit webové vyhledávání", + off: "Zakázat webové vyhledávání", + }, Prompt: "Rychlé příkazy", Masks: "Všechny masky", Clear: "Vymazat konverzaci", diff --git a/app/locales/da.ts b/app/locales/da.ts index 7c976188a..62d28d5e6 100644 --- a/app/locales/da.ts +++ b/app/locales/da.ts @@ -74,6 +74,10 @@ const da: PartialLocaleType = { light: "Lyst tema", dark: "Mørkt tema", }, + NetWork: { + on: "Aktivér web-søgning", + off: "Deaktivér web-søgning", + }, Prompt: "Prompts", Masks: "Personaer", Clear: "Ryd kontekst", diff --git a/app/locales/de.ts b/app/locales/de.ts index 1e5c75985..574738b95 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -73,6 +73,10 @@ const de: PartialLocaleType = { light: "Helles Thema", dark: "Dunkles Thema", }, + NetWork: { + on: "Web-Suche aktivieren", + off: "Web-Suche deaktivieren", + }, Prompt: "Schnellbefehle", Masks: "Alle Masken", Clear: "Chat löschen", @@ -437,7 +441,8 @@ const de: PartialLocaleType = { AI302: { ApiKey: { Title: "Schnittstellenschlüssel", - SubTitle: "Verwenden Sie einen benutzerdefinierten 302.AI API-Schlüssel", + SubTitle: + "Verwenden Sie einen benutzerdefinierten 302.AI API-Schlüssel", Placeholder: "302.AI API-Schlüssel", }, Endpoint: { diff --git a/app/locales/en.ts b/app/locales/en.ts index a6d191904..7c8ae8708 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -77,6 +77,10 @@ const en: LocaleType = { light: "Light Theme", dark: "Dark Theme", }, + NetWork: { + on: "Enable Web Search", + off: "Disable Web Search", + }, Prompt: "Prompts", Masks: "Masks", Clear: "Clear Context", diff --git a/app/locales/es.ts b/app/locales/es.ts index be229c20c..95657b67d 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -74,6 +74,10 @@ const es: PartialLocaleType = { light: "Modo claro", dark: "Modo oscuro", }, + NetWork: { + on: "Habilitar búsqueda web", + off: "Deshabilitar búsqueda web", + }, Prompt: "Comandos rápidos", Masks: "Todas las máscaras", Clear: "Limpiar chat", diff --git a/app/locales/fr.ts b/app/locales/fr.ts index 0675d925c..ecbcba54e 100644 --- a/app/locales/fr.ts +++ b/app/locales/fr.ts @@ -73,6 +73,10 @@ const fr: PartialLocaleType = { light: "Mode clair", dark: "Mode sombre", }, + NetWork: { + on: "Activer la recherche web", + off: "Désactiver la recherche web", + }, Prompt: "Commandes rapides", Masks: "Tous les masques", Clear: "Effacer la discussion", diff --git a/app/locales/id.ts b/app/locales/id.ts index 68cf43e30..7963ad5a6 100644 --- a/app/locales/id.ts +++ b/app/locales/id.ts @@ -72,6 +72,10 @@ const id: PartialLocaleType = { light: "Mode Terang", dark: "Mode Gelap", }, + NetWork: { + on: "Aktifkan pencarian web", + off: "Nonaktifkan pencarian web", + }, Prompt: "Perintah Cepat", Masks: "Semua Masker", Clear: "Hapus Obrolan", diff --git a/app/locales/it.ts b/app/locales/it.ts index c098f63d1..84b0736b8 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -73,6 +73,10 @@ const it: PartialLocaleType = { light: "Tema chiaro", dark: "Tema scuro", }, + NetWork: { + on: "Abilita ricerca web", + off: "Disabilita ricerca web", + }, Prompt: "Comandi rapidi", Masks: "Tutte le maschere", Clear: "Pulisci chat", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index d605b578f..977f7eb96 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -72,6 +72,10 @@ const jp: PartialLocaleType = { light: "ライトモード", dark: "ダークモード", }, + NetWork: { + on: "ウェブ検索を有効化", + off: "ウェブ検索を無効化", + }, Prompt: "クイックコマンド", Masks: "すべてのマスク", Clear: "チャットをクリア", diff --git a/app/locales/ko.ts b/app/locales/ko.ts index 023edca4a..118c86bd1 100644 --- a/app/locales/ko.ts +++ b/app/locales/ko.ts @@ -76,6 +76,10 @@ const ko: PartialLocaleType = { light: "라이트 모드", dark: "다크 모드", }, + NetWork: { + on: "웹 검색 활성화", + off: "웹 검색 비활성화", + }, Prompt: "빠른 명령", Masks: "모든 마스크", Clear: "채팅 지우기", diff --git a/app/locales/no.ts b/app/locales/no.ts index e0556a853..2635acf9b 100644 --- a/app/locales/no.ts +++ b/app/locales/no.ts @@ -74,6 +74,10 @@ const no: PartialLocaleType = { light: "Lyst tema", dark: "Mørkt tema", }, + NetWork: { + on: "Aktiver web-søk", + off: "Deaktiver web-søk", + }, Prompt: "Hurtigkommando", Masks: "Alle masker", Clear: "Rydd samtale", diff --git a/app/locales/pt.ts b/app/locales/pt.ts index 6b80c2ec1..ea34a3e51 100644 --- a/app/locales/pt.ts +++ b/app/locales/pt.ts @@ -72,6 +72,10 @@ const pt: PartialLocaleType = { light: "Tema Claro", dark: "Tema Escuro", }, + NetWork: { + on: "Ativar pesquisa web", + off: "Desativar pesquisa web", + }, Prompt: "Prompts", Masks: "Máscaras", Clear: "Limpar Contexto", diff --git a/app/locales/ru.ts b/app/locales/ru.ts index a4f0c949c..2aadcf6fd 100644 --- a/app/locales/ru.ts +++ b/app/locales/ru.ts @@ -72,6 +72,10 @@ const ru: PartialLocaleType = { light: "Светлая тема", dark: "Темная тема", }, + NetWork: { + on: "Включить веб-поиск", + off: "Отключить веб-поиск", + }, Prompt: "Быстрая команда", Masks: "Все маски", Clear: "Очистить чат", diff --git a/app/locales/sk.ts b/app/locales/sk.ts index 6508f7f38..f5dae93d0 100644 --- a/app/locales/sk.ts +++ b/app/locales/sk.ts @@ -73,6 +73,10 @@ const sk: PartialLocaleType = { light: "Svetlý motív", dark: "Tmavý motív", }, + NetWork: { + on: "Povoliť webové vyhľadávanie", + off: "Zakázať webové vyhľadávanie", + }, Prompt: "Výzvy", Masks: "Masky", Clear: "Vymazať kontext", diff --git a/app/locales/tr.ts b/app/locales/tr.ts index 15d21fb7d..219e44be8 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -72,6 +72,10 @@ const tr: PartialLocaleType = { light: "Açık mod", dark: "Koyu mod", }, + NetWork: { + on: "Web aramasını etkinleştir", + off: "Web aramasını devre dışı bırak", + }, Prompt: "Kısayol komutu", Masks: "Tüm maskeler", Clear: "Sohbeti temizle", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index d09465d9e..06c25b1ee 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -72,6 +72,10 @@ const tw = { light: "亮色模式", dark: "深色模式", }, + NetWork: { + on: "開啟網路搜尋", + off: "關閉網路搜尋", + }, Prompt: "快捷指令", Masks: "所有角色範本", Clear: "清除聊天", diff --git a/app/locales/vi.ts b/app/locales/vi.ts index 7f6ed3f6f..eeb3e06a7 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -72,6 +72,10 @@ const vi: PartialLocaleType = { light: "Chế độ sáng", dark: "Chế độ tối", }, + NetWork: { + on: "Bật tìm kiếm web", + off: "Tắt tìm kiếm web", + }, Prompt: "Lệnh tắt", Masks: "Tất cả mặt nạ", Clear: "Xóa cuộc trò chuyện", diff --git a/app/store/config.ts b/app/store/config.ts index 602e80318..fa243dbb5 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -6,7 +6,6 @@ import { DEFAULT_MODELS, DEFAULT_SIDEBAR_WIDTH, DEFAULT_TTS_ENGINE, - DEFAULT_TTS_ENGINES, DEFAULT_TTS_MODEL, DEFAULT_TTS_MODELS, DEFAULT_TTS_VOICE, @@ -82,6 +81,7 @@ export const DEFAULT_CONFIG = { size: "1024x1024" as ModelSize, quality: "standard" as DalleQuality, style: "vivid" as DalleStyle, + enableNetWork: false, }, ttsConfig: { diff --git a/app/utils.ts b/app/utils.ts index 073d4743c..6422afa05 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -296,6 +296,15 @@ export function isDalle3(model: string) { return "dall-e-3" === model; } +export function canUseNetWork(model: string) { + return ( + model.includes("qwen-max") || + model.includes("qwen-plus") || + model.includes("qwen-turbo") || + model.includes("qwq") + ); +} + export function getTimeoutMSByModel(model: string) { model = model.toLowerCase(); if ( diff --git a/public/plugins.json b/public/plugins.json index c4d7ec46a..d255759cb 100644 --- a/public/plugins.json +++ b/public/plugins.json @@ -2,16 +2,16 @@ { "id": "dalle3", "name": "Dalle3", - "schema": "https://ghp.ci/https://raw.githubusercontent.com/ChatGPTNextWeb/NextChat-Awesome-Plugins/main/plugins/dalle/openapi.json" + "schema": "https://raw.githubusercontent.com/ChatGPTNextWeb/NextChat-Awesome-Plugins/main/plugins/dalle/openapi.json" }, { "id": "arxivsearch", "name": "ArxivSearch", - "schema": "https://ghp.ci/https://raw.githubusercontent.com/ChatGPTNextWeb/NextChat-Awesome-Plugins/main/plugins/arxivsearch/openapi.json" + "schema": "https://raw.githubusercontent.com/ChatGPTNextWeb/NextChat-Awesome-Plugins/main/plugins/arxivsearch/openapi.json" }, { "id": "duckduckgolite", "name": "DuckDuckGoLiteSearch", - "schema": "https://ghp.ci/https://raw.githubusercontent.com/ChatGPTNextWeb/NextChat-Awesome-Plugins/main/plugins/duckduckgolite/openapi.json" + "schema": "https://raw.githubusercontent.com/ChatGPTNextWeb/NextChat-Awesome-Plugins/main/plugins/duckduckgolite/openapi.json" } ]