Commit
·
4d07ce6
1
Parent(s):
ef36331
add
Browse files
app.py
CHANGED
@@ -89,6 +89,50 @@ def analyze_profile(prompt, model_name="personality_gpt4o", temperature=0.5):
|
|
89 |
error_message = f"Error generating or parsing response: {str(e)}"
|
90 |
print(error_message)
|
91 |
return None, error_message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
def classify_traits(profile):
|
94 |
main_profile = profile['main_profile']
|
@@ -178,49 +222,7 @@ def generate_prompt_from_profile(profile, version="TestTakersSummary"):
|
|
178 |
|
179 |
return message
|
180 |
|
181 |
-
|
182 |
-
def render_report_as_markdown(report):
|
183 |
-
# Access attributes directly from the ReportSchema object
|
184 |
-
markdown = f"## Profile summary\n\n{report.profile_summary}\n\n"
|
185 |
-
|
186 |
-
# Strengths section
|
187 |
-
markdown += "## STRENGTHS\n\n"
|
188 |
-
for strength in report.strengths:
|
189 |
-
markdown += f"### {strength.trait} ({strength.level})\n\n{strength.summary}\n\n"
|
190 |
-
|
191 |
-
# Areas for development section
|
192 |
-
markdown += "## AREAS FOR DEVELOPMENT\n\n"
|
193 |
-
for area in report.areas_for_development:
|
194 |
-
markdown += f"### {area.trait} ({area.level})\n\n{area.summary}\n\n"
|
195 |
-
|
196 |
-
# Risks section (if present)
|
197 |
-
if report.risks:
|
198 |
-
markdown += "## RISKS\n\n"
|
199 |
-
for risk in report.risks:
|
200 |
-
markdown += f"### {risk.trait} ({risk.level})\n\n{risk.summary}\n\n"
|
201 |
-
|
202 |
-
# Trait interactions section
|
203 |
-
markdown += f"## Trait Interactions\n\n{report.trait_interactions}\n\n"
|
204 |
-
|
205 |
-
# Motivation section
|
206 |
-
markdown += "## Motivation\n\n"
|
207 |
-
|
208 |
-
if report.motivation.high_motivation:
|
209 |
-
markdown += "### High Motivation\n\n"
|
210 |
-
for trait in report.motivation.high_motivation:
|
211 |
-
markdown += f"### {trait.trait} ({trait.level})\n\n{trait.summary}\n\n"
|
212 |
-
|
213 |
-
if report.motivation.average_motivation:
|
214 |
-
markdown += "### Average Motivation\n\n"
|
215 |
-
for trait in report.motivation.average_motivation:
|
216 |
-
markdown += f"### {trait.trait} ({trait.level})\n\n{trait.summary}\n\n"
|
217 |
-
|
218 |
-
if report.motivation.low_motivation:
|
219 |
-
markdown += "### Low Motivation\n\n"
|
220 |
-
for trait in report.motivation.low_motivation:
|
221 |
-
markdown += f"### {trait.trait} ({trait.level})\n\n{trait.summary}\n\n"
|
222 |
-
|
223 |
-
return markdown
|
224 |
|
225 |
def display_profile_info(profile):
|
226 |
main_profile = profile["main_profile"]
|
|
|
89 |
error_message = f"Error generating or parsing response: {str(e)}"
|
90 |
print(error_message)
|
91 |
return None, error_message
|
92 |
+
|
93 |
+
# Function to render JSON report as markdown
|
94 |
+
def render_report_as_markdown(report):
|
95 |
+
# Access attributes directly from the ReportSchema object
|
96 |
+
markdown = f"## Profile summary\n\n{report.profile_summary}\n\n"
|
97 |
+
|
98 |
+
# Strengths section
|
99 |
+
markdown += "## STRENGTHS\n\n"
|
100 |
+
for strength in report.strengths:
|
101 |
+
markdown += f"### {strength.trait} ({strength.level})\n\n{strength.summary}\n\n"
|
102 |
+
|
103 |
+
# Areas for development section
|
104 |
+
markdown += "## AREAS FOR DEVELOPMENT\n\n"
|
105 |
+
for area in report.areas_for_development:
|
106 |
+
markdown += f"### {area.trait} ({area.level})\n\n{area.summary}\n\n"
|
107 |
+
|
108 |
+
# Risks section (if present)
|
109 |
+
if report.risks:
|
110 |
+
markdown += "## RISKS\n\n"
|
111 |
+
for risk in report.risks:
|
112 |
+
markdown += f"### {risk.trait} ({risk.level})\n\n{risk.summary}\n\n"
|
113 |
+
|
114 |
+
# Trait interactions section
|
115 |
+
markdown += f"## Trait Interactions\n\n{report.trait_interactions}\n\n"
|
116 |
+
|
117 |
+
# Motivation section
|
118 |
+
markdown += "## Motivation\n\n"
|
119 |
+
|
120 |
+
if report.motivation.high_motivation:
|
121 |
+
markdown += "### High Motivation\n\n"
|
122 |
+
for trait in report.motivation.high_motivation:
|
123 |
+
markdown += f"### {trait.trait} ({trait.level})\n\n{trait.summary}\n\n"
|
124 |
+
|
125 |
+
if report.motivation.average_motivation:
|
126 |
+
markdown += "### Average Motivation\n\n"
|
127 |
+
for trait in report.motivation.average_motivation:
|
128 |
+
markdown += f"### {trait.trait} ({trait.level})\n\n{trait.summary}\n\n"
|
129 |
+
|
130 |
+
if report.motivation.low_motivation:
|
131 |
+
markdown += "### Low Motivation\n\n"
|
132 |
+
for trait in report.motivation.low_motivation:
|
133 |
+
markdown += f"### {trait.trait} ({trait.level})\n\n{trait.summary}\n\n"
|
134 |
+
|
135 |
+
return markdown
|
136 |
|
137 |
def classify_traits(profile):
|
138 |
main_profile = profile['main_profile']
|
|
|
222 |
|
223 |
return message
|
224 |
|
225 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
def display_profile_info(profile):
|
228 |
main_profile = profile["main_profile"]
|