fix(backend): Agent 任务 - 限制循环读取并收紧提交后的取消边界
This commit is contained in:
1 parent
bc0d109428
commit
a218996e23
16 files changed
+778
-46
No files matched your search
@@ -324,7 +324,27 @@ func cloudAgentApprovalNodeTitle(node map[string]any, typeLabel string) string {
|
||||
}
|
||||
|
||||
func cloudAgentApprovalCallHash(call cloudAgentCall) string {
|
||||
raw, _ := json.Marshal(call)
|
||||
// Tool-call IDs are transport metadata and may be regenerated when the
|
||||
// model retries the same approved operation. Hash only the operation
|
||||
// payload so approval survives a retry with a different call ID. A media
|
||||
// snapshot hash is also a concurrency hint, not generation input: the
|
||||
// server revalidates the prepared dependency hash below, which deliberately
|
||||
// ignores layout-only edits such as moving a node.
|
||||
arguments := call.Function.Arguments
|
||||
if call.Function.Name == "generate_media" {
|
||||
var object map[string]any
|
||||
if err := json.Unmarshal([]byte(arguments), &object); err == nil {
|
||||
delete(object, "snapshotHash")
|
||||
if raw, err := json.Marshal(object); err == nil {
|
||||
arguments = string(raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
payload := struct {
|
||||
Name string `json:"name"`
|
||||
Arguments string `json:"arguments"`
|
||||
}{Name: call.Function.Name, Arguments: arguments}
|
||||
raw, _ := json.Marshal(payload)
|
||||
sum := sha256.Sum256(raw)
|
||||
return hex.EncodeToString(sum[:])
|
||||
}
|
||||
Reference in new issue
Block a user