Spaces:
Runtime error
Runtime error
Update chain_app.py
Browse files- chain_app.py +4 -9
chain_app.py
CHANGED
@@ -2362,19 +2362,14 @@ async def main(message: cl.Message):
|
|
2362 |
stop=None,
|
2363 |
)
|
2364 |
|
2365 |
-
complete_content = ""
|
2366 |
|
2367 |
# Iterate over each chunk
|
2368 |
for chunk in completion:
|
2369 |
-
# Retrieve the content from the current chunk
|
2370 |
-
content = chunk.choices[0].delta.content
|
2371 |
-
|
2372 |
# Check if the content is not None before concatenating it
|
2373 |
-
if
|
2374 |
-
|
2375 |
-
|
2376 |
-
# Send the concatenated content as a message
|
2377 |
-
await cl.Message(content=complete_content).send()
|
2378 |
|
2379 |
elif chat_profile == 'Llama-3.1-8B':
|
2380 |
completion = groq_client.chat.completions.create(
|
|
|
2362 |
stop=None,
|
2363 |
)
|
2364 |
|
2365 |
+
# complete_content = ""
|
2366 |
|
2367 |
# Iterate over each chunk
|
2368 |
for chunk in completion:
|
2369 |
+
# Retrieve the content from the current chunk
|
|
|
|
|
2370 |
# Check if the content is not None before concatenating it
|
2371 |
+
if chunk is not None:
|
2372 |
+
await msg.stream_token(chunk.choices[0].delta.content)
|
|
|
|
|
|
|
2373 |
|
2374 |
elif chat_profile == 'Llama-3.1-8B':
|
2375 |
completion = groq_client.chat.completions.create(
|