mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-10 21:55:42 +08:00
Feat: Add a user_id field to the message and retrieval operators. (#13508)
### What problem does this PR solve? Feat: Add a user_id field to the message and retrieval operators. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -1839,6 +1839,7 @@ Example: Virtual Hosted Style`,
|
||||
dbType: 'Database type',
|
||||
database: 'Database',
|
||||
username: 'Username',
|
||||
userId: 'User id',
|
||||
host: 'Host',
|
||||
port: 'Port',
|
||||
password: 'Password',
|
||||
|
||||
@@ -1599,6 +1599,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
|
||||
dbType: '数据库类型',
|
||||
database: '数据库',
|
||||
username: '用户名',
|
||||
userId: '用户 ID',
|
||||
host: '主机',
|
||||
port: '端口',
|
||||
password: '密码',
|
||||
|
||||
13
web/src/pages/agent/form/components/user-id-form-field.tsx
Normal file
13
web/src/pages/agent/form/components/user-id-form-field.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { RAGFlowFormItem } from '@/components/ragflow-form';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { PromptEditor } from './prompt-editor';
|
||||
|
||||
export function UserIdFormField() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<RAGFlowFormItem name="user_id" label={t('flow.userId')}>
|
||||
<PromptEditor multiLine={false} showToolbar={false}></PromptEditor>
|
||||
</RAGFlowFormItem>
|
||||
);
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import { ExportFileType } from '../../constant';
|
||||
import { INextOperatorForm } from '../../interface';
|
||||
import { FormWrapper } from '../components/form-wrapper';
|
||||
import { PromptEditor } from '../components/prompt-editor';
|
||||
import { UserIdFormField } from '../components/user-id-form-field';
|
||||
import { useShowWebhookResponseStatus } from './use-show-response-status';
|
||||
import { useValues } from './use-values';
|
||||
import { useWatchFormChange } from './use-watch-change';
|
||||
@@ -42,6 +43,7 @@ function MessageForm({ node }: INextOperatorForm) {
|
||||
auto_play: z.boolean().optional(),
|
||||
status: z.number().optional(),
|
||||
memory_ids: z.array(z.string()).optional(),
|
||||
user_id: z.string().optional(),
|
||||
});
|
||||
|
||||
const form = useForm({
|
||||
@@ -163,6 +165,7 @@ function MessageForm({ node }: INextOperatorForm) {
|
||||
</>
|
||||
)}
|
||||
<MemoriesFormField label={t('flow.saveToMemory')}></MemoriesFormField>
|
||||
<UserIdFormField></UserIdFormField>
|
||||
</FormWrapper>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -38,6 +38,7 @@ import { INextOperatorForm } from '../../interface';
|
||||
import { FormWrapper } from '../components/form-wrapper';
|
||||
import { Output } from '../components/output';
|
||||
import { PromptEditor } from '../components/prompt-editor';
|
||||
import { UserIdFormField } from '../components/user-id-form-field';
|
||||
import { useValues } from './use-values';
|
||||
|
||||
export const RetrievalPartialSchema = {
|
||||
@@ -54,6 +55,7 @@ export const RetrievalPartialSchema = {
|
||||
...MetadataFilterSchema,
|
||||
memory_ids: z.array(z.string()).optional(),
|
||||
retrieval_from: z.string(),
|
||||
user_id: z.string().optional(),
|
||||
};
|
||||
|
||||
export const FormSchema = z.object({
|
||||
@@ -82,7 +84,10 @@ export function MemoryDatasetForm() {
|
||||
</Radio.Group>
|
||||
</RAGFlowFormItem>
|
||||
{retrievalFrom === RetrievalFrom.Memory ? (
|
||||
<MemoriesFormField label={t('header.memories')}></MemoriesFormField>
|
||||
<>
|
||||
<MemoriesFormField label={t('header.memories')}></MemoriesFormField>
|
||||
<UserIdFormField></UserIdFormField>
|
||||
</>
|
||||
) : (
|
||||
<KnowledgeBaseFormField showVariable></KnowledgeBaseFormField>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user