first_visit logic
This commit is contained in:
parent
0e33063c99
commit
41fd8e3d15
2 changed files with 6 additions and 5 deletions
|
|
@ -173,7 +173,7 @@ class ChatService:
|
|||
session.add(user_session)
|
||||
session.commit()
|
||||
|
||||
async def initialize_chat(self, uid: str, application, name):
|
||||
async def initialize_chat(self, uid: str, application, name, first_visit):
|
||||
session_id = await self.get_user_session(uid)
|
||||
if not session_id or not await session_service.validate_session(session_id):
|
||||
session_id = await session_service.create_session(agent_id=settings.TALESTORM_AGENT_ID)
|
||||
|
|
@ -191,9 +191,7 @@ class ChatService:
|
|||
"answer": INIT_MESSAGES[0],
|
||||
}
|
||||
|
||||
last_message = await self.get_last_chat_message_date(session_id)
|
||||
print(f"{uid}; {session_id}; {last_message}")
|
||||
if not last_message:
|
||||
if first_visit:
|
||||
return {
|
||||
"session_id": session_id,
|
||||
"answer": INIT_MESSAGES[0],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue