Skip to content

Commit 25a466a

Browse files
committed
fix optional access info
1 parent 23ccf1a commit 25a466a

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/agents/utils/parse_json_to_prompt.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,24 +191,43 @@ def format_part_details(part: PartDetails, currentPart: Optional[CurrentPart], s
191191
]
192192
) if part.publishedWorkedSolutionSections else f"No worked solutions for part ({convert_index_to_lowercase_letter(part.publishedPartPosition)});"
193193
)
194-
return f"""
194+
if currentPart:
195+
return f"""
195196
# {'[CURRENTLY WORKING ON] ' if currentPart.id == part.publishedPartId else ''}Part ({convert_index_to_lowercase_letter(part.publishedPartPosition)}):
196197
{f"Time spent on this part: {currentPart.timeTakenPart if currentPart.timeTakenPart is not None else 'No recorded duration'}" if currentPart.id == part.publishedPartId else ''}
197198
Part Content: {part.publishedPartContent.strip() if part.publishedPartContent else 'No content'};
198199
{responseAreas}
199200
{f'Final Part Answer: {part.publishedPartAnswerContent}' if part.publishedPartAnswerContent else 'No direct answer for this part.'}
200201
{workedSolutions}
201-
"""
202-
203-
questionDetails = f"""This is the question I am currently working on. I am currently working on Part ({convert_index_to_lowercase_letter(questionAccessInformation.currentPart.position)}). Below, you'll find its details, including the parts of the question, my responses for each response area, and the feedback I received. This information highlights my efforts and progress so far. Use this this information to inform your understanding about the question materials provided to me and my work on them.
202+
"""
203+
else:
204+
return f"""
205+
# Part ({convert_index_to_lowercase_letter(part.publishedPartPosition)}):
206+
Part Content: {part.publishedPartContent.strip() if part.publishedPartContent else 'No content'};
207+
{responseAreas}
208+
{f'Final Part Answer: {part.publishedPartAnswerContent}' if part.publishedPartAnswerContent else 'No direct answer for this part.'}
209+
{workedSolutions}
210+
"""
211+
212+
if not questionSubmissionSummary:
213+
questionDetails = f"""This is the question I am currently working on. Below, you'll find its details, including the parts of the question, my responses for each response area, and the feedback I received. This information highlights my efforts and progress so far. Use this this information to inform your understanding about the question materials provided to me and my work on them.
204214
Maths equations are in KaTex format, preserve them the same. Use British English spellings.
205215
{f'# Question Set {questionInformation.setNumber + 1}: {questionInformation.setName};' if ((questionInformation.setName is not None) and (questionInformation.setNumber is not None)) else ''}
206216
# Question {f' {questionInformation.setNumber + 1}.{questionInformation.questionNumber + 1}' if ((questionInformation.setNumber is not None) and (questionInformation.questionNumber is not None)) else ''}: {questionInformation.questionTitle};
207217
Guidance to Solve the Question: {questionInformation.questionGuidance or 'None'};
208218
Description of Question: {questionInformation.questionContent};
209219
Expected Time to Complete the Question: {f'{questionInformation.durationLowerBound} - {questionInformation.durationUpperBound} min;' if questionInformation.durationLowerBound and questionInformation.durationUpperBound else 'No specified duration.'}
210-
Time Spent on the Question today: {questionAccessInformation.timeTaken or 'No recorded duration'} {f'which is {questionAccessInformation.accessStatus}' if questionAccessInformation.accessStatus else ''} {f'{questionAccessInformation.markedDone}' if questionAccessInformation.markedDone else ''};
211220
"""
221+
else:
222+
questionDetails = f"""This is the question I am currently working on. I am currently working on Part ({convert_index_to_lowercase_letter(questionAccessInformation.currentPart.position)}). Below, you'll find its details, including the parts of the question, my responses for each response area, and the feedback I received. This information highlights my efforts and progress so far. Use this this information to inform your understanding about the question materials provided to me and my work on them.
223+
Maths equations are in KaTex format, preserve them the same. Use British English spellings.
224+
{f'# Question Set {questionInformation.setNumber + 1}: {questionInformation.setName};' if ((questionInformation.setName is not None) and (questionInformation.setNumber is not None)) else ''}
225+
# Question {f' {questionInformation.setNumber + 1}.{questionInformation.questionNumber + 1}' if ((questionInformation.setNumber is not None) and (questionInformation.questionNumber is not None)) else ''}: {questionInformation.questionTitle};
226+
Guidance to Solve the Question: {questionInformation.questionGuidance or 'None'};
227+
Description of Question: {questionInformation.questionContent};
228+
Expected Time to Complete the Question: {f'{questionInformation.durationLowerBound} - {questionInformation.durationUpperBound} min;' if questionInformation.durationLowerBound and questionInformation.durationUpperBound else 'No specified duration.'}
229+
Time Spent on the Question today: {questionAccessInformation.timeTaken or 'No recorded duration'} {f'which is {questionAccessInformation.accessStatus}' if questionAccessInformation.accessStatus else ''} {f'{questionAccessInformation.markedDone}' if questionAccessInformation.markedDone else ''};
230+
"""
212231

213232
partsDetails = "\n".join(
214233
[

0 commit comments

Comments
 (0)