Files
weichen d6f5e0e28a feat(projectcontext): bizdev 注入项目对话并完成 PG 治理 E2E
新增 ctxmgr 项目对话采集并接入 PM/TE BuildSnapshot;PG 测试统一 TEST_DATABASE_URL 并使用三正式工作流 key。
2026-09-13 02:50:23 +00:00

40 lines
1.0 KiB
Go

package bizdev
import (
"context"
"fmt"
"chat-agent-system/internal/ctxmgr"
)
type snapshotDialogueInputs struct {
Dialogue []string
Decisions []string
ExcludedPrivate int
ExcludedNoAccess int
}
func (s *Service) collectSnapshotDialogueInputs(ctx context.Context, projectID, userID int64) snapshotDialogueInputs {
out := snapshotDialogueInputs{}
if s == nil || projectID <= 0 || s.ctxMgr == nil {
return out
}
if coll, err := s.getProjectContextForUser(ctx, projectID, userID); err == nil && coll != nil {
for _, d := range coll.MilestoneDecisions {
out.Decisions = append(out.Decisions, fmt.Sprintf("[%s] %s (%s)", d.ActivityType, d.Title, d.UserName))
}
}
dialogue, err := s.ctxMgr.CollectProjectDialogue(ctx, projectID, ctxmgr.CollectProjectDialogueOptions{
Limit: 120,
})
if err != nil || dialogue == nil {
return out
}
out.Dialogue = dialogue.Lines
out.ExcludedPrivate = dialogue.ExcludedPrivate
out.ExcludedNoAccess = dialogue.ExcludedNoAccess
return out
}