feat: 添加联网搜索功能,更新相关配置和多语言支持

This commit is contained in:
EvanWu
2025-08-05 18:28:06 +08:00
parent 4e3f166d67
commit 044298e18a
26 changed files with 118 additions and 5 deletions

View File

@@ -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 && <MCPAction />}
{canUseNetWork(currentModel) && (
<ChatAction
onClick={nextNetWork}
text={
Locale.Chat.InputActions.NetWork[enableNetWork ? "on" : "off"]
}
icon={<NetWorkIcon />}
/>
)}
</>
<div className={styles["chat-input-actions-end"]}>
{config.realtimeConfig.enable && (