mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-13 08:18:23 +08: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,
|
|
}
|