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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user