Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): preview generated images in right panel #6029

Closedkyzer1023(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/6029/headopened View on GitHub

Showing 31 changed files with 147 additions and 1 deletion (loading 28).

x
0 of 31 viewed, 31 left
61 additions and 1 deletionapps/server/src/assets/AssetAccess.test.tsModified
View file
@@ -1,5 +1,5 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
-import { AssetPreviewTypeValidationError, ThreadId } from "@t3tools/contracts";
+import { AssetPreviewTypeValidationError, EventId, ThreadId } from "@t3tools/contracts";
import { PROJECT_FAVICON_FALLBACK_MARKER } from "@t3tools/shared/projectFavicon";
import { describe, expect, it } from "@effect/vitest";
import * as Crypto from "effect/Crypto";
@@ -208,6 +208,66 @@
}).pipe(Effect.provide(testLayer)),
​
+ it.effect("issues exact capabilities for provider-generated images", () =>
+ Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const root = yield* fileSystem.makeTempDirectoryScoped({
+ prefix: "t3-asset-generated-image-",
+ });
+ const imagePath = path.join(root, "generated.png");
+ const siblingPath = path.join(root, "other.png");
+ yield* fileSystem.writeFile(imagePath, new Uint8Array([137, 80, 78, 71]));
+ yield* fileSystem.writeFile(siblingPath, new Uint8Array([137, 80, 78, 71]));
+ const canonicalImagePath = yield* fileSystem.realPath(imagePath);
+ const resource = {
+ _tag: "generated-image" as const,
+ threadId: ThreadId.make("thread-1"),
+ activityId: EventId.make("activity-1"),
+ };
+​
+ const result = yield* issueAssetUrl({ resource, generatedImagePath: imagePath });