Skip to content

Commit 262660c

Browse files
author
Roman Snapko
committed
Remove stepDisplayName and stepIndex from step context structure and related logic
1 parent 299fc5d commit 262660c

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

packages/react-ui/src/app/features/ai/lib/enrich-context.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,10 @@ export const createAdditionalContext = (
2222
flowId: flowVersion.flowId,
2323
flowVersionId: flowVersion.id,
2424
runId,
25-
currentStepId: stepData?.id ?? '',
26-
currentStepDisplayName: stepData?.displayName ?? '',
2725
currentStepIndex: stepData?.stepIndex,
2826
steps: [
2927
{
3028
id: stepData?.id ?? '',
31-
stepDisplayName: stepData?.displayName ?? '',
32-
stepIndex: stepData?.stepIndex,
3329
variables: variables.length > 0 ? variables : undefined,
3430
},
3531
],

packages/server/api/src/app/ai/chat/context-enrichment.service.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ async function enrichSteps(
181181
} catch (error) {
182182
return {
183183
id: step.id,
184-
stepDisplayName: step.stepDisplayName,
185-
stepIndex: step.stepIndex,
186184
variables: step.variables?.map((variable) => ({
187185
name: variable.name,
188186
value: String(error),
@@ -203,8 +201,6 @@ async function enrichStep(
203201
if (!step.variables || step.variables.length === 0) {
204202
return {
205203
id: step.id,
206-
stepDisplayName: step.stepDisplayName,
207-
stepIndex: step.stepIndex,
208204
variables: step.variables,
209205
};
210206
}
@@ -217,8 +213,6 @@ async function enrichStep(
217213

218214
return {
219215
id: step.id,
220-
stepDisplayName: step.stepDisplayName,
221-
stepIndex: step.stepIndex,
222216
variables: resolvedVariables,
223217
};
224218
}
@@ -256,11 +250,20 @@ async function resolveVariable(
256250
flowData: FlowData,
257251
projectId: string,
258252
): Promise<{ name: string; value: unknown }> {
253+
const workflowStep = flowHelper.getStepById(flowData.flow.version, step.id);
254+
255+
if (!workflowStep) {
256+
return {
257+
name: variable.name,
258+
value: 'Failed to resolve variable: Step not found in flow.',
259+
};
260+
}
261+
259262
const { result } = await engineRunner.executeVariable(flowData.engineToken, {
260263
variableExpression: variable.value,
261264
flowVersion: flowData.flow.version,
262265
projectId,
263-
stepName: step.stepDisplayName,
266+
stepName: workflowStep.name,
264267
stepTestOutputs: flowData.stepTestOutputs,
265268
});
266269

packages/shared/src/lib/ai/chat/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ export type VariableContext = Static<typeof VariableContext>;
4343

4444
export const StepContext = Type.Object({
4545
id: Type.String(),
46-
stepDisplayName: Type.String(),
47-
stepIndex: Type.Optional(Type.Number()),
4846
variables: Type.Optional(Type.Array(VariableContext)),
4947
});
5048
export type StepContext = Static<typeof StepContext>;

0 commit comments

Comments
 (0)