@@ -529,35 +529,39 @@ const search_type_change = () => {
529529 search_form .value = { name: ' ' , create_user: ' ' }
530530}
531531
532- const apiInputParams = ref ([])
533-
534532function toChat(row : any ) {
535- row ?.work_flow ?.nodes
536- ?.filter ((v : any ) => v .id === ' base-node' )
537- .map ((v : any ) => {
538- apiInputParams .value = v .properties .api_input_field_list
539- ? v .properties .api_input_field_list .map ((v : any ) => {
540- return {
541- name: v .variable ,
542- value: v .default_value ,
543- }
544- })
545- : v .properties .input_field_list
546- ? v .properties .input_field_list
547- .filter ((v : any ) => v .assignment_method === ' api_input' )
548- .map ((v : any ) => {
549- return {
550- name: v .variable ,
551- value: v .default_value ,
552- }
553- })
554- : []
533+ const api =
534+ row .type == ' WORK_FLOW'
535+ ? (id : string ) => ApplicationApi .getApplicationDetail (id )
536+ : (id : string ) => Promise .resolve ({ data: row })
537+ api (row .id ).then ((ok ) => {
538+ let aips = ok .data ?.work_flow ?.nodes
539+ ?.filter ((v : any ) => v .id === ' base-node' )
540+ .map ((v : any ) => {
541+ return v .properties .api_input_field_list
542+ ? v .properties .api_input_field_list .map ((v : any ) => {
543+ return {
544+ name: v .variable ,
545+ value: v .default_value ,
546+ }
547+ })
548+ : v .properties .input_field_list
549+ ? v .properties .input_field_list
550+ .filter ((v : any ) => v .assignment_method === ' api_input' )
551+ .map ((v : any ) => {
552+ return {
553+ name: v .variable ,
554+ value: v .default_value ,
555+ }
556+ })
557+ : []
558+ })
559+ .reduce ((x : Array <any >, y : Array <any >) => [... x , ... y ])
560+ aips = aips ? aips : []
561+ const apiParams = mapToUrlParams (aips ) ? ' ?' + mapToUrlParams (aips ) : ' '
562+ ApplicationApi .getAccessToken (row .id , loading ).then ((res : any ) => {
563+ window .open (application .location + res ?.data ?.access_token + apiParams )
555564 })
556- const apiParams = mapToUrlParams (apiInputParams .value )
557- ? ' ?' + mapToUrlParams (apiInputParams .value )
558- : ' '
559- ApplicationApi .getAccessToken (row .id , loading ).then ((res : any ) => {
560- window .open (application .location + res ?.data ?.access_token + apiParams )
561565 })
562566}
563567
0 commit comments