datacipen commited on
Commit
d954610
·
verified ·
1 Parent(s): fd1e446

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -250,8 +250,8 @@ async def Affichage_reponse(response, question, data):
250
  msg = response.invoke({"question": question, "data": data},
251
  config={"configurable": {"session_id":session_id}})
252
  #msg = msg.replace('Ã','é').replace('©','').replace('Ã','è').replace('¨','').replace('â','\'').replace('€','').replace('™','').replace('Å','oe').replace('“','').replace('®','î').replace('´','ô').replace('<','').replace('>','').replace('/','')
253
- #msg = GoogleTranslator(source='auto', target='fr').translate(msg[0:4999])
254
- msgList = msg.split(' ')
255
  for chunk in msgList:
256
  time.sleep(0.125)
257
  await result.stream_token(chunk + ' ')
@@ -262,7 +262,7 @@ async def Affichage_reponse(response, question, data):
262
  #memory.chat_memory.add_user_message(question)
263
  #memory.chat_memory.add_ai_message(msg)
264
 
265
- return msg
266
 
267
  @cl.step(type="tool", show_input=True)
268
  async def Affichage_question_contexte(answer, question, contexte):
 
250
  msg = response.invoke({"question": question, "data": data},
251
  config={"configurable": {"session_id":session_id}})
252
  #msg = msg.replace('Ã','é').replace('©','').replace('Ã','è').replace('¨','').replace('â','\'').replace('€','').replace('™','').replace('Å','oe').replace('“','').replace('®','î').replace('´','ô').replace('<','').replace('>','').replace('/','')
253
+ answer = GoogleTranslator(source='auto', target='fr').translate(msg.content[0:4999])
254
+ msgList = answer.split(' ')
255
  for chunk in msgList:
256
  time.sleep(0.125)
257
  await result.stream_token(chunk + ' ')
 
262
  #memory.chat_memory.add_user_message(question)
263
  #memory.chat_memory.add_ai_message(msg)
264
 
265
+ return answer
266
 
267
  @cl.step(type="tool", show_input=True)
268
  async def Affichage_question_contexte(answer, question, contexte):