feat: 摘要中间件增加压缩日志,提炼模板编辑框定高
- summarization_middleware: 真正压缩与复用缓存均记录 info 日志,便于无 stream writer 场景(定时任务/渠道/测试)排查 - KnowledgeManage: 提炼模板 system prompt 编辑框固定为 50vh 高度,内部滚动 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
97da7dc87f
commit
d82b5ed884
2 files changed
+15
-1
No files matched your search
@@ -380,7 +380,7 @@ export function ExtractTemplateManageDialog({
|
||||
placeholder="提示词正文(system prompt)。这里直接控制提炼粒度——想保留更多信息,就在此放宽要求、要求结构化更详细的输出。"
|
||||
value={draft.system_prompt}
|
||||
onChange={(e) => setDraft((d) => ({ ...d, system_prompt: e.target.value }))}
|
||||
className="font-mono text-xs"
|
||||
className="h-[50vh] max-h-[50vh] resize-none overflow-y-auto font-mono text-xs"
|
||||
/>
|
||||
<div className="flex flex-wrap items-center gap-4 text-sm">
|
||||
<label className="flex items-center gap-1.5">
|
||||
|
||||
+14
@@ -269,6 +269,12 @@ class DeerFlowSummarizationMiddleware(SummarizationMiddleware):
|
||||
no-op when there is no active stream writer (e.g. unit tests, non-stream
|
||||
runs), so callers never branch.
|
||||
"""
|
||||
# Always leave a backend trace of the genuine (blocking) compaction, even
|
||||
# when there is no stream writer to render the frontend toast (scheduled
|
||||
# runs, channels, tests). Grep ``上下文压缩`` / ``context compaction`` in
|
||||
# the Gateway log to confirm a real summarization LLM call fired.
|
||||
logger.info("summarization: 上下文压缩(真正摘要,触发一次 LLM 调用) context compaction firing")
|
||||
|
||||
try:
|
||||
from langgraph.config import get_stream_writer
|
||||
|
||||
@@ -327,6 +333,14 @@ class DeerFlowSummarizationMiddleware(SummarizationMiddleware):
|
||||
if not self._exceeds_trigger_by_count(effective):
|
||||
# Refresh LRU recency and reuse without an LLM call.
|
||||
self._touch_cache_entry(thread_id)
|
||||
logger.info(
|
||||
"summarization: 上下文压缩(复用缓存摘要,无 LLM 调用) context compaction reusing cached summary "
|
||||
"thread=%s full_tokens=%d compressed_tokens=%d preserved_msgs=%d",
|
||||
thread_id,
|
||||
self.token_counter(messages),
|
||||
self.token_counter(effective),
|
||||
len(preserved),
|
||||
)
|
||||
return ("reuse", effective)
|
||||
# New messages have pushed the compressed context back over the
|
||||
# threshold — fall through and re-summarize a larger prefix.
|
||||
|
||||
Reference in new issue
Block a user