-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_stream.py
More file actions
53 lines (41 loc) · 1.47 KB
/
debug_stream.py
File metadata and controls
53 lines (41 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""调试流式研究功能 - 检查事件类型"""
from deep_research_system import DeepResearchSystem
from loguru import logger
# 初始化系统
print("初始化系统...")
system = DeepResearchSystem()
# 测试问题
question = "什么是Transformer?"
print(f"\n开始测试流式研究: {question}")
print("="*60)
event_count = 0
string_events = []
dict_events = []
try:
for event in system.research_stream(question):
event_count += 1
if isinstance(event, dict):
dict_events.append(event.get('type', 'unknown'))
print(f"✓ 事件 {event_count}: 字典类型 - {event.get('type')}")
elif isinstance(event, str):
string_events.append(event)
print(f"⚠ 事件 {event_count}: 字符串类型 - {repr(event[:100])}")
else:
print(f"❌ 事件 {event_count}: 未知类型 - {type(event)}")
except Exception as e:
print(f"\n❌ 测试失败: {e}")
import traceback
traceback.print_exc()
print("\n" + "="*60)
print("测试完成")
print(f"总事件数: {event_count}")
print(f"字典事件数: {len(dict_events)}")
print(f"字符串事件数: {len(string_events)}")
if string_events:
print(f"\n⚠ 发现 {len(string_events)} 个字符串事件:")
for i, s in enumerate(string_events, 1):
print(f" {i}. {repr(s[:200])}")
if dict_events:
print(f"\n✓ 字典事件类型列表:")
for i, et in enumerate(dict_events, 1):
print(f" {i}. {et}")