fix: KB Accelerator tree builder, approve all, canvas delete button

- Fix _build_troubleshooting_tree() to handle deep nesting, warning nodes,
  and DAG deduplication (placed set prevents duplicate IDs)
- Fix step_sync VARCHAR(255) overflow on publish by truncating title
- Add "Approve All" button to KB review screen
- Add delete button (hover-reveal) to flow canvas nodes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-03-11 01:59:03 -04:00
parent 71ff4a8c35
commit 91d2bc6df3
9 changed files with 143 additions and 35 deletions

View File

@@ -89,6 +89,26 @@ export default function KBAcceleratorPage() {
}
}
const handleApproveAll = async () => {
if (!importId || !kbImport) return
const unapproved = kbImport.nodes.filter(n => !n.user_approved)
if (unapproved.length === 0) return
setLoading(true)
try {
await Promise.all(
unapproved.map(n => kbAcceleratorApi.editNode(importId, n.id, { operation: 'approve' }))
)
setKbImport(prev => {
if (!prev) return prev
return { ...prev, nodes: prev.nodes.map(n => ({ ...n, user_approved: true })) }
})
} catch {
toast.error('Failed to approve all nodes')
} finally {
setLoading(false)
}
}
const handleEditNode = async (nodeId: string, data: KBNodeEditRequest) => {
if (!importId) return
const updatedNode = await kbAcceleratorApi.editNode(importId, nodeId, data)
@@ -149,9 +169,9 @@ export default function KBAcceleratorPage() {
}
return (
<div className="flex flex-col h-full p-6">
<div className="flex flex-col h-full min-h-0 p-6">
{/* Page title */}
<div className="flex items-center gap-3 mb-6">
<div className="shrink-0 flex items-center gap-3 mb-6">
<Sparkles size={24} className="text-primary" />
<h1 className="text-2xl font-heading font-bold text-foreground">KB Accelerator</h1>
</div>
@@ -181,13 +201,16 @@ export default function KBAcceleratorPage() {
)}
{phase === 'review' && kbImport && (
<ReviewScreen
kbImport={kbImport}
onEditNode={handleEditNode}
onCommit={handleCommit}
onDiscard={handleDiscard}
loading={loading}
/>
<div className="flex-1 min-h-0">
<ReviewScreen
kbImport={kbImport}
onEditNode={handleEditNode}
onApproveAll={handleApproveAll}
onCommit={handleCommit}
onDiscard={handleDiscard}
loading={loading}
/>
</div>
)}
{phase === 'success' && commitResult && (

View File

@@ -815,6 +815,7 @@ export function TreeEditorPage() {
editingNodeId={editorAI.isOpen ? null : editingNodeId}
onNodeSelect={handleNodeSelect}
onSelectAnswerType={handleSelectAnswerType}
onNodeDelete={deleteNode}
onNodeContextMenu={editorAI.openContextMenu}
/>
</div>