@twick/studio 0.15.23 → 0.15.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4908,141 +4908,13 @@ function CaptionsPanelContainer() {
4908
4908
  const captionsPanelProps = useCaptionsPanel();
4909
4909
  return /* @__PURE__ */ jsx(CaptionsPanel, { ...captionsPanelProps });
4910
4910
  }
4911
- const FAL_IMAGE_ENDPOINTS = [
4912
- {
4913
- provider: "fal",
4914
- endpointId: "fal-ai/flux-pro/kontext",
4915
- label: "FLUX.1 Kontext [pro]",
4916
- description: "Professional image generation with context-aware editing",
4917
- popularity: 5,
4918
- category: "image",
4919
- inputAsset: ["image"],
4920
- availableDimensions: [
4921
- { width: 1024, height: 1024, label: "1024x1024 (1:1)" },
4922
- { width: 1024, height: 576, label: "1024x576 (16:9)" },
4923
- { width: 576, height: 1024, label: "576x1024 (9:16)" }
4924
- ]
4925
- },
4926
- {
4927
- provider: "fal",
4928
- endpointId: "fal-ai/flux/dev",
4929
- label: "FLUX.1 [dev]",
4930
- description: "High-quality image generation",
4931
- popularity: 5,
4932
- category: "image",
4933
- minSteps: 1,
4934
- maxSteps: 50,
4935
- defaultSteps: 28,
4936
- minGuidanceScale: 1,
4937
- maxGuidanceScale: 20,
4938
- defaultGuidanceScale: 3.5,
4939
- hasSeed: true
4940
- },
4941
- {
4942
- provider: "fal",
4943
- endpointId: "fal-ai/flux/schnell",
4944
- label: "FLUX.1 [schnell]",
4945
- description: "Ultra-fast image generation",
4946
- popularity: 4,
4947
- category: "image",
4948
- defaultSteps: 4,
4949
- availableDimensions: [
4950
- { width: 1024, height: 1024, label: "1024x1024 (1:1)" },
4951
- { width: 1024, height: 576, label: "1024x576 (16:9)" },
4952
- { width: 576, height: 1024, label: "576x1024 (9:16)" }
4953
- ]
4954
- },
4955
- {
4956
- provider: "fal",
4957
- endpointId: "fal-ai/gemini-25-flash-image",
4958
- label: "Gemini 2.5 Flash Image",
4959
- description: "Rapid text-to-image generation",
4960
- popularity: 5,
4961
- category: "image",
4962
- availableDimensions: [
4963
- { width: 1024, height: 1024, label: "1024x1024 (1:1)" },
4964
- { width: 1024, height: 768, label: "1024x768 (4:3)" },
4965
- { width: 768, height: 1024, label: "768x1024 (3:4)" },
4966
- { width: 1024, height: 576, label: "1024x576 (16:9)" },
4967
- { width: 576, height: 1024, label: "576x1024 (9:16)" }
4968
- ]
4969
- },
4970
- {
4971
- provider: "fal",
4972
- endpointId: "fal-ai/ideogram/v3",
4973
- label: "Ideogram V3",
4974
- description: "Advanced text-to-image with superior text rendering",
4975
- popularity: 5,
4976
- category: "image",
4977
- hasSeed: true,
4978
- hasNegativePrompt: true
4979
- }
4980
- ];
4981
- const FAL_VIDEO_ENDPOINTS = [
4982
- {
4983
- provider: "fal",
4984
- endpointId: "fal-ai/veo3",
4985
- label: "Veo 3",
4986
- description: "Google Veo 3 text-to-video",
4987
- popularity: 5,
4988
- category: "video",
4989
- availableDurations: [4, 6, 8],
4990
- defaultDuration: 8,
4991
- availableDimensions: [
4992
- { width: 576, height: 1024, label: "576x1024 (9:16)" },
4993
- { width: 1024, height: 576, label: "1024x576 (16:9)" },
4994
- { width: 1024, height: 1024, label: "1024x1024 (1:1)" }
4995
- ]
4996
- },
4997
- {
4998
- provider: "fal",
4999
- endpointId: "fal-ai/veo3/fast",
5000
- label: "Veo 3 Fast",
5001
- description: "Accelerated Veo 3 text-to-video",
5002
- popularity: 5,
5003
- category: "video",
5004
- availableDurations: [4, 6, 8],
5005
- defaultDuration: 8,
5006
- availableDimensions: [
5007
- { width: 576, height: 1024, label: "576x1024 (9:16)" },
5008
- { width: 1024, height: 576, label: "1024x576 (16:9)" },
5009
- { width: 1024, height: 1024, label: "1024x1024 (1:1)" }
5010
- ]
5011
- },
5012
- {
5013
- provider: "fal",
5014
- endpointId: "fal-ai/veo3/image-to-video",
5015
- label: "Veo 3 Image-to-Video",
5016
- description: "Animate images with Veo 3",
5017
- popularity: 5,
5018
- category: "video",
5019
- inputAsset: ["image"],
5020
- availableDurations: [8],
5021
- defaultDuration: 8
5022
- },
5023
- {
5024
- provider: "fal",
5025
- endpointId: "fal-ai/kling-video/v2.5-turbo/pro/text-to-video",
5026
- label: "Kling 2.5 Turbo Pro",
5027
- description: "Text-to-video with fluid motion",
5028
- popularity: 5,
5029
- category: "video",
5030
- availableDurations: [5, 10],
5031
- defaultDuration: 5,
5032
- availableDimensions: [
5033
- { width: 1024, height: 576, label: "1024x576 (16:9)" },
5034
- { width: 576, height: 1024, label: "576x1024 (9:16)" },
5035
- { width: 1024, height: 1024, label: "1024x1024 (1:1)" }
5036
- ]
5037
- }
5038
- ];
5039
4911
  const DEFAULT_IMAGE_DURATION = 5;
5040
4912
  function GenerateMediaPanelContainer({
5041
4913
  videoResolution,
5042
4914
  addElement,
5043
4915
  studioConfig
5044
4916
  }) {
5045
- var _a;
4917
+ var _a, _b, _c;
5046
4918
  const { getCurrentTime } = useLivePlayerContext();
5047
4919
  const [tab, setTab] = useState("image");
5048
4920
  const [prompt2, setPrompt] = useState("");
@@ -5053,8 +4925,12 @@ function GenerateMediaPanelContainer({
5053
4925
  const imageService = studioConfig == null ? void 0 : studioConfig.imageGenerationService;
5054
4926
  const videoService = studioConfig == null ? void 0 : studioConfig.videoGenerationService;
5055
4927
  const hasAnyService = !!imageService || !!videoService;
5056
- const endpoints = tab === "image" ? FAL_IMAGE_ENDPOINTS : FAL_VIDEO_ENDPOINTS;
5057
- const defaultEndpointId = ((_a = endpoints[0]) == null ? void 0 : _a.endpointId) ?? "";
4928
+ const imageModels = ((_a = imageService == null ? void 0 : imageService.getAvailableModels) == null ? void 0 : _a.call(imageService)) ?? [];
4929
+ const videoModels = ((_b = videoService == null ? void 0 : videoService.getAvailableModels) == null ? void 0 : _b.call(videoService)) ?? [];
4930
+ const endpoints = tab === "image" ? imageModels : videoModels;
4931
+ const defaultEndpointId = ((_c = endpoints[0]) == null ? void 0 : _c.endpointId) ?? "";
4932
+ const selectedEndpoint = endpoints.find((endpoint) => endpoint.endpointId === selectedEndpointId) ?? endpoints[0];
4933
+ const selectedProvider = selectedEndpoint == null ? void 0 : selectedEndpoint.provider;
5058
4934
  useEffect(() => {
5059
4935
  if (!selectedEndpointId && defaultEndpointId) {
5060
4936
  setSelectedEndpointId(defaultEndpointId);
@@ -5116,9 +4992,16 @@ function GenerateMediaPanelContainer({
5116
4992
  setStatus("Starting...");
5117
4993
  try {
5118
4994
  const endpointId = selectedEndpointId || defaultEndpointId;
4995
+ const provider = selectedProvider;
4996
+ if (!endpointId || !provider) {
4997
+ setError("No model is configured for this tab");
4998
+ setIsGenerating(false);
4999
+ setStatus(null);
5000
+ return;
5001
+ }
5119
5002
  if (tab === "image" && imageService) {
5120
5003
  const requestId = await imageService.generateImage({
5121
- provider: "fal",
5004
+ provider,
5122
5005
  endpointId,
5123
5006
  prompt: prompt2.trim()
5124
5007
  });
@@ -5128,7 +5011,7 @@ function GenerateMediaPanelContainer({
5128
5011
  }
5129
5012
  } else if (tab === "video" && videoService) {
5130
5013
  const requestId = await videoService.generateVideo({
5131
- provider: "fal",
5014
+ provider,
5132
5015
  endpointId,
5133
5016
  prompt: prompt2.trim()
5134
5017
  });
@@ -5150,7 +5033,8 @@ function GenerateMediaPanelContainer({
5150
5033
  defaultEndpointId,
5151
5034
  imageService,
5152
5035
  videoService,
5153
- pollStatus
5036
+ pollStatus,
5037
+ selectedProvider
5154
5038
  ]);
5155
5039
  if (!hasAnyService) {
5156
5040
  return /* @__PURE__ */ jsx("div", { className: "panel-container", children: /* @__PURE__ */ jsx("p", { className: "empty-state-text", children: "Image and video generation require configuration. Add imageGenerationService and videoGenerationService to StudioConfig." }) });