格式化画像更新确认消息 Args: profile: 用户画像字典 Returns: 格式化文本
(profile: Dict)
| 416 | |
| 417 | |
| 418 | def format_profile_update(profile: Dict) -> str: |
| 419 | """ |
| 420 | 格式化画像更新确认消息 |
| 421 | |
| 422 | Args: |
| 423 | profile: 用户画像字典 |
| 424 | |
| 425 | Returns: |
| 426 | 格式化文本 |
| 427 | """ |
| 428 | # 研究方向翻译 |
| 429 | translations = { |
| 430 | "gui-agent": "GUI Agent", |
| 431 | "multimodal-reasoning": "多模态推理", |
| 432 | "vision": "视觉", |
| 433 | "language": "语言", |
| 434 | "machine-learning": "机器学习", |
| 435 | "deep-learning": "深度学习", |
| 436 | "reinforcement-learning": "强化学习", |
| 437 | "reasoning": "推理", |
| 438 | "agent": "智能体", |
| 439 | "optimization": "优化", |
| 440 | "retrieval": "检索", |
| 441 | "generation": "生成", |
| 442 | "data-native": "数据原生", |
| 443 | "bio-molecular": "生物分子", |
| 444 | "science-discovery": "科学发现", |
| 445 | } |
| 446 | |
| 447 | lines = [] |
| 448 | lines.append("=" * 60) |
| 449 | lines.append("📊 学术画像已更新") |
| 450 | lines.append("=" * 60) |
| 451 | lines.append("") |
| 452 | |
| 453 | # 核心方向 |
| 454 | lines.append("━━━ 核心方向 ━━━") |
| 455 | core_directions = profile.get("core_directions", {}) |
| 456 | if core_directions: |
| 457 | for direction, weight in sorted(core_directions.items(), key=lambda x: -x[1]): |
| 458 | direction_cn = translations.get(direction, direction) |
| 459 | bar_length = max(1, int(weight * 20)) |
| 460 | bar = "█" * bar_length + "░" * (20 - bar_length) |
| 461 | lines.append(f"{direction_cn} [{bar}] {weight:.2f}") |
| 462 | else: |
| 463 | lines.append("(未检测到明确方向,待学习)") |
| 464 | lines.append("") |
| 465 | |
| 466 | # 必读清单 |
| 467 | lines.append("━━━ 必读清单 ━━━") |
| 468 | must_read = profile.get("must_read", {"authors": [], "institutions": [], "keywords": []}) |
| 469 | authors = must_read.get("authors", []) |
| 470 | institutions = must_read.get("institutions", []) |
| 471 | keywords = must_read.get("keywords", []) |
| 472 | |
| 473 | lines.append(f"作者:{', '.join(authors) or '(空,待添加)'}") |
| 474 | lines.append(f"机构:{', '.join(institutions) or '(空,待添加)'}") |
| 475 | lines.append(f"关键词:{', '.join(keywords) or '(空,待添加)'}") |
no test coverage detected