Log OpenCode tool execution steps in real time in voice assistant console
This commit is contained in:
@@ -168,6 +168,17 @@ class OpenCodeLLM(FrameProcessor):
|
||||
cwd=str(self._cwd),
|
||||
)
|
||||
|
||||
async def _read_stderr(stream):
|
||||
while True:
|
||||
line = await stream.readline()
|
||||
if not line:
|
||||
break
|
||||
decoded = line.decode("utf-8").strip()
|
||||
if decoded and not decoded.startswith(">"):
|
||||
logger.info(f"OpenCode Tool: {decoded}")
|
||||
|
||||
stderr_task = asyncio.create_task(_read_stderr(proc.stderr))
|
||||
|
||||
while True:
|
||||
line = await proc.stdout.readline()
|
||||
if not line:
|
||||
@@ -179,6 +190,7 @@ class OpenCodeLLM(FrameProcessor):
|
||||
await self.push_frame(LLMTextFrame(cleaned))
|
||||
|
||||
await proc.wait()
|
||||
await stderr_task
|
||||
|
||||
except asyncio.CancelledError:
|
||||
logger.info("OpenCode turn cancelled mid-response.")
|
||||
|
||||
Reference in New Issue
Block a user