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

Method create_conversation

astrbot/core/db/sqlite.py:334–364  ·  view source on GitHub ↗
(
        self,
        user_id,
        platform_id,
        content=None,
        title=None,
        persona_id=None,
        cid=None,
        created_at=None,
        updated_at=None,
    )

Source from the content-addressed store, hash-verified

332 return conversations, total
333
334 async def create_conversation(
335 self,
336 user_id,
337 platform_id,
338 content=None,
339 title=None,
340 persona_id=None,
341 cid=None,
342 created_at=None,
343 updated_at=None,
344 ):
345 kwargs = {}
346 if cid:
347 kwargs["conversation_id"] = cid
348 if created_at:
349 kwargs["created_at"] = created_at
350 if updated_at:
351 kwargs["updated_at"] = updated_at
352 async with self.get_db() as session:
353 session: AsyncSession
354 async with session.begin():
355 new_conversation = ConversationV2(
356 user_id=user_id,
357 content=content or [],
358 platform_id=platform_id,
359 title=title,
360 persona_id=persona_id,
361 **kwargs,
362 )
363 session.add(new_conversation)
364 return new_conversation
365
366 async def update_conversation(
367 self, cid, title=None, persona_id=None, content=None, token_usage=None

Callers

nothing calls this directly

Calls 3

ConversationV2Class · 0.90
addMethod · 0.80
get_dbMethod · 0.45

Tested by

no test coverage detected