eagle0504 commited on
Commit
7a01b51
·
verified ·
1 Parent(s): 2644024

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -42,12 +42,12 @@ if prompt := st.chat_input("What is up?"):
42
  max_tokens=1024,
43
  stream=True,
44
  )
45
- response = ""
46
  for chunk in stream:
47
  if chunk.choices[0].delta.content is not None:
48
- chunk_text = chunk.choices[0].delta.content
49
- response += chunk_text
50
- st.write(chunk_text, end="")
51
 
52
  # Store the assistant response in the session state
53
  st.session_state.messages.append({"role": "assistant", "content": response})
 
42
  max_tokens=1024,
43
  stream=True,
44
  )
45
+ response_chunks = []
46
  for chunk in stream:
47
  if chunk.choices[0].delta.content is not None:
48
+ response_chunks.append(chunk.choices[0].delta.content)
49
+ response = "".join(response_chunks)
50
+ st.markdown(response)
51
 
52
  # Store the assistant response in the session state
53
  st.session_state.messages.append({"role": "assistant", "content": response})