diff --git a/frontend/src/lib/components/copilot/IteratorGen.svelte b/frontend/src/lib/components/copilot/IteratorGen.svelte
index 140672620e..1f2ed94a63 100644
--- a/frontend/src/lib/components/copilot/IteratorGen.svelte
+++ b/frontend/src/lib/components/copilot/IteratorGen.svelte
@@ -3,7 +3,7 @@
import Button from '../common/button/Button.svelte'
import { getNonStreamingCompletion } from './lib'
import { sendUserToast } from '$lib/toast'
- import type { InputTransform } from '$lib/gen'
+ import type { Flow, InputTransform } from '$lib/gen'
import ManualPopover from '../ManualPopover.svelte'
import { createEventDispatcher, getContext } from 'svelte'
import type { FlowEditorContext } from '../flows/types'
@@ -13,6 +13,7 @@
import { dfs } from '../flows/dfs'
import { yamlStringifyExceptKeys } from './utils'
import { copilotInfo, stepInputCompletionEnabled } from '$lib/stores'
+ import { twMerge } from 'tailwind-merge'
let generatedContent = ''
let loading = false
@@ -36,7 +37,8 @@
}
abortController = new AbortController()
loading = true
- const idOrders = dfs($flowStore.value.modules, (x) => x.id)
+ const flow: Flow = JSON.parse(JSON.stringify($flowStore))
+ const idOrders = dfs(flow.value.modules, (x) => x.id)
const upToIndex = idOrders.indexOf($selectedId)
if (upToIndex === -1) {
throw new Error('Could not find the selected id in the flow')
@@ -44,9 +46,7 @@
const flowDetails =
'Take into account the following information for never tested results:\n\n' +
- yamlStringifyExceptKeys(sliceModules($flowStore.value.modules, upToIndex, idOrders), [
- 'lock'
- ]) +
+ yamlStringifyExceptKeys(sliceModules(flow.value.modules, upToIndex, idOrders), ['lock']) +
''
try {
const availableData = {
@@ -136,7 +136,12 @@ Only output the expression, do not explain or discuss.`