windmill-components 1.208.0 → 1.216.0
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/common.d.ts +29 -0
- package/package/common.js +20 -0
- package/package/components/ApiConnectForm.svelte +81 -1
- package/package/components/ArgEnum.svelte +23 -31
- package/package/components/ArgEnum.svelte.d.ts +1 -0
- package/package/components/ArgInfo.svelte +1 -1
- package/package/components/ArgInput.svelte +125 -26
- package/package/components/ArgInput.svelte.d.ts +1 -0
- package/package/components/DBSchemaExplorer.svelte +2 -2
- package/package/components/DiffEditor.svelte +1 -1
- package/package/components/DisplayResult.svelte +29 -2
- package/package/components/Editor.svelte +21 -8
- package/package/components/EditorBar.svelte +3 -0
- package/package/components/ErrorOrRecoveryHandler.svelte +6 -3
- package/package/components/FlowBuilder.svelte +90 -92
- package/package/components/FlowBuilderTutorials.svelte +1 -3
- package/package/components/FlowLoopIterationPreview.svelte +145 -0
- package/package/components/FlowLoopIterationPreview.svelte.d.ts +27 -0
- package/package/components/FlowPreviewContent.svelte +19 -9
- package/package/components/FlowStatusViewerInner.svelte +29 -20
- package/package/components/FlowStatusViewerInner.svelte.d.ts +1 -0
- package/package/components/FlowTimeline.svelte +7 -5
- package/package/components/FlowTimeline.svelte.d.ts +1 -0
- package/package/components/InputTransformForm.svelte +21 -10
- package/package/components/InstanceSettings.svelte +2 -2
- package/package/components/ItemPicker.svelte +27 -5
- package/package/components/LightweightArgInput.svelte +144 -78
- package/package/components/LightweightArgInput.svelte.d.ts +2 -0
- package/package/components/LightweightSchemaForm.svelte +2 -3
- package/package/components/LogViewer.svelte +29 -6
- package/package/components/NumberTypeNarrowing.svelte +21 -1
- package/package/components/NumberTypeNarrowing.svelte.d.ts +2 -0
- package/package/components/RunForm.svelte +38 -6
- package/package/components/S3FilePicker.svelte +354 -0
- package/package/components/S3FilePicker.svelte.d.ts +26 -0
- package/package/components/SchemaEditor.svelte +2 -15
- package/package/components/SchemaEditor.svelte.d.ts +1 -1
- package/package/components/SchemaForm.svelte +3 -1
- package/package/components/SchemaModal.svelte +55 -2
- package/package/components/SchemaModal.svelte.d.ts +1 -16
- package/package/components/ScriptBuilder.svelte +1 -1
- package/package/components/SimpleEditor.svelte +45 -31
- package/package/components/StringTypeNarrowing.svelte +38 -2
- package/package/components/StringTypeNarrowing.svelte.d.ts +1 -0
- package/package/components/TemplateEditor.svelte +72 -62
- package/package/components/TestJobLoader.svelte +0 -1
- package/package/components/UserSettings.svelte +6 -3
- package/package/components/WorkspaceGroup.svelte +3 -0
- package/package/components/apps/components/display/AppImage.svelte +7 -1
- package/package/components/apps/components/display/AppStatCard.svelte +125 -0
- package/package/components/apps/components/display/AppStatCard.svelte.d.ts +22 -0
- package/package/components/apps/components/display/table/AppTable.svelte +1 -1
- package/package/components/apps/components/helpers/ResolveStyle.svelte +1 -1
- package/package/components/apps/editor/AppEditor.svelte +1 -1
- package/package/components/apps/editor/AppEditorHeader.svelte +14 -4
- package/package/components/apps/editor/AppEditorTutorial.svelte +8 -1
- package/package/components/apps/editor/AppPreview.svelte +1 -0
- package/package/components/apps/editor/AppReportsDrawer.svelte +491 -0
- package/package/components/apps/editor/AppReportsDrawer.svelte.d.ts +17 -0
- package/package/components/apps/editor/component/Component.svelte +8 -0
- package/package/components/apps/editor/component/components.d.ts +150 -61
- package/package/components/apps/editor/component/components.js +89 -2
- package/package/components/apps/editor/component/sets.js +2 -1
- package/package/components/apps/editor/componentsPanel/CssProperty.svelte +184 -145
- package/package/components/apps/editor/componentsPanel/cssUtils.d.ts +0 -4
- package/package/components/apps/editor/componentsPanel/cssUtils.js +0 -25
- package/package/components/apps/editor/componentsPanel/quickStyleProperties.js +2 -1
- package/package/components/apps/editor/componentsPanel/tailwindUtils.d.ts +1 -0
- package/package/components/apps/editor/componentsPanel/tailwindUtils.js +4474 -0
- package/package/components/apps/editor/contextPanel/ComponentOutput.svelte +0 -1
- package/package/components/apps/editor/contextPanel/SubGridOutput.svelte +1 -2
- package/package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +1 -0
- package/package/components/apps/editor/settingsPanel/QuickAddColumn.svelte +1 -1
- package/package/components/apps/types.d.ts +2 -0
- package/package/components/apps/utils.d.ts +1 -0
- package/package/components/apps/utils.js +15 -0
- package/package/components/build_workers.js +9 -14
- package/package/components/common/alert/Alert.svelte +12 -10
- package/package/components/common/skeleton/Skeleton.svelte +11 -6
- package/package/components/common/skeleton/Skeleton.svelte.d.ts +1 -0
- package/package/components/copilot/CodeCompletionStatus.svelte +37 -0
- package/package/components/copilot/CodeCompletionStatus.svelte.d.ts +14 -0
- package/package/components/copilot/FlowCopilotDrawer.svelte +5 -2
- package/package/components/copilot/FlowCopilotStatus.svelte +1 -1
- package/package/components/copilot/RegexGen.svelte +172 -0
- package/package/components/copilot/RegexGen.svelte.d.ts +16 -0
- package/package/components/copilot/ScriptFix.svelte +1 -8
- package/package/components/copilot/ScriptGen.svelte +13 -7
- package/package/components/copilot/TestOpenaiKey.svelte +1 -1
- package/package/components/copilot/completion.js +5 -0
- package/package/components/copilot/flow.d.ts +13 -3
- package/package/components/copilot/flow.js +98 -32
- package/package/components/copilot/lib.d.ts +5 -5
- package/package/components/copilot/lib.js +3 -2
- package/package/components/copilot/prompts/edit.yaml +11 -9
- package/package/components/copilot/prompts/editPrompt.js +5 -5
- package/package/components/copilot/prompts/fix.yaml +11 -9
- package/package/components/copilot/prompts/fixPrompt.js +5 -5
- package/package/components/copilot/prompts/gen.yaml +73 -28
- package/package/components/copilot/prompts/genPrompt.js +14 -14
- package/package/components/flows/content/FlowLoop.svelte +25 -1
- package/package/components/flows/content/FlowSettings.svelte +42 -3
- package/package/components/flows/content/ScriptEditorDrawer.svelte +2 -7
- package/package/components/flows/header/FlowPreviewButtons.svelte +1 -0
- package/package/components/flows/map/InsertModuleButton.svelte +1 -1
- package/package/components/flows/map/VirtualItem.svelte.d.ts +1 -0
- package/package/components/graph/FlowGraph.svelte +1 -0
- package/package/components/graph/svelvet/types/index.js +1 -1
- package/package/components/instanceSettings.js +1 -1
- package/package/components/propertyPicker/ObjectViewer.svelte +28 -2
- package/package/components/runs/RunRow.svelte +1 -1
- package/package/components/runs/RunsFilter.svelte +329 -172
- package/package/components/runs/RunsFilter.svelte.d.ts +2 -0
- package/package/components/settings/WorkspaceUserSettings.svelte +94 -70
- package/package/components/sidebar/SidebarContent.svelte +71 -15
- package/package/components/sidebar/UserMenu.svelte +2 -2
- package/package/components/sidebar/WorkspaceMenu.svelte +16 -14
- package/package/components/tutorials/SkipTutorials.svelte +32 -0
- package/package/components/tutorials/SkipTutorials.svelte.d.ts +16 -0
- package/package/components/tutorials/Tutorial.svelte +46 -18
- package/package/components/tutorials/TutorialControls.svelte +45 -0
- package/package/components/tutorials/TutorialControls.svelte.d.ts +20 -0
- package/package/consts.d.ts +3 -0
- package/package/consts.js +3 -0
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/index.d.ts +7 -0
- package/package/gen/index.js +3 -0
- package/package/gen/models/FlowValue.d.ts +1 -0
- package/package/gen/models/LargeFileStorage.d.ts +9 -0
- package/package/gen/models/LargeFileStorage.js +11 -0
- package/package/gen/models/PolarsClientKwargs.d.ts +3 -0
- package/package/gen/models/PolarsClientKwargs.js +5 -0
- package/package/gen/models/S3Resource.d.ts +9 -0
- package/package/gen/models/S3Resource.js +5 -0
- package/package/gen/models/WindmillFileMetadata.d.ts +7 -0
- package/package/gen/models/WindmillFileMetadata.js +5 -0
- package/package/gen/models/WindmillFilePreview.d.ts +13 -0
- package/package/gen/models/WindmillFilePreview.js +14 -0
- package/package/gen/models/WindmillLargeFile.d.ts +3 -0
- package/package/gen/models/WindmillLargeFile.js +5 -0
- package/package/gen/services/HelpersService.d.ts +84 -0
- package/package/gen/services/HelpersService.js +107 -0
- package/package/gen/services/UserService.d.ts +9 -9
- package/package/gen/services/UserService.js +15 -15
- package/package/gen/services/WorkspaceService.d.ts +42 -0
- package/package/gen/services/WorkspaceService.js +58 -0
- package/package/infer.js +5 -5
- package/package/stores.d.ts +2 -0
- package/package/stores.js +2 -0
- package/package/utils.d.ts +2 -1
- package/package/utils.js +19 -0
- package/package.json +5 -6
|
@@ -36,7 +36,6 @@ $: subGrids = Array.from({ length: gridItem.data.numberOfSubgrids ?? 0 }).map((_
|
|
|
36
36
|
connectOutput(connectingInput, gridItem?.data?.type, gridItem.data.id, detail)
|
|
37
37
|
}}
|
|
38
38
|
/>
|
|
39
|
-
|
|
40
39
|
<SubGridOutput {name} {expanded} {subGrids} parentId={gridItem.id} />
|
|
41
40
|
<TableActionsOutput {gridItem} />
|
|
42
41
|
</OutputHeader>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script>import { classNames } from '../../../../utils';
|
|
2
2
|
import { getContext } from 'svelte';
|
|
3
|
-
import { slide } from 'svelte/transition';
|
|
4
3
|
import { connectInput } from '../appUtils';
|
|
5
4
|
import ComponentOutput from './ComponentOutput.svelte';
|
|
6
5
|
export let name = undefined;
|
|
@@ -48,7 +47,7 @@ function subscribeToOutput() {
|
|
|
48
47
|
{/if}
|
|
49
48
|
|
|
50
49
|
{#if selected === index || name !== 'Tabs'}
|
|
51
|
-
<div
|
|
50
|
+
<div class="border-l">
|
|
52
51
|
{#if items.length > 0}
|
|
53
52
|
{#each items as subGridItem, index (subGridItem.id)}
|
|
54
53
|
<ComponentOutput
|
|
@@ -21,7 +21,7 @@ function subscribeToAllOutputs(observableOutputs) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
function updateRemainingColumns(result, columns) {
|
|
24
|
-
if (result
|
|
24
|
+
if (result?.length > 0) {
|
|
25
25
|
const allKeysSet = result.reduce((acc, obj) => {
|
|
26
26
|
Object.keys(obj).forEach((key) => acc.add(key));
|
|
27
27
|
return acc;
|
|
@@ -22,6 +22,8 @@ export type ComponentCssProperty = {
|
|
|
22
22
|
class?: string;
|
|
23
23
|
style?: string;
|
|
24
24
|
evalClass?: RichConfiguration;
|
|
25
|
+
quickCss?: readonly string[] | undefined;
|
|
26
|
+
quickTailwindClasses?: readonly string[] | undefined;
|
|
25
27
|
};
|
|
26
28
|
export type ComponentCustomCSS<T extends keyof typeof components> = Partial<(typeof components)[T]['customCss']>;
|
|
27
29
|
export type Configuration = StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput | EvalAppInput | EvalV2AppInput | UploadAppInput | ResultAppInput;
|
|
@@ -29,3 +29,4 @@ export declare const TailwindClassPatterns: {
|
|
|
29
29
|
};
|
|
30
30
|
export declare function hasTailwindClass(classes: string | undefined, pattern: RegExp): boolean;
|
|
31
31
|
export declare function transformBareBase64IfNecessary(source: string | undefined): string | undefined;
|
|
32
|
+
export declare function getImageDataURL(imageKind: string | undefined, image: string | undefined): string | null;
|
|
@@ -294,3 +294,18 @@ export function transformBareBase64IfNecessary(source) {
|
|
|
294
294
|
return `data:application/octet-stream;base64,${source}`;
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
+
export function getImageDataURL(imageKind, image) {
|
|
298
|
+
if (!imageKind || !image) {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
switch (imageKind) {
|
|
302
|
+
case 'png encoded as base64':
|
|
303
|
+
return 'data:image/png;base64,' + image;
|
|
304
|
+
case 'jpeg encoded as base64':
|
|
305
|
+
return 'data:image/jpeg;base64,' + image;
|
|
306
|
+
case 'svg encoded as base64':
|
|
307
|
+
return 'data:image/svg+xml;base64,' + image;
|
|
308
|
+
default:
|
|
309
|
+
return image;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
|
|
2
|
+
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
3
|
+
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
|
|
4
|
+
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
|
5
|
+
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
2
6
|
export function buildWorkerDefinition(workerPath, basePath, useModuleWorker) {
|
|
3
7
|
const monWin = self;
|
|
4
8
|
const workerOverrideGlobals = {
|
|
@@ -20,30 +24,21 @@ export function buildWorkerDefinition(workerPath, basePath, useModuleWorker) {
|
|
|
20
24
|
monEnv.workerOverrideGlobals = workerOverrideGlobals;
|
|
21
25
|
const getWorker = (_, label) => {
|
|
22
26
|
console.log('getWorker: workerId: ' + _ + ' label: ' + label);
|
|
23
|
-
const buildWorker = (globals, label, workerName, editorType) => {
|
|
24
|
-
globals.workerOptions.name = label;
|
|
25
|
-
const workerFilename = globals.workerOptions.type === 'module' ? `${workerName}-es.js` : `${workerName}-iife.js`;
|
|
26
|
-
const workerPathLocal = `${globals.workerPath}/${workerFilename}`;
|
|
27
|
-
const workerUrl = new URL(workerPathLocal, globals.basePath);
|
|
28
|
-
console.log(`${editorType}: url: ${workerUrl.href} created from basePath: ${globals.basePath} and file: ${workerPathLocal}`);
|
|
29
|
-
return new Worker(workerUrl.href, globals.workerOptions);
|
|
30
|
-
};
|
|
31
27
|
switch (label) {
|
|
32
28
|
case 'template':
|
|
33
29
|
case 'typescript':
|
|
34
30
|
case 'javascript':
|
|
35
|
-
return
|
|
31
|
+
return new tsWorker();
|
|
36
32
|
case 'html':
|
|
37
33
|
case 'handlebars':
|
|
38
34
|
case 'razor':
|
|
39
|
-
return
|
|
35
|
+
return new htmlWorker();
|
|
40
36
|
case 'css':
|
|
41
|
-
return new cssWorker();
|
|
42
37
|
case 'scss':
|
|
43
38
|
case 'less':
|
|
44
|
-
return
|
|
39
|
+
return new cssWorker();
|
|
45
40
|
case 'json':
|
|
46
|
-
return
|
|
41
|
+
return new jsonWorker();
|
|
47
42
|
case 'graphql':
|
|
48
43
|
const workerFilename = `graphql.worker.bundle.js`;
|
|
49
44
|
const workerPathLocal = `${workerOverrideGlobals.workerPath}/${workerFilename}`;
|
|
@@ -52,7 +47,7 @@ export function buildWorkerDefinition(workerPath, basePath, useModuleWorker) {
|
|
|
52
47
|
name: label
|
|
53
48
|
});
|
|
54
49
|
default:
|
|
55
|
-
return
|
|
50
|
+
return new editorWorker();
|
|
56
51
|
}
|
|
57
52
|
};
|
|
58
53
|
monWin.MonacoEnvironment.getWorker = getWorker;
|
|
@@ -54,7 +54,7 @@ const classes = {
|
|
|
54
54
|
<svelte:component this={icons[type]} class={classes[type].iconClass} size={16} />
|
|
55
55
|
</div>
|
|
56
56
|
|
|
57
|
-
<div class="ml-2 w-full">
|
|
57
|
+
<div class="ml-2 pt-[0.15rem] w-full">
|
|
58
58
|
<span
|
|
59
59
|
class={classNames(
|
|
60
60
|
size === 'sm' ? 'text-sm' : 'text-xs ',
|
|
@@ -66,15 +66,17 @@ const classes = {
|
|
|
66
66
|
<Tooltip {documentationLink} scale={0.9}>{tooltip}</Tooltip>
|
|
67
67
|
{/if}
|
|
68
68
|
</span>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
{#if $$slots.default}
|
|
70
|
+
<div
|
|
71
|
+
class={classNames(
|
|
72
|
+
size === 'sm' ? 'text-sm' : 'text-xs ',
|
|
73
|
+
'mt-2',
|
|
74
|
+
classes[type].descriptionClass
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
77
|
+
<slot />
|
|
78
|
+
</div>
|
|
79
|
+
{/if}
|
|
78
80
|
</div>
|
|
79
81
|
</div>
|
|
80
82
|
</div>
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { HEIGHT_UNIT } from './model';
|
|
1
|
+
<script>import { HEIGHT_UNIT } from './model';
|
|
3
2
|
import SkeletonElement from './SkeletonElement.svelte';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
4
|
export let layout;
|
|
5
5
|
export let loading = true;
|
|
6
6
|
export let overlay = false;
|
|
7
|
+
export let mounted = false;
|
|
8
|
+
onMount(() => {
|
|
9
|
+
setTimeout(() => {
|
|
10
|
+
mounted = true;
|
|
11
|
+
}, 10);
|
|
12
|
+
});
|
|
7
13
|
</script>
|
|
8
14
|
|
|
9
15
|
{#if loading}
|
|
10
16
|
<div class="relative flex justify-center">
|
|
11
17
|
<div
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
? 'absolute w-full h-full z-[1000]'
|
|
15
|
-
: ''} {$$props.class}"
|
|
18
|
+
class="flex grow flex-col overflow-hidden transition-[opacity] duration-1000 opacity-0 {mounted
|
|
19
|
+
? 'opacity-100'
|
|
20
|
+
: ''} {overlay ? 'absolute w-full h-full z-[1000]' : ''} {$$props.class}"
|
|
16
21
|
>
|
|
17
22
|
{#each layout as row}
|
|
18
23
|
<div class="flex justify-between items-start gap-4">
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script>import { ZapIcon, ZapOffIcon } from 'lucide-svelte';
|
|
2
|
+
import Button from '../common/button/Button.svelte';
|
|
3
|
+
import { codeCompletionLoading, copilotInfo, codeCompletionSessionEnabled } from '../../stores';
|
|
4
|
+
import Popover from '../Popover.svelte';
|
|
5
|
+
function loadCodeCompletionSessinoEnabled() {
|
|
6
|
+
const stored = localStorage.getItem('codeCompletionSessionEnabled');
|
|
7
|
+
if (stored) {
|
|
8
|
+
$codeCompletionSessionEnabled = JSON.parse(stored);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function toggleCodeCompletionSessionEnabled() {
|
|
12
|
+
$codeCompletionSessionEnabled = !$codeCompletionSessionEnabled;
|
|
13
|
+
localStorage.setItem('codeCompletionSessionEnabled', JSON.stringify($codeCompletionSessionEnabled));
|
|
14
|
+
}
|
|
15
|
+
loadCodeCompletionSessinoEnabled();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#if $copilotInfo.code_completion_enabled}
|
|
19
|
+
<Popover>
|
|
20
|
+
<svelte:fragment slot="text"
|
|
21
|
+
>Click to {$codeCompletionSessionEnabled ? 'disable' : 'enable'} code completion (applies only
|
|
22
|
+
to you)</svelte:fragment
|
|
23
|
+
>
|
|
24
|
+
<Button
|
|
25
|
+
color="light"
|
|
26
|
+
loading={$codeCompletionLoading}
|
|
27
|
+
startIcon={$codeCompletionLoading
|
|
28
|
+
? undefined
|
|
29
|
+
: {
|
|
30
|
+
icon: $codeCompletionSessionEnabled ? ZapIcon : ZapOffIcon
|
|
31
|
+
}}
|
|
32
|
+
on:click={() => {
|
|
33
|
+
toggleCodeCompletionSessionEnabled()
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
</Popover>
|
|
37
|
+
{/if}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type CodeCompletionStatusProps = typeof __propDef.props;
|
|
10
|
+
export type CodeCompletionStatusEvents = typeof __propDef.events;
|
|
11
|
+
export type CodeCompletionStatusSlots = typeof __propDef.slots;
|
|
12
|
+
export default class CodeCompletionStatus extends SvelteComponent<CodeCompletionStatusProps, CodeCompletionStatusEvents, CodeCompletionStatusSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -111,7 +111,10 @@ const { drawerStore, modulesStore, currentStepStore } = getContext('FlowCopilotC
|
|
|
111
111
|
<div class="w-full text-left font-normal">
|
|
112
112
|
<div class="text-primary flex-wrap text-sm font-medium">
|
|
113
113
|
{copilotModule.source === 'hub' && copilotModule.selectedCompletion
|
|
114
|
-
? copilotModule.selectedCompletion.summary
|
|
114
|
+
? copilotModule.selectedCompletion.summary +
|
|
115
|
+
' (' +
|
|
116
|
+
copilotModule.selectedCompletion.app +
|
|
117
|
+
')'
|
|
115
118
|
: `Generate "${copilotModule.description}" in ${
|
|
116
119
|
copilotModule.lang === 'bun' ? 'TypeScript' : 'Python'
|
|
117
120
|
}`}
|
|
@@ -240,7 +243,7 @@ const { drawerStore, modulesStore, currentStepStore } = getContext('FlowCopilotC
|
|
|
240
243
|
|
|
241
244
|
<div class="text-left font-normal text-sm">
|
|
242
245
|
<div class="text-primary font-medium">
|
|
243
|
-
{item.summary ?? ''}
|
|
246
|
+
{(item.summary ?? '') + ' (' + item['app'] + ')'}
|
|
244
247
|
</div>
|
|
245
248
|
</div>
|
|
246
249
|
</div>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<script>import { Button } from '../common';
|
|
2
|
+
import { getNonStreamingCompletion } from './lib';
|
|
3
|
+
import { sendUserToast } from '../../toast';
|
|
4
|
+
import Popup from '../common/popup/Popup.svelte';
|
|
5
|
+
import { copilotInfo } from '../../stores';
|
|
6
|
+
import { WindmillIcon } from '../icons';
|
|
7
|
+
import { autoPlacement } from '@floating-ui/core';
|
|
8
|
+
import { ExternalLink, HistoryIcon, Wand2 } from 'lucide-svelte';
|
|
9
|
+
import { fade } from 'svelte/transition';
|
|
10
|
+
import { createEventDispatcher } from 'svelte';
|
|
11
|
+
// state
|
|
12
|
+
let funcDesc = '';
|
|
13
|
+
let genLoading = false;
|
|
14
|
+
let input;
|
|
15
|
+
let abortController = undefined;
|
|
16
|
+
let button;
|
|
17
|
+
const dispatch = createEventDispatcher();
|
|
18
|
+
async function onGenerate(closePopup) {
|
|
19
|
+
if (funcDesc.length <= 0) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
savePrompt();
|
|
23
|
+
try {
|
|
24
|
+
genLoading = true;
|
|
25
|
+
abortController = new AbortController();
|
|
26
|
+
const res = await getNonStreamingCompletion([
|
|
27
|
+
{
|
|
28
|
+
role: 'system',
|
|
29
|
+
content: 'Generate a regex pattern that one can use in a javascript Regex object. Output only the regex itself. The regex should match the following:'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
role: 'user',
|
|
33
|
+
content: funcDesc
|
|
34
|
+
}
|
|
35
|
+
], abortController);
|
|
36
|
+
dispatch('gen', { res: res, prompt: funcDesc });
|
|
37
|
+
closePopup();
|
|
38
|
+
funcDesc = '';
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (err?.message) {
|
|
42
|
+
sendUserToast('Failed to generate regex: ' + err.message, true);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
sendUserToast('Failed to generate regex', true);
|
|
46
|
+
console.error(err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
genLoading = false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
$: input && setTimeout(() => input?.focus(), 100);
|
|
54
|
+
let promptHistory = JSON.parse(localStorage.getItem('prompts-regex') || '[]');
|
|
55
|
+
function savePrompt() {
|
|
56
|
+
if (promptHistory.includes(funcDesc)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
promptHistory.unshift(funcDesc);
|
|
60
|
+
while (promptHistory.length > 5) {
|
|
61
|
+
promptHistory.pop();
|
|
62
|
+
}
|
|
63
|
+
localStorage.setItem('prompts-regex', JSON.stringify(promptHistory));
|
|
64
|
+
}
|
|
65
|
+
function clearPromptHistory() {
|
|
66
|
+
promptHistory = [];
|
|
67
|
+
localStorage.setItem('prompts-regex', JSON.stringify(promptHistory));
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
{#if genLoading}
|
|
72
|
+
<div transition:fade class="fixed z-[4999] inset-0 bg-gray-500/75" />
|
|
73
|
+
{/if}
|
|
74
|
+
|
|
75
|
+
<Popup
|
|
76
|
+
floatingConfig={{
|
|
77
|
+
middleware: [
|
|
78
|
+
autoPlacement({
|
|
79
|
+
allowedPlacements: ['bottom-start', 'bottom-end', 'top-start', 'top-end', 'top', 'bottom']
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}}
|
|
83
|
+
let:close
|
|
84
|
+
>
|
|
85
|
+
<svelte:fragment slot="button">
|
|
86
|
+
<Button
|
|
87
|
+
title="Generate regexes from prompt"
|
|
88
|
+
btnClasses={'!font-medium ' + (genLoading ? 'z-[5000]' : '')}
|
|
89
|
+
size="xs"
|
|
90
|
+
color={genLoading ? 'red' : 'light'}
|
|
91
|
+
spacingSize="md"
|
|
92
|
+
startIcon={genLoading ? undefined : { icon: Wand2 }}
|
|
93
|
+
propagateEvent
|
|
94
|
+
on:click={genLoading ? () => abortController?.abort() : () => {}}
|
|
95
|
+
bind:element={button}
|
|
96
|
+
>
|
|
97
|
+
{#if genLoading}
|
|
98
|
+
<WindmillIcon
|
|
99
|
+
white={true}
|
|
100
|
+
class="mr-1 text-white"
|
|
101
|
+
height="16px"
|
|
102
|
+
width="20px"
|
|
103
|
+
spin="veryfast"
|
|
104
|
+
/>
|
|
105
|
+
Stop
|
|
106
|
+
{:else}
|
|
107
|
+
AI
|
|
108
|
+
{/if}
|
|
109
|
+
</Button>
|
|
110
|
+
</svelte:fragment>
|
|
111
|
+
<div class="block text-primary z-[2000]">
|
|
112
|
+
{#if $copilotInfo.exists_openai_resource_path}
|
|
113
|
+
<div class="flex flex-col gap-4">
|
|
114
|
+
<div class="flex w-96">
|
|
115
|
+
<input
|
|
116
|
+
type="text"
|
|
117
|
+
bind:this={input}
|
|
118
|
+
bind:value={funcDesc}
|
|
119
|
+
on:keypress={({ key }) => {
|
|
120
|
+
if (key === 'Enter' && funcDesc.length > 0) {
|
|
121
|
+
onGenerate(() => close(input || null))
|
|
122
|
+
}
|
|
123
|
+
}}
|
|
124
|
+
placeholder={'Describe what the regex should do'}
|
|
125
|
+
/>
|
|
126
|
+
<Button
|
|
127
|
+
size="xs"
|
|
128
|
+
color="blue"
|
|
129
|
+
buttonType="button"
|
|
130
|
+
btnClasses="!p-1 !w-[38px] !ml-2"
|
|
131
|
+
aria-label="Generate"
|
|
132
|
+
on:click={() => {
|
|
133
|
+
onGenerate(() => close(input || null))
|
|
134
|
+
}}
|
|
135
|
+
disabled={funcDesc.length <= 0}
|
|
136
|
+
iconOnly
|
|
137
|
+
startIcon={{ icon: Wand2 }}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
{#if promptHistory.length > 0}
|
|
141
|
+
<div class="w-96 flex flex-col gap-1">
|
|
142
|
+
{#each promptHistory as p}
|
|
143
|
+
<Button
|
|
144
|
+
size="xs2"
|
|
145
|
+
color="light"
|
|
146
|
+
btnClasses="justify-start overflow-x-scroll no-scrollbar"
|
|
147
|
+
startIcon={{ icon: HistoryIcon, classes: 'shrink-0' }}
|
|
148
|
+
on:click={() => {
|
|
149
|
+
funcDesc = p
|
|
150
|
+
}}>{p}</Button
|
|
151
|
+
>
|
|
152
|
+
{/each}
|
|
153
|
+
<button
|
|
154
|
+
class="underline text-xs text-start px-2 text-secondary font-normal"
|
|
155
|
+
on:click={clearPromptHistory}>clear history</button
|
|
156
|
+
>
|
|
157
|
+
</div>
|
|
158
|
+
{/if}
|
|
159
|
+
</div>
|
|
160
|
+
{:else}
|
|
161
|
+
<p class="text-sm">
|
|
162
|
+
Enable Windmill AI in the <a
|
|
163
|
+
href="/workspace_settings?tab=openai"
|
|
164
|
+
target="_blank"
|
|
165
|
+
class="inline-flex flex-row items-center gap-1"
|
|
166
|
+
>
|
|
167
|
+
workspace settings <ExternalLink size={16} />
|
|
168
|
+
</a>
|
|
169
|
+
</p>
|
|
170
|
+
{/if}
|
|
171
|
+
</div>
|
|
172
|
+
</Popup>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
gen: CustomEvent<any>;
|
|
6
|
+
} & {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type RegexGenProps = typeof __propDef.props;
|
|
12
|
+
export type RegexGenEvents = typeof __propDef.events;
|
|
13
|
+
export type RegexGenSlots = typeof __propDef.slots;
|
|
14
|
+
export default class RegexGen extends SvelteComponent<RegexGenProps, RegexGenEvents, RegexGenSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -130,14 +130,7 @@ $: updateSchema(lang, args);
|
|
|
130
130
|
floatingConfig={{
|
|
131
131
|
middleware: [
|
|
132
132
|
autoPlacement({
|
|
133
|
-
allowedPlacements: [
|
|
134
|
-
'bottom-start',
|
|
135
|
-
'bottom-end',
|
|
136
|
-
'top-start',
|
|
137
|
-
'top-end',
|
|
138
|
-
'top',
|
|
139
|
-
'bottom'
|
|
140
|
-
]
|
|
133
|
+
allowedPlacements: ['bottom-end', 'top-end']
|
|
141
134
|
})
|
|
142
135
|
]
|
|
143
136
|
}}
|
|
@@ -13,7 +13,7 @@ import HighlightCode from '../HighlightCode.svelte';
|
|
|
13
13
|
import LoadingIcon from '../apps/svelte-select/lib/LoadingIcon.svelte';
|
|
14
14
|
import { sleep } from '../../utils';
|
|
15
15
|
import { autoPlacement } from '@floating-ui/core';
|
|
16
|
-
import { Ban, Check, ExternalLink, HistoryIcon, Wand2, X } from 'lucide-svelte';
|
|
16
|
+
import { Ban, Check, ExternalLink, HistoryIcon, Wand2, X, ZapIcon } from 'lucide-svelte';
|
|
17
17
|
import { fade } from 'svelte/transition';
|
|
18
18
|
import { isInitialCode } from '../../script_helpers';
|
|
19
19
|
// props
|
|
@@ -101,7 +101,7 @@ function hideDiff() {
|
|
|
101
101
|
editor?.show();
|
|
102
102
|
diffEditor?.hide();
|
|
103
103
|
}
|
|
104
|
-
$: input?.focus();
|
|
104
|
+
$: input && setTimeout(() => input?.focus(), 100);
|
|
105
105
|
function clear() {
|
|
106
106
|
$generatedCode = '';
|
|
107
107
|
}
|
|
@@ -281,10 +281,16 @@ $: $generatedCode && updateScroll();
|
|
|
281
281
|
</div>
|
|
282
282
|
{:else if $copilotInfo.exists_openai_resource_path}
|
|
283
283
|
<div class="flex flex-col gap-4">
|
|
284
|
-
<
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
<div class="flex flex-row justify-between items-center">
|
|
285
|
+
<ToggleButtonGroup class="w-auto shrink-0" bind:selected={mode}>
|
|
286
|
+
<ToggleButton value={'gen'} label="Generate from scratch" small light />
|
|
287
|
+
<ToggleButton value={'edit'} label="Edit existing code" small light />
|
|
288
|
+
</ToggleButtonGroup>
|
|
289
|
+
|
|
290
|
+
<div class="text-[0.6rem] text-secondary opacity-60 flex flex-row items-center gap-0.5">
|
|
291
|
+
GPT-4 Turbo<ZapIcon size={14} />
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
288
294
|
<div class="flex w-96">
|
|
289
295
|
<input
|
|
290
296
|
type="text"
|
|
@@ -340,7 +346,7 @@ $: $generatedCode && updateScroll();
|
|
|
340
346
|
Context: {lang === 'graphql' ? 'GraphQL' : 'DB'} schema
|
|
341
347
|
</p>
|
|
342
348
|
<Tooltip>
|
|
343
|
-
|
|
349
|
+
We pass the selected schema to GPT-4 Turbo for better script generation.
|
|
344
350
|
</Tooltip>
|
|
345
351
|
</div>
|
|
346
352
|
{#if dbSchema.lang !== 'graphql' && (dbSchema.schema?.public || dbSchema.schema?.PUBLIC || dbSchema.schema?.dbo)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getNonStreamingCompletion } from './lib';
|
|
2
|
+
import { codeCompletionLoading } from '../../stores';
|
|
2
3
|
const systemPrompt = 'You are a code completion assistant, return the code that should go inside the <completion></completion> tags. If you add a line break, take into account the indentation of the code. You can also not return anything if you think the code is already complete.';
|
|
3
4
|
const prompt = `complete the following code:
|
|
4
5
|
\`\`\`{language}
|
|
@@ -13,6 +14,7 @@ const exampleUser = prompt
|
|
|
13
14
|
const exampleAssistant = `<completion>print(number)
|
|
14
15
|
number = number / 4</completion>`;
|
|
15
16
|
export async function editorCodeCompletion(before, after, lang, abortController) {
|
|
17
|
+
codeCompletionLoading.set(true);
|
|
16
18
|
const messages = [
|
|
17
19
|
{
|
|
18
20
|
role: 'system',
|
|
@@ -44,4 +46,7 @@ export async function editorCodeCompletion(before, after, lang, abortController)
|
|
|
44
46
|
console.log(err);
|
|
45
47
|
}
|
|
46
48
|
}
|
|
49
|
+
finally {
|
|
50
|
+
codeCompletionLoading.set(false);
|
|
51
|
+
}
|
|
47
52
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
|
-
import
|
|
2
|
+
import { type FlowModule, type HubScriptKind, RawScript, type PathScript, type InputTransform } from '../../gen';
|
|
3
3
|
import type { Writable } from 'svelte/store';
|
|
4
4
|
import type Editor from '../Editor.svelte';
|
|
5
5
|
import type { Drawer } from '../common';
|
|
@@ -31,6 +31,16 @@ export type FlowCopilotContext = {
|
|
|
31
31
|
modulesStore: Writable<FlowCopilotModule[]>;
|
|
32
32
|
currentStepStore: Writable<string | undefined>;
|
|
33
33
|
genFlow: ((i: number, modules: FlowModule[], stepOnly?: boolean) => Promise<void>) | undefined;
|
|
34
|
+
shouldUpdatePropertyType: Writable<{
|
|
35
|
+
[key: string]: 'static' | 'javascript' | undefined;
|
|
36
|
+
}>;
|
|
34
37
|
};
|
|
35
|
-
export declare function stepCopilot(module: FlowCopilotModule, deltaCodeStore: Writable<string>,
|
|
36
|
-
|
|
38
|
+
export declare function stepCopilot(module: FlowCopilotModule, deltaCodeStore: Writable<string>, workspace: string, pastModule: (FlowModule & {
|
|
39
|
+
value: RawScript | PathScript;
|
|
40
|
+
}) | undefined, isFirstInLoop: boolean, abortController: AbortController): Promise<string>;
|
|
41
|
+
export declare function glueCopilot(inputs: Record<string, InputTransform>, workspace: string, pastModule: FlowModule & {
|
|
42
|
+
value: RawScript | PathScript;
|
|
43
|
+
}, isFirstInLoop: boolean, abortController: AbortController): Promise<{
|
|
44
|
+
inputs: Record<string, string>;
|
|
45
|
+
allExprs: Record<string, string>;
|
|
46
|
+
}>;
|