diff --git a/frontend/src/api/modules/plugin-extensions.ts b/frontend/src/api/modules/plugin-extensions.ts index ad4aa873a..049e43cd9 100644 --- a/frontend/src/api/modules/plugin-extensions.ts +++ b/frontend/src/api/modules/plugin-extensions.ts @@ -2,6 +2,9 @@ import type { RequestConfig, RequestOptions } from '../request' import { API_BASE_URL } from '../constants' import request, { requestRaw } from '../request' +// 管理路由可能执行长任务,HTTP 与页面桥使用同一等待上限。 +export const PLUGIN_MANAGEMENT_TIMEOUT_MS = 180_000 + const MAXIMUM_MANAGEMENT_BODY_BYTES = 1024 * 1024 export interface PluginManagementTarget { @@ -90,6 +93,7 @@ export function callPluginManagementRoute( method: call.method, data: call.body?.byteLength ? call.body : undefined, headers: call.contentType ? { 'Content-Type': call.contentType } : undefined, + timeout: PLUGIN_MANAGEMENT_TIMEOUT_MS, ...options, }) } diff --git a/frontend/src/views/plugins/components/PluginVersionCard.vue b/frontend/src/views/plugins/components/PluginVersionCard.vue index 8b1172eb2..413b9e122 100644 --- a/frontend/src/views/plugins/components/PluginVersionCard.vue +++ b/frontend/src/views/plugins/components/PluginVersionCard.vue @@ -57,7 +57,7 @@ const detailsId = useId() 历史配置 -
+
{{ sourceLabel(artifact.source) }} diff --git a/frontend/src/views/plugins/management/frame.ts b/frontend/src/views/plugins/management/frame.ts index 47891c407..59bbd2dde 100644 --- a/frontend/src/views/plugins/management/frame.ts +++ b/frontend/src/views/plugins/management/frame.ts @@ -6,7 +6,8 @@ import type { import { THEME_TOKEN_NAMES } from '@codex-proxy/ui/theme' import { generate, parse, walk } from 'css-tree' -import { getPluginManagementResource } from '@/api' +import { getPluginManagementResource, PLUGIN_MANAGEMENT_TIMEOUT_MS } from '@/api' +import { API_TIMEOUT_MS } from '@/api/constants' export const PLUGIN_MANAGEMENT_BRIDGE = 'codex-proxy-plugin-management' export const PLUGIN_MANAGEMENT_BRIDGE_VERSION = 2 @@ -543,7 +544,7 @@ function createBridgeScript(input: { const timer = window.setTimeout(() => { pending.delete(id); reject(new Error('插件管理请求超时')); - }, 30000); + }, kind === 'request' ? ${PLUGIN_MANAGEMENT_TIMEOUT_MS} : ${API_TIMEOUT_MS}); pending.set(id, { resolve, reject, timer }); post(kind, id, payload, transfer); });