feat(agent): add configurable MCP OAuth wait timeout per agent
Allow agents to set how long in-conversation OAuth prompts wait before auto-skipping, with UI in the agent editor and bounded gate behavior.
This commit is contained in:
@@ -33,6 +33,9 @@ export interface CustomAgentConfig {
|
||||
// MCP服务选择模式:all=全部启用的MCP服务, selected=指定服务, none=不使用MCP
|
||||
mcp_selection_mode?: 'all' | 'selected' | 'none';
|
||||
mcp_services?: string[]; // 选择的MCP服务ID列表
|
||||
// 对话中触发 OAuth 授权时的等待超时(秒):到点后自动跳过授权提示。
|
||||
// <=0 时使用服务端默认超时。仅对使用 OAuth 的 MCP 服务生效。
|
||||
mcp_auth_wait_timeout?: number;
|
||||
|
||||
// ===== Skills设置(仅Agent模式)=====
|
||||
// Skills选择模式:all=全部预装, selected=指定, none=不使用
|
||||
|
||||
@@ -5440,6 +5440,9 @@ export default {
|
||||
selectLabel: 'Select MCP Services',
|
||||
selectDesc: 'Select MCP services to enable',
|
||||
selectPlaceholder: 'Select MCP services',
|
||||
authWaitTimeout: 'Authentication Wait Timeout (s)',
|
||||
authWaitTimeoutDesc: 'Maximum seconds to wait for you to complete OAuth authentication when prompted during a conversation; the prompt is skipped after it elapses (only affects OAuth MCP services).',
|
||||
authWaitTimeoutPlaceholder: 'Default 600 seconds',
|
||||
},
|
||||
llmCallTimeout: {
|
||||
label: "LLM Call Timeout",
|
||||
|
||||
@@ -5451,6 +5451,9 @@ export default {
|
||||
selectLabel: 'MCP 서비스 선택',
|
||||
selectDesc: '활성화할 MCP 서비스를 선택하세요',
|
||||
selectPlaceholder: 'MCP 서비스 선택',
|
||||
authWaitTimeout: '인증 대기 시간(초)',
|
||||
authWaitTimeoutDesc: '대화 중 OAuth 인증이 필요할 때 인증 완료를 기다리는 최대 시간(초)이며, 초과하면 인증 요청을 건너뜁니다(OAuth를 사용하는 MCP 서비스에만 적용).',
|
||||
authWaitTimeoutPlaceholder: '기본 600초',
|
||||
},
|
||||
llmCallTimeout: {
|
||||
label: "LLM 호출 타임아웃",
|
||||
|
||||
@@ -4950,7 +4950,9 @@ export default {
|
||||
desc: 'Выберите MCP-сервисы, доступные агенту',
|
||||
selectLabel: 'Выбор MCP-сервисов',
|
||||
selectDesc: 'Выберите MCP-сервисы для включения',
|
||||
selectPlaceholder: 'Выберите MCP-сервисы'
|
||||
selectPlaceholder: 'Выберите MCP-сервисы',
|
||||
authWaitTimeout: 'Тайм-аут ожидания аутентификации (с)',
|
||||
authWaitTimeoutDesc: 'Максимальное время ожидания (в секундах) завершения OAuth-аутентификации при запросе во время диалога; по его истечении запрос пропускается (влияет только на MCP-сервисы с OAuth).'
|
||||
},
|
||||
llmCallTimeout: {
|
||||
label: 'Таймаут вызова LLM',
|
||||
|
||||
@@ -5453,6 +5453,9 @@ export default {
|
||||
selectLabel: "选择 MCP 服务",
|
||||
selectDesc: "选择要启用的 MCP 服务",
|
||||
selectPlaceholder: "选择 MCP 服务",
|
||||
authWaitTimeout: "授权等待超时(秒)",
|
||||
authWaitTimeoutDesc: "对话中触发 OAuth 授权时,等待你完成授权的最长秒数,超时后自动跳过授权提示(仅对使用 OAuth 的 MCP 服务生效)。",
|
||||
authWaitTimeoutPlaceholder: "默认 600 秒",
|
||||
},
|
||||
llmCallTimeout: {
|
||||
label: "LLM 调用超时",
|
||||
|
||||
@@ -967,6 +967,18 @@
|
||||
</t-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 授权等待超时:对话中触发 OAuth 授权时的等待秒数 -->
|
||||
<div v-if="mcpSelectionMode !== 'none'" class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('agentEditor.mcp.authWaitTimeout') }}</label>
|
||||
<p class="desc">{{ $t('agentEditor.mcp.authWaitTimeoutDesc') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<t-input-number v-model="formData.config.mcp_auth_wait_timeout" :min="5" :max="3600"
|
||||
theme="column" :placeholder="$t('agentEditor.mcp.authWaitTimeoutPlaceholder')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1990,6 +2002,8 @@ const defaultFormData = {
|
||||
// MCP 服务设置
|
||||
mcp_selection_mode: 'none' as 'all' | 'selected' | 'none',
|
||||
mcp_services: [] as string[],
|
||||
// 对话中触发 OAuth 授权时的等待超时(秒),默认 600
|
||||
mcp_auth_wait_timeout: 600,
|
||||
// Skills 设置
|
||||
skills_selection_mode: 'none' as 'all' | 'selected' | 'none',
|
||||
selected_skills: [] as string[],
|
||||
@@ -2561,6 +2575,10 @@ watch(() => props.visible, async (val) => {
|
||||
if (!agentData.config.knowledge_bases) agentData.config.knowledge_bases = [];
|
||||
if (!agentData.config.allowed_tools) agentData.config.allowed_tools = [];
|
||||
if (!agentData.config.mcp_services) agentData.config.mcp_services = [];
|
||||
// 授权等待超时:旧数据缺省时用默认 600 秒
|
||||
if (agentData.config.mcp_auth_wait_timeout == null || agentData.config.mcp_auth_wait_timeout <= 0) {
|
||||
agentData.config.mcp_auth_wait_timeout = 600;
|
||||
}
|
||||
if (!agentData.config.selected_skills) agentData.config.selected_skills = [];
|
||||
if (!agentData.config.supported_file_types) agentData.config.supported_file_types = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user