MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / delete_persona_folder

Method delete_persona_folder

astrbot/core/db/sqlite.py:1108–1128  ·  view source on GitHub ↗

Delete a persona folder by its folder_id. Note: This will also set folder_id to NULL for all personas in this folder, moving them to the root directory.

(self, folder_id: str)

Source from the content-addressed store, hash-verified

1106 return await self.get_persona_folder_by_id(folder_id)
1107
1108 async def delete_persona_folder(self, folder_id: str) -> None:
1109 """Delete a persona folder by its folder_id.
1110
1111 Note: This will also set folder_id to NULL for all personas in this folder,
1112 moving them to the root directory.
1113 """
1114 async with self.get_db() as session:
1115 session: AsyncSession
1116 async with session.begin():
1117 # Move personas to root directory
1118 await session.execute(
1119 update(Persona)
1120 .where(col(Persona.folder_id) == folder_id)
1121 .values(folder_id=None)
1122 )
1123 # Delete the folder
1124 await session.execute(
1125 delete(PersonaFolder).where(
1126 col(PersonaFolder.folder_id) == folder_id
1127 ),
1128 )
1129
1130 async def move_persona_to_folder(
1131 self, persona_id: str, folder_id: str | None

Callers

nothing calls this directly

Calls 5

deleteFunction · 0.85
updateFunction · 0.50
get_dbMethod · 0.45
executeMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected