MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / delete

Method delete

backend/app/operators/assistant/chat.py:51–81  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

49 return chat
50
51 async def delete(self, **kwargs) -> ModelEntity:
52 kwargs = self._check_kwargs(object_id_required=True, **kwargs)
53 assistant_id = kwargs.get("assistant_id")
54 chat_id = kwargs.get("chat_id")
55
56 async with self.postgres_pool.get_db_connection() as conn:
57 async with conn.transaction():
58 # get assistant
59 assistant = await assistant_ops.get(
60 postgres_conn=conn,
61 assistant_id=assistant_id,
62 )
63
64 # get chat
65 chat = await self.get(
66 postgres_conn=conn,
67 assistant_id=assistant_id,
68 chat_id=chat_id,
69 )
70
71 # delete chat
72 await self._delete_entity(conn, chat)
73
74 # update assistant num_chats
75 await assistant_ops.update(
76 postgres_conn=conn,
77 assistant_id=assistant_id,
78 update_dict={"num_chats": assistant.num_chats - 1},
79 )
80
81 return assistant
82
83
84chat_ops = ChatModelOperator(

Callers 15

deletePluginFunction · 0.45
deleteRecordFunction · 0.45
deleteAssistantFunction · 0.45
deleteModelsFunction · 0.45
deleteChatItemFunction · 0.45
deleteApiKeysFunction · 0.45
deleteActionsFunction · 0.45
deleteRetrievalFunction · 0.45
deleteRecordFunction · 0.45
api_deleteFunction · 0.45
api_deleteFunction · 0.45
api_deleteFunction · 0.45

Calls 5

_check_kwargsMethod · 0.80
get_db_connectionMethod · 0.80
_delete_entityMethod · 0.80
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected