mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 17:16:52 +08:00
Fix: Fixed the issue of empty memory parameters (#11988)
### What problem does this PR solve? Fix: Fixed the issue of empty memory parameters ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -10,17 +10,17 @@ import { useState } from 'react';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const advancedSettingsFormSchema = {
|
||||
permission: z.string().optional(),
|
||||
permissions: z.string().optional(),
|
||||
storage_type: z.enum(['table', 'graph']).optional(),
|
||||
forget_policy: z.enum(['lru', 'fifo']).optional(),
|
||||
forgetting_policy: z.enum(['lru', 'fifo']).optional(),
|
||||
temperature: z.number().optional(),
|
||||
system_prompt: z.string().optional(),
|
||||
user_prompt: z.string().optional(),
|
||||
};
|
||||
export const defaultAdvancedSettingsForm = {
|
||||
permission: 'me',
|
||||
permissions: 'me',
|
||||
storage_type: 'table',
|
||||
forget_policy: 'fifo',
|
||||
forgetting_policy: 'fifo',
|
||||
temperature: 0.7,
|
||||
system_prompt: '',
|
||||
user_prompt: '',
|
||||
@ -40,120 +40,120 @@ export const AdvancedSettingsForm = () => {
|
||||
)}
|
||||
{t('memory.config.advancedSettings')}
|
||||
</div>
|
||||
{/* {showAdvancedSettings && ( */}
|
||||
<>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'permission',
|
||||
label: t('memory.config.permission'),
|
||||
required: false,
|
||||
horizontal: true,
|
||||
// hideLabel: true,
|
||||
type: FormFieldType.Custom,
|
||||
render: (field) => (
|
||||
<RadioGroup
|
||||
defaultValue="me"
|
||||
className="flex"
|
||||
{...field}
|
||||
onValueChange={(value) => {
|
||||
console.log(value);
|
||||
field.onChange(value);
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<RadioGroupItem value="me" id="r1" />
|
||||
<Label htmlFor="r1">{t('memory.config.onlyMe')}</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<RadioGroupItem value="team" id="r2" />
|
||||
<Label htmlFor="r2">{t('memory.config.team')}</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'storage_type',
|
||||
label: t('memory.config.storageType'),
|
||||
type: FormFieldType.Select,
|
||||
horizontal: true,
|
||||
placeholder: t('memory.config.storageTypePlaceholder'),
|
||||
options: [
|
||||
{ label: 'table', value: 'table' },
|
||||
// { label: 'graph', value: 'graph' },
|
||||
],
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'forget_policy',
|
||||
label: t('memory.config.forgetPolicy'),
|
||||
type: FormFieldType.Select,
|
||||
horizontal: true,
|
||||
// placeholder: t('memory.config.storageTypePlaceholder'),
|
||||
options: [
|
||||
// { label: 'lru', value: 'lru' },
|
||||
{ label: 'fifo', value: 'fifo' },
|
||||
],
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'temperature',
|
||||
label: t('memory.config.temperature'),
|
||||
type: FormFieldType.Custom,
|
||||
horizontal: true,
|
||||
required: false,
|
||||
render: (field) => (
|
||||
<div className="flex gap-2 items-center">
|
||||
<SingleFormSlider
|
||||
{showAdvancedSettings && (
|
||||
<>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'permissions',
|
||||
label: t('memory.config.permission'),
|
||||
required: false,
|
||||
horizontal: true,
|
||||
// hideLabel: true,
|
||||
type: FormFieldType.Custom,
|
||||
render: (field) => (
|
||||
<RadioGroup
|
||||
defaultValue="me"
|
||||
className="flex"
|
||||
{...field}
|
||||
onChange={(value: number) => {
|
||||
onValueChange={(value) => {
|
||||
console.log(value);
|
||||
field.onChange(value);
|
||||
}}
|
||||
max={1}
|
||||
step={0.01}
|
||||
min={0}
|
||||
disabled={false}
|
||||
></SingleFormSlider>
|
||||
<NumberInput
|
||||
className={cn(
|
||||
'h-6 w-10 p-1 border border-border-button rounded-sm',
|
||||
)}
|
||||
max={1}
|
||||
step={0.01}
|
||||
min={0}
|
||||
{...field}
|
||||
></NumberInput>
|
||||
</div>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'system_prompt',
|
||||
label: t('memory.config.systemPrompt'),
|
||||
type: FormFieldType.Textarea,
|
||||
horizontal: true,
|
||||
placeholder: t('memory.config.systemPromptPlaceholder'),
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'user_prompt',
|
||||
label: t('memory.config.userPrompt'),
|
||||
type: FormFieldType.Text,
|
||||
horizontal: true,
|
||||
placeholder: t('memory.config.userPromptPlaceholder'),
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
{/* )} */}
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<RadioGroupItem value="me" id="r1" />
|
||||
<Label htmlFor="r1">{t('memory.config.onlyMe')}</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<RadioGroupItem value="team" id="r2" />
|
||||
<Label htmlFor="r2">{t('memory.config.team')}</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'storage_type',
|
||||
label: t('memory.config.storageType'),
|
||||
type: FormFieldType.Select,
|
||||
horizontal: true,
|
||||
placeholder: t('memory.config.storageTypePlaceholder'),
|
||||
options: [
|
||||
{ label: 'table', value: 'table' },
|
||||
// { label: 'graph', value: 'graph' },
|
||||
],
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'forgetting_policy',
|
||||
label: t('memory.config.forgetPolicy'),
|
||||
type: FormFieldType.Select,
|
||||
horizontal: true,
|
||||
// placeholder: t('memory.config.storageTypePlaceholder'),
|
||||
options: [
|
||||
// { label: 'lru', value: 'lru' },
|
||||
{ label: 'fifo', value: 'fifo' },
|
||||
],
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'temperature',
|
||||
label: t('memory.config.temperature'),
|
||||
type: FormFieldType.Custom,
|
||||
horizontal: true,
|
||||
required: false,
|
||||
render: (field) => (
|
||||
<div className="flex gap-2 items-center">
|
||||
<SingleFormSlider
|
||||
{...field}
|
||||
onChange={(value: number) => {
|
||||
field.onChange(value);
|
||||
}}
|
||||
max={1}
|
||||
step={0.01}
|
||||
min={0}
|
||||
disabled={false}
|
||||
></SingleFormSlider>
|
||||
<NumberInput
|
||||
className={cn(
|
||||
'h-6 w-10 p-1 border border-border-button rounded-sm',
|
||||
)}
|
||||
max={1}
|
||||
step={0.01}
|
||||
min={0}
|
||||
{...field}
|
||||
></NumberInput>
|
||||
</div>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'system_prompt',
|
||||
label: t('memory.config.systemPrompt'),
|
||||
type: FormFieldType.Textarea,
|
||||
horizontal: true,
|
||||
placeholder: t('memory.config.systemPromptPlaceholder'),
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
<RenderField
|
||||
field={{
|
||||
name: 'user_prompt',
|
||||
label: t('memory.config.userPrompt'),
|
||||
type: FormFieldType.Text,
|
||||
horizontal: true,
|
||||
placeholder: t('memory.config.userPromptPlaceholder'),
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user