mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 08:46:58 +08:00
Improve NOFXi agent strategy creation flow
This commit is contained in:
@@ -1893,6 +1893,7 @@ func (a *Agent) toolManageStrategy(storeUserID, argsJSON string) string {
|
||||
IsPublic *bool `json:"is_public"`
|
||||
ConfigVisible *bool `json:"config_visible"`
|
||||
AllowClamped bool `json:"allow_clamped_update"`
|
||||
Confirmed bool `json:"confirmed"`
|
||||
Config map[string]any `json:"config"`
|
||||
}
|
||||
if err := json.Unmarshal([]byte(argsJSON), &args); err != nil {
|
||||
@@ -1919,6 +1920,9 @@ func (a *Agent) toolManageStrategy(storeUserID, argsJSON string) string {
|
||||
if name == "" {
|
||||
return `{"error":"name is required for create"}`
|
||||
}
|
||||
if !args.Confirmed {
|
||||
return `{"error":"strategy create requires explicit chat confirmation before execution. Present the strategy config summary to the user and ask them to reply 确认创建; do not claim the strategy was created.","requires_confirmation":true}`
|
||||
}
|
||||
if lockedField, ok := strategyConfigContainsLockedField(args.Config); ok {
|
||||
return fmt.Sprintf(`{"error":"%s"}`, strategyLockedFieldError("zh", lockedField))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user