mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-23 08:25:57 +00:00
df63c104a7
- Replaced `fetchWithAuth` with a generic `fetch` function across various API modules for consistency. - Updated `useThreadStream` and `useThreadHistory` hooks to manage chat history loading, including loading states and pagination. - Introduced `LoadMoreHistoryIndicator` component for better user experience when loading more chat history. - Enhanced message handling in `MessageList` to accommodate new loading states and history management. - Added support for run messages in the thread context, improving the overall message handling logic. - Updated translations for loading indicators in English and Chinese.
14 lines
675 B
Python
14 lines
675 B
Python
from typing import override
|
|
|
|
from langchain.agents.middleware import SummarizationMiddleware as BaseSummarizationMiddleware
|
|
from langchain_core.messages.human import HumanMessage
|
|
|
|
|
|
class SummarizationMiddleware(BaseSummarizationMiddleware):
|
|
@override
|
|
def _build_new_messages(self, summary: str) -> list[HumanMessage]:
|
|
"""Override the base implementation to let the human message with the special name 'summary'.
|
|
And this message will be ignored to display in the frontend, but still can be used as context for the model.
|
|
"""
|
|
return [HumanMessage(content=f"Here is a summary of the conversation to date:\n\n{summary}", name="summary")]
|