From 99f38726a2cae471ac3c1187ca95cd99676050ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Sat, 29 Aug 2026 01:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E:=20Agent=20=E4=B8=AD?= =?UTF-8?q?=E7=BB=A7=E6=A8=A1=E5=BC=8F=E2=80=94=E2=80=94u-relay=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=8E=A5=E5=85=A5=E8=BF=9C=E7=AB=AF?= =?UTF-8?q?=20agent=20=E6=8C=87=E4=BB=A4=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 16 +- src/components/ai/AgentPanel.vue | 223 ++++++++++++++++++++++++ src/components/modals/SettingsModal.vue | 30 +++- src/core/ai.ts | 39 +++++ src/core/relay.ts | 212 ++++++++++++++++++++++ src/core/types.ts | 4 + 6 files changed, 517 insertions(+), 7 deletions(-) create mode 100644 src/components/ai/AgentPanel.vue create mode 100644 src/core/relay.ts diff --git a/src/App.vue b/src/App.vue index 1450411..47eafed 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,6 +19,7 @@ import ThumbBar from './components/editor/ThumbBar.vue' import Canvas from './components/editor/Canvas.vue' import PropsPanel from './components/editor/PropsPanel.vue' import AiPanel from './components/ai/AiPanel.vue' +import AgentPanel from './components/ai/AgentPanel.vue' import SettingsModal from './components/modals/SettingsModal.vue' import OssSettingsModal from './components/modals/OssSettingsModal.vue' import LibraryModal from './components/modals/LibraryModal.vue' @@ -34,8 +35,8 @@ const presentVisible = ref(false) const presentStartIndex = ref(0) /* ---------- 活动面板 tab ---------- */ -const activeTab = ref<'props' | 'ai'>('props') -function switchTab(name: 'props' | 'ai') { +const activeTab = ref<'props' | 'ai' | 'agent'>('props') +function switchTab(name: 'props' | 'ai' | 'agent') { activeTab.value = name } @@ -506,6 +507,7 @@ onUnmounted(() => {
+
@@ -515,7 +517,13 @@ onUnmounted(() => { @busy-change="onBusyChange" @toast="toast" @open-settings="settingsVisible = true" - @switch-tab="(t: string) => switchTab(t as 'props' | 'ai')" + @switch-tab="(t: string) => switchTab(t as 'props' | 'ai' | 'agent')" + /> + + @@ -543,7 +551,7 @@ onUnmounted(() => { :visible="libraryVisible" @close="libraryVisible = false" @toast="toast" - @switch-tab="(t: string) => switchTab(t as 'props' | 'ai')" + @switch-tab="(t: string) => switchTab(t as 'props' | 'ai' | 'agent')" @open-deck="mode = 'editor'" /> + + + + + diff --git a/src/components/modals/SettingsModal.vue b/src/components/modals/SettingsModal.vue index 2f87e6a..8bc51a1 100644 --- a/src/components/modals/SettingsModal.vue +++ b/src/components/modals/SettingsModal.vue @@ -34,7 +34,8 @@ const PROTO_DEFAULTS: Record = { const form = ref({ preset: 'zhipu', protocol: 'openai', base: '', key: '', model: '', proxy: '', - imgBase: '', imgKey: '', imgModel: '' + imgBase: '', imgKey: '', imgModel: '', + relayUrl: '', relayToken: '', relayDeviceId: '' }) /** 从 store 读取并填充表单 */ @@ -46,7 +47,10 @@ function loadFromStore() { base: c.base, key: c.key, model: c.model, proxy: c.proxy, imgBase: c.imgBase || '', imgKey: c.imgKey || '', - imgModel: c.imgModel || '' + imgModel: c.imgModel || '', + relayUrl: c.relayUrl || '', + relayToken: c.relayToken || '', + relayDeviceId: c.relayDeviceId || '' } } @@ -87,7 +91,10 @@ function save() { proxy: form.value.proxy.trim(), imgBase: (form.value.imgBase || '').trim(), imgKey: (form.value.imgKey || '').trim(), - imgModel: (form.value.imgModel || '').trim() + imgModel: (form.value.imgModel || '').trim(), + relayUrl: (form.value.relayUrl || '').trim(), + relayToken: (form.value.relayToken || '').trim(), + relayDeviceId: (form.value.relayDeviceId || '').trim() }) const label = form.value.preset === 'custom' ? (form.value.protocol === 'anthropic' ? 'Anthropic' : 'OpenAI') + ' 自定义' @@ -172,6 +179,23 @@ function save() { +
Agent 中继(可选,三项齐备即启用 Agent 模式)
+ +
+ + +
+ +
+ + +
+ +
+ + +
+