From 6e83396d6480e36250d291db9490ff9ebff0e99e Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Tue, 9 Jun 2026 16:48:40 +0800 Subject: [PATCH] Add AssistantIdentity component to AssistantPage for assistant ID display and copy functionality - Introduce the AssistantIdentity component to show the current assistant ID and provide a copy-to-clipboard feature. - Update multiple sections of AssistantPage to include the AssistantIdentity component, enhancing user interaction with assistant IDs. - Ensure the component handles the display of the assistant ID and provides feedback when copied successfully. --- .../src/components/pages/AssistantPage.tsx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/frontend/src/components/pages/AssistantPage.tsx b/frontend/src/components/pages/AssistantPage.tsx index e3fe98e..a8ef566 100644 --- a/frontend/src/components/pages/AssistantPage.tsx +++ b/frontend/src/components/pages/AssistantPage.tsx @@ -1146,6 +1146,7 @@ export function AssistantPage() { value={difyForm.name} onChange={(value) => updateDifyForm("name", value)} /> +
@@ -1244,6 +1245,7 @@ export function AssistantPage() { value={fastGptForm.name} onChange={(value) => updateFastGptForm("name", value)} /> +
@@ -1348,6 +1350,7 @@ export function AssistantPage() { value={openCodeForm.name} onChange={(value) => updateOpenCodeForm("name", value)} /> +
@@ -1465,6 +1468,7 @@ export function AssistantPage() { value={form.name} onChange={(value) => updateForm("name", value)} /> +
@@ -1879,6 +1883,37 @@ function EditorBackButton({ onClick }: { onClick: () => void }) { ); } +function AssistantIdentity({ assistantId }: { assistantId: string | null }) { + const [copied, setCopied] = useState(false); + + async function copyId() { + if (!assistantId) return; + await navigator.clipboard.writeText(assistantId); + setCopied(true); + window.setTimeout(() => setCopied(false), 1600); + } + + return ( +
+ + {assistantId ? `ID · ${assistantId}` : "ID · 保存后生成"} + + {assistantId && ( + + )} + {!assistantId && } +
+ ); +} + function EditableTitle({ value, onChange,