import React, { useState, useEffect } from 'react'; import { Button } from './Button'; interface SettingsModalProps { isOpen: boolean; onClose: () => void; onSave: (apiKey: string) => void; currentApiKey: string; } export const SettingsModal: React.FC = ({ isOpen, onClose, onSave, currentApiKey }) => { const [key, setKey] = useState(currentApiKey); // Sync internal state when prop changes or modal opens useEffect(() => { setKey(currentApiKey); }, [currentApiKey, isOpen]); if (!isOpen) return null; return (

设置

setKey(e.target.value)} placeholder="AIzaSy..." className="w-full px-3 py-2 border border-slate-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-sm font-mono" />

您的 Key 仅存储在本地浏览器中,用于直接调用 Google Gemini API。
如果留空,将尝试使用系统默认配置。

); };