Spaces:
Runtime error
Runtime error
Merge pull request #33 from EnvisionMindCa/codex/fix-discord-bot-response-for-llm-without-tools
Browse files- src/chat.py +6 -0
src/chat.py
CHANGED
@@ -141,6 +141,12 @@ class ChatSession:
|
|
141 |
conversation: Conversation,
|
142 |
depth: int = 0,
|
143 |
) -> AsyncIterator[ChatResponse]:
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
while depth < MAX_TOOL_CALL_DEPTH and response.message.tool_calls:
|
145 |
for call in response.message.tool_calls:
|
146 |
if call.function.name != "execute_terminal":
|
|
|
141 |
conversation: Conversation,
|
142 |
depth: int = 0,
|
143 |
) -> AsyncIterator[ChatResponse]:
|
144 |
+
if not response.message.tool_calls:
|
145 |
+
if response.message.content:
|
146 |
+
yield response
|
147 |
+
async with self._lock:
|
148 |
+
self._state = "idle"
|
149 |
+
return
|
150 |
while depth < MAX_TOOL_CALL_DEPTH and response.message.tool_calls:
|
151 |
for call in response.message.tool_calls:
|
152 |
if call.function.name != "execute_terminal":
|