def create_frontend_view_html(persona):
"""Create HTML representation of the frontend view of the persona"""
if not persona:
return "
페르소나가 아직 생성되지 않았습니다.
"
name = persona.get("기본정보", {}).get("이름", "Unknown")
object_type = persona.get("기본정보", {}).get("유형", "Unknown")
description = persona.get("기본정보", {}).get("설명", "")
# 성격 요약 가져오기
personality_summary = persona.get("성격요약", {})
summary_html = ""
if personality_summary:
summary_items = []
for trait, value in personality_summary.items():
if isinstance(value, (int, float)):
trait_name = trait
trait_value = value
summary_items.append(f"• {trait_name}: {trait_value:.1f}%")
if summary_items:
summary_html = "성격 요약
" + "".join([f"- {item}
" for item in summary_items]) + "
"
# Personality traits
traits_html = ""
for trait, value in persona.get("성격특성", {}).items():
traits_html += f"""
"""
# Flaws - 매력적 결함
flaws = persona.get("매력적결함", [])
flaws_list = ""
for flaw in flaws[:4]: # 최대 4개만 표시
flaws_list += f"{flaw}"
# 소통 방식
communication_style = persona.get("소통방식", "")
# 유머 스타일
humor_style = persona.get("유머스타일", "")
# 전체 HTML 스타일과 내용
html = f"""
{summary_html}
소통 스타일
{communication_style}
유머 스타일
{humor_style}
"""
return html