Restore live tool execution logging in console for OpenCode
This commit is contained in:
+10
-6
@@ -119,7 +119,7 @@ class OpenCodeLLM(FrameProcessor):
|
||||
port: int = 4096,
|
||||
system_prompt: str | None = None,
|
||||
observer=None,
|
||||
use_server: bool = True,
|
||||
use_server: bool = False,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(**kwargs)
|
||||
@@ -244,11 +244,15 @@ class OpenCodeLLM(FrameProcessor):
|
||||
data = await resp.json()
|
||||
parts = data.get("parts", []) if isinstance(data, dict) else []
|
||||
for p in parts:
|
||||
if isinstance(p, dict) and p.get("type") == "text" and "text" in p:
|
||||
text_chunk = _clean_spoken_text(p["text"])
|
||||
if text_chunk:
|
||||
chunks.append(text_chunk)
|
||||
await self.push_frame(LLMTextFrame(text_chunk))
|
||||
if isinstance(p, dict):
|
||||
p_type = p.get("type")
|
||||
if p_type == "text" and "text" in p:
|
||||
text_chunk = _clean_spoken_text(p["text"])
|
||||
if text_chunk:
|
||||
chunks.append(text_chunk)
|
||||
await self.push_frame(LLMTextFrame(text_chunk))
|
||||
elif p_type not in ("step-start", "step-finish"):
|
||||
logger.info(f"OpenCode Tool: {p_type} -> {json.dumps(p)[:120]}")
|
||||
if not chunks and isinstance(data, dict):
|
||||
if "delta" in data:
|
||||
text_chunk = _clean_spoken_text(data["delta"])
|
||||
|
||||
Reference in New Issue
Block a user