Compare commits
1 commit
main
...
fix/tool_c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56eaa35657 |
1 changed files with 12 additions and 11 deletions
|
|
@ -88,6 +88,7 @@ class LangflowHistoryService:
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract function calls from content_blocks if present
|
# Extract function calls from content_blocks if present
|
||||||
|
# Convert to match streaming format: chunk.item.type === "tool_call"
|
||||||
content_blocks = msg.get("content_blocks", [])
|
content_blocks = msg.get("content_blocks", [])
|
||||||
if content_blocks:
|
if content_blocks:
|
||||||
chunks = []
|
chunks = []
|
||||||
|
|
@ -95,23 +96,23 @@ class LangflowHistoryService:
|
||||||
if block.get("title") == "Agent Steps" and block.get("contents"):
|
if block.get("title") == "Agent Steps" and block.get("contents"):
|
||||||
for content in block["contents"]:
|
for content in block["contents"]:
|
||||||
if content.get("type") == "tool_use":
|
if content.get("type") == "tool_use":
|
||||||
# Convert Langflow tool_use format to OpenRAG chunks format
|
# Convert Langflow tool_use format to match streaming chunks format
|
||||||
|
# Frontend expects: chunk.item.type === "tool_call" with tool_name, inputs, results
|
||||||
chunk = {
|
chunk = {
|
||||||
"type": "function",
|
"type": "response.output_item.added",
|
||||||
"function": {
|
"item": {
|
||||||
"name": content.get("name", ""),
|
"type": "tool_call",
|
||||||
"arguments": content.get("tool_input", {}),
|
"tool_name": content.get("name", ""),
|
||||||
"response": content.get("output", {})
|
"inputs": content.get("tool_input", {}),
|
||||||
},
|
"results": content.get("output", {}),
|
||||||
"function_call_result": content.get("output", {}),
|
"id": content.get("id") or content.get("run_id", ""),
|
||||||
"duration": content.get("duration"),
|
"status": "completed" if not content.get("error") else "error"
|
||||||
"error": content.get("error")
|
}
|
||||||
}
|
}
|
||||||
chunks.append(chunk)
|
chunks.append(chunk)
|
||||||
|
|
||||||
if chunks:
|
if chunks:
|
||||||
converted_msg["chunks"] = chunks
|
converted_msg["chunks"] = chunks
|
||||||
converted_msg["response_data"] = {"tool_calls": chunks}
|
|
||||||
|
|
||||||
converted_messages.append(converted_msg)
|
converted_messages.append(converted_msg)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue