Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,12 +42,12 @@ if prompt := st.chat_input("What is up?"):
|
|
42 |
max_tokens=1024,
|
43 |
stream=True,
|
44 |
)
|
45 |
-
|
46 |
for chunk in stream:
|
47 |
if chunk.choices[0].delta.content is not None:
|
48 |
-
|
49 |
-
|
50 |
-
|
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})
|