chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"academy/internal/application/attachment"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAttachmentSandboxProjectionWritesUnchangedFilesOnce(t *testing.T) {
|
||||
store := &stagingSandboxManager{}
|
||||
doc := &types.TemporaryDocument{ID: "doc", FileType: "pdf", Content: "# Report\n"}
|
||||
projection := &attachmentSandboxProjection{
|
||||
store: store, sessionID: "session",
|
||||
originals: map[string]string{types.AttachmentPath(doc.ID): "inputs/report.pdf"},
|
||||
}
|
||||
ctx := context.Background()
|
||||
description := &attachment.Description{Text: "chart", Detail: "brief", Model: "vision", CreatedAt: time.Now()}
|
||||
for range 3 {
|
||||
_, err := projection.Document(ctx, doc)
|
||||
require.NoError(t, err)
|
||||
_, err = projection.Image(ctx, doc, 1, []byte("png"), "image/png", "key", description)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
require.Len(t, store.writes, 3)
|
||||
|
||||
doc.Content = "# Report v2\n"
|
||||
_, err := projection.Document(ctx, doc)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, store.writes, 4)
|
||||
require.Equal(t, "# Report v2\n", string(store.files["inputs/report.pdf"+parsedSidecarSuffix]))
|
||||
}
|
||||
Reference in new issue
Block a user