diff --git a/frontend/src/components/pages/AssistantPage.tsx b/frontend/src/components/pages/AssistantPage.tsx
index 578e81a..3ae5572 100644
--- a/frontend/src/components/pages/AssistantPage.tsx
+++ b/frontend/src/components/pages/AssistantPage.tsx
@@ -7,6 +7,8 @@ import {
Check,
Copy,
Database,
+ Eye,
+ EyeOff,
MessageSquareText,
MoreHorizontal,
Pencil,
@@ -525,7 +527,8 @@ export function AssistantPage() {
setDifyForm({
name: a.name,
apiUrl: a.apiUrl,
- apiKey: a.apiKey, // 编辑时为打码值,不改则原样回传(后端哨兵保留旧 key)
+ // 编辑时不把打码占位符放入输入框;空值写回后端表示保留旧 key
+ apiKey: "",
asr: a.asrCredentialId ?? "",
voice: a.ttsCredentialId ?? "",
enableInterrupt: a.enableInterrupt,
@@ -552,7 +555,8 @@ export function AssistantPage() {
name: a.name,
appId: a.appId,
apiUrl: a.apiUrl,
- apiKey: a.apiKey,
+ // 编辑时不把打码占位符放入输入框;空值写回后端表示保留旧 key
+ apiKey: "",
asr: a.asrCredentialId ?? "",
voice: a.ttsCredentialId ?? "",
enableInterrupt: a.enableInterrupt,
@@ -580,6 +584,9 @@ export function AssistantPage() {
type: typeToLabel[a.type],
updatedAt: formatTimestamp(a.updatedAt),
}));
+ const hasStoredApiKey = Boolean(
+ editingId && assistants.find((assistant) => assistant.id === editingId)?.apiKey,
+ );
const filteredAssistants = listItems.filter((assistant) => {
if (typeFilter !== "全部" && assistant.type !== typeFilter) {
@@ -1082,6 +1089,7 @@ export function AssistantPage() {
+ setView("list")} />
updateDifyForm("name", value)}
@@ -1089,15 +1097,6 @@ export function AssistantPage() {
-
-
{saveError && (
{saveError}
@@ -1131,12 +1130,12 @@ export function AssistantPage() {
onChange={(value) => updateDifyForm("apiUrl", value)}
placeholder="https://api.dify.ai/v1/chat-messages"
/>
- updateDifyForm("apiKey", value)}
placeholder="请输入 Dify API Key"
- type="password"
+ hasStoredValue={hasStoredApiKey}
/>
@@ -1188,6 +1187,7 @@ export function AssistantPage() {
+ setView("list")} />
updateFastGptForm("name", value)}
@@ -1195,15 +1195,6 @@ export function AssistantPage() {
-
-
{saveError && (
{saveError}
@@ -1243,12 +1234,12 @@ export function AssistantPage() {
onChange={(value) => updateFastGptForm("apiUrl", value)}
placeholder="https://api.fastgpt.in/api/v1/chat/completions"
/>
- updateFastGptForm("apiKey", value)}
placeholder="请输入 FastGPT API Key"
- type="password"
+ hasStoredValue={hasStoredApiKey}
/>
@@ -1300,6 +1291,7 @@ export function AssistantPage() {
+ setView("list")} />
updateOpenCodeForm("name", value)}
@@ -1307,15 +1299,6 @@ export function AssistantPage() {
-
-