From 429179e472916b8eaaec654f120118280fcf6161 Mon Sep 17 00:00:00 2001 From: WeiCHEN Date: Tue, 8 Sep 2026 13:20:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(bizdev):=20=E8=B4=AF=E9=80=9A=E8=B7=A8?= =?UTF-8?q?=E9=98=B6=E6=AE=B5=E4=BA=8B=E5=AE=9E=E9=BB=91=E6=9D=BF=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E4=BC=A0=E6=89=BF=E4=B8=8E=E9=87=8C=E7=A8=8B=E7=A2=91?= =?UTF-8?q?=E5=86=B3=E7=AD=96=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- internal/bizdev/service.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/internal/bizdev/service.go b/internal/bizdev/service.go index d6ab95d8..00335afa 100644 --- a/internal/bizdev/service.go +++ b/internal/bizdev/service.go @@ -385,6 +385,16 @@ func (s *Service) executeStageInternal(ctx context.Context, req StageRunRequest) // 3. 汇总当前阶段累积的事实与前序文档 currentFields := make(map[string]string) + + // 若存在项目协同管理器,优先载入已沉淀的项目事实与黑板 + if s.ctxMgr != nil && req.ProjectID > 0 { + if projCtx, err := s.ctxMgr.GetProjectContext(ctx, req.ProjectID); err == nil && projCtx != nil { + for k, v := range projCtx.BlackboardFacts { + currentFields[k] = v + } + } + } + if req.Fields != nil { for k, v := range req.Fields { currentFields[k] = v @@ -531,6 +541,33 @@ func (s *Service) executeStageInternal(ctx context.Context, req StageRunRequest) } } + // 将本阶段累积沉淀的事实回填到 ContextManager,供下一阶段或后续对话读取 + if s.ctxMgr != nil && req.ProjectID > 0 { + _ = s.ctxMgr.UpdateProjectBlackboard(ctx, req.ProjectID, currentFields) + _ = s.ctxMgr.UpdateProjectStage(ctx, req.ProjectID, string(req.Stage)) + authorName := req.AuthorName + if authorName == "" { + authorName = "系统协调员" + } + _, _ = s.ctxMgr.RecordActivity( + ctx, + req.ProjectID, + req.UserID, + authorName, + "stage_advance", + fmt.Sprintf("阶段跃迁至【%s】", targetMeta.Title), + map[string]any{ + "stage": string(req.Stage), + "duration_ms": time.Since(start).Milliseconds(), + "artifacts": len(executedArtifacts), + "device_type": req.DeviceType, + "target_market": req.TargetMarket, + }, + 1.0, + true, // 里程碑决策,豁免衰减 + ) + } + if streamer != nil { streamer.EmitPhase("stage_completed", fmt.Sprintf("商务成熟度阶段【%s】全部任务协同推演完成!", req.Stage), "coordinator", len(targetMeta.Tasks), len(targetMeta.Tasks), 100) if stageBrief != nil {