Feat: Support passing knowledge base id as variable in retrieval component (#7088)

### What problem does this PR solve?

Fix #6600

Hello, I have the same business requirement as #6600. My use case is: 

We have many departments (> 20 now and increasing), and each department
has its own knowledge base. Because the agent workflow is the same, so I
want to change the knowledge base on the fly, instead of creating agents
for every department.

It now looks like this:


![屏幕截图_20250416_212622](https://github.com/user-attachments/assets/5cb3dade-d4fb-4591-ade3-4b9c54387911)

Knowledge bases can be selected from the dropdown, and passed through
the variables in the table. All selected knowledge bases are used for
retrieval.

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
This commit is contained in:
Song Fuchang
2025-04-30 15:32:14 +08:00
committed by GitHub
parent f56b651acb
commit 6e7dd54a50
7 changed files with 90 additions and 43 deletions

View File

@ -10,11 +10,13 @@ import { FormControl, FormField, FormItem, FormLabel } from './ui/form';
import { MultiSelect } from './ui/multi-select';
interface KnowledgeBaseItemProps {
tooltipText?: string;
required?: boolean;
onChange?(): void;
}
const KnowledgeBaseItem = ({
tooltipText,
required = true,
onChange,
}: KnowledgeBaseItemProps) => {
@ -40,7 +42,7 @@ const KnowledgeBaseItem = ({
<Form.Item
label={t('knowledgeBases')}
name="kb_ids"
tooltip={t('knowledgeBasesTip')}
tooltip={tooltipText || t('knowledgeBasesTip')}
rules={[
{
required,