feat: allow fill inputs from url params (#20630)

This commit is contained in:
非法操作 2025-06-05 09:44:41 +08:00 • committed by GitHub
commit f2dcfc976d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 55 additions and 5 deletions

View file

@ -15,6 +15,17 @@ async function decodeBase64AndDecompress(base64String: string) {
}
}
async function getRawInputsFromUrlParams(): Promise<Record<string, any>> {
const urlParams = new URLSearchParams(window.location.search)
const inputs: Record<string, any> = {}
const entriesArray = Array.from(urlParams.entries())
entriesArray.forEach(([key, value]) => {
if (!key.startsWith('sys.'))
inputs[key] = decodeURIComponent(value)
})
return inputs
}
async function getProcessedInputsFromUrlParams(): Promise<Record<string, any>> {
const urlParams = new URLSearchParams(window.location.search)
const inputs: Record<string, any> = {}
@ -184,6 +195,7 @@ function getThreadMessages(tree: ChatItemInTree[], targetMessageId?: string): Ch
}
export {
getRawInputsFromUrlParams,
getProcessedInputsFromUrlParams,
getProcessedSystemVariablesFromUrlParams,
isValidGeneratedAnswer,