can someone help me out to figure out how to store...
# agents
t
can someone help me out to figure out how to store all the conversation and user session local database.
r
You can store session.history to a file if you like.
m
You Can refer this code for saving the transcript in the database.@session.on("user_input_transcribed") def on_transcript(transcript): if appointment_scheduling_assistant.transcription_buffer: appointment_scheduling_assistant.transcription_buffer+=" "+ transcript.transcript else: appointment_scheduling_assistant.transcription_buffer = transcript.transcript logger.info(f"Transcription Buffer: {appointment_scheduling_assistant.transcription_buffer}") sentence_endings=re.findall(r'[.!?]',appointment_scheduling_assistant.transcription_buffer) if len(sentence_endings)>=3: sentence_count=0 last_pos=0 for match in re.finditer(r'[.!?]',appointment_scheduling_assistant.transcription_buffer): sentence_count+=1 if sentence_count ==3 : last_pos=match.end() break two_sentences=appointment_scheduling_assistant.transcription_buffer[:last_pos].strip()# Extract the second sentence appointment_scheduling_assistant.transcription_buffer =appointment_scheduling_assistant.transcription_buffer[last_pos:].strip()# Remove the second sentence from the buffer appointment_scheduling_assistant.transcriptions.append(two_sentences)# Append the second sentence to the list logger.info(f"Processing for notes : {two_sentences}") if(len( two_sentences)>5 and two_sentences not in appointment_scheduling_assistant.transcriptions): db.add_transcription(1,two_sentences)