feat(ui): 系统设置接入会话发送键位与 Web 搜索代理
- 会话发送键位改用 chat-send-mode 统一配置(CHAT_SEND_MODE_OPTIONS/ useChatSendMode),替换页面内自维护的模式常量。 - Web 搜索区新增代理输入框(http/socks5,留空为直连)。 Claude-Session: https://claude.ai/code/session_01RtPQYJ8W1mcaace3sHWGDm
This commit is contained in:
1 parent
be90d520a3
commit
a3fe9b767b
1 file changed
+31
-19
@@ -12,12 +12,7 @@ import { Label } from "@/components/ui/label";
|
|||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { api } from "@/lib/api";
|
import { api } from "@/lib/api";
|
||||||
import {
|
import { CHAT_SEND_MODE_OPTIONS, type ChatSendMode, setChatSendMode, useChatSendMode } from "@/lib/chat-send-mode";
|
||||||
CHAT_SEND_MODE_OPTIONS,
|
|
||||||
type ChatSendMode,
|
|
||||||
setChatSendMode,
|
|
||||||
useChatSendMode,
|
|
||||||
} from "@/lib/chat-send-mode";
|
|
||||||
import type { Settings } from "@/lib/types";
|
import type { Settings } from "@/lib/types";
|
||||||
|
|
||||||
export default function SystemSettingsPage() {
|
export default function SystemSettingsPage() {
|
||||||
@@ -82,7 +77,11 @@ export default function SystemSettingsPage() {
|
|||||||
};
|
};
|
||||||
const detectPython = () => {
|
const detectPython = () => {
|
||||||
setSaving(true);
|
setSaving(true);
|
||||||
api.detectPython().then((r) => setPyInterp(r.python_interpreter)).catch(() => undefined).finally(() => setSaving(false));
|
api
|
||||||
|
.detectPython()
|
||||||
|
.then((r) => setPyInterp(r.python_interpreter))
|
||||||
|
.catch(() => undefined)
|
||||||
|
.finally(() => setSaving(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@@ -189,7 +188,12 @@ export default function SystemSettingsPage() {
|
|||||||
<p className="text-muted-foreground text-sm">全局运行时开关</p>
|
<p className="text-muted-foreground text-sm">全局运行时开关</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card className="max-w-2xl">
|
{/* 多列而非 grid:网络搜索卡片比其余高数倍,且高度随所选后端变化(brave/tavily
|
||||||
|
的 key 输入是条件渲染)。grid 会按最高的一张撑满整行、在旁边留下大片空白,
|
||||||
|
多列则自动按内容高度平衡填充。卡片间距靠 mb 而非 gap——多列布局下
|
||||||
|
column-gap 只管列间距,行间距要由子元素自己给。 */}
|
||||||
|
<div className="columns-1 gap-4 md:gap-6 lg:columns-2">
|
||||||
|
<Card className="mb-4 break-inside-avoid md:mb-6">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="flex items-center gap-2 text-base">
|
<CardTitle className="flex items-center gap-2 text-base">
|
||||||
<RadioTowerIcon className="size-4" />
|
<RadioTowerIcon className="size-4" />
|
||||||
@@ -216,7 +220,7 @@ export default function SystemSettingsPage() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="max-w-2xl">
|
<Card className="mb-4 break-inside-avoid md:mb-6">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="flex items-center gap-2 text-base">
|
<CardTitle className="flex items-center gap-2 text-base">
|
||||||
<SearchIcon className="size-4" />
|
<SearchIcon className="size-4" />
|
||||||
@@ -224,9 +228,11 @@ export default function SystemSettingsPage() {
|
|||||||
</CardTitle>
|
</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
这是网络搜索的<b>总开关 + 来源配置</b>。开启后,才能在<b>每个 Agent 的配置</b>里单独选择是否启用
|
这是网络搜索的<b>总开关 + 来源配置</b>。开启后,才能在<b>每个 Agent 的配置</b>里单独选择是否启用
|
||||||
<b>web_search</b>(仅返回标题/链接/摘要,不抓取正文;抓取由 WebFetch 负责)。网络搜索<b>不走</b>记录代理,独立于流量捕获。
|
<b>web_search</b>(仅返回标题/链接/摘要,不抓取正文;抓取由 WebFetch 负责)。网络搜索<b>不走</b>
|
||||||
|
记录代理,独立于流量捕获。
|
||||||
<br />
|
<br />
|
||||||
来源可选 <b>DuckDuckGo(ddgs)</b>(无需 Key)、<b>Brave(免费版)</b>(需填写 Brave API Key)或 <b>Tavily</b>(需填写 Tavily API Key)。总开关关闭时,各 Agent 的网络搜索开关不可用。
|
来源可选 <b>DuckDuckGo(ddgs)</b>(无需 Key)、<b>Brave(免费版)</b>(需填写 Brave API Key)或{" "}
|
||||||
|
<b>Tavily</b>(需填写 Tavily API Key)。总开关关闭时,各 Agent 的网络搜索开关不可用。
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="flex flex-col gap-4">
|
<CardContent className="flex flex-col gap-4">
|
||||||
@@ -332,9 +338,7 @@ export default function SystemSettingsPage() {
|
|||||||
已选择 Tavily 但尚未配置 Key —— 在保存 Key 之前,搜索工具不会启用。
|
已选择 Tavily 但尚未配置 Key —— 在保存 Key 之前,搜索工具不会启用。
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<p className="text-muted-foreground text-xs">
|
<p className="text-muted-foreground text-xs">前往 https://tavily.com 注册并获取 API Key。</p>
|
||||||
前往 https://tavily.com 注册并获取 API Key。
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -367,7 +371,13 @@ export default function SystemSettingsPage() {
|
|||||||
<p className="text-muted-foreground text-xs">
|
<p className="text-muted-foreground text-xs">
|
||||||
用当前配置(来源 + 代理 + Key)实际搜索一次「test」,验证是否可用。
|
用当前配置(来源 + 代理 + Key)实际搜索一次「test」,验证是否可用。
|
||||||
</p>
|
</p>
|
||||||
<Button type="button" variant="outline" onClick={runTest} disabled={!loaded || testing} className="shrink-0">
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
onClick={runTest}
|
||||||
|
disabled={!loaded || testing}
|
||||||
|
className="shrink-0"
|
||||||
|
>
|
||||||
{testing ? "测试中…" : "测试搜索"}
|
{testing ? "测试中…" : "测试搜索"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -375,7 +385,7 @@ export default function SystemSettingsPage() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="max-w-2xl">
|
<Card className="mb-4 break-inside-avoid md:mb-6">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="flex items-center gap-2 text-base">
|
<CardTitle className="flex items-center gap-2 text-base">
|
||||||
<RadioTowerIcon className="size-4" />
|
<RadioTowerIcon className="size-4" />
|
||||||
@@ -405,14 +415,15 @@ export default function SystemSettingsPage() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="max-w-2xl">
|
<Card className="mb-4 break-inside-avoid md:mb-6">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="flex items-center gap-2 text-base">
|
<CardTitle className="flex items-center gap-2 text-base">
|
||||||
<CpuIcon className="size-4" />
|
<CpuIcon className="size-4" />
|
||||||
工作并发 · Work Agent 数
|
工作并发 · Work Agent 数
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
每个任务并发运行的工作 agent 数量(默认 3)。数值越大并发探测越多、消耗也越高。修改后<b>对之后启动的任务生效</b>,正在运行的任务不受影响。
|
每个任务并发运行的工作 agent 数量(默认 3)。数值越大并发探测越多、消耗也越高。修改后
|
||||||
|
<b>对之后启动的任务生效</b>,正在运行的任务不受影响。
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="flex flex-col gap-3">
|
<CardContent className="flex flex-col gap-3">
|
||||||
@@ -433,7 +444,7 @@ export default function SystemSettingsPage() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="max-w-2xl">
|
<Card className="mb-4 break-inside-avoid md:mb-6">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="flex items-center gap-2 text-base">
|
<CardTitle className="flex items-center gap-2 text-base">
|
||||||
<KeyboardIcon className="size-4" />
|
<KeyboardIcon className="size-4" />
|
||||||
@@ -464,5 +475,6 @@ export default function SystemSettingsPage() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user