/** * ============================================================ * src/cli/wizards/searchWizard.tsx —— 搜索引擎子向导 * ------------------------------------------------------------ * 单字段(Tavily API Key),基于通用 FieldForm。 * ============================================================ */ import React from 'react'; import { configService } from '../../config/configService.js'; import { FieldForm } from './fieldForm.js'; interface Props { /** 已配置时预填,未配置传 null/undefined。 */ existing?: { apiKey: string } | null; onDone: () => void; onCancel: () => void; } export function SearchWizard({ existing, onDone, onCancel }: Props): JSX.Element { return ( { const apiKey = String(values.apiKey ?? '').trim(); if (!apiKey) { onDone(); return; } await configService.savePatch({ tools: { webSearch: { apiKey } } }); onDone(); }} onCancel={onCancel} /> ); }