fix: restore tree root node (📁 根目录)
This commit is contained in:
parent
8e1ef924e5
commit
5ec01c3b18
@ -8,7 +8,10 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
recs = await sor.sqlExe(
|
recs = await sor.sqlExe(
|
||||||
"SELECT id, '' as parentid, content as label FROM document_chunks WHERE kb_id=${kb_id}$ AND chunk_type='directory' AND (description IS NULL OR description='') ORDER BY content",
|
"SELECT id, '' as parentid, content as label FROM document_chunks WHERE kb_id=${kb_id}$ AND chunk_type='directory' AND (description IS NULL OR description='') ORDER BY content",
|
||||||
{"kb_id": kb_id})
|
{"kb_id": kb_id})
|
||||||
return [dict(r) for r in recs]
|
result = [{"id": "__root__", "parentid": "", "label": "📁 根目录"}]
|
||||||
|
for r in recs:
|
||||||
|
result.append({"id": r.id, "parentid": r.parentid, "label": r.label})
|
||||||
|
return result
|
||||||
else:
|
else:
|
||||||
recs = await sor.sqlExe(
|
recs = await sor.sqlExe(
|
||||||
"SELECT id, description as parentid, content as label FROM document_chunks WHERE kb_id=${kb_id}$ AND chunk_type='directory' AND description=${id}$ ORDER BY content",
|
"SELECT id, description as parentid, content as label FROM document_chunks WHERE kb_id=${kb_id}$ AND chunk_type='directory' AND description=${id}$ ORDER BY content",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user