mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Let system variables appear in operator prompts #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
38 lines
967 B
TypeScript
38 lines
967 B
TypeScript
import { SelectWithSearch } from '@/components/originui/select-with-search';
|
|
import {
|
|
FormControl,
|
|
FormField,
|
|
FormItem,
|
|
FormLabel,
|
|
FormMessage,
|
|
} from '@/components/ui/form';
|
|
import { useFormContext } from 'react-hook-form';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useBuildQueryVariableOptions } from '../../hooks/use-get-begin-query';
|
|
|
|
export function QueryVariable() {
|
|
const { t } = useTranslation();
|
|
const form = useFormContext();
|
|
|
|
const nextOptions = useBuildQueryVariableOptions();
|
|
|
|
return (
|
|
<FormField
|
|
control={form.control}
|
|
name="query"
|
|
render={({ field }) => (
|
|
<FormItem>
|
|
<FormLabel tooltip={t('chat.modelTip')}>{t('flow.query')}</FormLabel>
|
|
<FormControl>
|
|
<SelectWithSearch
|
|
options={nextOptions}
|
|
{...field}
|
|
></SelectWithSearch>
|
|
</FormControl>
|
|
<FormMessage />
|
|
</FormItem>
|
|
)}
|
|
/>
|
|
);
|
|
}
|