mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-25 16:26:51 +08:00
Feat: Support knowledge base type input in agent flow debugger (#7471)
### What problem does this PR solve? This is a follow-up of #7088 , adding a knowledge base type input to the `Begin` component, and a knowledge base selector to the agent flow debug input panel:  then you can select one or more knowledge bases when testing the agent:  Note: the lines changed in `agent/component/retrieval.py` after line 94 are modified by `ruff format` from the `pre-commit` hooks, no functional change. ### 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:
@ -56,6 +56,7 @@ import upperFirst from 'lodash/upperFirst';
|
||||
import {
|
||||
CirclePower,
|
||||
CloudUpload,
|
||||
Database,
|
||||
IterationCcw,
|
||||
ListOrdered,
|
||||
OptionIcon,
|
||||
@ -2949,6 +2950,7 @@ export enum BeginQueryType {
|
||||
File = 'file',
|
||||
Integer = 'integer',
|
||||
Boolean = 'boolean',
|
||||
KnowledgeBases = 'kb',
|
||||
}
|
||||
|
||||
export const BeginQueryTypeIconMap = {
|
||||
@ -2958,6 +2960,7 @@ export const BeginQueryTypeIconMap = {
|
||||
[BeginQueryType.File]: CloudUpload,
|
||||
[BeginQueryType.Integer]: ListOrdered,
|
||||
[BeginQueryType.Boolean]: ToggleLeft,
|
||||
[BeginQueryType.KnowledgeBases]: Database,
|
||||
};
|
||||
|
||||
export const NoDebugOperatorsList = [
|
||||
|
||||
@ -25,6 +25,7 @@ import { BeginQuery } from '../interface';
|
||||
import { PopoverForm } from './popover-form';
|
||||
|
||||
import styles from './index.less';
|
||||
import KnowledgeBaseItem from '@/components/knowledge-base-item';
|
||||
|
||||
interface IProps {
|
||||
parameters: BeginQuery[];
|
||||
@ -164,6 +165,13 @@ const DebugContent = ({
|
||||
<Switch></Switch>
|
||||
</Form.Item>
|
||||
),
|
||||
[BeginQueryType.KnowledgeBases]: (
|
||||
<KnowledgeBaseItem
|
||||
name={idx.toString()}
|
||||
label={q.name || q.key}
|
||||
required={!q.optional}
|
||||
></KnowledgeBaseItem>
|
||||
)
|
||||
};
|
||||
|
||||
return (
|
||||
@ -182,12 +190,16 @@ const DebugContent = ({
|
||||
if (Array.isArray(value)) {
|
||||
nextValue = ``;
|
||||
|
||||
value.forEach((x) => {
|
||||
nextValue +=
|
||||
x?.originFileObj instanceof File
|
||||
? `${x.name}\n${x.response?.data}\n----\n`
|
||||
: `${x.url}\n${x.result}\n----\n`;
|
||||
});
|
||||
if (item.type === 'kb') {
|
||||
nextValue = value.join(',')
|
||||
} else {
|
||||
value.forEach((x) => {
|
||||
nextValue +=
|
||||
x?.originFileObj instanceof File
|
||||
? `${x.name}\n${x.response?.data}\n----\n`
|
||||
: `${x.url}\n${x.result}\n----\n`;
|
||||
});
|
||||
}
|
||||
}
|
||||
return { ...item, value: nextValue };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user