|
@@ -21,3 +21,37 @@ def format_agent_profile(profile: Dict) -> str:
|
|
|
cur_string = f"- {field[1]}:{profile[field[0]]}"
|
|
|
strings_to_join.append(cur_string)
|
|
|
return "\n".join(strings_to_join)
|
|
|
+
|
|
|
+def format_user_profile(profile: Dict) -> str:
|
|
|
+ """
|
|
|
+ :param profile:
|
|
|
+ :return: formatted string.
|
|
|
+ example:
|
|
|
+ - 微信昵称:{nickname}
|
|
|
+ - 姓名:{name}
|
|
|
+ - 头像:{avatar}
|
|
|
+ - 偏好的称呼:{preferred_nickname}
|
|
|
+ - 年龄:{age}
|
|
|
+ - 地区:{region}
|
|
|
+ - 健康状况:{health_conditions}
|
|
|
+ - 用药信息:{medications}
|
|
|
+ - 兴趣爱好:{interests}
|
|
|
+ """
|
|
|
+ fields = [
|
|
|
+ ('nickname', '微信昵称'),
|
|
|
+ ('name', '姓名'),
|
|
|
+ ('avatar', '头像'),
|
|
|
+ ('preferred_nickname', '偏好的称呼'),
|
|
|
+ ('age', '年龄'),
|
|
|
+ ('region', '地区'),
|
|
|
+ ('health_conditions', '健康状况'),
|
|
|
+ ('medications', '用药信息'),
|
|
|
+ ('interests', '兴趣爱好')
|
|
|
+ ]
|
|
|
+ strings_to_join = []
|
|
|
+ for field in fields:
|
|
|
+ if not profile.get(field[0], None):
|
|
|
+ continue
|
|
|
+ cur_string = f"- {field[1]}:{profile[field[0]]}"
|
|
|
+ strings_to_join.append(cur_string)
|
|
|
+ return "\n".join(strings_to_join)
|