Browse Source

fix

feature/add_provider_popi
weige 1 month ago
parent
commit
cbaad623f0
  1. 2
      src/app/api/popi/asset/create/route.ts
  2. 2
      src/store/execution/simpleNodeExecutors.ts

2
src/app/api/popi/asset/create/route.ts

@ -5,6 +5,7 @@ import { ApiError } from "@/app/api/_errors";
const POPI_MEDIA_UPLOAD_BASE64_PATH = "/api_client/media/uploadFileBase64";
const POPI_MEDIA_UPLOAD_PATH = "/api_client/media/upload";
const POPI_ASSET_CREATE_PATH = "/api_client/anime/asset/create";
const POPI_ASSET_ORIGIN_CANVAS = "canvas";
type PopiserverResponse<T> = {
status?: string;
@ -145,6 +146,7 @@ async function createPopiserverAsset(
description: string
) {
const asset = await postPopiJson<PopiAsset>(request, token, POPI_ASSET_CREATE_PATH, {
origin: POPI_ASSET_ORIGIN_CANVAS,
type: type === "video" ? 2 : type === "audio" ? 3 : 1,
title,
description,

2
src/store/execution/simpleNodeExecutors.ts

@ -25,6 +25,7 @@ import { isPopiProviderMode } from "@/lib/providerMode";
const popiserverOutputAssetCache = new Map<string, Promise<string | null | undefined>>();
const USER_SESSION_STORAGE_KEY = "node-banana-user-session";
const POPISERVER_CANVAS_ORIGIN = "canvas";
function isPopiserverMediaUrl(value: string): boolean {
if (value.startsWith("/media/") || value.startsWith("/media_private/")) return true;
@ -129,6 +130,7 @@ async function createPopiserverAssetForOutput(
const extension = extensionForMimeType(mimeType, kind);
const formData = new FormData();
formData.append("type", kind);
formData.append("origin", POPISERVER_CANVAS_ORIGIN);
formData.append("title", title || "");
formData.append("file", blob, `canvas-output-${Date.now()}.${extension}`);

Loading…
Cancel
Save