feat(frontend): add assistant delete menu to prompt editor topbar

Place a more-actions dropdown beside the assistant ID with confirmed delete that returns to the assistant list after removal.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Xin Wang
2026-08-06 17:08:40 +08:00
co-authored by Cursor
parent b6e2ac5765
commit 723ee84925
2 changed files with 71 additions and 0 deletions
@@ -639,6 +639,19 @@ export function AssistantPage(props: AssistantPageProps) {
);
}
async function handleDeleteCurrentAssistant() {
if (!editingId) return;
const assistantName = form.name.trim() || "未命名助手";
if (!window.confirm(`确认删除助手“${assistantName}”?`)) return;
setSaveError(null);
try {
await assistantsApi.remove(editingId);
router.push("/assistants");
} catch (error) {
setSaveError(error instanceof Error ? error.message : "删除失败");
}
}
// ---- 外部智能体平台(Dify / FastGPT)----
function fillAgentPlatformForm(a: Assistant): AgentPlatformForm {
const next: AgentPlatformForm = {
@@ -1611,6 +1624,7 @@ export function AssistantPage(props: AssistantPageProps) {
tools={tools}
onBack={() => router.push("/assistants")}
onSave={() => void handleSavePrompt()}
onDelete={() => void handleDeleteCurrentAssistant()}
updateForm={updateForm}
handlePromptVisionEnabledChange={handlePromptVisionEnabledChange}
handlePromptModelChange={handlePromptModelChange}