mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-03 18:23:51 +08:00
feat(byok): add external API for local apps
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
CallDetail,
|
||||
CursorHarnessStatus,
|
||||
ExternalApiSettings,
|
||||
LlmCall,
|
||||
Model,
|
||||
Overview,
|
||||
@@ -86,6 +87,7 @@ let harnessStatus: CursorHarnessStatus = {
|
||||
|
||||
let detailed = true;
|
||||
let portSettings = { proxy_port: 0, service_port: 0 };
|
||||
let externalApiSettings: ExternalApiSettings = { enabled: false, api_key: "" };
|
||||
let proxySettings: ProxySettings = {
|
||||
mode: "default",
|
||||
address: "",
|
||||
@@ -148,6 +150,11 @@ export function installDemoApi() {
|
||||
portSettings = body as typeof portSettings;
|
||||
return json(portSettings);
|
||||
}
|
||||
if (path === "/settings/external-api" && method === "GET") return json(externalApiSettings);
|
||||
if (path === "/settings/external-api") {
|
||||
externalApiSettings = body as ExternalApiSettings;
|
||||
return json(externalApiSettings);
|
||||
}
|
||||
if (path === "/settings/storage/statistics" && method === "GET") return json(storage);
|
||||
if (path === "/settings/storage/statistics") {
|
||||
const scope = (body as { scope?: string } | null)?.scope ?? "details";
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
@use "../../styles/typography" as type;
|
||||
|
||||
.content {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.row, .address {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.description {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
min-width: 0;
|
||||
|
||||
small {
|
||||
color: var(--vscode-descriptionForeground);
|
||||
font-size: type.$font-size-xs;
|
||||
}
|
||||
}
|
||||
|
||||
.address {
|
||||
flex-wrap: wrap;
|
||||
|
||||
code {
|
||||
flex: 1 1 240px;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--vscode-descriptionForeground);
|
||||
font-size: type.$font-size-xs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { api, type ExternalApiSettings } from "../../shared/api";
|
||||
import { Button } from "../../shared/ui/Button";
|
||||
import { FormField, SecretTextInput } from "../../shared/ui/FormControls";
|
||||
import { Switch } from "../../shared/ui/Switch";
|
||||
import { TitledCard } from "../../shared/ui/TitledCard";
|
||||
import { useMessage } from "../../shared/ui/message";
|
||||
import styles from "./ExternalApiSettingsCard.module.scss";
|
||||
|
||||
export function ExternalApiSettingsCard({ servicePort }: { servicePort: number }) {
|
||||
const message = useMessage();
|
||||
const [saved, setSaved] = useState<ExternalApiSettings | null>(null);
|
||||
const [draft, setDraft] = useState<ExternalApiSettings>({ enabled: false, api_key: "" });
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
void api.externalApiSettings().then((settings) => {
|
||||
setSaved(settings);
|
||||
setDraft(settings);
|
||||
}).catch((cause: unknown) => message(cause instanceof Error ? cause.message : String(cause)));
|
||||
}, [message]);
|
||||
|
||||
const save = async () => {
|
||||
try {
|
||||
setSaving(true);
|
||||
const settings = await api.setExternalApiSettings(draft);
|
||||
setSaved(settings);
|
||||
setDraft(settings);
|
||||
message(t("外部 API 设置已保存"));
|
||||
} catch (cause) {
|
||||
message(cause instanceof Error ? cause.message : String(cause));
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
const address = `http://127.0.0.1:${servicePort}/byok/v1`;
|
||||
const changed = saved && (saved.enabled !== draft.enabled || saved.api_key !== draft.api_key);
|
||||
|
||||
return <TitledCard title={t("外部 API")} action={<Button size="small" variant="primary" disabled={!changed || saving} onClick={() => void save()}>
|
||||
{saving ? t("保存中…") : t("保存")}
|
||||
</Button>}>
|
||||
<div className={styles.content}>
|
||||
<div className={styles.row}>
|
||||
<div className={styles.description}>
|
||||
<strong>{t("开启外部 API")}</strong>
|
||||
<small>{t("允许本机应用使用密钥调用已配置的模型,包括插件模型。")}</small>
|
||||
</div>
|
||||
<Switch label={t("开启外部 API")} checked={draft.enabled} disabled={!saved || saving}
|
||||
onChange={(enabled) => setDraft((current) => ({ ...current, enabled }))} />
|
||||
</div>
|
||||
<FormField label={t("API 密钥")} hint={t("开启后,所有外部请求都必须提供此密钥。")}>
|
||||
<SecretTextInput value={draft.api_key} autoComplete="off" disabled={!saved || saving}
|
||||
onChange={(event) => setDraft((current) => ({ ...current, api_key: event.target.value }))} />
|
||||
</FormField>
|
||||
<div className={styles.address}>
|
||||
<strong>{t("基础地址")}</strong>
|
||||
<code>{address}</code>
|
||||
</div>
|
||||
</div>
|
||||
</TitledCard>;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { PageContent } from "../../shell/layout/PageContent";
|
||||
import { LegacyModelImport } from "../models/LegacyModelImport";
|
||||
import { AppLifecycleSettingsCard } from "./AppLifecycleSettingsCard";
|
||||
import { CommitSettingsCard } from "./CommitSettingsCard";
|
||||
import { ExternalApiSettingsCard } from "./ExternalApiSettingsCard";
|
||||
import { PricingSettingsCard } from "./PricingSettingsCard";
|
||||
import { ProxySettingsCard } from "./ProxySettingsCard";
|
||||
import { TabSettingsCard } from "./TabSettingsCard";
|
||||
@@ -224,6 +225,7 @@ export function SettingsPage() {
|
||||
</div>
|
||||
</div>
|
||||
</TitledCard>
|
||||
<ExternalApiSettingsCard servicePort={ports.service_port} />
|
||||
<ProxySettingsCard settings={outboundProxy} draft={proxyDraft} editing={editingProxy} saving={savingProxy} onDraftChange={setProxyDraft} onEdit={editProxy} onCancel={cancelProxyEdit} onSave={() => void saveProxy()} />
|
||||
<TabSettingsCard settings={tabSettings} draft={tabDraft} editing={editingTab} saving={savingTab} onDraftChange={setTabDraft} onEdit={editTab} onCancel={cancelTabEdit} onSave={() => void saveTab()} />
|
||||
<CommitSettingsCard />
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 182,
|
||||
"line": 183,
|
||||
"column": 82
|
||||
},
|
||||
{
|
||||
@@ -372,7 +372,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 99,
|
||||
"line": 100,
|
||||
"column": 38
|
||||
}
|
||||
]
|
||||
@@ -401,7 +401,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 277,
|
||||
"line": 279,
|
||||
"column": 26
|
||||
}
|
||||
]
|
||||
@@ -537,6 +537,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"13a494f82d7f26df": {
|
||||
"source": "开启外部 API",
|
||||
"kind": "text",
|
||||
"placeholders": [],
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 46,
|
||||
"column": 20
|
||||
},
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 49,
|
||||
"column": 24
|
||||
}
|
||||
]
|
||||
},
|
||||
"13a9ac7a68c5fd96": {
|
||||
"source": "CA 仅保存在本机,用于安全解析 Cursor 的 HTTPS 请求。",
|
||||
"kind": "text",
|
||||
@@ -764,7 +781,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 281,
|
||||
"line": 283,
|
||||
"column": 131
|
||||
}
|
||||
]
|
||||
@@ -790,17 +807,17 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 69,
|
||||
"line": 70,
|
||||
"column": 42
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 187,
|
||||
"line": 188,
|
||||
"column": 22
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 214,
|
||||
"line": 215,
|
||||
"column": 58
|
||||
}
|
||||
]
|
||||
@@ -899,7 +916,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 254,
|
||||
"line": 256,
|
||||
"column": 43
|
||||
}
|
||||
]
|
||||
@@ -923,7 +940,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 124,
|
||||
"line": 125,
|
||||
"column": 15
|
||||
}
|
||||
]
|
||||
@@ -947,7 +964,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 304,
|
||||
"line": 306,
|
||||
"column": 24
|
||||
}
|
||||
]
|
||||
@@ -1135,12 +1152,12 @@
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 178,
|
||||
"line": 179,
|
||||
"column": 81
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 296,
|
||||
"line": 298,
|
||||
"column": 22
|
||||
},
|
||||
{
|
||||
@@ -1246,7 +1263,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 148,
|
||||
"line": 149,
|
||||
"column": 15
|
||||
}
|
||||
]
|
||||
@@ -1396,7 +1413,7 @@
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 239,
|
||||
"line": 241,
|
||||
"column": 27
|
||||
}
|
||||
]
|
||||
@@ -1469,7 +1486,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 306,
|
||||
"line": 308,
|
||||
"column": 42
|
||||
}
|
||||
]
|
||||
@@ -1534,7 +1551,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 288,
|
||||
"line": 290,
|
||||
"column": 14
|
||||
}
|
||||
]
|
||||
@@ -1563,7 +1580,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 239,
|
||||
"line": 241,
|
||||
"column": 39
|
||||
}
|
||||
]
|
||||
@@ -1630,12 +1647,12 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 246,
|
||||
"line": 248,
|
||||
"column": 22
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 252,
|
||||
"line": 254,
|
||||
"column": 26
|
||||
}
|
||||
]
|
||||
@@ -1717,7 +1734,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 155,
|
||||
"line": 156,
|
||||
"column": 66
|
||||
}
|
||||
]
|
||||
@@ -1729,7 +1746,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 272,
|
||||
"line": 274,
|
||||
"column": 52
|
||||
}
|
||||
]
|
||||
@@ -2179,7 +2196,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 176,
|
||||
"line": 177,
|
||||
"column": 26
|
||||
}
|
||||
]
|
||||
@@ -2302,7 +2319,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 232,
|
||||
"line": 234,
|
||||
"column": 78
|
||||
}
|
||||
]
|
||||
@@ -2348,7 +2365,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 236,
|
||||
"line": 238,
|
||||
"column": 21
|
||||
}
|
||||
]
|
||||
@@ -2446,6 +2463,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"5f600b307b4eb0fb": {
|
||||
"source": "API 密钥",
|
||||
"kind": "text",
|
||||
"placeholders": [],
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 52,
|
||||
"column": 25
|
||||
}
|
||||
]
|
||||
},
|
||||
"5f8d556a9c47da3c": {
|
||||
"source": "已关闭开机启动",
|
||||
"kind": "text",
|
||||
@@ -2649,7 +2678,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "shared/api.ts",
|
||||
"line": 527,
|
||||
"line": 532,
|
||||
"column": 43
|
||||
}
|
||||
]
|
||||
@@ -2776,7 +2805,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 99,
|
||||
"line": 100,
|
||||
"column": 55
|
||||
}
|
||||
]
|
||||
@@ -2940,7 +2969,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 166,
|
||||
"line": 167,
|
||||
"column": 16
|
||||
}
|
||||
]
|
||||
@@ -2964,7 +2993,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 264,
|
||||
"line": 266,
|
||||
"column": 26
|
||||
}
|
||||
]
|
||||
@@ -2988,7 +3017,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "shared/api.ts",
|
||||
"line": 522,
|
||||
"line": 527,
|
||||
"column": 43
|
||||
}
|
||||
]
|
||||
@@ -3012,7 +3041,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 297,
|
||||
"line": 299,
|
||||
"column": 23
|
||||
}
|
||||
]
|
||||
@@ -3029,6 +3058,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"7cc1cf151d967bda": {
|
||||
"source": "允许本机应用使用密钥调用已配置的模型,包括插件模型。",
|
||||
"kind": "text",
|
||||
"placeholders": [],
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 47,
|
||||
"column": 19
|
||||
}
|
||||
]
|
||||
},
|
||||
"7cea2f3c46565d29": {
|
||||
"source": "OpenAI 额外参数",
|
||||
"kind": "text",
|
||||
@@ -3067,7 +3108,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 142,
|
||||
"line": 143,
|
||||
"column": 83
|
||||
}
|
||||
]
|
||||
@@ -3084,6 +3125,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"7ed9f96f513813a4": {
|
||||
"source": "外部 API 设置已保存",
|
||||
"kind": "text",
|
||||
"placeholders": [],
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 29,
|
||||
"column": 15
|
||||
}
|
||||
]
|
||||
},
|
||||
"7f3c8312816fe26a": {
|
||||
"source": "刷新中…",
|
||||
"kind": "text",
|
||||
@@ -3142,7 +3195,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "shared/api.ts",
|
||||
"line": 456,
|
||||
"line": 461,
|
||||
"column": 21
|
||||
}
|
||||
]
|
||||
@@ -3247,6 +3300,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"857d282a0213d785": {
|
||||
"source": "外部 API",
|
||||
"kind": "text",
|
||||
"placeholders": [],
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 40,
|
||||
"column": 29
|
||||
}
|
||||
]
|
||||
},
|
||||
"864597982c308d72": {
|
||||
"source": "已开启静默启动",
|
||||
"kind": "text",
|
||||
@@ -3387,7 +3452,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 235,
|
||||
"line": 237,
|
||||
"column": 22
|
||||
}
|
||||
]
|
||||
@@ -3514,7 +3579,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 158,
|
||||
"line": 159,
|
||||
"column": 7
|
||||
}
|
||||
]
|
||||
@@ -3670,6 +3735,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"99ac861433209a53": {
|
||||
"source": "开启后,所有外部请求都必须提供此密钥。",
|
||||
"kind": "text",
|
||||
"placeholders": [],
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 52,
|
||||
"column": 44
|
||||
}
|
||||
]
|
||||
},
|
||||
"9a84733cc9ab1706": {
|
||||
"source": "资源详情",
|
||||
"kind": "text",
|
||||
@@ -3838,7 +3915,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 243,
|
||||
"line": 245,
|
||||
"column": 26
|
||||
}
|
||||
]
|
||||
@@ -3874,7 +3951,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 62,
|
||||
"line": 63,
|
||||
"column": 34
|
||||
}
|
||||
]
|
||||
@@ -3971,6 +4048,11 @@
|
||||
"line": 213,
|
||||
"column": 22
|
||||
},
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 41,
|
||||
"column": 27
|
||||
},
|
||||
{
|
||||
"file": "features/settings/PricingSettingsCard.tsx",
|
||||
"line": 92,
|
||||
@@ -3983,7 +4065,7 @@
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 179,
|
||||
"line": 180,
|
||||
"column": 133
|
||||
},
|
||||
{
|
||||
@@ -4377,6 +4459,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"b1968db970026087": {
|
||||
"source": "基础地址",
|
||||
"kind": "text",
|
||||
"placeholders": [],
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 57,
|
||||
"column": 18
|
||||
}
|
||||
]
|
||||
},
|
||||
"b254ff315d861346": {
|
||||
"source": "请重试初始化",
|
||||
"kind": "text",
|
||||
@@ -4495,7 +4589,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 155,
|
||||
"line": 156,
|
||||
"column": 45
|
||||
}
|
||||
]
|
||||
@@ -4521,7 +4615,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 280,
|
||||
"line": 282,
|
||||
"column": 22
|
||||
}
|
||||
]
|
||||
@@ -4679,7 +4773,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 281,
|
||||
"line": 283,
|
||||
"column": 31
|
||||
}
|
||||
]
|
||||
@@ -4691,7 +4785,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 272,
|
||||
"line": 274,
|
||||
"column": 40
|
||||
}
|
||||
]
|
||||
@@ -4977,12 +5071,12 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 164,
|
||||
"line": 165,
|
||||
"column": 22
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 170,
|
||||
"line": 171,
|
||||
"column": 20
|
||||
}
|
||||
]
|
||||
@@ -4994,7 +5088,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 201,
|
||||
"line": 202,
|
||||
"column": 21
|
||||
}
|
||||
]
|
||||
@@ -5030,7 +5124,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 157,
|
||||
"line": 158,
|
||||
"column": 7
|
||||
}
|
||||
]
|
||||
@@ -5398,7 +5492,7 @@
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 316,
|
||||
"line": 318,
|
||||
"column": 30
|
||||
},
|
||||
{
|
||||
@@ -5662,7 +5756,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 75,
|
||||
"line": 76,
|
||||
"column": 17
|
||||
}
|
||||
]
|
||||
@@ -5756,7 +5850,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 161,
|
||||
"line": 162,
|
||||
"column": 26
|
||||
}
|
||||
]
|
||||
@@ -5871,7 +5965,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 220,
|
||||
"line": 221,
|
||||
"column": 16
|
||||
}
|
||||
]
|
||||
@@ -6032,7 +6126,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 247,
|
||||
"line": 249,
|
||||
"column": 21
|
||||
}
|
||||
]
|
||||
@@ -6118,7 +6212,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 188,
|
||||
"line": 189,
|
||||
"column": 21
|
||||
}
|
||||
]
|
||||
@@ -6316,7 +6410,7 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 307,
|
||||
"line": 309,
|
||||
"column": 38
|
||||
}
|
||||
]
|
||||
@@ -6331,6 +6425,11 @@
|
||||
"line": 169,
|
||||
"column": 24
|
||||
},
|
||||
{
|
||||
"file": "features/settings/ExternalApiSettingsCard.tsx",
|
||||
"line": 41,
|
||||
"column": 15
|
||||
},
|
||||
{
|
||||
"file": "features/settings/PricingSettingsCard.tsx",
|
||||
"line": 92,
|
||||
@@ -6343,7 +6442,7 @@
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 179,
|
||||
"line": 180,
|
||||
"column": 121
|
||||
},
|
||||
{
|
||||
@@ -6372,17 +6471,17 @@
|
||||
"refs": [
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 70,
|
||||
"line": 71,
|
||||
"column": 46
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 200,
|
||||
"line": 201,
|
||||
"column": 22
|
||||
},
|
||||
{
|
||||
"file": "features/settings/SettingsPage.tsx",
|
||||
"line": 215,
|
||||
"line": 216,
|
||||
"column": 58
|
||||
}
|
||||
]
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"124be3f86f197802": "Token usage",
|
||||
"12ae77e6202d063e": "Custom Headers",
|
||||
"133340e53175128a": "Test all",
|
||||
"13a494f82d7f26df": "Enable external API",
|
||||
"13a9ac7a68c5fd96": "The CA is stored only on this device and is used to securely inspect Cursor HTTPS requests.",
|
||||
"13b61c5f697b6700": "Cache hit rate",
|
||||
"146da2e2a991493e": "Fetching…",
|
||||
@@ -163,6 +164,7 @@
|
||||
"5c55a67935af8f45": "All",
|
||||
"5c62e36c152dfc7c": "Plugin runtime initialized",
|
||||
"5d59857bf039cac9": "Cursor Assistant v{version}",
|
||||
"5f600b307b4eb0fb": "API key",
|
||||
"5f8d556a9c47da3c": "Launch at login disabled",
|
||||
"5f9acfb945229062": "Are you sure you no longer want to see this ad?",
|
||||
"5fd2ec5a6e9b654c": "Total: {cost}",
|
||||
@@ -205,10 +207,12 @@
|
||||
"7a3cec4ca715de80": "Call statistics",
|
||||
"7ba2d6728fe2531b": "Confirm clear",
|
||||
"7c10d97162c96dbd": "Validating the plugin runtime",
|
||||
"7cc1cf151d967bda": "Allow local apps to call configured models, including plugin models, with an API key.",
|
||||
"7cea2f3c46565d29": "OpenAI extra parameters",
|
||||
"7d9f043f8f7ab45c": "Version {version} is available in Settings",
|
||||
"7e0891860c9e6374": "TAB service address is required",
|
||||
"7e7df68f2a82e09e": "Importing the same configuration again will not create duplicate models. Existing models are skipped automatically.",
|
||||
"7ed9f96f513813a4": "External API settings saved",
|
||||
"7f3c8312816fe26a": "Refreshing…",
|
||||
"7f68ebad19ba6bcd": "Check for updates",
|
||||
"802b0faf0ceb513e": "{label}: {percent}% left",
|
||||
@@ -221,6 +225,7 @@
|
||||
"842b9f11cdd96bda": "Launch at login",
|
||||
"843ac7e15a5047a7": "Confirm legacy model configuration import",
|
||||
"844b8cc8dff7c1d8": "Default",
|
||||
"857d282a0213d785": "External API",
|
||||
"864597982c308d72": "Silent start enabled",
|
||||
"86de7c4ee8fa7689": "Sync models",
|
||||
"8716e1344b0daddb": "Cursor official",
|
||||
@@ -252,6 +257,7 @@
|
||||
"9845c165151daee3": "Used",
|
||||
"9850ed41a5bfbb0c": "{count} selected",
|
||||
"997ec8201c2adeda": "Open terminal to install CA",
|
||||
"99ac861433209a53": "All external requests must provide this key when enabled.",
|
||||
"9a84733cc9ab1706": "Resource details",
|
||||
"9b1b7ed518ee401d": "This will open the tutorial in your system browser. Continue?",
|
||||
"9b9bc9cd7c76406f": "Open authorization page",
|
||||
@@ -298,6 +304,7 @@
|
||||
"affb73206cfa035d": "Expires: {time}",
|
||||
"b06325c5660f0c29": "Direct",
|
||||
"b16c3b2ecedd6fe1": "Cursor integration is active. Add a model configuration to use a BYOK model.",
|
||||
"b1968db970026087": "Base URL",
|
||||
"b254ff315d861346": "Try initializing again",
|
||||
"b2617bf9ae663752": "Group settings",
|
||||
"b4411558b932266f": "Provider type",
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"124be3f86f197802": "Uso de tokens",
|
||||
"12ae77e6202d063e": "Cabeçalhos personalizados",
|
||||
"133340e53175128a": "Testar tudo",
|
||||
"13a494f82d7f26df": "Ativar API externa",
|
||||
"13a9ac7a68c5fd96": "A CA é armazenada apenas neste dispositivo e é usada para inspecionar com segurança as requisições HTTPS do Cursor.",
|
||||
"13b61c5f697b6700": "Taxa de acerto de cache",
|
||||
"146da2e2a991493e": "Obtendo…",
|
||||
@@ -163,6 +164,7 @@
|
||||
"5c55a67935af8f45": "Todos",
|
||||
"5c62e36c152dfc7c": "Runtime de plugins inicializado com sucesso",
|
||||
"5d59857bf039cac9": "Assistente Cursor v{version}",
|
||||
"5f600b307b4eb0fb": "Chave da API",
|
||||
"5f8d556a9c47da3c": "Inicialização com o sistema desativada",
|
||||
"5f9acfb945229062": "Tem certeza de que não deseja mais ver este anúncio?",
|
||||
"5fd2ec5a6e9b654c": "Total: {cost}",
|
||||
@@ -205,10 +207,12 @@
|
||||
"7a3cec4ca715de80": "Estatísticas de chamadas",
|
||||
"7ba2d6728fe2531b": "Confirmar limpeza",
|
||||
"7c10d97162c96dbd": "Validando o runtime de plugins",
|
||||
"7cc1cf151d967bda": "Permite que aplicativos locais acessem os modelos configurados, incluindo modelos de plugins, com uma chave de API.",
|
||||
"7cea2f3c46565d29": "Parâmetros adicionais da OpenAI",
|
||||
"7d9f043f8f7ab45c": "Versão {version} disponível nas Configurações",
|
||||
"7e0891860c9e6374": "O endereço do serviço TAB é obrigatório",
|
||||
"7e7df68f2a82e09e": "Importar a mesma configuração novamente não criará modelos duplicados. Modelos existentes são ignorados automaticamente.",
|
||||
"7ed9f96f513813a4": "Configurações da API externa salvas",
|
||||
"7f3c8312816fe26a": "Atualizando…",
|
||||
"7f68ebad19ba6bcd": "Verificar atualizações",
|
||||
"802b0faf0ceb513e": "{label}: {percent}% restante",
|
||||
@@ -221,6 +225,7 @@
|
||||
"842b9f11cdd96bda": "Iniciar com o sistema",
|
||||
"843ac7e15a5047a7": "Confirmar importação da configuração legada de modelos",
|
||||
"844b8cc8dff7c1d8": "Padrão",
|
||||
"857d282a0213d785": "API externa",
|
||||
"864597982c308d72": "Inicialização silenciosa ativada",
|
||||
"86de7c4ee8fa7689": "Sincronizar modelos",
|
||||
"8716e1344b0daddb": "Cursor Oficial",
|
||||
@@ -252,6 +257,7 @@
|
||||
"9845c165151daee3": "Utilizado",
|
||||
"9850ed41a5bfbb0c": "{count} selecionados",
|
||||
"997ec8201c2adeda": "Abrir terminal para instalar CA",
|
||||
"99ac861433209a53": "Todas as solicitações externas devem fornecer esta chave quando a API estiver ativada.",
|
||||
"9a84733cc9ab1706": "Detalhes do recurso",
|
||||
"9b1b7ed518ee401d": "O tutorial de uso será aberto no navegador padrão. Deseja continuar?",
|
||||
"9b9bc9cd7c76406f": "Abrir página de autorização",
|
||||
@@ -298,6 +304,7 @@
|
||||
"affb73206cfa035d": "Expira em: {time}",
|
||||
"b06325c5660f0c29": "Conexão direta",
|
||||
"b16c3b2ecedd6fe1": "A integração com o Cursor está ativa. Adicione uma configuração de modelo para usar modelos BYOK.",
|
||||
"b1968db970026087": "URL base",
|
||||
"b254ff315d861346": "Tente inicializar novamente",
|
||||
"b2617bf9ae663752": "Configurações do grupo",
|
||||
"b4411558b932266f": "Tipo de provedor",
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"124be3f86f197802": "Token 消耗",
|
||||
"12ae77e6202d063e": "自定义 Headers",
|
||||
"133340e53175128a": "一键测试",
|
||||
"13a494f82d7f26df": "开启外部 API",
|
||||
"13a9ac7a68c5fd96": "CA 仅保存在本机,用于安全解析 Cursor 的 HTTPS 请求。",
|
||||
"13b61c5f697b6700": "缓存命中率",
|
||||
"146da2e2a991493e": "获取中…",
|
||||
@@ -163,6 +164,7 @@
|
||||
"5c55a67935af8f45": "全部",
|
||||
"5c62e36c152dfc7c": "插件运行时初始化完成",
|
||||
"5d59857bf039cac9": "Cursor 助手 v{version}",
|
||||
"5f600b307b4eb0fb": "API 密钥",
|
||||
"5f8d556a9c47da3c": "已关闭开机启动",
|
||||
"5f9acfb945229062": "你确认不想再看到此广告吗?",
|
||||
"5fd2ec5a6e9b654c": "合计:{cost}",
|
||||
@@ -205,10 +207,12 @@
|
||||
"7a3cec4ca715de80": "调用统计",
|
||||
"7ba2d6728fe2531b": "确认清理",
|
||||
"7c10d97162c96dbd": "正在验证插件运行时",
|
||||
"7cc1cf151d967bda": "允许本机应用使用密钥调用已配置的模型,包括插件模型。",
|
||||
"7cea2f3c46565d29": "OpenAI 额外参数",
|
||||
"7d9f043f8f7ab45c": "发现新版本 {version},可在设置中安装",
|
||||
"7e0891860c9e6374": "TAB 服务地址不能为空",
|
||||
"7e7df68f2a82e09e": "重复导入相同配置不会创建重复模型;已经存在的模型会自动跳过。",
|
||||
"7ed9f96f513813a4": "外部 API 设置已保存",
|
||||
"7f3c8312816fe26a": "刷新中…",
|
||||
"7f68ebad19ba6bcd": "检查更新",
|
||||
"802b0faf0ceb513e": "{label} 剩余 {percent}%",
|
||||
@@ -221,6 +225,7 @@
|
||||
"842b9f11cdd96bda": "开机启动",
|
||||
"843ac7e15a5047a7": "确认导入旧版模型配置",
|
||||
"844b8cc8dff7c1d8": "默认",
|
||||
"857d282a0213d785": "外部 API",
|
||||
"864597982c308d72": "已开启静默启动",
|
||||
"86de7c4ee8fa7689": "同步模型",
|
||||
"8716e1344b0daddb": "Cursor 官方",
|
||||
@@ -252,6 +257,7 @@
|
||||
"9845c165151daee3": "已使用",
|
||||
"9850ed41a5bfbb0c": "已选 {count} 项",
|
||||
"997ec8201c2adeda": "打开终端安装 CA",
|
||||
"99ac861433209a53": "开启后,所有外部请求都必须提供此密钥。",
|
||||
"9a84733cc9ab1706": "资源详情",
|
||||
"9b1b7ed518ee401d": "将在系统浏览器中打开使用教程,是否继续?",
|
||||
"9b9bc9cd7c76406f": "打开授权网页",
|
||||
@@ -298,6 +304,7 @@
|
||||
"affb73206cfa035d": "到期时间:{time}",
|
||||
"b06325c5660f0c29": "直连",
|
||||
"b16c3b2ecedd6fe1": "Cursor 接管已生效;添加模型配置后即可使用 BYOK 模型。",
|
||||
"b1968db970026087": "基础地址",
|
||||
"b254ff315d861346": "请重试初始化",
|
||||
"b2617bf9ae663752": "分组设置",
|
||||
"b4411558b932266f": "上游类型",
|
||||
|
||||
@@ -113,6 +113,11 @@ export interface PortSettings {
|
||||
service_port: number;
|
||||
}
|
||||
|
||||
export interface ExternalApiSettings {
|
||||
enabled: boolean;
|
||||
api_key: string;
|
||||
}
|
||||
|
||||
export interface StatisticsStorage {
|
||||
call_count: number;
|
||||
trace_count: number;
|
||||
@@ -541,6 +546,8 @@ export const api = {
|
||||
setObservability: (detailed: boolean) => request<{ detailed: boolean }>("/settings/observability", { method: "PUT", body: JSON.stringify({ detailed }) }),
|
||||
ports: () => request<PortSettings>("/settings/ports"),
|
||||
setPorts: (settings: PortSettings) => request<PortSettings>("/settings/ports", { method: "PUT", body: JSON.stringify(settings) }),
|
||||
externalApiSettings: () => request<ExternalApiSettings>("/settings/external-api"),
|
||||
setExternalApiSettings: (settings: ExternalApiSettings) => request<ExternalApiSettings>("/settings/external-api", { method: "PUT", body: JSON.stringify(settings) }),
|
||||
statisticsStorage: () => request<StatisticsStorage>("/settings/storage/statistics"),
|
||||
clearStatisticsStorage: (scope: StatisticsStorageScope) => request<StatisticsStorage>("/settings/storage/statistics", { method: "DELETE", body: JSON.stringify({ scope }) }),
|
||||
proxySettings: () => request<ProxySettings>("/settings/proxy"),
|
||||
|
||||
Reference in New Issue
Block a user