docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// 用户确认应用冲突生成输出:不重新生成,只在当前目标代数、位置和版本均确认后写入已存结果。
|
||||
package platform
|
||||
|
||||
import (
|
||||
@@ -7,6 +8,7 @@ import (
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// applyCanvasAIOutput 要求 conflict、尚未应用且 run 未取消;v2 显式绑定目标画布/incarnation 和逻辑操作身份。
|
||||
func (s *service) applyCanvasAIOutput(w http.ResponseWriter, r *http.Request, project, account string) error {
|
||||
if r.Method != http.MethodPost {
|
||||
reject(w, 405, "method_not_allowed")
|
||||
@@ -96,6 +98,7 @@ func (s *service) applyCanvasAIOutput(w http.ResponseWriter, r *http.Request, pr
|
||||
if err != sql.ErrNoRows {
|
||||
return err
|
||||
}
|
||||
// 输出必须属于该 run 并与请求 node 匹配,不能拿另一输出 ID 或已应用结果重复写入。
|
||||
var stepID, targetBoard, node, status string
|
||||
var outputRaw, frozenRaw json.RawMessage
|
||||
var applied sql.NullInt64
|
||||
@@ -125,6 +128,7 @@ func (s *service) applyCanvasAIOutput(w http.ResponseWriter, r *http.Request, pr
|
||||
if canonical && (frozen.TargetIncarnation != input.TargetIncarnation || frozen.CanonicalRoot == "") {
|
||||
return rejectRequest(409, "target_changed")
|
||||
}
|
||||
// 生成后 owner 可能改变,使用权威身份重新解析;请求确认的 TargetCanvasID 必须仍是当前位置。
|
||||
targetBoard, identityOK, err := resolveCanvasAITarget(r.Context(), tx, project, workspace, frozen)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -149,6 +153,7 @@ func (s *service) applyCanvasAIOutput(w http.ResponseWriter, r *http.Request, pr
|
||||
if snapshot.Version != expected {
|
||||
return rejectRequest(412, "version_conflict")
|
||||
}
|
||||
// 显式应用允许覆盖已编辑的内容,但仍检查输出模态、字节/字符预算及图片当前可读性。
|
||||
patch := response{}
|
||||
switch output.Kind {
|
||||
case "text":
|
||||
@@ -190,6 +195,7 @@ func (s *service) applyCanvasAIOutput(w http.ResponseWriter, r *http.Request, pr
|
||||
if target["kind"] != frozen.Kind {
|
||||
return rejectRequest(409, "ownership_conflict")
|
||||
}
|
||||
// 通过共享窄字段 patch 保存,原几何和未知元数据不被旧输出快照回滚;应用版本与事件/回执同事务提交。
|
||||
change, err := prepareCanvasAIPatch(r, tx, project, workspace, snapshot, node, patch)
|
||||
if err != nil {
|
||||
return rejectRequest(413, "canvas_too_large")
|
||||
|
||||
Reference in New Issue
Block a user