mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
fix: fixed the issue where parameters of DuckDuckGo could not be saved to the backend after being dragged to the canvas #918 (#1503)
### What problem does this PR solve? fix: fixed the issue where parameters of DuckDuckGo could not be saved to the backend after being dragged to the canvas #918 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -8,6 +8,7 @@ import React, {
|
||||
KeyboardEventHandler,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { Connection, Edge, Node, Position, ReactFlowInstance } from 'reactflow';
|
||||
@ -30,9 +31,12 @@ import {
|
||||
NodeMap,
|
||||
Operator,
|
||||
RestrictedUpstreamMap,
|
||||
initialBaiduValues,
|
||||
initialBeginValues,
|
||||
initialCategorizeValues,
|
||||
initialDuckValues,
|
||||
initialGenerateValues,
|
||||
initialKeywordExtractValues,
|
||||
initialMessageValues,
|
||||
initialRelevantValues,
|
||||
initialRetrievalValues,
|
||||
@ -65,24 +69,30 @@ export const useSelectCanvasData = () => {
|
||||
export const useInitializeOperatorParams = () => {
|
||||
const llmId = useFetchModelId(true);
|
||||
|
||||
const initialFormValuesMap = useMemo(() => {
|
||||
return {
|
||||
[Operator.Begin]: initialBeginValues,
|
||||
[Operator.Retrieval]: initialRetrievalValues,
|
||||
[Operator.Generate]: { ...initialGenerateValues, llm_id: llmId },
|
||||
[Operator.Answer]: {},
|
||||
[Operator.Categorize]: { ...initialCategorizeValues, llm_id: llmId },
|
||||
[Operator.Relevant]: { ...initialRelevantValues, llm_id: llmId },
|
||||
[Operator.RewriteQuestion]: {
|
||||
...initialRewriteQuestionValues,
|
||||
llm_id: llmId,
|
||||
},
|
||||
[Operator.Message]: initialMessageValues,
|
||||
[Operator.KeywordExtract]: initialKeywordExtractValues,
|
||||
[Operator.DuckDuckGo]: initialDuckValues,
|
||||
[Operator.Baidu]: initialBaiduValues,
|
||||
};
|
||||
}, [llmId]);
|
||||
|
||||
const initializeOperatorParams = useCallback(
|
||||
(operatorName: Operator) => {
|
||||
const initialFormValuesMap = {
|
||||
[Operator.Begin]: initialBeginValues,
|
||||
[Operator.Retrieval]: initialRetrievalValues,
|
||||
[Operator.Generate]: { ...initialGenerateValues, llm_id: llmId },
|
||||
[Operator.Answer]: {},
|
||||
[Operator.Categorize]: { ...initialCategorizeValues, llm_id: llmId },
|
||||
[Operator.Relevant]: { ...initialRelevantValues, llm_id: llmId },
|
||||
[Operator.RewriteQuestion]: {
|
||||
...initialRewriteQuestionValues,
|
||||
llm_id: llmId,
|
||||
},
|
||||
[Operator.Message]: initialMessageValues,
|
||||
};
|
||||
return initialFormValuesMap[operatorName];
|
||||
},
|
||||
[llmId],
|
||||
[initialFormValuesMap],
|
||||
);
|
||||
|
||||
return initializeOperatorParams;
|
||||
|
||||
Reference in New Issue
Block a user