Skip to content

Don't check equality with None #1609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ async def async_respond(self, user_input=None):
current_block.partial_json += chunk.delta.partial_json

if hasattr(current_block, "name"):
if edit.name == None:
if edit.name is None:
edit.name = current_block.name
edit.feed(chunk.delta.partial_json)

Expand Down Expand Up @@ -673,7 +673,7 @@ async def async_respond(self, user_input=None):
# Fix ollama
stream = False
actual_model = self.model.replace("ollama/", "openai/")
if self.api_base == None:
if self.api_base is None:
api_base = "http://localhost:11434/v1/"
else:
api_base = self.api_base
Expand Down Expand Up @@ -812,28 +812,28 @@ async def async_respond(self, user_input=None):
self._spinner.stop()
first_token = False

if message == None:
if message is None:
message = chunk.choices[0].delta

if chunk.choices[0].delta.content:
md.feed(chunk.choices[0].delta.content)
await asyncio.sleep(0)

if message.content == None:
if message.content is None:
message.content = chunk.choices[0].delta.content
elif chunk.choices[0].delta.content != None:
elif chunk.choices[0].delta.content is not None:
message.content += chunk.choices[0].delta.content

if chunk.choices[0].delta.tool_calls:
if chunk.choices[0].delta.tool_calls[0].id:
if message.tool_calls == None or chunk.choices[
if message.tool_calls is None or chunk.choices[
0
].delta.tool_calls[0].id not in [
t.id for t in message.tool_calls
]:
edit.close()
edit = ToolRenderer()
if message.tool_calls == None:
if message.tool_calls is None:
message.tool_calls = []
message.tool_calls.append(
chunk.choices[0].delta.tool_calls[0]
Expand All @@ -848,9 +848,9 @@ async def async_respond(self, user_input=None):
tool_name = (
chunk.choices[0].delta.tool_calls[0].function.name
)
if edit.name == None:
if edit.name is None:
edit.name = tool_name
if current_tool_call.function.name == None:
if current_tool_call.function.name is None:
current_tool_call.function.name = tool_name
if chunk.choices[0].delta.tool_calls[0].function.arguments:
arguments_delta = (
Expand Down