MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / format_profile

Function format_profile

scripts/show_profile.py:21–100  ·  view source on GitHub ↗

Format profile for display

(profile: dict)

Source from the content-addressed store, hash-verified

19def format_profile(profile: dict) -> str:
20 """Format profile for display"""
21
22 lines = []
23 lines.append("=" * 60)
24 lines.append("你的学术画像")
25 lines.append("=" * 60)
26 lines.append(f"User ID: {profile['user_id']}")
27 lines.append(f"Version: {profile['version']}")
28 lines.append(f"Updated: {profile.get('updated_at', 'N/A')}")
29 lines.append("")
30
31 # Core directions
32 lines.append("--- 核心方向 ---")
33 for direction, weight in profile.get('core_directions', {}).items():
34 bar_len = int(weight * 20)
35 bar = "#" * bar_len + "-" * (20 - bar_len)
36 lines.append(f"{direction:40} {bar} {weight:.2f}")
37 lines.append("")
38
39 # Methodology preferences
40 lines.append("--- 方法论偏好 ---")
41 prefs = profile.get('methodology_preferences', {})
42 pref_labels = {
43 'preference_data_driven_over_theory': '数据驱动 > 纯理论',
44 'preference_systematic_work_over_incremental': '系统性工作 > 单点改进',
45 'preference_open_source_code': '有开源代码',
46 'preference_multimodal_application': '多模态应用场景'
47 }
48 for key, label in pref_labels.items():
49 status = "Y" if prefs.get(key, False) else " "
50 lines.append(f" [{status}] {label}")
51 lines.append("")
52
53 # Must read
54 lines.append("--- 必读清单 ---")
55 must_read = profile.get('must_read', {})
56
57 authors = must_read.get('authors', [])
58 if authors:
59 lines.append(f"作者:{', '.join(authors)}")
60 else:
61 lines.append("作者:(空)")
62
63 institutions = must_read.get('institutions', [])
64 if institutions:
65 lines.append(f"机构:{', '.join(institutions)}")
66 else:
67 lines.append("机构:(空)")
68
69 keywords = must_read.get('keywords', [])
70 if keywords:
71 lines.append(f"关键词:{', '.join(keywords)}")
72 else:
73 lines.append("关键词:(空)")
74 lines.append("")
75
76 # Topic weights
77 lines.append("--- 主题权重 ---")
78 for topic, weight in profile.get('topic_weights', {}).items():

Callers 1

mainFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected