feat: implement UI automation test history isolation

- Add ResetHistory option to PlanningOptions and ActionOptions
- Implement task completion detection with isTaskFinished() method
- Add executeActions() method to separate action execution logic
- Modify ConversationHistory.Clear() to completely clear all messages including system message
- Refactor StartToGoal() to automatically reset history on first attempt
- Add WithResetHistory() option function for consistent API
- Consolidate test files into driver_ext_ai_test.go with comprehensive test coverage
This commit is contained in:
lilong.129
2025-06-06 15:29:42 +08:00
parent 6e1bd5bbe2
commit b642ea004e
6 changed files with 306 additions and 48 deletions
+9 -4
View File
@@ -62,10 +62,15 @@ func (h *ConversationHistory) Append(msg *schema.Message) {
}
func (h *ConversationHistory) Clear() {
// Keep only the system message
systemMsg := (*h)[0]
*h = ConversationHistory{systemMsg}
log.Info().Msg("conversation history cleared")
// Check if history is empty
if len(*h) == 0 {
log.Info().Msg("conversation history is already empty")
return
}
// Clear everything including system message
*h = ConversationHistory{}
log.Info().Msg("conversation history cleared completely")
}
func logRequest(messages ConversationHistory) {