View renders the max iterations confirmation dialog
()
| 84 | |
| 85 | // View renders the max iterations confirmation dialog |
| 86 | func (d *maxIterationsDialog) View() string { |
| 87 | dialogWidth := d.ComputeDialogWidth(maxIterDialogWidthPercent, maxIterDialogMinWidth, maxIterDialogMaxWidth) |
| 88 | contentWidth := dialogWidth - styles.DialogWarningStyle.GetHorizontalFrameSize() |
| 89 | |
| 90 | infoText := fmt.Sprintf("Max Iterations: %d", d.maxIterations) |
| 91 | messageText := "The agent may be stuck in a loop. This can happen with smaller or less capable models." |
| 92 | questionText := "Do you want to continue for 10 more iterations?" |
| 93 | |
| 94 | content := NewContent(contentWidth). |
| 95 | AddTitle("Maximum Iterations Reached"). |
| 96 | AddSeparator(). |
| 97 | AddContent(styles.DialogContentStyle.Render(wrapDisplayText(infoText, contentWidth))). |
| 98 | AddSpace(). |
| 99 | AddContent(styles.DialogContentStyle.Render(wrapDisplayText(messageText, contentWidth))). |
| 100 | AddSpace(). |
| 101 | AddContent(styles.DialogQuestionStyle.Width(contentWidth).Render(wrapDisplayText(questionText, contentWidth))). |
| 102 | AddSpace(). |
| 103 | AddHelpKeys("Y", "yes", "N", "no"). |
| 104 | Build() |
| 105 | |
| 106 | // DialogWarningStyle already includes Padding(1, 2) |
| 107 | return styles.DialogWarningStyle. |
| 108 | Width(dialogWidth). |
| 109 | Render(content) |
| 110 | } |
| 111 | |
| 112 | // wrapDisplayText wraps text based on display cell width. |
| 113 | func wrapDisplayText(text string, maxWidth int) string { |
no test coverage detected