fix(report): 报告源/产物落 MinIO,去掉 gateway↔mcp-go 本地盘耦合
多机/容器化第一时间断裂的隐患(ARCHITECTURE_REVIEW §7 #1):此前报告 源(reportStore)与 .docx 产物(reportExport/reportRender)都写 mcp-go 本地 SUNDYNIX_REPORTS_DIR,gateway 再按同一路径 c.File 回流——mcp-go 与 gateway 不共享磁盘即断。 - blob 包从 gateway/internal 提到 sundynix-shared/blob,gateway 与 mcp-go 共用同一 MinIO;新增 PutBytes/GetBytes 走二进制(.docx)。 - mcp-go 注入 blob:report 源/产物优先 Put 到对象存储(键 reports/<id>.{json,docx}), 导出结果返回 minio://<key>;MinIO 未就绪回退本地盘(单机降级,getSource 兼容旧本地报告)。 - gateway ExportReport 识别 minio:// → GetBytes 流式下载,否则 c.File 本地降级。 - 测试:mcp 本地回落往返单测 + shared/blob 真 MinIO 二进制往返(BLOB_TEST_ENDPOINT 门控)。 四模块 build 绿,受影响测试全过。 - 附带:go mod tidy 引入 genproto 拆包冲突,四模块统一钉单体 genproto 新版解决 (注:勿 go work sync,会剪掉 indirect require 回落旧版重现冲突)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/sundynix/sundynix-shared/blob"
|
||||
sharedbus "github.com/sundynix/sundynix-shared/bus"
|
||||
"github.com/sundynix/sundynix-shared/contract"
|
||||
|
||||
@@ -57,6 +58,15 @@ func main() {
|
||||
defer b.Close()
|
||||
log.Printf("[mcp_go] connected %s", natsURL)
|
||||
|
||||
// 报告源/产物落对象存储(与 gateway 同一 MinIO/bucket),跨进程/多机共享,
|
||||
// 替代此前 SUNDYNIX_REPORTS_DIR 本地盘耦合;连不上则回退本地盘(单机降级)。
|
||||
blobStore := blob.Open(
|
||||
envOr("MINIO_ENDPOINT", "localhost:9000"),
|
||||
envOr("MINIO_ACCESS_KEY", "minioadmin"),
|
||||
envOr("MINIO_SECRET_KEY", "minioadmin"),
|
||||
envOr("MINIO_BUCKET", "sundynix-docs"),
|
||||
)
|
||||
|
||||
mem := memory.Open(pgDSN) // 偏好记忆:sundynix_user_profile(连不上则降级)
|
||||
defer mem.Close()
|
||||
hist := history.Open(redisAddr) // 会话短期历史:Redis(连不上则降级)
|
||||
@@ -102,7 +112,7 @@ func main() {
|
||||
log.Printf("[mcp_go] subscribe prompts: %v", err)
|
||||
}
|
||||
|
||||
gw := mcp.NewGateway(b, mem, hist, ragEngine, pgDSN)
|
||||
gw := mcp.NewGateway(b, mem, hist, ragEngine, blobStore, pgDSN)
|
||||
|
||||
log.Println("[mcp_go] serving MCP over sundynix.tools.go.* (Ctrl-C to quit)")
|
||||
if err := gw.Serve(ctx); err != nil && err != context.Canceled {
|
||||
|
||||
Reference in New Issue
Block a user