windmill-components 1.555.1 → 1.558.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/components/AIAgentLogViewer.svelte.d.ts +3 -3
- package/package/components/AIProviderPicker.svelte.d.ts +3 -3
- package/package/components/ArgInput.svelte +2 -0
- package/package/components/DBManager.svelte.d.ts +3 -3
- package/package/components/DBManagerDrawer.svelte.d.ts +3 -3
- package/package/components/DBSchemaExplorer.svelte.d.ts +3 -3
- package/package/components/DBTable.svelte.d.ts +3 -3
- package/package/components/DBTableEditor.svelte +9 -12
- package/package/components/DBTableEditor.svelte.d.ts +3 -3
- package/package/components/DateTimeInput.svelte +19 -13
- package/package/components/DateTimeInput.svelte.d.ts +5 -0
- package/package/components/DucklakePicker.svelte +32 -0
- package/package/components/DucklakePicker.svelte.d.ts +13 -0
- package/package/components/Editor.svelte +1 -1
- package/package/components/EditorBar.svelte +14 -1
- package/package/components/FakeMonacoPlaceHolder.svelte +1 -1
- package/package/components/FlowGraphViewerStep.svelte +1 -1
- package/package/components/FlowPreviewContent.svelte +1 -1
- package/package/components/HighlightCode.svelte +21 -10
- package/package/components/HighlightCode.svelte.d.ts +12 -22
- package/package/components/InputTransformForm.svelte +9 -41
- package/package/components/InstanceSetting.svelte +1 -6
- package/package/components/ResourceEditor.svelte +1 -1
- package/package/components/ResourcePicker.svelte +0 -5
- package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +50 -34
- package/package/components/apps/components/display/dbtable/DbExplorerCount.svelte +7 -5
- package/package/components/apps/components/display/dbtable/DbExplorerCount.svelte.d.ts +2 -2
- package/package/components/apps/components/display/dbtable/DeleteRow.svelte +2 -2
- package/package/components/apps/components/display/dbtable/DeleteRow.svelte.d.ts +3 -2
- package/package/components/apps/components/display/dbtable/InsertRow.svelte +13 -7
- package/package/components/apps/components/display/dbtable/InsertRowRunnable.svelte +6 -3
- package/package/components/apps/components/display/dbtable/InsertRowRunnable.svelte.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/UpdateCell.svelte +2 -2
- package/package/components/apps/components/display/dbtable/UpdateCell.svelte.d.ts +3 -2
- package/package/components/apps/components/display/dbtable/queries/count.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/count.js +28 -18
- package/package/components/apps/components/display/dbtable/queries/createTable.d.ts +1 -1
- package/package/components/apps/components/display/dbtable/queries/createTable.js +1 -1
- package/package/components/apps/components/display/dbtable/queries/delete.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/delete.js +19 -10
- package/package/components/apps/components/display/dbtable/queries/insert.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/insert.js +16 -10
- package/package/components/apps/components/display/dbtable/queries/select.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/select.js +20 -16
- package/package/components/apps/components/display/dbtable/queries/update.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/update.js +19 -10
- package/package/components/apps/components/display/dbtable/utils.d.ts +1 -1
- package/package/components/apps/components/display/dbtable/utils.js +12 -3
- package/package/components/apps/components/display/table/AppAggridExplorerTable.svelte +9 -1
- package/package/components/apps/components/display/table/AppAggridExplorerTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte +2 -1
- package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridInfiniteTableEe.svelte +2 -1
- package/package/components/apps/components/display/table/AppAggridInfiniteTableEe.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridTable.svelte +9 -1
- package/package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridTableEe.svelte +2 -1
- package/package/components/apps/components/display/table/AppAggridTableEe.svelte.d.ts +1 -0
- package/package/components/apps/components/helpers/RunnableComponent.svelte +3 -1
- package/package/components/apps/components/inputs/AppDateInput.svelte +1 -0
- package/package/components/apps/editor/AppEditor.svelte +6 -1
- package/package/components/apps/editor/AppEditorHeader.svelte +12 -8
- package/package/components/apps/editor/AppJobsDrawer.svelte +5 -5
- package/package/components/apps/editor/component/ComponentInner.svelte +4 -0
- package/package/components/apps/editor/component/components.d.ts +16 -0
- package/package/components/apps/editor/component/components.js +17 -1
- package/package/components/apps/editor/settingsPanel/AGChartRichEditor.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/CSSMigrationModal.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/ChartJSRichEditor.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +23 -23
- package/package/components/apps/editor/settingsPanel/EventHandlers.svelte +7 -2
- package/package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +1 -0
- package/package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +2 -1
- package/package/components/apps/editor/settingsPanel/inputEditor/DBTableSelect.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +10 -0
- package/package/components/apps/inputType.d.ts +2 -2
- package/package/components/auditLogs/AuditLogsFilters.svelte.d.ts +1 -1
- package/package/components/common/button/ConnectionButton.svelte +12 -14
- package/package/components/common/button/ConnectionButton.svelte.d.ts +5 -18
- package/package/components/copilot/AIFormAssistant.svelte.d.ts +3 -3
- package/package/components/copilot/AIFormSettings.svelte.d.ts +3 -3
- package/package/components/copilot/FlowInlineScriptAIButton.svelte.d.ts +3 -3
- package/package/components/copilot/StepInputsGen.svelte +1 -1
- package/package/components/copilot/TestAIKey.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChat.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatDisplay.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatInlineWidget.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatInput.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatMessage.svelte.d.ts +3 -3
- package/package/components/copilot/chat/ContextElementBadge.svelte +2 -2
- package/package/components/copilot/chat/flow/AIChangesWarningModal.svelte.d.ts +3 -3
- package/package/components/copilot/chat/flow/FlowAIButton.svelte.d.ts +3 -3
- package/package/components/copilot/chat/flow/FlowAIChat.svelte +4 -1
- package/package/components/copilot/chat/flow/FlowAIChat.svelte.d.ts +3 -3
- package/package/components/copilot/chat/script/CodeDisplay.svelte +30 -9
- package/package/components/copilot/chat/script/core.d.ts +2 -1
- package/package/components/copilot/chat/script/core.js +6 -1
- package/package/components/details/DetailPageLayout.svelte +11 -3
- package/package/components/details/DetailPageLayout.svelte.d.ts +1 -0
- package/package/components/flows/content/DynamicInputHelpBox.svelte +4 -4
- package/package/components/flows/content/FlowInput.svelte +1 -1
- package/package/components/flows/content/FlowInputsQuick.svelte +1 -1
- package/package/components/flows/content/FlowLoop.svelte +143 -10
- package/package/components/flows/conversations/FlowChatInterface.svelte +110 -0
- package/package/components/flows/{FlowChatInterface.svelte.d.ts → conversations/FlowChatInterface.svelte.d.ts} +1 -1
- package/package/components/flows/conversations/FlowChatManager.svelte.d.ts +52 -0
- package/package/components/flows/conversations/FlowChatManager.svelte.js +422 -0
- package/package/components/flows/conversations/FlowChatMessage.svelte +68 -0
- package/package/components/flows/{FlowChatMessage.svelte.d.ts → conversations/FlowChatMessage.svelte.d.ts} +2 -4
- package/package/components/flows/{FlowConversationsSidebar.svelte → conversations/FlowConversationsSidebar.svelte} +6 -6
- package/package/components/flows/flowInfers.js +1 -1
- package/package/components/flows/scheduleUtils.js +2 -1
- package/package/components/graph/renderers/nodes/AIToolNode.svelte.d.ts +3 -3
- package/package/components/graph/renderers/nodes/NewAIToolNode.svelte.d.ts +3 -3
- package/package/components/icons/CACertificate.svelte.d.ts +3 -3
- package/package/components/icons/MSSqlServerIcon.svelte.d.ts +3 -3
- package/package/components/icons/MSTeamsIcon.svelte.d.ts +3 -3
- package/package/components/icons/OracleDBIcon.svelte.d.ts +3 -3
- package/package/components/icons/PHPIcon.svelte.d.ts +3 -3
- package/package/components/icons/QRCodeIcon.svelte.d.ts +3 -3
- package/package/components/instanceSettings.js +11 -2
- package/package/components/runs/JobsLoader.svelte +3 -3
- package/package/components/runs/RunRow.svelte +1 -1
- package/package/components/schema/SchemaFormDND.svelte.d.ts +3 -3
- package/package/components/settings/AIUserSettings.svelte.d.ts +3 -3
- package/package/components/sidebar/SidebarContent.svelte +2 -2
- package/package/components/text_input/TextInput.svelte.d.ts +1 -1
- package/package/components/triggers/http/OpenAPISpecGenerator.svelte.d.ts +3 -3
- package/package/components/triggers/schedules/ScheduleEditorInner.svelte +42 -1
- package/package/components/vscode.js +16 -12
- package/package/components/wizards/ChartJSWizard.svelte.d.ts +3 -3
- package/package/components/wizards/DBExplorerWizard.svelte.d.ts +3 -3
- package/package/components/wizards/LoggedWizardResult.svelte +95 -0
- package/package/components/wizards/LoggedWizardResult.svelte.d.ts +17 -0
- package/package/components/workspaceSettings/AISettings.svelte.d.ts +3 -3
- package/package/components/workspaceSettings/DucklakeSettings.svelte +223 -89
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +73 -5
- package/package/gen/schemas.gen.js +73 -5
- package/package/gen/services.gen.d.ts +8 -8
- package/package/gen/services.gen.js +14 -12
- package/package/gen/types.gen.d.ts +69 -18
- package/package/svelte5Utils.svelte.d.ts +1 -0
- package/package/svelte5Utils.svelte.js +6 -0
- package/package/utils.js +2 -5
- package/package.json +10 -12
- package/package/components/flows/FlowChatInterface.svelte +0 -404
- package/package/components/flows/FlowChatMessage.svelte +0 -41
- package/package/components/meltComponents/Menubar.svelte.d.ts +0 -503
- /package/package/components/flows/{FlowConversationsSidebar.svelte.d.ts → conversations/FlowConversationsSidebar.svelte.d.ts} +0 -0
|
@@ -97,7 +97,7 @@ const allToplevelNodes = [
|
|
|
97
97
|
['While loop', 'whileloop'],
|
|
98
98
|
['Branch to one', 'branchone'],
|
|
99
99
|
['Branch to all', 'branchall'],
|
|
100
|
-
['AI Agent', 'aiagent']
|
|
100
|
+
...(customUi?.aiAgent != false ? [['AI Agent', 'aiagent']] : [])
|
|
101
101
|
];
|
|
102
102
|
let topLevelNodes = $state([]);
|
|
103
103
|
function computeToplevelNodeChoices(funcDesc, preFilter) {
|
|
@@ -12,7 +12,7 @@ import { getStepPropPicker } from '../previousResults';
|
|
|
12
12
|
import { enterpriseLicense } from '../../../stores';
|
|
13
13
|
import FlowModuleSleep from './FlowModuleSleep.svelte';
|
|
14
14
|
import FlowModuleMock from './FlowModuleMock.svelte';
|
|
15
|
-
import { Play } from 'lucide-svelte';
|
|
15
|
+
import { Play, FunctionSquare } from 'lucide-svelte';
|
|
16
16
|
import FlowLoopIterationPreview from '../../FlowLoopIterationPreview.svelte';
|
|
17
17
|
import FlowModuleDeleteAfterUse from './FlowModuleDeleteAfterUse.svelte';
|
|
18
18
|
import IteratorGen from '../../copilot/IteratorGen.svelte';
|
|
@@ -21,10 +21,33 @@ import FlowPlugConnect from '../../FlowPlugConnect.svelte';
|
|
|
21
21
|
import PropPickerWrapper, { CONNECT } from '../propPicker/PropPickerWrapper.svelte';
|
|
22
22
|
import TabsV2 from '../../common/tabs/TabsV2.svelte';
|
|
23
23
|
import { useUiIntent } from '../../copilot/chat/flow/useUiIntent';
|
|
24
|
+
import { emptySchema } from '../../../utils';
|
|
25
|
+
import { slide } from 'svelte/transition';
|
|
26
|
+
import ToggleButtonGroup from '../../common/toggleButton-v2/ToggleButtonGroup.svelte';
|
|
27
|
+
import ToggleButton from '../../common/toggleButton-v2/ToggleButton.svelte';
|
|
24
28
|
const { previewArgs, flowStateStore, flowStore, currentEditor } = getContext('FlowEditorContext');
|
|
25
29
|
let { mod = $bindable(), parentModule, previousModule, noEditor, enableAi = false } = $props();
|
|
26
30
|
let editor = $state(undefined);
|
|
31
|
+
let parallelismEditor = $state(undefined);
|
|
27
32
|
let selected = $state('early-stop');
|
|
33
|
+
let parallelismType = $state(mod.value.type === 'forloopflow'
|
|
34
|
+
? mod.value.parallelism?.type === 'javascript'
|
|
35
|
+
? 'javascript'
|
|
36
|
+
: 'static'
|
|
37
|
+
: undefined);
|
|
38
|
+
let parallelismSchema = $state(emptySchema());
|
|
39
|
+
parallelismSchema.properties['parallelism'] = {
|
|
40
|
+
type: 'number'
|
|
41
|
+
};
|
|
42
|
+
if (mod.value.type === 'forloopflow') {
|
|
43
|
+
const forloopValue = mod.value;
|
|
44
|
+
if (typeof forloopValue.parallelism === 'number') {
|
|
45
|
+
forloopValue.parallelism = {
|
|
46
|
+
type: 'static',
|
|
47
|
+
value: forloopValue.parallelism
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
28
51
|
// UI Intent handling for AI tool control
|
|
29
52
|
useUiIntent(`forloopflow-${mod.id}`, {
|
|
30
53
|
openTab: (tab) => {
|
|
@@ -96,8 +119,8 @@ $effect(() => {
|
|
|
96
119
|
<Splitpanes horizontal class="h-full">
|
|
97
120
|
<Pane size={50} minSize={20} class="p-4">
|
|
98
121
|
{#if mod.value.type === 'forloopflow'}
|
|
99
|
-
<div class="flex flex-row gap-
|
|
100
|
-
<div>
|
|
122
|
+
<div class="flex flex-row gap-6 mt-2 mb-6">
|
|
123
|
+
<div class="flex-shrink-0">
|
|
101
124
|
<div class="mb-2 text-sm font-bold"
|
|
102
125
|
>Skip failures <Tooltip
|
|
103
126
|
documentationLink="https://www.windmill.dev/docs/flows/flow_loops"
|
|
@@ -111,30 +134,140 @@ $effect(() => {
|
|
|
111
134
|
options={{
|
|
112
135
|
right: 'Skip failures'
|
|
113
136
|
}}
|
|
137
|
+
class="whitespace-nowrap"
|
|
114
138
|
/>
|
|
115
139
|
</div>
|
|
116
|
-
<div>
|
|
140
|
+
<div class="flex-shrink-0">
|
|
117
141
|
<div class="mb-2 text-sm font-bold">Run in parallel</div>
|
|
118
142
|
<Toggle
|
|
119
143
|
bind:checked={mod.value.parallel}
|
|
120
144
|
options={{
|
|
121
145
|
right: 'All iterations run in parallel'
|
|
122
146
|
}}
|
|
147
|
+
class="whitespace-nowrap"
|
|
123
148
|
/>
|
|
124
149
|
</div>
|
|
125
|
-
<div>
|
|
150
|
+
<div class="flex-shrink-0">
|
|
126
151
|
<div class="mb-2 text-sm font-bold"
|
|
127
152
|
>Parallelism <Tooltip
|
|
128
153
|
>Assign a maximum number of branches run in parallel to control huge for-loops.</Tooltip
|
|
129
154
|
>
|
|
130
155
|
</div>
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
156
|
+
<div class="flex gap-2 items-center">
|
|
157
|
+
<input
|
|
158
|
+
type="number"
|
|
159
|
+
min="1"
|
|
160
|
+
class="w-20 px-2 py-1 text-sm border border-gray-200 dark:border-gray-700 rounded bg-surface"
|
|
161
|
+
disabled={!mod.value.parallel || parallelismType === 'javascript'}
|
|
162
|
+
placeholder={parallelismType === 'javascript' ? 'Expression' : ''}
|
|
163
|
+
bind:value={
|
|
164
|
+
() => {
|
|
165
|
+
const parallelismExpr = (mod.value as ForloopFlow).parallelism
|
|
166
|
+
|
|
167
|
+
return parallelismExpr && parallelismExpr.type === 'static'
|
|
168
|
+
? parallelismExpr.value
|
|
169
|
+
: ''
|
|
170
|
+
},
|
|
171
|
+
(value) => {
|
|
172
|
+
;(mod.value as ForloopFlow).parallelism = {
|
|
173
|
+
type: 'static',
|
|
174
|
+
value
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/>
|
|
179
|
+
<ToggleButtonGroup
|
|
180
|
+
disabled={!mod.value.parallel}
|
|
181
|
+
bind:selected={parallelismType}
|
|
182
|
+
on:selected={(e) => {
|
|
183
|
+
const forLoopFlow = mod.value as ForloopFlow
|
|
184
|
+
if (e.detail == parallelismType) return
|
|
185
|
+
if (e.detail === 'javascript') {
|
|
186
|
+
if (!forLoopFlow.parallelism || forLoopFlow.parallelism.type !== 'javascript') {
|
|
187
|
+
;(mod.value as ForloopFlow).parallelism = {
|
|
188
|
+
type: 'javascript',
|
|
189
|
+
expr: ''
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
if (!forLoopFlow.parallelism || forLoopFlow.parallelism.type !== 'static') {
|
|
194
|
+
;(mod.value as ForloopFlow).parallelism = {
|
|
195
|
+
type: 'static',
|
|
196
|
+
value: 0
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}}
|
|
201
|
+
class="h-6"
|
|
202
|
+
>
|
|
203
|
+
{#snippet children({ item })}
|
|
204
|
+
<ToggleButton light small label="static" value="static" {item} />
|
|
205
|
+
|
|
206
|
+
<ToggleButton
|
|
207
|
+
small
|
|
208
|
+
light
|
|
209
|
+
tooltip="JavaScript expression ('flow_input' or 'results')."
|
|
210
|
+
value="javascript"
|
|
211
|
+
icon={FunctionSquare}
|
|
212
|
+
{item}
|
|
213
|
+
/>
|
|
214
|
+
{/snippet}
|
|
215
|
+
</ToggleButtonGroup>
|
|
216
|
+
</div>
|
|
136
217
|
</div>
|
|
137
218
|
</div>
|
|
219
|
+
|
|
220
|
+
{#if mod.value.type === 'forloopflow' && mod.value.parallel && mod.value.parallelism?.type == 'javascript'}
|
|
221
|
+
<div class="my-2 flex flex-row gap-2 items-center">
|
|
222
|
+
<div class="text-sm font-bold whitespace-nowrap">
|
|
223
|
+
Parallelism expression
|
|
224
|
+
<Tooltip>
|
|
225
|
+
JavaScript expression that defines the maximum number of parallel executions.
|
|
226
|
+
Example: flow_input.max_parallel || 3
|
|
227
|
+
</Tooltip>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
231
|
+
<div
|
|
232
|
+
class="border w-full mb-2 h-full max-h-[250px]"
|
|
233
|
+
id="flow-editor-parallel-expression"
|
|
234
|
+
transition:slide={{ duration: 300 }}
|
|
235
|
+
>
|
|
236
|
+
<PropPickerWrapper
|
|
237
|
+
notSelectable
|
|
238
|
+
flow_input={stepPropPicker.pickableProperties.flow_input}
|
|
239
|
+
pickableProperties={stepPropPicker.pickableProperties}
|
|
240
|
+
on:select={({ detail }) => {
|
|
241
|
+
parallelismEditor?.insertAtCursor(detail)
|
|
242
|
+
parallelismEditor?.focus()
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
<SimpleEditor
|
|
246
|
+
bind:this={parallelismEditor}
|
|
247
|
+
autofocus
|
|
248
|
+
lang="javascript"
|
|
249
|
+
bind:code={
|
|
250
|
+
() => {
|
|
251
|
+
const parallelismExpr = (mod.value as ForloopFlow).parallelism
|
|
252
|
+
|
|
253
|
+
return parallelismExpr && parallelismExpr.type === 'javascript'
|
|
254
|
+
? parallelismExpr.expr
|
|
255
|
+
: ''
|
|
256
|
+
},
|
|
257
|
+
(expr) => {
|
|
258
|
+
;(mod.value as ForloopFlow).parallelism = {
|
|
259
|
+
type: 'javascript',
|
|
260
|
+
expr
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
class="small-editor"
|
|
265
|
+
shouldBindKey={false}
|
|
266
|
+
extraLib={stepPropPicker.extraLib}
|
|
267
|
+
/>
|
|
268
|
+
</PropPickerWrapper>
|
|
269
|
+
</div>
|
|
270
|
+
{/if}
|
|
138
271
|
<div class="my-2 flex flex-row gap-2 items-center">
|
|
139
272
|
<div class="text-sm font-bold whitespace-nowrap">
|
|
140
273
|
Iterator expression
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script lang="ts">import { Button, Alert } from '../../common';
|
|
2
|
+
import { MessageCircle, Loader2, ArrowUp } from 'lucide-svelte';
|
|
3
|
+
import { workspaceStore } from '../../../stores';
|
|
4
|
+
import autosize from '../../../autosize';
|
|
5
|
+
import FlowChatMessage from './FlowChatMessage.svelte';
|
|
6
|
+
import { createFlowChatManager } from './FlowChatManager.svelte';
|
|
7
|
+
let { onRunFlow, conversationId, refreshConversations, deploymentInProgress = false, createConversation, useStreaming = false, path } = $props();
|
|
8
|
+
const manager = createFlowChatManager();
|
|
9
|
+
// Initialize manager when component mounts
|
|
10
|
+
$effect(() => {
|
|
11
|
+
if ($workspaceStore) {
|
|
12
|
+
manager.initialize({
|
|
13
|
+
onRunFlow,
|
|
14
|
+
createConversation,
|
|
15
|
+
refreshConversations,
|
|
16
|
+
conversationId,
|
|
17
|
+
useStreaming,
|
|
18
|
+
path
|
|
19
|
+
}, $workspaceStore);
|
|
20
|
+
}
|
|
21
|
+
return () => {
|
|
22
|
+
manager.cleanup();
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
// Update conversation ID when it changes
|
|
26
|
+
$effect(() => {
|
|
27
|
+
manager.updateConversationId(conversationId);
|
|
28
|
+
});
|
|
29
|
+
// Public API for parent components
|
|
30
|
+
export function fillInputMessage(message) {
|
|
31
|
+
manager.fillInputMessage(message);
|
|
32
|
+
}
|
|
33
|
+
export function focusInput() {
|
|
34
|
+
manager.focusInput();
|
|
35
|
+
}
|
|
36
|
+
export function clearMessages() {
|
|
37
|
+
manager.clearMessages();
|
|
38
|
+
}
|
|
39
|
+
export async function loadConversationMessages(conversationId) {
|
|
40
|
+
await manager.loadConversationMessages(conversationId);
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div class="flex flex-col h-full w-full">
|
|
45
|
+
<div class="flex-1 flex flex-col min-h-0 w-full">
|
|
46
|
+
<!-- Messages Container -->
|
|
47
|
+
<div
|
|
48
|
+
bind:this={manager.messagesContainer}
|
|
49
|
+
class="flex-1 overflow-y-auto p-4 bg-background"
|
|
50
|
+
onscroll={manager.handleScroll}
|
|
51
|
+
>
|
|
52
|
+
{#if deploymentInProgress}
|
|
53
|
+
<Alert type="warning" title="Deployment in progress" size="xs" />
|
|
54
|
+
{/if}
|
|
55
|
+
{#if manager.isLoadingMessages}
|
|
56
|
+
<div class="flex items-center justify-center h-full">
|
|
57
|
+
<Loader2 size={32} class="animate-spin" />
|
|
58
|
+
</div>
|
|
59
|
+
{:else if manager.messages.length === 0}
|
|
60
|
+
<div class="text-center text-tertiary flex items-center justify-center flex-col h-full">
|
|
61
|
+
<MessageCircle size={48} class="mx-auto mb-4 opacity-50" />
|
|
62
|
+
<p class="text-lg font-medium">Start a conversation</p>
|
|
63
|
+
<p class="text-sm">Send a message to run the flow and see the results</p>
|
|
64
|
+
</div>
|
|
65
|
+
{:else}
|
|
66
|
+
<div class="max-w-7xl mx-auto space-y-4">
|
|
67
|
+
{#each manager.messages as message (message.id)}
|
|
68
|
+
<FlowChatMessage {message} />
|
|
69
|
+
{/each}
|
|
70
|
+
{#if manager.isWaitingForResponse}
|
|
71
|
+
<div class="flex items-center gap-2 text-tertiary">
|
|
72
|
+
<Loader2 size={16} class="animate-spin" />
|
|
73
|
+
<span class="text-sm">Processing...</span>
|
|
74
|
+
</div>
|
|
75
|
+
{/if}
|
|
76
|
+
</div>
|
|
77
|
+
{/if}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<!-- Chat Input -->
|
|
81
|
+
<div class="p-2 bg-surface">
|
|
82
|
+
<div
|
|
83
|
+
class="flex items-center gap-2 rounded-lg border border-gray-200 dark:border-gray-600 bg-surface"
|
|
84
|
+
class:opacity-50={deploymentInProgress}
|
|
85
|
+
>
|
|
86
|
+
<textarea
|
|
87
|
+
bind:this={manager.inputElement}
|
|
88
|
+
bind:value={manager.inputMessage}
|
|
89
|
+
use:autosize
|
|
90
|
+
onkeydown={manager.handleKeyDown}
|
|
91
|
+
placeholder="Type your message here..."
|
|
92
|
+
class="flex-1 min-h-[24px] max-h-32 resize-none !border-0 !bg-transparent text-sm placeholder-gray-400 !outline-none !ring-0 p-0 !shadow-none focus:!border-0 focus:!outline-none focus:!ring-0 focus:!shadow-none"
|
|
93
|
+
rows={3}
|
|
94
|
+
></textarea>
|
|
95
|
+
<div class="flex-shrink-0 pr-2">
|
|
96
|
+
<Button
|
|
97
|
+
color="blue"
|
|
98
|
+
size="xs2"
|
|
99
|
+
btnClasses="!rounded-full !p-1.5"
|
|
100
|
+
startIcon={{ icon: ArrowUp }}
|
|
101
|
+
disabled={!manager.inputMessage?.trim() || manager.isLoading || deploymentInProgress}
|
|
102
|
+
on:click={() => manager.sendMessage()}
|
|
103
|
+
iconOnly
|
|
104
|
+
title={deploymentInProgress ? 'Deployment in progress' : 'Send message (Enter)'}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
@@ -13,7 +13,7 @@ declare const FlowChatInterface: import("svelte").Component<Props, {
|
|
|
13
13
|
fillInputMessage: (message: string) => void;
|
|
14
14
|
focusInput: () => void;
|
|
15
15
|
clearMessages: () => void;
|
|
16
|
-
loadConversationMessages: (
|
|
16
|
+
loadConversationMessages: (conversationId?: string) => Promise<void>;
|
|
17
17
|
}, "">;
|
|
18
18
|
type FlowChatInterface = ReturnType<typeof FlowChatInterface>;
|
|
19
19
|
export default FlowChatInterface;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { FlowConversationMessage } from '../../../gen/types.gen';
|
|
2
|
+
export interface ChatMessage extends FlowConversationMessage {
|
|
3
|
+
loading?: boolean;
|
|
4
|
+
streaming?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface FlowChatManagerOptions {
|
|
7
|
+
onRunFlow: (userMessage: string, conversationId: string) => Promise<string | undefined>;
|
|
8
|
+
createConversation: (options: {
|
|
9
|
+
clearMessages?: boolean;
|
|
10
|
+
}) => Promise<string>;
|
|
11
|
+
refreshConversations?: () => Promise<void>;
|
|
12
|
+
conversationId?: string;
|
|
13
|
+
useStreaming?: boolean;
|
|
14
|
+
path?: string;
|
|
15
|
+
}
|
|
16
|
+
declare class FlowChatManager {
|
|
17
|
+
#private;
|
|
18
|
+
messages: ChatMessage[];
|
|
19
|
+
inputMessage: string;
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
isLoadingMessages: boolean;
|
|
22
|
+
isWaitingForResponse: boolean;
|
|
23
|
+
messagesContainer: HTMLDivElement | undefined;
|
|
24
|
+
inputElement: HTMLTextAreaElement | undefined;
|
|
25
|
+
page: number;
|
|
26
|
+
hasMoreMessages: boolean;
|
|
27
|
+
loadingMoreMessages: boolean;
|
|
28
|
+
currentEventSource: EventSource | undefined;
|
|
29
|
+
pollingInterval: number | undefined;
|
|
30
|
+
initialize(options: FlowChatManagerOptions, workspace: string): void;
|
|
31
|
+
updateConversationId(conversationId: string | undefined): void;
|
|
32
|
+
cleanup(): void;
|
|
33
|
+
fillInputMessage(message: string): void;
|
|
34
|
+
focusInput(): void;
|
|
35
|
+
clearMessages(): void;
|
|
36
|
+
loadConversationMessages(conversationId?: string): Promise<void>;
|
|
37
|
+
private loadMessages;
|
|
38
|
+
handleScroll: () => void;
|
|
39
|
+
scrollToBottom(): void;
|
|
40
|
+
private scrollToUserMessage;
|
|
41
|
+
private pollJobResult;
|
|
42
|
+
private parseStreamDeltas;
|
|
43
|
+
private pollConversationMessages;
|
|
44
|
+
private startPolling;
|
|
45
|
+
private stopPolling;
|
|
46
|
+
sendMessage(): Promise<void>;
|
|
47
|
+
private handleStreamingMessage;
|
|
48
|
+
private handlePollingMessage;
|
|
49
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
50
|
+
}
|
|
51
|
+
export declare const createFlowChatManager: () => FlowChatManager;
|
|
52
|
+
export {};
|