docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// AI 运行详情、事件增量和准入回执查询;所有结果读取都重新检查当前资源权限。
|
||||
package platform
|
||||
|
||||
import (
|
||||
@@ -7,6 +8,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// publicAIPlan 只公开计划结构、依赖及来源身份,静态输入标记 frozen_snapshot,不暴露冻结正文/图片。
|
||||
func publicAIPlan(plan canvasAIPlan) response {
|
||||
steps := []any{}
|
||||
for _, step := range plan.Steps {
|
||||
@@ -18,6 +20,8 @@ func publicAIPlan(plan canvasAIPlan) response {
|
||||
}
|
||||
return response{"steps": steps, "edges": plan.Edges, "frozen_versions": plan.Versions}
|
||||
}
|
||||
|
||||
// getCanvasAIRun 按 after_seq 增量返回事件,查询步骤前按 canonical 稳定身份解析当前目标并检查权限。
|
||||
func (s *service) getCanvasAIRun(w http.ResponseWriter, r *http.Request, project, account string) error {
|
||||
if r.Method != http.MethodGet {
|
||||
reject(w, 405, "method_not_allowed")
|
||||
@@ -66,6 +70,7 @@ func (s *service) getCanvasAIRun(w http.ResponseWriter, r *http.Request, project
|
||||
if err = json.Unmarshal(rawPlan, &plan); err != nil {
|
||||
return err
|
||||
}
|
||||
// 目标可能已换 owner;解析失败退回计划来源做路由授权,避免查询绕过撤权或归档约束。
|
||||
checked := map[string]bool{board: true}
|
||||
for _, step := range plan.Steps {
|
||||
target, ok, e := resolveCanvasAITarget(r.Context(), tx, project, workspace, step)
|
||||
@@ -82,6 +87,7 @@ func (s *service) getCanvasAIRun(w http.ResponseWriter, r *http.Request, project
|
||||
checked[target] = true
|
||||
}
|
||||
}
|
||||
// 步骤输出剔除 text,仅返回元信息和可应用版本;AppliedBoard 反映实际写回位置而非原计划位置。
|
||||
rows, err := tx.QueryContext(r.Context(), `SELECT id,COALESCE(applied_board_id,board_id)::text,node_id,status,error_code,applied_version,CASE WHEN output IS NULL THEN NULL ELSE output-'text' END FROM canvas_ai_steps WHERE project=$1 AND workspace_id=$2 AND run_id=$3 ORDER BY ordinal`, project, workspace, id)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -134,6 +140,7 @@ func (s *service) getCanvasAIRun(w http.ResponseWriter, r *http.Request, project
|
||||
rows.Close()
|
||||
return err
|
||||
}
|
||||
// 事件页既限条数又限累计 data 字节;至少保留首事件,next_seq 仅推进到真正返回的最后事件。
|
||||
if size+len(data) > 800<<10 && len(events) > 0 {
|
||||
break
|
||||
}
|
||||
@@ -168,6 +175,8 @@ func (s *service) getCanvasAIRun(w http.ResponseWriter, r *http.Request, project
|
||||
|
||||
// Resolve admission by the original client key, before the caller knows a run ID.
|
||||
// Absence is unknown, not a terminal proof that an earlier invocation had no effect.
|
||||
// getCanvasAIAdmission 用原客户端键恢复准入结果,先查 v2 请求表,再兼容旧 run 的 create_response。
|
||||
// 没有记录只说明 unknown,不构成确定零效果证明,客户端应保留原键继续恢复。
|
||||
func (s *service) getCanvasAIAdmission(w http.ResponseWriter, r *http.Request, project, account string) error {
|
||||
if r.Method != http.MethodGet {
|
||||
reject(w, 405, "method_not_allowed")
|
||||
|
||||
Reference in New Issue
Block a user