feat(agent): Agent 生成审批 - 支持改模型参数、忽略位置漂移并取消 8 轮硬限制

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ddCatandCursor committed 2026-09-16 22:59:38 +08:00
1 parent f394cd7385
commit fc5548836f
21 files changed
+930 -66

No files matched your search

@@ -38,6 +38,28 @@ func cloudAgentCanvasHash(doc map[string]any) string {
return creationHash(content)
}
// Generation does not depend on node positions. Keep the full canvas hash for
// mutations and undo, which must still detect layout edits before restoring data.
func cloudAgentMediaContentHash(doc map[string]any) string {
content := make(map[string]any, len(doc))
for key, value := range doc {
content[key] = value
}
nodes := creationMaps(doc["nodes"])
projected := make([]map[string]any, 0, len(nodes))
for _, node := range nodes {
item := make(map[string]any, len(node))
for key, value := range node {
if key != "position" {
item[key] = value
}
}
projected = append(projected, item)
}
content["nodes"] = projected
return cloudAgentCanvasHash(content)
}
func cloudAgentCanvasState(repo *repository.Repository, userID string, doc map[string]any, offset int, ids []string, storyboardOffset int) (any, error) {
if offset < 0 || storyboardOffset < 0 || len(ids) > 8 {
return nil, BadAuthRequest("画布读取分页参数无效")
@@ -152,7 +174,7 @@ func cloudAgentCanvasState(repo *repository.Repository, userID string, doc map[s
edges = append(edges, map[string]any{"id": edge["id"], "fromNodeId": edge["fromNodeId"], "toNodeId": edge["toNodeId"]})
}
}
return map[string]any{"snapshotHash": cloudAgentCanvasHash(doc), "nodes": nodes, "connections": edges, "totalNodes": len(all), "nextOffset": next, "hasMore": next > 0}, nil
return map[string]any{"snapshotHash": cloudAgentCanvasHash(doc), "mediaSnapshotHash": cloudAgentMediaContentHash(doc), "nodes": nodes, "connections": edges, "totalNodes": len(all), "nextOffset": next, "hasMore": next > 0}, nil
}
func cloudAgentSafeNumber(value any) (any, bool) {