| 152 | } |
| 153 | |
| 154 | func redrawTerminal(messages []st.ConversationMessage, thinking bool) { |
| 155 | fmt.Print("\033[2J\033[H") // Clear screen and move cursor to home |
| 156 | |
| 157 | // Show conversation history |
| 158 | for _, msg := range messages { |
| 159 | if msg.Role == st.ConversationRoleUser { |
| 160 | fmt.Printf("> %s\n", msg.Message) |
| 161 | } else { |
| 162 | fmt.Printf("%s\n", msg.Message) |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | if thinking { |
| 167 | fmt.Print("Thinking... ") |
| 168 | } else { |
| 169 | fmt.Print("> ") |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | func cleanTerminalInput(input string) string { |
| 174 | // Strip ANSI escape sequences |