@@ -14,7 +14,7 @@ import {
1414import { COL_SCROLL_STYLE , PRO_FORM_PROPS } from "@/constant" ;
1515import { handelResponseError , safeJsonStringify } from "@/app/utils" ;
1616import { CodeModal , renderCode , RenderSubmitter } from "@/app/render" ;
17- import { api2Provider , useAppConfig } from "@/app/store" ;
17+ import { useAppConfig } from "@/app/store" ;
1818import { Col , Divider , Empty , Image , Segmented , Spin } from "antd" ;
1919import { AccountType , LumaApi , LumaExtendTaskRequest , LumaGenerationTaskRequest } from "@/app/client/Luma" ;
2020import { ExpandAltOutlined , FileTextOutlined , UnorderedListOutlined } from "@ant-design/icons" ;
@@ -155,61 +155,15 @@ const LumaGenerateForm = (props: {
155155 label = { "Image URL" }
156156 tooltip = { "Start frame picture" }
157157 accept = { "image/*" }
158- max = { 1 }
159- action = { appConfig . getUploadConfig ( ) . action }
160- fieldProps = { {
161- listType : "picture-card" ,
162- headers : {
163- Authorization : appConfig . getUploadConfig ( ) . auth ,
164- } ,
165- onChange : ( info ) => {
166- const getValueByPosition = ( obj : any , position : readonly any [ ] ) => {
167- return position . reduce ( ( acc , key ) => acc && acc [ key ] , obj ) ;
168- } ;
169-
170- if ( info . file . status === "done" ) {
171- try {
172- const response = info . file . response ;
173- if ( response ) {
174- info . file . url = getValueByPosition ( response , appConfig . getUploadConfig ( ) . position ) ;
175- }
176- } catch ( e ) {
177- console . error ( e ) ;
178- }
179- }
180- } ,
181- } }
158+ { ...appConfig . getProFormUploadConfig ( "url" , 1 , "picture-card" ) }
182159 />
183160
184161 < ProFormUploadButton
185162 name = { "image_end_url" }
186163 label = { "Image End URL" }
187164 tooltip = { "End frame image, key frame" }
188165 accept = { "image/*" }
189- max = { 1 }
190- action = { appConfig . getUploadConfig ( ) . action }
191- fieldProps = { {
192- listType : "picture-card" ,
193- headers : {
194- Authorization : appConfig . getUploadConfig ( ) . auth ,
195- } ,
196- onChange : ( info ) => {
197- const getValueByPosition = ( obj : any , position : readonly any [ ] ) => {
198- return position . reduce ( ( acc , key ) => acc && acc [ key ] , obj ) ;
199- } ;
200-
201- if ( info . file . status === "done" ) {
202- try {
203- const response = info . file . response ;
204- if ( response ) {
205- info . file . url = getValueByPosition ( response , appConfig . getUploadConfig ( ) . position ) ;
206- }
207- } catch ( e ) {
208- console . error ( e ) ;
209- }
210- }
211- } ,
212- } }
166+ { ...appConfig . getProFormUploadConfig ( "url" , 1 , "picture-card" ) }
213167 />
214168 </ ProForm >
215169 ) ;
@@ -284,60 +238,14 @@ const LumaExtendForm = (props: {
284238 < ProFormUploadButton
285239 name = { "image_end_url" }
286240 label = { "Image End URL" }
287- max = { 1 }
288- action = { appConfig . getUploadConfig ( ) . action }
289241 accept = { "image/*" }
290- fieldProps = { {
291- listType : "picture-card" ,
292- headers : {
293- Authorization : appConfig . getUploadConfig ( ) . auth ,
294- } ,
295- onChange : ( info ) => {
296- const getValueByPosition = ( obj : any , position : readonly any [ ] ) => {
297- return position . reduce ( ( acc , key ) => acc && acc [ key ] , obj ) ;
298- } ;
299-
300- if ( info . file . status === "done" ) {
301- try {
302- const response = info . file . response ;
303- if ( response ) {
304- info . file . url = getValueByPosition ( response , appConfig . getUploadConfig ( ) . position ) ;
305- }
306- } catch ( e ) {
307- console . error ( e ) ;
308- }
309- }
310- } ,
311- } }
242+ { ...appConfig . getProFormUploadConfig ( "url" , 1 , "picture-card" ) }
312243 />
313244 < ProFormUploadButton
314245 name = { "video_url" }
315246 label = { "Video URL" }
316247 accept = { "video/*" }
317- max = { 1 }
318- action = { appConfig . getUploadConfig ( ) . action }
319- fieldProps = { {
320- listType : "picture-card" ,
321- headers : {
322- Authorization : appConfig . getUploadConfig ( ) . auth ,
323- } ,
324- onChange : ( info ) => {
325- const getValueByPosition = ( obj : any , position : readonly any [ ] ) => {
326- return position . reduce ( ( acc , key ) => acc && acc [ key ] , obj ) ;
327- } ;
328-
329- if ( info . file . status === "done" ) {
330- try {
331- const response = info . file . response ;
332- if ( response ) {
333- info . file . url = getValueByPosition ( response , appConfig . getUploadConfig ( ) . position ) ;
334- }
335- } catch ( e ) {
336- console . error ( e ) ;
337- }
338- }
339- } ,
340- } }
248+ { ...appConfig . getProFormUploadConfig ( "url" , 1 , "picture-card" ) }
341249 rules = { [ { required : true } ] }
342250 />
343251 </ ProForm >
@@ -540,7 +448,7 @@ const LumaTaskRenderer = (props: {
540448
541449const LumaPage = ( ) => {
542450 const appConfig = useAppConfig ( ) ;
543- const lumaApi = new LumaApi ( appConfig . getFirstApiKey ( api2Provider . Luma ) ) ;
451+ const lumaApi = new LumaApi ( appConfig . getApiKey ( ) ) ;
544452 const [ accountType , setAccountType ] = useState < AccountType > ( "relax" ) ;
545453
546454 const operate_type_options = [
0 commit comments