mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-04 17:45:07 +08:00
Feature:memory function complete (#11982)
### What problem does this PR solve? memory function complete ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,41 +1,63 @@
|
||||
import { FormFieldConfig, FormFieldType } from '@/components/dynamic-form';
|
||||
import { EmbeddingSelect } from '@/pages/dataset/dataset-setting/configuration/common-item';
|
||||
import { t } from 'i18next';
|
||||
import { TFunction } from 'i18next';
|
||||
export enum MemoryType {
|
||||
Raw = 'raw',
|
||||
Semantic = 'semantic',
|
||||
Episodic = 'episodic',
|
||||
Procedural = 'procedural',
|
||||
}
|
||||
export const createMemoryFields = (t: TFunction) =>
|
||||
[
|
||||
{
|
||||
name: 'name',
|
||||
label: t('memories.name'),
|
||||
placeholder: t('memories.memoryNamePlaceholder'),
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'memory_type',
|
||||
label: t('memories.memoryType'),
|
||||
type: FormFieldType.MultiSelect,
|
||||
placeholder: t('memories.descriptionPlaceholder'),
|
||||
tooltip: t('memories.memoryTypeTooltip'),
|
||||
options: [
|
||||
{ label: 'Raw', value: MemoryType.Raw },
|
||||
{ label: 'Semantic', value: MemoryType.Semantic },
|
||||
{ label: 'Episodic', value: MemoryType.Episodic },
|
||||
{ label: 'Procedural', value: MemoryType.Procedural },
|
||||
],
|
||||
required: true,
|
||||
customValidate: (value) => {
|
||||
if (!value.includes(MemoryType.Raw) || !value.length) {
|
||||
return t('memories.embeddingModelError');
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'embd_id',
|
||||
label: t('memories.embeddingModel'),
|
||||
placeholder: t('memories.selectModel'),
|
||||
tooltip: t('memories.embeddingModelTooltip'),
|
||||
required: true,
|
||||
// hideLabel: true,
|
||||
// type: 'custom',
|
||||
render: (field) => <EmbeddingSelect field={field} isEdit={false} />,
|
||||
},
|
||||
{
|
||||
name: 'llm_id',
|
||||
label: t('memories.llm'),
|
||||
placeholder: t('memories.selectModel'),
|
||||
required: true,
|
||||
type: FormFieldType.Select,
|
||||
tooltip: t('memories.llmTooltip'),
|
||||
},
|
||||
] as FormFieldConfig[];
|
||||
|
||||
export const createMemoryFields = [
|
||||
{
|
||||
name: 'name',
|
||||
label: t('memories.name'),
|
||||
placeholder: t('memories.memoryNamePlaceholder'),
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'memory_type',
|
||||
label: t('memories.memoryType'),
|
||||
type: FormFieldType.MultiSelect,
|
||||
placeholder: t('memories.descriptionPlaceholder'),
|
||||
options: [
|
||||
{ label: 'Raw', value: 'raw' },
|
||||
{ label: 'Semantic', value: 'semantic' },
|
||||
{ label: 'Episodic', value: 'episodic' },
|
||||
{ label: 'Procedural', value: 'procedural' },
|
||||
],
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'embd_id',
|
||||
label: t('memories.embeddingModel'),
|
||||
placeholder: t('memories.selectModel'),
|
||||
required: true,
|
||||
// hideLabel: true,
|
||||
// type: 'custom',
|
||||
render: (field) => <EmbeddingSelect field={field} isEdit={false} />,
|
||||
},
|
||||
{
|
||||
name: 'llm_id',
|
||||
label: t('memories.llm'),
|
||||
placeholder: t('memories.selectModel'),
|
||||
required: true,
|
||||
type: FormFieldType.Select,
|
||||
},
|
||||
] as FormFieldConfig[];
|
||||
export const defaultMemoryFields = {
|
||||
name: '',
|
||||
memory_type: [MemoryType.Raw],
|
||||
embd_id: '',
|
||||
llm_id: '',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user