25 lines
627 B
Python
25 lines
627 B
Python
from ..models import Conversation
|
|
|
|
|
|
class ConversationService:
|
|
@staticmethod
|
|
def create_conversation(workspace_id, data):
|
|
conversation = Conversation(
|
|
workspace_id=workspace_id,
|
|
agent_id=data["agent_id"],
|
|
title=data.get("title"),
|
|
)
|
|
conversation.save()
|
|
return conversation
|
|
|
|
@staticmethod
|
|
def update_conversation(conversation, data):
|
|
if "title" in data:
|
|
conversation.title = data["title"]
|
|
|
|
if "status" in data:
|
|
conversation.status = data["status"]
|
|
|
|
conversation.save()
|
|
return conversation
|