(agent_steps: str, prs: Presentation)
| 18 | |
| 19 | |
| 20 | def rebuild_pptx(agent_steps: str, prs: Presentation): |
| 21 | slides = [] |
| 22 | steps = list(jsonlines.open(agent_steps)) |
| 23 | if len(steps) == 0: |
| 24 | os.remove(agent_steps) |
| 25 | raise ValueError(f"Jump {agent_steps} as no steps") |
| 26 | if steps[-1][0] != HistoryMark.API_CALL_CORRECT: |
| 27 | raise ValueError(f"Jump {agent_steps} as last step is failed") |
| 28 | for mark, slide_idx, actions in steps: |
| 29 | if mark != HistoryMark.API_CALL_CORRECT: |
| 30 | continue |
| 31 | slides.append(deepcopy(prs.slides[slide_idx - 1])) # slide_idx starts from 1 |
| 32 | feedback = code_executor.execute_actions(actions, slides[-1]) |
| 33 | assert feedback is None, feedback |
| 34 | return slides |
| 35 | |
| 36 | |
| 37 | def rebuild_all( |
no test coverage detected