diff --git a/frontend/src/components/pages/AssistantPage.tsx b/frontend/src/components/pages/AssistantPage.tsx index 3ae5572..21f278e 100644 --- a/frontend/src/components/pages/AssistantPage.tsx +++ b/frontend/src/components/pages/AssistantPage.tsx @@ -584,9 +584,10 @@ export function AssistantPage() { type: typeToLabel[a.type], updatedAt: formatTimestamp(a.updatedAt), })); - const hasStoredApiKey = Boolean( - editingId && assistants.find((assistant) => assistant.id === editingId)?.apiKey, - ); + const storedApiKeyMask = + (editingId && + assistants.find((assistant) => assistant.id === editingId)?.apiKey) || + ""; const filteredAssistants = listItems.filter((assistant) => { if (typeFilter !== "全部" && assistant.type !== typeFilter) { @@ -1135,7 +1136,7 @@ export function AssistantPage() { value={difyForm.apiKey} onChange={(value) => updateDifyForm("apiKey", value)} placeholder="请输入 Dify API Key" - hasStoredValue={hasStoredApiKey} + storedValueMask={storedApiKeyMask} /> @@ -1239,7 +1240,7 @@ export function AssistantPage() { value={fastGptForm.apiKey} onChange={(value) => updateFastGptForm("apiKey", value)} placeholder="请输入 FastGPT API Key" - hasStoredValue={hasStoredApiKey} + storedValueMask={storedApiKeyMask} /> @@ -1324,7 +1325,7 @@ export function AssistantPage() { value={openCodeForm.apiKey} onChange={(value) => updateOpenCodeForm("apiKey", value)} placeholder="请输入 OpenCode API Key" - hasStoredValue={false} + storedValueMask="" /> @@ -1908,22 +1909,31 @@ function SecretInputField({ label, value, placeholder, - hasStoredValue, + storedValueMask, onChange, }: { label?: string; value: string; placeholder?: string; - hasStoredValue: boolean; + storedValueMask: string; onChange: (value: string) => void; }) { const [showValue, setShowValue] = useState(false); + const hasStoredValue = Boolean(storedValueMask); return (