mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 08:56:47 +08:00
### What problem does this PR solve? Feat: Add memory multi-select dropdown to recall and message operator forms. #4213 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
33
web/src/components/memories-form-field.tsx
Normal file
33
web/src/components/memories-form-field.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
import { useFetchAllMemoryList } from '@/hooks/use-memory-request';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { RAGFlowFormItem } from './ragflow-form';
|
||||
import { MultiSelect } from './ui/multi-select';
|
||||
|
||||
type MemoriesFormFieldProps = {
|
||||
label: string;
|
||||
};
|
||||
|
||||
export function MemoriesFormField({ label }: MemoriesFormFieldProps) {
|
||||
const { t } = useTranslation();
|
||||
const memoryList = useFetchAllMemoryList();
|
||||
|
||||
const options = memoryList.data?.map((memory) => ({
|
||||
label: memory.name,
|
||||
value: memory.id,
|
||||
}));
|
||||
|
||||
return (
|
||||
<RAGFlowFormItem name="memory_ids" label={label}>
|
||||
{(field) => (
|
||||
<MultiSelect
|
||||
options={options || []}
|
||||
placeholder={t('common.pleaseSelect')}
|
||||
maxCount={100}
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
modalPopover
|
||||
/>
|
||||
)}
|
||||
</RAGFlowFormItem>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user