Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: allow fill inputs from url params (#20630)
非法操作f2dcfc976d70
diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsxindex 36946661393..dd7cb14b256 100644--- a/web/app/components/base/chat/chat-with-history/hooks.tsx+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx@@ -16,7 +16,7 @@ import type {Feedback,} from '../types'import { CONVERSATION_ID_INFO } from '../constants'-import { buildChatItemTree, getProcessedSystemVariablesFromUrlParams } from '../utils'+import { buildChatItemTree, getProcessedSystemVariablesFromUrlParams, getRawInputsFromUrlParams } from '../utils'import { addFileInfos, sortAgentSorts } from '../../../tools/utils'import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils'import {@@ -195,6 +195,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {const { t } = useTranslation()const newConversationInputsRef = useRef<Record<string, any>>({})const [newConversationInputs, setNewConversationInputs] = useState<Record<string, any>>({})+ const [initInputs, setInitInputs] = useState<Record<string, any>>({})const handleNewConversationInputsChange = useCallback((newInputs: Record<string, any>) => {newConversationInputsRef.current = newInputssetNewConversationInputs(newInputs)@@ -202,20 +203,29 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {const inputsForms = useMemo(() => {return (appParams?.user_input_form || []).filter((item: any) => !item.external_data_tool).map((item: any) => {if (item.paragraph) {+ let value = initInputs[item.paragraph.variable]+ if (value && item.paragraph.max_length && value.length > item.paragraph.max_length)+ value = value.slice(0, item.paragraph.max_length)+return {...item.paragraph,+ default: value || item.default,type: 'paragraph',}}if (item.number) {+ const convertedNumber = Number(initInputs[item.number.variable]) ?? undefinedreturn {...item.number,+ default: convertedNumber || item.default,type: 'number',}}if (item.select) {+ const isInputInOptions = item.select.options.includes(initInputs[item.select.variable])return {...item.select,+ default: (isInputInOptions ? initInputs[item.select.variable] : undefined) || item.default,type: 'select',}}@@ -234,17 +244,30 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {}}+ let value = initInputs[item['text-input'].variable]+ if (value && item['text-input'].max_length && value.length > item['text-input'].max_length)+ value = value.slice(0, item['text-input'].max_length)+return {...item['text-input'],+ default: value || item.default,type: 'text-input',}})- }, [appParams])+ }, [initInputs, appParams])const allInputsHidden = useMemo(() => {return inputsForms.length > 0 && inputsForms.every(item => item.hide === true)}, [inputsForms])+ useEffect(() => {+ // init inputs from url params+ (async () => {+ const inputs = await getRawInputsFromUrlParams()+ setInitInputs(inputs)+ })()+ }, [])+useEffect(() => {const conversationInputs: Record<string, any> = {}@@ -362,11 +385,11 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {if (conversationId)setClearChatList(false)}, [handleConversationIdInfoChange, setClearChatList])- const handleNewConversation = useCallback(() => {+ const handleNewConversation = useCallback(async () => {currentChatInstanceRef.current.handleStop()setShowNewConversationItemInList(true)handleChangeConversation('')- handleNewConversationInputsChange({})+ handleNewConversationInputsChange(await getRawInputsFromUrlParams())setClearChatList(true)}, [handleChangeConversation, setShowNewConversationItemInList, handleNewConversationInputsChange, setClearChatList])const handleUpdateConversationList = useCallback(() => {diff --git a/web/app/components/base/chat/utils.ts b/web/app/components/base/chat/utils.tsindex bdac5998fe7..8e044375d30 100644--- a/web/app/components/base/chat/utils.ts+++ b/web/app/components/base/chat/utils.ts@@ -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,diff --git a/web/i18n/es-ES/app-debug.ts b/web/i18n/es-ES/app-debug.tsindex ab5b82e7d18..8c986bf6692 100644--- a/web/i18n/es-ES/app-debug.ts+++ b/web/i18n/es-ES/app-debug.ts@@ -280,6 +280,7 @@ const translation = {'inputPlaceholder': 'Por favor ingresa','content': 'Contenido','required': 'Requerido',+ 'hide': 'Ocultar','errorMsg': {varNameRequired: 'Nombre de la variable es requerido',labelNameRequired: 'Nombre de la etiqueta es requerido',diff --git a/web/i18n/fa-IR/app-debug.ts b/web/i18n/fa-IR/app-debug.tsindex 00891f3b17e..5cf9c15efe7 100644--- a/web/i18n/fa-IR/app-debug.ts+++ b/web/i18n/fa-IR/app-debug.ts@@ -315,6 +315,7 @@ const translation = {'inputPlaceholder': 'لطفاً وارد کنید','content': 'محتوا','required': 'مورد نیاز',+ 'hide': 'مخفی کردن','errorMsg': {varNameRequired: 'نام متغیر مورد نیاز است',labelNameRequired: 'نام برچسب مورد نیاز است',diff --git a/web/i18n/fr-FR/app-debug.ts b/web/i18n/fr-FR/app-debug.tsindex 2fd863742bb..66710929309 100644--- a/web/i18n/fr-FR/app-debug.ts+++ b/web/i18n/fr-FR/app-debug.ts@@ -268,6 +268,7 @@ const translation = {'labelName': 'Label Name','inputPlaceholder': 'Please input','required': 'Required',+ 'hide': 'Caché','errorMsg': {varNameRequired: 'Variable name is required',labelNameRequired: 'Label name is required',diff --git a/web/i18n/hi-IN/app-debug.ts b/web/i18n/hi-IN/app-debug.tsindex 1b0633ef321..3f4b06c08bd 100644--- a/web/i18n/hi-IN/app-debug.ts+++ b/web/i18n/hi-IN/app-debug.ts@@ -312,6 +312,7 @@ const translation = {'inputPlaceholder': 'कृपया इनपुट करें','content': 'सामग्री','required': 'आवश्यक',+ 'hide': 'छुपाएँ','errorMsg': {varNameRequired: 'वेरिएबल नाम आवश्यक है',labelNameRequired: 'लेबल नाम आवश्यक है',diff --git a/web/i18n/it-IT/app-debug.ts b/web/i18n/it-IT/app-debug.tsindex e4555b973a3..c8b3c083028 100644--- a/web/i18n/it-IT/app-debug.ts+++ b/web/i18n/it-IT/app-debug.ts@@ -314,6 +314,7 @@ const translation = {'inputPlaceholder': 'Per favore inserisci','content': 'Contenuto','required': 'Richiesto',+ 'hide': 'Nascondi','errorMsg': {varNameRequired: 'Il nome della variabile è richiesto',labelNameRequired: 'Il nome dell\'etichetta è richiesto',diff --git a/web/i18n/ja-JP/app-debug.ts b/web/i18n/ja-JP/app-debug.tsindex cc07a6d8f6f..f862f3f2f71 100644--- a/web/i18n/ja-JP/app-debug.ts+++ b/web/i18n/ja-JP/app-debug.ts@@ -359,6 +359,7 @@ const translation = {'labelName': 'ラベル名','inputPlaceholder': '入力してください','required': '必須',+ 'hide': '非表示','file': {supportFileTypes: 'サポートされたファイルタイプ',image: {diff --git a/web/i18n/ko-KR/app-debug.ts b/web/i18n/ko-KR/app-debug.tsindex 290ccb0b011..3c5a3f4b1fc 100644--- a/web/i18n/ko-KR/app-debug.ts+++ b/web/i18n/ko-KR/app-debug.ts@@ -279,6 +279,7 @@ const translation = {'labelName': '레이블명','inputPlaceholder': '입력하세요','required': '필수',+ 'hide': '숨기기','errorMsg': {varNameRequired: '변수명은 필수입니다',labelNameRequired: '레이블명은 필수입니다',diff --git a/web/i18n/pl-PL/app-debug.ts b/web/i18n/pl-PL/app-debug.tsindex cf7232e563a..48b44c0cbb9 100644--- a/web/i18n/pl-PL/app-debug.ts+++ b/web/i18n/pl-PL/app-debug.ts@@ -309,6 +309,7 @@ const translation = {'labelName': 'Nazwa etykiety','inputPlaceholder': 'Proszę wpisać','required': 'Wymagane',+ 'hide': 'Ukryj','errorMsg': {varNameRequired: 'Wymagana nazwa zmiennej',labelNameRequired: 'Wymagana nazwa etykiety',diff --git a/web/i18n/pt-BR/app-debug.ts b/web/i18n/pt-BR/app-debug.tsindex df4312f8870..64f7a85fe73 100644--- a/web/i18n/pt-BR/app-debug.ts+++ b/web/i18n/pt-BR/app-debug.ts@@ -285,6 +285,7 @@ const translation = {'labelName': 'Nome do Rótulo','inputPlaceholder': 'Por favor, insira','required': 'Obrigatório',+ 'hide': 'Ocultar','errorMsg': {varNameRequired: 'O nome da variável é obrigatório',labelNameRequired: 'O nome do rótulo é obrigatório',diff --git a/web/i18n/ro-RO/app-debug.ts b/web/i18n/ro-RO/app-debug.tsindex bafeee8bb02..f7240055e31 100644--- a/web/i18n/ro-RO/app-debug.ts+++ b/web/i18n/ro-RO/app-debug.ts@@ -285,6 +285,7 @@ const translation = {'labelName': 'Nume etichetă','inputPlaceholder': 'Vă rugăm să introduceți','required': 'Obligatoriu',+ 'hide': 'Ascundeți','errorMsg': {varNameRequired: 'Numele variabilei este obligatoriu',labelNameRequired: 'Numele etichetei este obligatoriu',diff --git a/web/i18n/ru-RU/app-debug.ts b/web/i18n/ru-RU/app-debug.tsindex 038165301e6..00cd6e8a751 100644--- a/web/i18n/ru-RU/app-debug.ts+++ b/web/i18n/ru-RU/app-debug.ts@@ -322,6 +322,7 @@ const translation = {'inputPlaceholder': 'Пожалуйста, введите','content': 'Содержимое','required': 'Обязательно',+ 'hide': 'Скрыть','errorMsg': {labelNameRequired: 'Имя метки обязательно',varNameCanBeRepeat: 'Имя переменной не может повторяться',diff --git a/web/i18n/sl-SI/app-debug.ts b/web/i18n/sl-SI/app-debug.tsindex 8672fa5c58f..7e5c7dd6b04 100644--- a/web/i18n/sl-SI/app-debug.ts+++ b/web/i18n/sl-SI/app-debug.ts@@ -239,4 +239,4 @@ const translation = {},}-module.exports = translation+export default translationdiff --git a/web/i18n/uk-UA/app-debug.ts b/web/i18n/uk-UA/app-debug.tsindex 1fc6981122c..7e410ffef99 100644--- a/web/i18n/uk-UA/app-debug.ts+++ b/web/i18n/uk-UA/app-debug.ts@@ -279,6 +279,7 @@ const translation = {'labelName': 'Назва мітки','inputPlaceholder': 'Будь ласка, введіть','required': 'Обов\'язково',+ 'hide': 'Приховати','errorMsg': {varNameRequired: 'Потрібно вказати назву змінної',labelNameRequired: 'Потрібно вказати назву мітки',diff --git a/web/i18n/vi-VN/app-debug.ts b/web/i18n/vi-VN/app-debug.tsindex 4e8a1962fe9..c091cb5abba 100644--- a/web/i18n/vi-VN/app-debug.ts+++ b/web/i18n/vi-VN/app-debug.ts@@ -279,6 +279,7 @@ const translation = {'labelName': 'Tên nhãn','inputPlaceholder': 'Vui lòng nhập','required': 'Bắt buộc',+ 'hide': 'Ẩn','errorMsg': {varNameRequired: 'Tên biến là bắt buộc',labelNameRequired: 'Tên nhãn là bắt buộc',diff --git a/web/i18n/zh-Hans/app-debug.ts b/web/i18n/zh-Hans/app-debug.tsindex 06e737c3c3b..4f84b396d01 100644--- a/web/i18n/zh-Hans/app-debug.ts+++ b/web/i18n/zh-Hans/app-debug.ts@@ -361,6 +361,7 @@ const translation = {'inputPlaceholder': '请输入','labelName': '显示名称','required': '必填',+ 'hide': '隐藏','file': {supportFileTypes: '支持的文件类型',image: {diff --git a/web/i18n/zh-Hant/app-debug.ts b/web/i18n/zh-Hant/app-debug.tsindex 7a1cc88ea23..16374992b56 100644--- a/web/i18n/zh-Hant/app-debug.ts+++ b/web/i18n/zh-Hant/app-debug.ts@@ -264,6 +264,7 @@ const translation = {'inputPlaceholder': '請輸入','labelName': '顯示名稱','required': '必填',+ 'hide': '隱藏','errorMsg': {varNameRequired: '變數名稱必填',labelNameRequired: '顯示名稱必填',