mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-31 01:01:30 +08:00
### What problem does this PR solve? Feat: Hide part of the message field in webhook mode #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: balibabu <assassin_cike@163.com>
This commit is contained in:
@ -2120,8 +2120,8 @@ Important structured information may include: names, dates, locations, events, k
|
|||||||
queryParameters: 'Query parameters',
|
queryParameters: 'Query parameters',
|
||||||
headerParameters: 'Header parameters',
|
headerParameters: 'Header parameters',
|
||||||
requestBodyParameters: 'Request body parameters',
|
requestBodyParameters: 'Request body parameters',
|
||||||
streaming: 'Accepted response',
|
immediately: 'Accepted response',
|
||||||
immediately: 'Final response',
|
streaming: 'Final response',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
llmTools: {
|
llmTools: {
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
IAttachment,
|
IAttachment,
|
||||||
IEventList,
|
IEventList,
|
||||||
IInputEvent,
|
|
||||||
IMessageEndData,
|
IMessageEndData,
|
||||||
IMessageEndEvent,
|
IMessageEndEvent,
|
||||||
IMessageEvent,
|
IMessageEvent,
|
||||||
@ -93,7 +92,7 @@ export function findMessageFromList(eventList: IEventList) {
|
|||||||
export function findInputFromList(eventList: IEventList) {
|
export function findInputFromList(eventList: IEventList) {
|
||||||
const inputEvent = eventList.find(
|
const inputEvent = eventList.find(
|
||||||
(x) => x.event === MessageEventType.UserInputs,
|
(x) => x.event === MessageEventType.UserInputs,
|
||||||
) as IInputEvent;
|
);
|
||||||
|
|
||||||
if (!inputEvent) {
|
if (!inputEvent) {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { FormContainer } from '@/components/form-container';
|
|
||||||
import { BlockButton, Button } from '@/components/ui/button';
|
import { BlockButton, Button } from '@/components/ui/button';
|
||||||
import {
|
import {
|
||||||
Form,
|
Form,
|
||||||
@ -67,99 +66,99 @@ function MessageForm({ node }: INextOperatorForm) {
|
|||||||
{showWebhookResponseStatus && (
|
{showWebhookResponseStatus && (
|
||||||
<WebHookResponseStatusFormField name="status"></WebHookResponseStatusFormField>
|
<WebHookResponseStatusFormField name="status"></WebHookResponseStatusFormField>
|
||||||
)}
|
)}
|
||||||
<FormContainer>
|
<FormItem>
|
||||||
<FormItem>
|
<FormLabel tooltip={t('flow.msgTip')}>{t('flow.msg')}</FormLabel>
|
||||||
<FormLabel tooltip={t('flow.msgTip')}>{t('flow.msg')}</FormLabel>
|
<div className="space-y-4">
|
||||||
<div className="space-y-4">
|
{fields.map((field, index) => (
|
||||||
{fields.map((field, index) => (
|
<div key={field.id} className="flex items-start gap-2">
|
||||||
<div key={field.id} className="flex items-start gap-2">
|
<FormField
|
||||||
<FormField
|
control={form.control}
|
||||||
control={form.control}
|
name={`content.${index}.value`}
|
||||||
name={`content.${index}.value`}
|
render={({ field }) => (
|
||||||
render={({ field }) => (
|
<FormItem className="flex-1">
|
||||||
<FormItem className="flex-1">
|
<FormControl>
|
||||||
<FormControl>
|
<PromptEditor
|
||||||
<PromptEditor
|
{...field}
|
||||||
{...field}
|
placeholder={t('flow.messagePlaceholder')}
|
||||||
placeholder={t('flow.messagePlaceholder')}
|
></PromptEditor>
|
||||||
></PromptEditor>
|
</FormControl>
|
||||||
</FormControl>
|
</FormItem>
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
{fields.length > 1 && (
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant={'ghost'}
|
|
||||||
onClick={() => remove(index)}
|
|
||||||
>
|
|
||||||
<X />
|
|
||||||
</Button>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
/>
|
||||||
))}
|
{fields.length > 1 && (
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant={'ghost'}
|
||||||
|
onClick={() => remove(index)}
|
||||||
|
>
|
||||||
|
<X />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
<BlockButton
|
<BlockButton
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => append({ value: '' })} // "" will cause the inability to add, refer to: https://github.com/orgs/react-hook-form/discussions/8485#discussioncomment-2961861
|
onClick={() => append({ value: '' })} // "" will cause the inability to add, refer to: https://github.com/orgs/react-hook-form/discussions/8485#discussioncomment-2961861
|
||||||
>
|
>
|
||||||
{t('flow.addMessage')}
|
{t('flow.addMessage')}
|
||||||
</BlockButton>
|
</BlockButton>
|
||||||
</div>
|
</div>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormContainer>
|
{!showWebhookResponseStatus && (
|
||||||
<FormContainer>
|
<>
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel tooltip={t('flow.downloadFileTypeTip')}>
|
<FormLabel tooltip={t('flow.downloadFileTypeTip')}>
|
||||||
{t('flow.downloadFileType')}
|
{t('flow.downloadFileType')}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name={`output_format`}
|
name={`output_format`}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex-1">
|
<FormItem className="flex-1">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<RAGFlowSelect
|
<RAGFlowSelect
|
||||||
options={Object.keys(ExportFileType).map(
|
options={Object.keys(ExportFileType).map(
|
||||||
(key: string) => {
|
(key: string) => {
|
||||||
return {
|
return {
|
||||||
value:
|
value:
|
||||||
ExportFileType[
|
ExportFileType[
|
||||||
key as keyof typeof ExportFileType
|
key as keyof typeof ExportFileType
|
||||||
],
|
],
|
||||||
label: key,
|
label: key,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
{...field}
|
{...field}
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
placeholder={t('common.selectPlaceholder')}
|
placeholder={t('common.selectPlaceholder')}
|
||||||
allowClear
|
allowClear
|
||||||
></RAGFlowSelect>
|
></RAGFlowSelect>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t('flow.autoPlay')}</FormLabel>
|
<FormLabel>{t('flow.autoPlay')}</FormLabel>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name={`auto_play`}
|
name={`auto_play`}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex-1">
|
<FormItem className="flex-1">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Switch
|
<Switch
|
||||||
checked={field.value}
|
checked={field.value}
|
||||||
onCheckedChange={field.onChange}
|
onCheckedChange={field.onChange}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormContainer>
|
</>
|
||||||
|
)}
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export function useShowWebhookResponseStatus(form: UseFormReturn<any>) {
|
|||||||
const showWebhookResponseStatus = useMemo(() => {
|
const showWebhookResponseStatus = useMemo(() => {
|
||||||
const formData: BeginFormSchemaType = getNode(BeginId)?.data.form;
|
const formData: BeginFormSchemaType = getNode(BeginId)?.data.form;
|
||||||
return (
|
return (
|
||||||
formData.mode === AgentDialogueMode.Webhook &&
|
formData?.mode === AgentDialogueMode.Webhook &&
|
||||||
formData.execution_mode === WebhookExecutionMode.Streaming
|
formData.execution_mode === WebhookExecutionMode.Streaming
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user