mirror of https://github.com/langgenius/dify.git
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
|
||||
form_content: string
|
||||
inputs: FormInputItem[]
|
||||
placeholder_values: Record<string, string>
|
||||
user_actions: UserAction[]
|
||||
expiration_time: number
|
||||
}
|
||||
|
|
@ -235,6 +236,7 @@ const FormContent = () => {
|
|||
formInputFields={formData.inputs}
|
||||
inputs={inputs}
|
||||
onInputChange={handleInputsChange}
|
||||
resolvedPlaceholderValues={formData.placeholder_values}
|
||||
/>
|
||||
))}
|
||||
<div className="flex flex-wrap gap-1 py-1">
|
||||
|
|
|
|||
|
|
@ -499,6 +499,27 @@ export const useWorkflowRun = () => {
|
|||
if (audioPlayer)
|
||||
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,
|
||||
onCompleted: wrappedOnCompleted,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import type {
|
|||
IOnTTSEnd,
|
||||
IOtherOptions,
|
||||
} 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 { 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 {
|
||||
AppConversationData,
|
||||
|
|
@ -280,13 +280,7 @@ export const getAppAccessModeByAppCode = (appCode: string) => {
|
|||
}
|
||||
|
||||
export const getHumanInputForm = (token: string) => {
|
||||
return get<{
|
||||
site: any
|
||||
form_content: string
|
||||
inputs: FormInputItem[]
|
||||
user_actions: UserAction[]
|
||||
expiration_time: number
|
||||
}>(`/form/human_input/${token}`)
|
||||
return get<HumanInputFormData>(`/form/human_input/${token}`)
|
||||
}
|
||||
|
||||
export const submitHumanInputForm = (token: string, data: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue