windmill-components 1.501.20 → 1.501.22
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/FlowBuilder.svelte +1 -1
- package/package/components/FlowWrapper.svelte +5 -2
- package/package/components/ScriptWrapper.svelte +4 -5
- package/package/components/apps/components/display/dbtable/utils.d.ts +8 -8
- package/package/components/copilot/chat/AiChatLayout.svelte +68 -0
- package/package/components/copilot/chat/AiChatLayout.svelte.d.ts +9 -0
- package/package/stores.d.ts +1 -0
- package/package/stores.js +12 -0
- package/package.json +1 -1
|
@@ -42,7 +42,7 @@ let initialPathStore = writable(initialPath);
|
|
|
42
42
|
let fakeInitialPath = 'u/' +
|
|
43
43
|
($userStore?.username?.includes('@')
|
|
44
44
|
? $userStore.username.split('@')[0].replace(/[^a-zA-Z0-9_]/g, '')
|
|
45
|
-
: $userStore
|
|
45
|
+
: $userStore?.username) +
|
|
46
46
|
'/' +
|
|
47
47
|
generateRandomString(12);
|
|
48
48
|
// Used by multiplayer deploy collision warning
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
<script lang="ts">import
|
|
1
|
+
<script lang="ts">import AiChatLayout from './copilot/chat/AiChatLayout.svelte';
|
|
2
|
+
import FlowBuilder from './FlowBuilder.svelte';
|
|
2
3
|
let { flowStore: oldFlowStore, ...props } = $props();
|
|
3
4
|
let flowStore = $state(oldFlowStore);
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
|
-
<
|
|
7
|
+
<AiChatLayout noPadding={true}>
|
|
8
|
+
<FlowBuilder {flowStore} {...props} />
|
|
9
|
+
</AiChatLayout>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script lang="ts">import ScriptBuilder from './ScriptBuilder.svelte';
|
|
2
|
+
import AiChatLayout from './copilot/chat/AiChatLayout.svelte';
|
|
2
3
|
let { script: oldScript, ...props } = $props();
|
|
3
4
|
let script = $state(oldScript);
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
<ScriptBuilder
|
|
8
|
-
|
|
9
|
-
{...props}
|
|
10
|
-
/>
|
|
7
|
+
<AiChatLayout noPadding>
|
|
8
|
+
<ScriptBuilder {script} {...props} />
|
|
9
|
+
</AiChatLayout>
|
|
@@ -56,14 +56,6 @@ export declare function formatSchema(dbSchema: {
|
|
|
56
56
|
schema: SQLSchema['schema'];
|
|
57
57
|
publicOnly: SQLSchema['publicOnly'];
|
|
58
58
|
}): {
|
|
59
|
-
[tableKey: string]: {
|
|
60
|
-
[columnKey: string]: {
|
|
61
|
-
type: string;
|
|
62
|
-
default: string;
|
|
63
|
-
required: boolean;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
} | {
|
|
67
59
|
[schemaKey: string]: {
|
|
68
60
|
[tableKey: string]: {
|
|
69
61
|
[columnKey: string]: {
|
|
@@ -73,6 +65,14 @@ export declare function formatSchema(dbSchema: {
|
|
|
73
65
|
};
|
|
74
66
|
};
|
|
75
67
|
};
|
|
68
|
+
} | {
|
|
69
|
+
[tableKey: string]: {
|
|
70
|
+
[columnKey: string]: {
|
|
71
|
+
type: string;
|
|
72
|
+
default: string;
|
|
73
|
+
required: boolean;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
76
|
};
|
|
77
77
|
export declare function formatGraphqlSchema(schema: IntrospectionQuery): string;
|
|
78
78
|
export type DbType = (typeof dbTypes)[number];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">import { classNames } from '../../../utils';
|
|
2
|
+
import { Pane, Splitpanes } from 'svelte-splitpanes';
|
|
3
|
+
import AiChat from './AIChat.svelte';
|
|
4
|
+
import { zIndexes } from '../../../zIndexes';
|
|
5
|
+
import { loadCopilot, userStore, workspaceStore } from '../../../stores';
|
|
6
|
+
import { chatState } from './sharedChatState.svelte';
|
|
7
|
+
let { noPadding: noBorder = false, isCollapsed = false, children, onMenuOpen } = $props();
|
|
8
|
+
workspaceStore.subscribe(async (workspace) => {
|
|
9
|
+
if (workspace) {
|
|
10
|
+
loadCopilot(workspace);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Splitpanes horizontal={false} class="flex-1 min-h-0">
|
|
16
|
+
<Pane size={99.8 - chatState.size} minSize={50} class="flex flex-col min-h-0">
|
|
17
|
+
<div
|
|
18
|
+
id="content"
|
|
19
|
+
class={classNames(
|
|
20
|
+
'w-full flex-1 flex flex-col overflow-y-auto',
|
|
21
|
+
noBorder || $userStore?.operator ? '!pl-0' : isCollapsed ? 'md:pl-12' : 'md:pl-40',
|
|
22
|
+
'transition-all ease-in-out duration-200'
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
<main class="flex-1 flex flex-col">
|
|
26
|
+
<div class="relative w-full flex-1 flex flex-col">
|
|
27
|
+
<div
|
|
28
|
+
class={classNames(
|
|
29
|
+
'pt-2 px-4 sm:px-4 flex flex-row justify-between items-center shadow-sm max-w-7xl md:hidden',
|
|
30
|
+
noBorder || $userStore?.operator ? 'hidden' : ''
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
<button
|
|
34
|
+
aria-label="Menu"
|
|
35
|
+
type="button"
|
|
36
|
+
onclick={() => {
|
|
37
|
+
onMenuOpen?.()
|
|
38
|
+
}}
|
|
39
|
+
class="h-8 w-8 inline-flex items-center justify-center rounded-md text-tertiary hover:text-primary focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500"
|
|
40
|
+
>
|
|
41
|
+
<svg
|
|
42
|
+
class="h-6 w-6"
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
fill="none"
|
|
45
|
+
viewBox="0 0 24 24"
|
|
46
|
+
stroke-width="2"
|
|
47
|
+
stroke="currentColor"
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
>
|
|
50
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
|
|
51
|
+
</svg>
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="flex-1">
|
|
55
|
+
{@render children?.()}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</main>
|
|
59
|
+
</div>
|
|
60
|
+
</Pane>
|
|
61
|
+
<Pane
|
|
62
|
+
bind:size={chatState.size}
|
|
63
|
+
minSize={15}
|
|
64
|
+
class={`flex flex-col min-h-0 z-[${zIndexes.aiChat}]`}
|
|
65
|
+
>
|
|
66
|
+
<AiChat />
|
|
67
|
+
</Pane>
|
|
68
|
+
</Splitpanes>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
noPadding?: boolean;
|
|
3
|
+
isCollapsed?: boolean;
|
|
4
|
+
children: any;
|
|
5
|
+
onMenuOpen?: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const AiChatLayout: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type AiChatLayout = ReturnType<typeof AiChatLayout>;
|
|
9
|
+
export default AiChatLayout;
|
package/package/stores.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const copilotInfo: import("svelte/store").Writable<{
|
|
|
49
49
|
defaultModel?: AIProviderModel;
|
|
50
50
|
aiModels: AIProviderModel[];
|
|
51
51
|
}>;
|
|
52
|
+
export declare function loadCopilot(workspace: string): Promise<void>;
|
|
52
53
|
export declare function setCopilotInfo(aiConfig: AIConfig): void;
|
|
53
54
|
export declare const codeCompletionLoading: import("svelte/store").Writable<boolean>;
|
|
54
55
|
export declare const metadataCompletionEnabled: import("svelte/store").Writable<boolean>;
|
package/package/stores.js
CHANGED
|
@@ -2,6 +2,7 @@ import { BROWSER } from 'esm-env';
|
|
|
2
2
|
import { derived, writable } from 'svelte/store';
|
|
3
3
|
import { WorkspaceService } from './gen';
|
|
4
4
|
import { getLocalSetting } from './utils';
|
|
5
|
+
import { workspaceAIClients } from './components/copilot/lib';
|
|
5
6
|
const persistedWorkspace = BROWSER && getWorkspace();
|
|
6
7
|
function getWorkspace() {
|
|
7
8
|
try {
|
|
@@ -62,6 +63,17 @@ export const copilotInfo = writable({
|
|
|
62
63
|
defaultModel: undefined,
|
|
63
64
|
aiModels: []
|
|
64
65
|
});
|
|
66
|
+
export async function loadCopilot(workspace) {
|
|
67
|
+
workspaceAIClients.init(workspace);
|
|
68
|
+
try {
|
|
69
|
+
const info = await WorkspaceService.getCopilotInfo({ workspace });
|
|
70
|
+
setCopilotInfo(info);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
setCopilotInfo({});
|
|
74
|
+
console.error('Could not get copilot info', err);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
65
77
|
export function setCopilotInfo(aiConfig) {
|
|
66
78
|
if (Object.keys(aiConfig.providers ?? {}).length > 0) {
|
|
67
79
|
const aiModels = Object.entries(aiConfig.providers ?? {}).flatMap(([provider, providerConfig]) => providerConfig.models.map((m) => ({ model: m, provider: provider })));
|