/** * ============================================================ * src/cli/wizards/openRouterWizard.tsx —— OpenRouter 子向导 * ------------------------------------------------------------ * 单字段(API Key),基于通用 FieldForm。这把 key 目前主要在没有独立 * 配置生图模型时,给 GenerateImage 工具当兜底 provider 用 * (见 configService.ts::trustedToolEnv 的 openrouter 兜底分支)。 * ============================================================ */ import React from 'react'; import { configService } from '../../config/configService.js'; import { FieldForm } from './fieldForm.js'; interface Props { existing?: { apiKey: string } | null; onDone: () => void; onCancel: () => void; } export function OpenRouterWizard({ existing, onDone, onCancel }: Props): JSX.Element { return ( { const apiKey = String(values.apiKey ?? '').trim(); if (!apiKey) { onDone(); return; } await configService.savePatch({ tools: { openRouter: { apiKey } } }); onDone(); }} onCancel={onCancel} /> ); }