nits disableAi

This commit is contained in:
Ruben Fiszel
2025-10-04 16:54:59 +00:00
parent ed26aa4092
commit 417ea10701
8 changed files with 46 additions and 21 deletions
@@ -1671,7 +1671,7 @@
</div>
{#if selected == 'logs' && render}
<div
class="mx-auto"
class="mx-auto overflow-auto"
bind:clientHeight={tabsHeight.logsHeight}
style="min-height: {minTabHeight}px"
>
@@ -5,17 +5,27 @@
import { Wand2, Loader2 } from 'lucide-svelte'
import SearchItems from '../SearchItems.svelte'
import { emptyString } from '$lib/utils'
import { createEventDispatcher, onMount } from 'svelte'
import { createEventDispatcher, onMount, untrack } from 'svelte'
export let funcDesc: string
export let trigger = false
export let loading = false
export let preFilter: string
export let disableAi = false
let scripts: Script[] | undefined = $state(undefined)
interface Props {
funcDesc: string
trigger?: boolean
loading?: boolean
preFilter: string
disableAi?: boolean
filteredItems?: (Script & { marked?: string })[] | (Item & { marked?: string })[]
}
let scripts: Script[] | undefined = undefined
export let filteredItems: (Script & { marked?: string })[] | (Item & { marked?: string })[] = []
$: prefilteredItems = scripts ?? []
let {
funcDesc = $bindable(),
trigger = false,
loading = false,
preFilter,
disableAi = false,
filteredItems = $bindable([])
}: Props = $props()
let prefilteredItems = $derived(scripts ?? [])
const dispatch = createEventDispatcher()
@@ -29,14 +39,18 @@
scripts = loadedScripts
}
$: scripts == undefined && funcDesc?.length > 1 && loadScripts()
$effect(() => {
scripts == undefined && funcDesc?.length > 1 && untrack(() => loadScripts())
})
let input: HTMLInputElement
let input: HTMLInputElement | undefined = $state()
$: preFilter &&
setTimeout(() => {
input?.focus()
}, 50)
$effect(() => {
preFilter &&
setTimeout(() => {
input?.focus()
}, 50)
})
onMount(() => {
input?.focus()
@@ -55,7 +69,7 @@
<input
bind:this={input}
type="text"
on:keydown={(e) => {
onkeydown={(e) => {
if (e.key === 'Escape') {
dispatch('escape')
}
@@ -14,10 +14,12 @@
import { aiModuleActionToBgColor } from '$lib/components/copilot/chat/flow/utils'
let {
small,
clazz
clazz,
disableAi
}: {
small: boolean
clazz: string
disableAi?: boolean
} = $props()
const dispatch = createEventDispatcher<{
@@ -111,6 +113,7 @@
{:else}
<!-- Index 0 is used by the tutorial to identify the first "Add step" -->
<InsertModuleButton
{disableAi}
index="error-handler-button"
placement={'bottom-center'}
on:new={(e) => {
@@ -363,6 +363,7 @@
class={`z-50 absolute inline-flex flex-col gap-2 top-3 left-1/2 -translate-x-1/2 flex-initial items-center transition-colors duration-[400ms] ease-linear bg-surface-100`}
>
<FlowStickyNode
{disableAi}
{showFlowAiButton}
{disableSettings}
{disableStaticInputs}
@@ -15,6 +15,7 @@
aiChatOpen?: boolean
showFlowAiButton?: boolean
toggleAiChat?: () => void
disableAi?: boolean
}
let {
@@ -23,7 +24,8 @@
smallErrorHandler,
aiChatOpen,
showFlowAiButton,
toggleAiChat
toggleAiChat,
disableAi
}: Props = $props()
const { selectedId, flowStore } = getContext<FlowEditorContext>('FlowEditorContext')
@@ -68,7 +70,7 @@
</Popover>
{/if}
<Popover>
<FlowErrorHandlerItem small={smallErrorHandler} on:generateStep clazz={nodeClass} />
<FlowErrorHandlerItem {disableAi} small={smallErrorHandler} on:generateStep clazz={nodeClass} />
{#snippet text()}
Error Handler
{/snippet}
@@ -21,6 +21,7 @@
iconSize?: number
clazz?: string
placement?: Placement
disableAi?: boolean
}
let {
@@ -29,7 +30,8 @@
kind = 'script',
iconSize = 12,
clazz = '',
placement = 'bottom-center'
placement = 'bottom-center',
disableAi = false
}: Props = $props()
let floatingConfig: ComputeConfig = {
@@ -98,6 +100,7 @@ shouldUsePortal={true} -->
on:pickScript
allowTrigger={index == 0}
{kind}
{disableAi}
/>
{/snippet}
</PopupV2>
@@ -92,6 +92,7 @@
<!-- <pre class="text-2xs">A{JSON.stringify(data.branch)}, {data.sourceId}, {data.targetId}</pre> -->
<!-- {data.targetId} B -->
<InsertModuleButton
disableAi={data.disableAi}
index={data.index ?? 0}
on:new={(e) => {
data?.eventHandlers.insert({
@@ -38,6 +38,7 @@
{#if data.insertable && !data.hasPreprocessor}
<div class="absolute bottom-full left-0 right-0 flex center-center mb-3.5">
<InsertModuleButton
disableAi={data.disableAi}
index={0}
kind="preprocessor"
on:new={(e) => {