myagent-ai 1.15.13 → 1.15.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/context_builder.py +4 -3
- package/package.json +1 -1
package/core/context_builder.py
CHANGED
|
@@ -158,14 +158,15 @@ class ContextBuilder:
|
|
|
158
158
|
# 优先使用 get_knowledge(LLM 指定的检索关键词),否则使用用户消息
|
|
159
159
|
kb_query = get_knowledge.strip() if get_knowledge else query
|
|
160
160
|
|
|
161
|
+
# [v1.15.13] 动态计算对话历史预算:context_window 的 25%,至少 10000,最多 60000
|
|
162
|
+
dialog_budget = max(10000, min(int(self.context_window * 0.25), 60000))
|
|
163
|
+
|
|
161
164
|
sections: List[str] = [
|
|
162
165
|
self._build_datetime(),
|
|
163
166
|
self._build_whomi(agent_name, agent_description, agent_override_prompt),
|
|
164
167
|
self._build_memory(query, session_id, recall),
|
|
165
168
|
self._build_knowledge(kb_query),
|
|
166
|
-
|
|
167
|
-
# 其他上下文由系统记忆(automemory/recall_memory)自行处理
|
|
168
|
-
# self._build_recent_dialog(conversation_history, self.max_dialog_chars, session_id),
|
|
169
|
+
self._build_recent_dialog(conversation_history, dialog_budget, session_id),
|
|
169
170
|
self._build_user_input(user_typed_text, user_voice_text),
|
|
170
171
|
self._build_task_plan(task_plan),
|
|
171
172
|
self._build_tools(self.skill_registry),
|