mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Highlight the edges after running #9538 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -134,6 +134,7 @@ export function LlmSettingFieldItems({
|
|||||||
label="temperature"
|
label="temperature"
|
||||||
max={1}
|
max={1}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
min={0}
|
||||||
></SliderInputSwitchFormField>
|
></SliderInputSwitchFormField>
|
||||||
<SliderInputSwitchFormField
|
<SliderInputSwitchFormField
|
||||||
name={getFieldWithPrefix('top_p')}
|
name={getFieldWithPrefix('top_p')}
|
||||||
@ -141,6 +142,7 @@ export function LlmSettingFieldItems({
|
|||||||
label="topP"
|
label="topP"
|
||||||
max={1}
|
max={1}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
min={0}
|
||||||
></SliderInputSwitchFormField>
|
></SliderInputSwitchFormField>
|
||||||
<SliderInputSwitchFormField
|
<SliderInputSwitchFormField
|
||||||
name={getFieldWithPrefix('presence_penalty')}
|
name={getFieldWithPrefix('presence_penalty')}
|
||||||
@ -148,6 +150,7 @@ export function LlmSettingFieldItems({
|
|||||||
label="presencePenalty"
|
label="presencePenalty"
|
||||||
max={1}
|
max={1}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
min={0}
|
||||||
></SliderInputSwitchFormField>
|
></SliderInputSwitchFormField>
|
||||||
<SliderInputSwitchFormField
|
<SliderInputSwitchFormField
|
||||||
name={getFieldWithPrefix('frequency_penalty')}
|
name={getFieldWithPrefix('frequency_penalty')}
|
||||||
@ -155,12 +158,14 @@ export function LlmSettingFieldItems({
|
|||||||
label="frequencyPenalty"
|
label="frequencyPenalty"
|
||||||
max={1}
|
max={1}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
min={0}
|
||||||
></SliderInputSwitchFormField>
|
></SliderInputSwitchFormField>
|
||||||
<SliderInputSwitchFormField
|
<SliderInputSwitchFormField
|
||||||
name={getFieldWithPrefix('max_tokens')}
|
name={getFieldWithPrefix('max_tokens')}
|
||||||
checkName="maxTokensEnabled"
|
checkName="maxTokensEnabled"
|
||||||
label="maxTokens"
|
label="maxTokens"
|
||||||
max={128000}
|
max={128000}
|
||||||
|
min={0}
|
||||||
></SliderInputSwitchFormField>
|
></SliderInputSwitchFormField>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export type DSLComponents = Record<string, IOperator>;
|
|||||||
export interface DSL {
|
export interface DSL {
|
||||||
components: DSLComponents;
|
components: DSLComponents;
|
||||||
history: any[];
|
history: any[];
|
||||||
path?: string[][];
|
path?: string[];
|
||||||
answer?: any[];
|
answer?: any[];
|
||||||
graph?: IGraph;
|
graph?: IGraph;
|
||||||
messages: Message[];
|
messages: Message[];
|
||||||
|
|||||||
@ -39,7 +39,7 @@ function InnerButtonEdge({
|
|||||||
targetPosition,
|
targetPosition,
|
||||||
});
|
});
|
||||||
const selectedStyle = useMemo(() => {
|
const selectedStyle = useMemo(() => {
|
||||||
return selected ? { strokeWidth: 1, stroke: 'rgba(76, 164, 231, 1)' } : {};
|
return selected ? { strokeWidth: 1, stroke: 'var(--accent-primary)' } : {};
|
||||||
}, [selected]);
|
}, [selected]);
|
||||||
|
|
||||||
const onEdgeClick = () => {
|
const onEdgeClick = () => {
|
||||||
@ -49,31 +49,21 @@ function InnerButtonEdge({
|
|||||||
// highlight the nodes that the workflow passes through
|
// highlight the nodes that the workflow passes through
|
||||||
const { data: flowDetail } = useFetchAgent();
|
const { data: flowDetail } = useFetchAgent();
|
||||||
|
|
||||||
const graphPath = useMemo(() => {
|
const showHighlight = useMemo(() => {
|
||||||
// TODO: this will be called multiple times
|
|
||||||
const path = flowDetail?.dsl?.path ?? [];
|
const path = flowDetail?.dsl?.path ?? [];
|
||||||
// The second to last
|
const idx = path.findIndex((x) => x === target);
|
||||||
const previousGraphPath: string[] = path.at(-2) ?? [];
|
|
||||||
let graphPath: string[] = path.at(-1) ?? [];
|
|
||||||
// The last of the second to last article
|
|
||||||
const previousLatestElement = previousGraphPath.at(-1);
|
|
||||||
if (previousGraphPath.length > 0 && previousLatestElement) {
|
|
||||||
graphPath = [previousLatestElement, ...graphPath];
|
|
||||||
}
|
|
||||||
return Array.isArray(graphPath) ? graphPath : [];
|
|
||||||
}, [flowDetail.dsl?.path]);
|
|
||||||
|
|
||||||
const highlightStyle = useMemo(() => {
|
|
||||||
const idx = graphPath.findIndex((x) => x === source);
|
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
// The set of elements following source
|
let index = idx - 1;
|
||||||
const slicedGraphPath = graphPath.slice(idx + 1);
|
while (index >= 0) {
|
||||||
if (slicedGraphPath.some((x) => x === target)) {
|
if (path[index] === source) {
|
||||||
return { strokeWidth: 1, stroke: 'red' };
|
return { strokeWidth: 1, stroke: 'var(--accent-primary)' };
|
||||||
}
|
}
|
||||||
|
index--;
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}, [source, target, graphPath]);
|
}
|
||||||
|
return {};
|
||||||
|
}, [flowDetail?.dsl?.path, source, target]);
|
||||||
|
|
||||||
const visible = useMemo(() => {
|
const visible = useMemo(() => {
|
||||||
return (
|
return (
|
||||||
@ -89,8 +79,8 @@ function InnerButtonEdge({
|
|||||||
<BaseEdge
|
<BaseEdge
|
||||||
path={edgePath}
|
path={edgePath}
|
||||||
markerEnd={markerEnd}
|
markerEnd={markerEnd}
|
||||||
style={{ ...style, ...selectedStyle, ...highlightStyle }}
|
style={{ ...style, ...selectedStyle, ...showHighlight }}
|
||||||
className="text-text-secondary"
|
className={cn('text-text-secondary')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EdgeLabelRenderer>
|
<EdgeLabelRenderer>
|
||||||
|
|||||||
@ -107,9 +107,7 @@ const ChatContainer = () => {
|
|||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
resetSession();
|
resetSession();
|
||||||
clearEventList();
|
clearEventList();
|
||||||
if (isTaskMode) {
|
|
||||||
showBeginParameterDialog();
|
showBeginParameterDialog();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if (!conversationId) {
|
if (!conversationId) {
|
||||||
return <div>empty</div>;
|
return <div>empty</div>;
|
||||||
|
|||||||
@ -186,6 +186,7 @@ export function LlmSettingFieldItems({
|
|||||||
checkName={getFieldWithPrefix('temperatureEnabled')}
|
checkName={getFieldWithPrefix('temperatureEnabled')}
|
||||||
label="temperature"
|
label="temperature"
|
||||||
max={1}
|
max={1}
|
||||||
|
min={0}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
checkParameterIsEquel();
|
checkParameterIsEquel();
|
||||||
@ -197,6 +198,7 @@ export function LlmSettingFieldItems({
|
|||||||
label="topP"
|
label="topP"
|
||||||
max={1}
|
max={1}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
min={0}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
checkParameterIsEquel();
|
checkParameterIsEquel();
|
||||||
}}
|
}}
|
||||||
@ -207,6 +209,7 @@ export function LlmSettingFieldItems({
|
|||||||
label="presencePenalty"
|
label="presencePenalty"
|
||||||
max={1}
|
max={1}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
min={0}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
checkParameterIsEquel();
|
checkParameterIsEquel();
|
||||||
}}
|
}}
|
||||||
@ -217,6 +220,7 @@ export function LlmSettingFieldItems({
|
|||||||
label="frequencyPenalty"
|
label="frequencyPenalty"
|
||||||
max={1}
|
max={1}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
min={0}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
checkParameterIsEquel();
|
checkParameterIsEquel();
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user