mirror of
https://github.com/langgenius/dify.git
synced 2025-07-05 16:22:23 +00:00
21 lines
821 B
TypeScript
21 lines
821 B
TypeScript
![]() |
async function decodeBase64AndDecompress(base64String: string) {
|
||
|
const binaryString = atob(base64String)
|
||
|
const compressedUint8Array = Uint8Array.from(binaryString, char => char.charCodeAt(0))
|
||
|
const decompressedStream = new Response(compressedUint8Array).body.pipeThrough(new DecompressionStream('gzip'))
|
||
|
const decompressedArrayBuffer = await new Response(decompressedStream).arrayBuffer()
|
||
|
return new TextDecoder().decode(decompressedArrayBuffer)
|
||
|
}
|
||
|
|
||
|
function getProcessedInputsFromUrlParams(): Record<string, any> {
|
||
|
const urlParams = new URLSearchParams(window.location.search)
|
||
|
const inputs: Record<string, any> = {}
|
||
|
urlParams.forEach(async (value, key) => {
|
||
|
inputs[key] = await decodeBase64AndDecompress(decodeURIComponent(value))
|
||
|
})
|
||
|
return inputs
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
getProcessedInputsFromUrlParams,
|
||
|
}
|