mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-05 07:10:29 +08:00
Fix: The dataset for the retrieval operator of the agent created from the template cannot be selected. (#17760)
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
"description": "Retrieve papers, reports, datasets, and notes that ground CAJAL scientific writing outputs.",
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -254,6 +255,7 @@
|
||||
"description": "Retrieve papers, reports, datasets, and notes that ground CAJAL scientific writing outputs.",
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
"description": "",
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -260,6 +261,7 @@
|
||||
"description": "",
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
|
||||
@@ -241,6 +241,7 @@
|
||||
"kb_ids": [
|
||||
"a5aaec4a819b11f095f1047c16ec874f"
|
||||
],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -272,6 +273,7 @@
|
||||
"kb_ids": [
|
||||
"65cb5150819b11f08347047c16ec874f"
|
||||
],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"meta_data_filter": {},
|
||||
"outputs": {
|
||||
@@ -593,6 +595,7 @@
|
||||
"kb_ids": [
|
||||
"65cb5150819b11f08347047c16ec874f"
|
||||
],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"meta_data_filter": {},
|
||||
"outputs": {
|
||||
@@ -693,6 +696,7 @@
|
||||
"kb_ids": [
|
||||
"a5aaec4a819b11f095f1047c16ec874f"
|
||||
],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
"kb_ids": [
|
||||
"60c53ed89acc11f0bc1e7a2a6d0b2755"
|
||||
],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -1009,6 +1010,7 @@
|
||||
"kb_ids": [
|
||||
"60c53ed89acc11f0bc1e7a2a6d0b2755"
|
||||
],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -146,6 +147,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -175,6 +177,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -344,6 +347,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -382,6 +386,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -420,6 +425,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
"description": "",
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -418,6 +419,7 @@
|
||||
"description": "",
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
|
||||
@@ -260,6 +260,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
@@ -604,6 +605,7 @@
|
||||
"cross_languages": [],
|
||||
"empty_response": "",
|
||||
"kb_ids": [],
|
||||
"retrieval_from": "dataset",
|
||||
"keywords_similarity_weight": 0.7,
|
||||
"outputs": {
|
||||
"formalized_content": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@ import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { lowerFirst } from 'lodash';
|
||||
import { ArrowUpRight, CirclePlay, X } from 'lucide-react';
|
||||
import { MouseEventHandler } from 'react';
|
||||
import { Operator } from '../constant';
|
||||
import { AgentFormContext } from '../context';
|
||||
import { RunTooltip } from '../flow-tooltip';
|
||||
@@ -34,6 +35,11 @@ const EmptyContent = () => <div></div>;
|
||||
const SandboxQuickstartUrl =
|
||||
'https://github.com/infiniflow/ragflow/blob/main/docs/guides/agent/agent_quickstarts/sandbox_quickstart.md';
|
||||
|
||||
const openSandboxQuickstart: MouseEventHandler<HTMLButtonElement> = (e) => {
|
||||
e.stopPropagation();
|
||||
window.open(SandboxQuickstartUrl, '_blank', 'noopener,noreferrer');
|
||||
};
|
||||
|
||||
const FormSheet = ({
|
||||
visible,
|
||||
hideModal,
|
||||
@@ -108,14 +114,7 @@ const FormSheet = ({
|
||||
size="icon"
|
||||
className="ml-1 inline-flex size-5 !p-0 align-middle bg-transparent"
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
window.open(
|
||||
SandboxQuickstartUrl,
|
||||
'_blank',
|
||||
'noopener,noreferrer',
|
||||
);
|
||||
}}
|
||||
onClick={openSandboxQuickstart}
|
||||
>
|
||||
<ArrowUpRight className="size-4 cursor-pointer text-text-secondary" />
|
||||
</Button>
|
||||
|
||||
@@ -11,7 +11,7 @@ export function useWatchFormChange(id?: string, form?: UseFormReturn<any>) {
|
||||
if (id) {
|
||||
values = form?.getValues();
|
||||
|
||||
updateNodeForm(id, { ...values, items: values.items?.slice() || [] });
|
||||
updateNodeForm(id, { ...values, items: values.items || [] });
|
||||
}
|
||||
}, [id, updateNodeForm, values]);
|
||||
}
|
||||
|
||||
@@ -216,10 +216,7 @@ const useGraphStore = create<RFState>()(
|
||||
clickedToolId: '',
|
||||
onNodesChange: (changes) => {
|
||||
set({
|
||||
nodes: applyNodeChanges(
|
||||
changes, // The issue of errors when using templates was resolved by using cloneDeep.
|
||||
cloneDeep(get().nodes) as RAGFlowNodeType[], // Cannot assign to read only property 'width' of object '#<Object>'
|
||||
),
|
||||
nodes: applyNodeChanges(changes, get().nodes),
|
||||
});
|
||||
},
|
||||
onEdgesChange: (changes: EdgeChange[]) => {
|
||||
@@ -527,38 +524,31 @@ const useGraphStore = create<RFState>()(
|
||||
values: any,
|
||||
path: (string | number)[] = [],
|
||||
) => {
|
||||
const nextNodes = get().nodes.map((node) => {
|
||||
if (node.id === nodeId) {
|
||||
let nextForm: Record<string, unknown> = { ...node.data.form };
|
||||
if (path.length === 0) {
|
||||
nextForm = Object.assign(nextForm, values);
|
||||
} else {
|
||||
lodashSet(nextForm, path, values);
|
||||
}
|
||||
return {
|
||||
...node,
|
||||
data: {
|
||||
...node.data,
|
||||
form: nextForm,
|
||||
},
|
||||
} as any;
|
||||
set((state) => {
|
||||
const node = state.nodes.find((x) => x.id === nodeId);
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
const form = (node.data.form ??= {});
|
||||
// Deep clone to decouple from react-hook-form's internal values:
|
||||
// immer freezes the produced state, and RHF keeps mutating the same
|
||||
// nested references afterwards, which would throw on frozen arrays.
|
||||
if (path.length === 0) {
|
||||
Object.assign(form, cloneDeep(values));
|
||||
} else {
|
||||
lodashSet(form, path, cloneDeep(values));
|
||||
}
|
||||
|
||||
return node;
|
||||
});
|
||||
set({
|
||||
nodes: nextNodes,
|
||||
});
|
||||
|
||||
return nextNodes;
|
||||
return get().nodes;
|
||||
},
|
||||
replaceNodeForm(nodeId, values) {
|
||||
if (nodeId) {
|
||||
set((state) => {
|
||||
for (const node of state.nodes) {
|
||||
if (node.id === nodeId) {
|
||||
//cloneDeep Solving the issue of react-hook-form errors
|
||||
node.data.form = cloneDeep(values); // TypeError: Cannot assign to read only property '0' of object '[object Array]'
|
||||
// See updateNodeForm for why the deep clone is needed.
|
||||
node.data.form = cloneDeep(values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user