Skip to content

Commit ba21936

Browse files
committed
fix: correct for string [DONE] in gptscript events
Signed-off-by: Donnie Adams <donnie@acorn.io>
1 parent d72985d commit ba21936

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

gptscript/run.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import sys
23
import json
34
from typing import Union, Any, Self, Callable, Awaitable
45

@@ -136,10 +137,8 @@ async def _request(self, tool: Any):
136137
self._err = "run encountered an error"
137138

138139
async for line in resp.aiter_lines():
139-
line = line.strip()
140-
line = line.removeprefix("data: ")
141-
line = line.strip()
142-
if line == "" or line == "[DONE]":
140+
line = line.strip().removeprefix("data: ").strip()
141+
if line == '' or line == '"[DONE]"':
143142
continue
144143

145144
data = json.loads(line)

0 commit comments

Comments
 (0)