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

Method update_conversation

astrbot/core/db/sqlite.py:366–388  ·  view source on GitHub ↗
(
        self, cid, title=None, persona_id=None, content=None, token_usage=None
    )

Source from the content-addressed store, hash-verified

364 return new_conversation
365
366 async def update_conversation(
367 self, cid, title=None, persona_id=None, content=None, token_usage=None
368 ):
369 async with self.get_db() as session:
370 session: AsyncSession
371 async with session.begin():
372 query = update(ConversationV2).where(
373 col(ConversationV2.conversation_id) == cid,
374 )
375 values = {}
376 if title is not None:
377 values["title"] = title
378 if persona_id is not None:
379 values["persona_id"] = persona_id
380 if content is not None:
381 values["content"] = content
382 if token_usage is not None:
383 values["token_usage"] = token_usage
384 if not values:
385 return None
386 query = query.values(**values)
387 await session.execute(query)
388 return await self.get_conversation_by_id(cid)
389
390 async def delete_conversation(self, cid) -> None:
391 async with self.get_db() as session:

Callers

nothing calls this directly

Calls 5

updateFunction · 0.50
get_dbMethod · 0.45
valuesMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected