fix: [Application] An application that adds interface parameters, clicks on the application list page to initiate a conversation, but does not carry interface parameters (#4122)

v3.2
shaohuzhang1 2025-09-26 14:52:43 +08:00 committed by GitHub
parent c56742f9b3
commit 8d4bad55f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 31 additions and 27 deletions

View File

@ -529,13 +529,16 @@ const search_type_change = () => {
search_form.value = { name: '', create_user: '' } search_form.value = { name: '', create_user: '' }
} }
const apiInputParams = ref([])
function toChat(row: any) { function toChat(row: any) {
row?.work_flow?.nodes const api =
row.type == 'WORK_FLOW'
? (id: string) => ApplicationApi.getApplicationDetail(id)
: (id: string) => Promise.resolve({ data: row })
api(row.id).then((ok) => {
let aips = ok.data?.work_flow?.nodes
?.filter((v: any) => v.id === 'base-node') ?.filter((v: any) => v.id === 'base-node')
.map((v: any) => { .map((v: any) => {
apiInputParams.value = v.properties.api_input_field_list return v.properties.api_input_field_list
? v.properties.api_input_field_list.map((v: any) => { ? v.properties.api_input_field_list.map((v: any) => {
return { return {
name: v.variable, name: v.variable,
@ -553,12 +556,13 @@ function toChat(row: any) {
}) })
: [] : []
}) })
const apiParams = mapToUrlParams(apiInputParams.value) .reduce((x: Array<any>, y: Array<any>) => [...x, ...y])
? '?' + mapToUrlParams(apiInputParams.value) aips = aips ? aips : []
: '' const apiParams = mapToUrlParams(aips) ? '?' + mapToUrlParams(aips) : ''
ApplicationApi.getAccessToken(row.id, loading).then((res: any) => { ApplicationApi.getAccessToken(row.id, loading).then((res: any) => {
window.open(application.location + res?.data?.access_token + apiParams) window.open(application.location + res?.data?.access_token + apiParams)
}) })
})
} }
function mapToUrlParams(map: any[]) { function mapToUrlParams(map: any[]) {