@@ -108,6 +108,15 @@ export function useWorkspaceCatalog(options: WorkspaceCatalogOptions) {
108108 requestTemplate : string
109109 requestExample : string
110110 responseExample : string
111+ asyncTaskEnabled : boolean
112+ asyncTaskQueryMethod : 'GET' | 'POST'
113+ asyncTaskQueryUrlTemplate : string
114+ asyncTaskAuthMode : 'SAME_AS_SUBMIT' | 'OVERRIDE'
115+ asyncTaskAuthScheme : '' | 'NONE' | 'HEADER_TOKEN' | 'QUERY_TOKEN'
116+ asyncTaskAuthConfig : string
117+ asyncTaskStatusPath : string
118+ asyncTaskResultPath : string
119+ asyncTaskErrorPath : string
111120 } > ( {
112121 displayName : '' ,
113122 categoryCode : '' ,
@@ -118,6 +127,15 @@ export function useWorkspaceCatalog(options: WorkspaceCatalogOptions) {
118127 requestTemplate : '' ,
119128 requestExample : '' ,
120129 responseExample : '' ,
130+ asyncTaskEnabled : false ,
131+ asyncTaskQueryMethod : 'GET' ,
132+ asyncTaskQueryUrlTemplate : '' ,
133+ asyncTaskAuthMode : 'SAME_AS_SUBMIT' ,
134+ asyncTaskAuthScheme : '' ,
135+ asyncTaskAuthConfig : '' ,
136+ asyncTaskStatusPath : '' ,
137+ asyncTaskResultPath : '' ,
138+ asyncTaskErrorPath : '' ,
121139 } )
122140 const aiTagInput = ref ( '' )
123141 const recentAssets = ref ( deps . getRecentAssets ( ) )
@@ -144,6 +162,15 @@ export function useWorkspaceCatalog(options: WorkspaceCatalogOptions) {
144162 requestTemplate : asset ?. requestTemplate ?? '' ,
145163 requestExample : asset ?. requestExample ?? '' ,
146164 responseExample : asset ?. responseExample ?? '' ,
165+ asyncTaskEnabled : asset ?. asyncTaskConfig ?. enabled ?? false ,
166+ asyncTaskQueryMethod : asset ?. asyncTaskConfig ?. queryMethod ?? 'GET' ,
167+ asyncTaskQueryUrlTemplate : asset ?. asyncTaskConfig ?. queryUrlTemplate ?? '' ,
168+ asyncTaskAuthMode : asset ?. asyncTaskConfig ?. authMode ?? 'SAME_AS_SUBMIT' ,
169+ asyncTaskAuthScheme : asset ?. asyncTaskConfig ?. authScheme ?? '' ,
170+ asyncTaskAuthConfig : asset ?. asyncTaskConfig ?. authConfig ?? '' ,
171+ asyncTaskStatusPath : asset ?. asyncTaskConfig ?. statusPath ?? '' ,
172+ asyncTaskResultPath : asset ?. asyncTaskConfig ?. resultPath ?? '' ,
173+ asyncTaskErrorPath : asset ?. asyncTaskConfig ?. errorPath ?? '' ,
147174 }
148175 }
149176
@@ -178,6 +205,7 @@ export function useWorkspaceCatalog(options: WorkspaceCatalogOptions) {
178205 requestTemplate : updated . requestTemplate ?? previous . requestTemplate ,
179206 requestExample : updated . requestExample ?? previous . requestExample ,
180207 responseExample : updated . responseExample ?? previous . responseExample ,
208+ asyncTaskConfig : updated . asyncTaskConfig ?? previous . asyncTaskConfig ,
181209 aiProfile : updated . aiProfile ?? {
182210 provider : aiProfileForm . value . provider ,
183211 model : aiProfileForm . value . model ,
@@ -392,8 +420,39 @@ export function useWorkspaceCatalog(options: WorkspaceCatalogOptions) {
392420 return trimmed ? trimmed : null
393421 }
394422
423+ function buildAsyncTaskConfig ( ) : ReviseAssetBody [ 'asyncTaskConfig' ] {
424+ if ( ! assetConfigForm . value . asyncTaskEnabled ) {
425+ return null
426+ }
427+
428+ return {
429+ enabled : true ,
430+ queryMethod : assetConfigForm . value . asyncTaskQueryMethod ,
431+ queryUrlTemplate : assetConfigForm . value . asyncTaskQueryUrlTemplate . trim ( ) ,
432+ authMode : assetConfigForm . value . asyncTaskAuthMode ,
433+ authScheme :
434+ assetConfigForm . value . asyncTaskAuthMode === 'OVERRIDE'
435+ ? assetConfigForm . value . asyncTaskAuthScheme || null
436+ : null ,
437+ authConfig :
438+ assetConfigForm . value . asyncTaskAuthMode === 'OVERRIDE'
439+ ? normalizeOptionalText ( assetConfigForm . value . asyncTaskAuthConfig )
440+ : null ,
441+ statusPath : normalizeOptionalText ( assetConfigForm . value . asyncTaskStatusPath ) ,
442+ resultPath : normalizeOptionalText ( assetConfigForm . value . asyncTaskResultPath ) ,
443+ errorPath : normalizeOptionalText ( assetConfigForm . value . asyncTaskErrorPath ) ,
444+ }
445+ }
446+
395447 async function handleSaveAssetConfig ( ) {
396448 if ( ! currentAsset . value ) return
449+ if (
450+ assetConfigForm . value . asyncTaskEnabled &&
451+ ! assetConfigForm . value . asyncTaskQueryUrlTemplate . trim ( )
452+ ) {
453+ assetError . value = deps . t ( 'console.workspace.asyncTaskQueryUrlRequired' )
454+ return false
455+ }
397456 assetLoading . value = true
398457 assetError . value = ''
399458 try {
@@ -408,6 +467,7 @@ export function useWorkspaceCatalog(options: WorkspaceCatalogOptions) {
408467 requestTemplate : normalizeOptionalText ( assetConfigForm . value . requestTemplate ) ,
409468 requestExample : normalizeOptionalText ( assetConfigForm . value . requestExample ) ,
410469 responseExample : normalizeOptionalText ( assetConfigForm . value . responseExample ) ,
470+ asyncTaskConfig : buildAsyncTaskConfig ( ) ,
411471 } ) ,
412472 )
413473 assetEditorOpen . value = false
0 commit comments