mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-26 00:33:35 +08:00
* feat: add db memory * WEBUI 添加多会话功能 --------- Co-authored-by: liqiankun.1111 <liqiankun.1111@bytedance.com> Co-authored-by: liunux4odoo <liunux@qq.com>
17 lines
440 B
Python
17 lines
440 B
Python
from server.db.session import with_session
|
|
import uuid
|
|
from server.db.models.conversation_model import ConversationModel
|
|
|
|
|
|
@with_session
|
|
def add_conversation_to_db(session, chat_type, name="", conversation_id=None):
|
|
"""
|
|
新增聊天记录
|
|
"""
|
|
if not conversation_id:
|
|
conversation_id = uuid.uuid4().hex
|
|
c = ConversationModel(id=conversation_id, chat_type=chat_type, name=name)
|
|
|
|
session.add(c)
|
|
return c.id
|