yao/agent/robot/executor/standard/learning.go
Max 28d5730289 Add Description Field to Task Struct and Enhance Execution Management
- Introduced a new `Description` field in the `Task` struct for a human-readable task description, improving UI clarity.
- Updated the `ParseTask` function to save the description from input data and convert it to a message if no explicit messages are provided.
- Enhanced the `Executor` to update UI fields with localized messages during task execution phases, ensuring better user feedback.
- Implemented a new method in the `ExecutionStore` to persist task status updates, allowing real-time UI updates.
- Added unit tests to validate the new task description handling and UI updates during execution phases.
2026-01-24 12:16:02 +08:00

39 lines
1,004 B
Go

package standard
import (
robottypes "github.com/yaoapp/yao/agent/robot/types"
)
// RunLearning executes P5: Learning phase
// Extracts learnings and saves to knowledge base
//
// Input:
// - Execution summary (all phases)
//
// Output:
// - LearningEntry list with extracted knowledge
//
// Learning Types:
// - LearnExecution: Execution patterns
// - LearnTask: Task-specific insights
// - LearnError: Error patterns for improvement
//
// TODO: Implement real learning extraction
func (e *Executor) RunLearning(ctx *robottypes.Context, exec *robottypes.Execution, _ interface{}) error {
// Get robot for locale
robot := exec.GetRobot()
// Update UI field with i18n
locale := getEffectiveLocale(robot, exec.Input)
e.updateUIFields(ctx, exec, "", getLocalizedMessage(locale, "learning_from_exec"))
e.simulateStreamDelay()
exec.Learning = []robottypes.LearningEntry{
{
Type: robottypes.LearnExecution,
Content: "Completed daily tasks successfully",
},
}
return nil
}