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