File tree Expand file tree Collapse file tree
apps/sim/app/api/knowledge Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ import {
1313import { getOllamaBaseUrl , validateOllamaModel } from '@/lib/knowledge/embeddings'
1414import {
1515 createKnowledgeBase ,
16- deleteKnowledgeBase ,
1716 getKnowledgeBases ,
17+ hardDeleteKnowledgeBase ,
1818 KnowledgeBaseConflictError ,
1919 type KnowledgeBaseScope ,
2020} from '@/lib/knowledge/service'
@@ -221,10 +221,11 @@ export async function POST(req: NextRequest) {
221221 `[${ requestId } ] Failed to create embedding table for KB ${ newKnowledgeBase . id } ` ,
222222 tableError
223223 )
224- // Clean up the orphaned KB row and any partially-created table
224+ // Hard-delete the KB row — this is a creation-time rollback, not a user-initiated
225+ // deletion, so a soft delete would leave a restorable broken KB in the archive.
225226 try {
226227 await dropKBEmbeddingTable ( newKnowledgeBase . id )
227- await deleteKnowledgeBase ( newKnowledgeBase . id , requestId )
228+ await hardDeleteKnowledgeBase ( newKnowledgeBase . id )
228229 logger . info (
229230 `[${ requestId } ] Cleaned up orphaned KB ${ newKnowledgeBase . id } after table creation failure`
230231 )
You can’t perform that action at this time.
0 commit comments