mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-24 23:46:52 +08:00
### What problem does this PR solve? Feat: Remove HMAC from the webhook #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -25,3 +25,12 @@ const CopyToClipboard = ({ text }: Props) => {
|
||||
};
|
||||
|
||||
export default CopyToClipboard;
|
||||
|
||||
export function CopyToClipboardWithText({ text }: { text: string }) {
|
||||
return (
|
||||
<div className="bg-bg-card p-1 rounded-md flex gap-2">
|
||||
<span className="flex-1 truncate">{text}</span>
|
||||
<CopyToClipboard text={text}></CopyToClipboard>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ interface NumberInputProps {
|
||||
onChange?: (value: number) => void;
|
||||
height?: number | string;
|
||||
min?: number;
|
||||
max?: number;
|
||||
}
|
||||
|
||||
const NumberInput: React.FC<NumberInputProps> = ({
|
||||
@ -15,6 +16,7 @@ const NumberInput: React.FC<NumberInputProps> = ({
|
||||
onChange,
|
||||
height,
|
||||
min = 0,
|
||||
max = Infinity,
|
||||
}) => {
|
||||
const [value, setValue] = useState<number>(() => {
|
||||
return initialValue ?? 0;
|
||||
@ -34,6 +36,9 @@ const NumberInput: React.FC<NumberInputProps> = ({
|
||||
};
|
||||
|
||||
const handleIncrement = () => {
|
||||
if (value > max - 1) {
|
||||
return;
|
||||
}
|
||||
setValue(value + 1);
|
||||
onChange?.(value + 1);
|
||||
};
|
||||
@ -41,6 +46,9 @@ const NumberInput: React.FC<NumberInputProps> = ({
|
||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const newValue = Number(e.target.value);
|
||||
if (!isNaN(newValue)) {
|
||||
if (newValue > max) {
|
||||
return;
|
||||
}
|
||||
setValue(newValue);
|
||||
onChange?.(newValue);
|
||||
}
|
||||
|
||||
@ -7,7 +7,11 @@ import {
|
||||
} from '@/components/ui/form';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { ReactNode, cloneElement, isValidElement } from 'react';
|
||||
import { ControllerRenderProps, useFormContext } from 'react-hook-form';
|
||||
import {
|
||||
ControllerRenderProps,
|
||||
UseControllerProps,
|
||||
useFormContext,
|
||||
} from 'react-hook-form';
|
||||
|
||||
type RAGFlowFormItemProps = {
|
||||
name: string;
|
||||
@ -18,7 +22,7 @@ type RAGFlowFormItemProps = {
|
||||
required?: boolean;
|
||||
labelClassName?: string;
|
||||
className?: string;
|
||||
};
|
||||
} & Pick<UseControllerProps<any>, 'rules'>;
|
||||
|
||||
export function RAGFlowFormItem({
|
||||
name,
|
||||
@ -29,11 +33,13 @@ export function RAGFlowFormItem({
|
||||
required = false,
|
||||
labelClassName,
|
||||
className,
|
||||
rules,
|
||||
}: RAGFlowFormItemProps) {
|
||||
const form = useFormContext();
|
||||
return (
|
||||
<FormField
|
||||
control={form.control}
|
||||
rules={rules}
|
||||
name={name}
|
||||
render={({ field }) => (
|
||||
<FormItem
|
||||
|
||||
Reference in New Issue
Block a user