fix: use AIMessage content for summarization response parsing

Agent-Logs-Url: https://github.com/bytedance/deer-flow/sessions/0b34cccd-f69a-4f68-bfa6-9a41256b63b5

Co-authored-by: WillemJiang <219644+WillemJiang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-11 14:48:45 +00:00
committed by GitHub
parent c995c3a394
commit 6ffe267d20
2 changed files with 10 additions and 4 deletions
@@ -201,7 +201,7 @@ class DeerFlowSummarizationMiddleware(SummarizationMiddleware):
"callbacks": [],
},
)
return response.text.strip()
return self._extract_summary_text(response)
except Exception as e:
return f"Error generating summary: {e!s}"
@@ -230,10 +230,16 @@ class DeerFlowSummarizationMiddleware(SummarizationMiddleware):
"callbacks": [],
},
)
return response.text.strip()
return self._extract_summary_text(response)
except Exception as e:
return f"Error generating summary: {e!s}"
def _extract_summary_text(self, response: Any) -> str:
summary_text = getattr(response, "content", None)
if summary_text is None:
summary_text = getattr(response, "text", "")
return summary_text.strip() if isinstance(summary_text, str) else str(summary_text).strip()
@override
def _build_new_messages(self, summary: str) -> list[HumanMessage]:
"""Override the base implementation to let the human message with the special name 'summary'.