perf: upgrade Graphiti LLM to Qwen 32B + improve progress feedback

- Upgrade from Qwen2.5-7B to Qwen2.5-32B-Instruct (faster, better quality)
- Add real-time progress messages: "正在处理第 X/Y 个文本块"
- Log per-episode processing time
- Expand progress range from 15-55% to 15-90% (no more episode polling step)
- Add GRAPHITI_LLM_* separate config for graph building LLM

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
liyizhouAI 2026-04-13 15:31:16 +08:00
parent a35ba347f3
commit d5a908077a
2 changed files with 17 additions and 5 deletions

View File

@ -424,7 +424,7 @@ def build_graph():
# 添加文本progress_callback 签名是 (msg, progress_ratio)
def add_progress_callback(msg, progress_ratio):
progress = 15 + int(progress_ratio * 40) # 15% - 55%
progress = 15 + int(progress_ratio * 75) # 15% - 90%
task_manager.update_task(
task_id,
message=msg,

View File

@ -267,14 +267,17 @@ class GraphitiClient:
edge_types: Optional[Dict] = None,
progress_callback=None,
):
"""Add multiple text episodes sequentially (Graphiti processes one at a time)."""
"""Add multiple text episodes sequentially with real-time progress."""
total = len(texts)
import time as _time
for i, text in enumerate(texts):
# Report progress BEFORE processing (so user sees "正在处理 2/5...")
if progress_callback:
progress_callback(
f"Processing episode {i + 1}/{total}",
(i + 1) / total,
f"正在处理第 {i + 1}/{total} 个文本块Graphiti 实体提取中...",
i / total,
)
start = _time.time()
try:
self.add_episode(
graph_id, text, source_description,
@ -283,9 +286,18 @@ class GraphitiClient:
except Exception as e:
logger.error(f"Failed to add episode {i + 1}/{total}: {e}")
raise
elapsed = _time.time() - start
logger.info(f"Episode {i + 1}/{total} processed in {elapsed:.1f}s")
# Report completion of this episode
if progress_callback:
progress_callback(
f"{i + 1}/{total} 个文本块处理完成(用时 {elapsed:.0f}s",
(i + 1) / total,
)
# Small delay to avoid rate limiting
if i < total - 1:
time.sleep(0.5)
_time.sleep(0.3)
# ========== Search ==========