Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
null check for chunk.choices
Namanf0ee68666092
diff --git a/backend/llm.py b/backend/llm.pyindex 44f97e19..e32051c8 100644--- a/backend/llm.py+++ b/backend/llm.py@@ -59,7 +59,7 @@ async def stream_openai_response(full_response = ""async for chunk in stream: # type: ignoreassert isinstance(chunk, ChatCompletionChunk)- if chunk.choices and chunk.choices[0].delta.content:+ if chunk.choices and len(chunk.choices) > 0 and chunk.choices[0].delta and chunk.choices[0].delta.content:content = chunk.choices[0].delta.content or ""full_response += contentawait callback(content)