mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
feat: enhance human input form handling by adding placeholder values and new workflow event handlers
This commit is contained in:
parent
61c7fdc614
commit
91c35c2f0a
@ -24,6 +24,7 @@ export type FormData = {
|
|||||||
site: any
|
site: any
|
||||||
form_content: string
|
form_content: string
|
||||||
inputs: FormInputItem[]
|
inputs: FormInputItem[]
|
||||||
|
placeholder_values: Record<string, string>
|
||||||
user_actions: UserAction[]
|
user_actions: UserAction[]
|
||||||
expiration_time: number
|
expiration_time: number
|
||||||
}
|
}
|
||||||
@ -235,6 +236,7 @@ const FormContent = () => {
|
|||||||
formInputFields={formData.inputs}
|
formInputFields={formData.inputs}
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
onInputChange={handleInputsChange}
|
onInputChange={handleInputsChange}
|
||||||
|
resolvedPlaceholderValues={formData.placeholder_values}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<div className="flex flex-wrap gap-1 py-1">
|
<div className="flex flex-wrap gap-1 py-1">
|
||||||
|
|||||||
@ -499,6 +499,27 @@ export const useWorkflowRun = () => {
|
|||||||
if (audioPlayer)
|
if (audioPlayer)
|
||||||
audioPlayer.playAudioWithAudio(audio, false)
|
audioPlayer.playAudioWithAudio(audio, false)
|
||||||
},
|
},
|
||||||
|
onWorkflowPaused: (params) => {
|
||||||
|
handleWorkflowPaused()
|
||||||
|
if (onWorkflowPaused)
|
||||||
|
onWorkflowPaused(params)
|
||||||
|
const url = `/workflow/${params.workflow_run_id}/events`
|
||||||
|
sseGet(
|
||||||
|
url,
|
||||||
|
{},
|
||||||
|
baseSseOptions,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onHumanInputRequired: (params) => {
|
||||||
|
handleWorkflowNodeHumanInputRequired(params)
|
||||||
|
if (onHumanInputRequired)
|
||||||
|
onHumanInputRequired(params)
|
||||||
|
},
|
||||||
|
onHumanInputFormFilled: (params) => {
|
||||||
|
handleWorkflowNodeHumanInputFormFilled(params)
|
||||||
|
if (onHumanInputFormFilled)
|
||||||
|
onHumanInputFormFilled(params)
|
||||||
|
},
|
||||||
onError: wrappedOnError,
|
onError: wrappedOnError,
|
||||||
onCompleted: wrappedOnCompleted,
|
onCompleted: wrappedOnCompleted,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,9 +10,9 @@ import type {
|
|||||||
IOnTTSEnd,
|
IOnTTSEnd,
|
||||||
IOtherOptions,
|
IOtherOptions,
|
||||||
} from './base'
|
} from './base'
|
||||||
|
import type { FormData as HumanInputFormData } from '@/app/(humanInputLayout)/form/[token]/form'
|
||||||
import type { FeedbackType } from '@/app/components/base/chat/chat/type'
|
import type { FeedbackType } from '@/app/components/base/chat/chat/type'
|
||||||
import type { ChatConfig } from '@/app/components/base/chat/types'
|
import type { ChatConfig } from '@/app/components/base/chat/types'
|
||||||
import type { FormInputItem, UserAction } from '@/app/components/workflow/nodes/human-input/types'
|
|
||||||
import type { AccessMode } from '@/models/access-control'
|
import type { AccessMode } from '@/models/access-control'
|
||||||
import type {
|
import type {
|
||||||
AppConversationData,
|
AppConversationData,
|
||||||
@ -280,13 +280,7 @@ export const getAppAccessModeByAppCode = (appCode: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const getHumanInputForm = (token: string) => {
|
export const getHumanInputForm = (token: string) => {
|
||||||
return get<{
|
return get<HumanInputFormData>(`/form/human_input/${token}`)
|
||||||
site: any
|
|
||||||
form_content: string
|
|
||||||
inputs: FormInputItem[]
|
|
||||||
user_actions: UserAction[]
|
|
||||||
expiration_time: number
|
|
||||||
}>(`/form/human_input/${token}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const submitHumanInputForm = (token: string, data: {
|
export const submitHumanInputForm = (token: string, data: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user