Demosthene-OR commited on
Commit
ea335bb
·
1 Parent(s): 8512623

Update chatbot_tab.py

Browse files
Files changed (1) hide show
  1. tabs/chatbot_tab.py +6 -2
tabs/chatbot_tab.py CHANGED
@@ -96,10 +96,14 @@ def run():
96
 
97
  trimmer.invoke(messages)
98
 
99
- query = "Hi I'm Todd, please tell me a joke."
 
100
  language = "French"
101
 
102
  input_messages = [HumanMessage(query)]
 
 
 
103
  for chunk, metadata in app.stream(
104
  {"messages": input_messages, "language": language},
105
  config,
@@ -107,7 +111,7 @@ def run():
107
  ):
108
  if isinstance(chunk, AIMessage): # Filter to just model responses
109
  # st.markdown("<span style='white-space: nowrap;'>"+"/"+chunk.content+"/"+"</span>", unsafe_allow_html=True)
110
- st.markdown(chunk.content, unsafe_allow_html=True)
111
 
112
  '''
113
  sentences = ["This is an example sentence", "Each sentence is converted"]
 
96
 
97
  trimmer.invoke(messages)
98
 
99
+ # query = "Hi I'm Todd, please tell me a joke."
100
+ query = st.text_area(label=tr("Vendeur:"), value="")
101
  language = "French"
102
 
103
  input_messages = [HumanMessage(query)]
104
+ # Créer un espace réservé pour afficher les tokens
105
+ placeholder = st.empty()
106
+
107
  for chunk, metadata in app.stream(
108
  {"messages": input_messages, "language": language},
109
  config,
 
111
  ):
112
  if isinstance(chunk, AIMessage): # Filter to just model responses
113
  # st.markdown("<span style='white-space: nowrap;'>"+"/"+chunk.content+"/"+"</span>", unsafe_allow_html=True)
114
+ placeholder.markdown(f"<p style='display: inline;'>{chunk.content}</p>", unsafe_allow_html=True)
115
 
116
  '''
117
  sentences = ["This is an example sentence", "Each sentence is converted"]