Fix: Highlight the edges after running #9538 (#9994)

### 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:
balibabu
2025-09-09 17:04:37 +08:00
committed by GitHub
parent 79076ffb5f
commit fcdde26a7f
5 changed files with 24 additions and 27 deletions

View File

@ -134,6 +134,7 @@ export function LlmSettingFieldItems({
label="temperature"
max={1}
step={0.01}
min={0}
></SliderInputSwitchFormField>
<SliderInputSwitchFormField
name={getFieldWithPrefix('top_p')}
@ -141,6 +142,7 @@ export function LlmSettingFieldItems({
label="topP"
max={1}
step={0.01}
min={0}
></SliderInputSwitchFormField>
<SliderInputSwitchFormField
name={getFieldWithPrefix('presence_penalty')}
@ -148,6 +150,7 @@ export function LlmSettingFieldItems({
label="presencePenalty"
max={1}
step={0.01}
min={0}
></SliderInputSwitchFormField>
<SliderInputSwitchFormField
name={getFieldWithPrefix('frequency_penalty')}
@ -155,12 +158,14 @@ export function LlmSettingFieldItems({
label="frequencyPenalty"
max={1}
step={0.01}
min={0}
></SliderInputSwitchFormField>
<SliderInputSwitchFormField
name={getFieldWithPrefix('max_tokens')}
checkName="maxTokensEnabled"
label="maxTokens"
max={128000}
min={0}
></SliderInputSwitchFormField>
</div>
);

View File

@ -38,7 +38,7 @@ export type DSLComponents = Record<string, IOperator>;
export interface DSL {
components: DSLComponents;
history: any[];
path?: string[][];
path?: string[];
answer?: any[];
graph?: IGraph;
messages: Message[];

View File

@ -39,7 +39,7 @@ function InnerButtonEdge({
targetPosition,
});
const selectedStyle = useMemo(() => {
return selected ? { strokeWidth: 1, stroke: 'rgba(76, 164, 231, 1)' } : {};
return selected ? { strokeWidth: 1, stroke: 'var(--accent-primary)' } : {};
}, [selected]);
const onEdgeClick = () => {
@ -49,31 +49,21 @@ function InnerButtonEdge({
// highlight the nodes that the workflow passes through
const { data: flowDetail } = useFetchAgent();
const graphPath = useMemo(() => {
// TODO: this will be called multiple times
const showHighlight = useMemo(() => {
const path = flowDetail?.dsl?.path ?? [];
// The second to last
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);
const idx = path.findIndex((x) => x === target);
if (idx !== -1) {
// The set of elements following source
const slicedGraphPath = graphPath.slice(idx + 1);
if (slicedGraphPath.some((x) => x === target)) {
return { strokeWidth: 1, stroke: 'red' };
let index = idx - 1;
while (index >= 0) {
if (path[index] === source) {
return { strokeWidth: 1, stroke: 'var(--accent-primary)' };
}
index--;
}
return {};
}
return {};
}, [source, target, graphPath]);
}, [flowDetail?.dsl?.path, source, target]);
const visible = useMemo(() => {
return (
@ -89,8 +79,8 @@ function InnerButtonEdge({
<BaseEdge
path={edgePath}
markerEnd={markerEnd}
style={{ ...style, ...selectedStyle, ...highlightStyle }}
className="text-text-secondary"
style={{ ...style, ...selectedStyle, ...showHighlight }}
className={cn('text-text-secondary')}
/>
<EdgeLabelRenderer>

View File

@ -107,9 +107,7 @@ const ChatContainer = () => {
const handleReset = () => {
resetSession();
clearEventList();
if (isTaskMode) {
showBeginParameterDialog();
}
showBeginParameterDialog();
};
if (!conversationId) {
return <div>empty</div>;

View File

@ -186,6 +186,7 @@ export function LlmSettingFieldItems({
checkName={getFieldWithPrefix('temperatureEnabled')}
label="temperature"
max={1}
min={0}
step={0.01}
onChange={() => {
checkParameterIsEquel();
@ -197,6 +198,7 @@ export function LlmSettingFieldItems({
label="topP"
max={1}
step={0.01}
min={0}
onChange={() => {
checkParameterIsEquel();
}}
@ -207,6 +209,7 @@ export function LlmSettingFieldItems({
label="presencePenalty"
max={1}
step={0.01}
min={0}
onChange={() => {
checkParameterIsEquel();
}}
@ -217,6 +220,7 @@ export function LlmSettingFieldItems({
label="frequencyPenalty"
max={1}
step={0.01}
min={0}
onChange={() => {
checkParameterIsEquel();
}}