Files
windmill/frontend/src/lib/components/copilot/TestAIKey.svelte
T
centdixandClaude Opus 4.6 db5e03610d feat: add instance-level AI settings (#8453)
* feat: add instance-level AI settings with workspace fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add AI step to onboarding setup wizard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: thread workspace prop through resource editor and disable chat offset

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Revert "fix: thread workspace prop through resource editor and disable chat offset"

This reverts commit 9fea9cc0c239f6432d1fef1487c45e74ab752e21.

* fix: set workspace store and disable chat offset during AI setup step

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: thread workspace and disableChatOffset props through resource editors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: populate workspace and user stores for AI step path component

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: initialize AI clients for test key during onboarding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: extract AI config state into InstanceAISettings component

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: move AI config state ownership into AISettings component

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Persist instance AI settings before navigation

* Reload effective workspace AI state after save

* Scope AI key tests to the rendered workspace

* Add post-create AI onboarding for new workspaces

* Unify instance AI settings header

* Fix instance AI drawer offset on workspace selection

* Add instance AI fallback settings behavior

* Update sqlx metadata

* Update sqlx metadata

* Clarify active instance AI in workspace settings

* Refresh workspace AI state after instance AI save

* Declare instance AI summary in API schema

* Normalize empty instance AI config handling

* Clean up workspace AI settings UI

* Unify AI config provider checks

* Split AI settings metadata from effective config

* Propagate instance AI cache invalidation across servers

* Fix AI settings dirty state tracking

* Update sqlx metadata

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 19:18:36 +00:00

68 lines
1.3 KiB
Svelte

<script lang="ts">
import type { AIProvider } from '$lib/gen'
import { sendUserToast } from '$lib/toast'
import Button from '../common/button/Button.svelte'
import { testKey } from './lib'
interface Props {
disabled?: boolean
apiKey?: string | undefined
workspace?: string | undefined
resourcePath?: string | undefined
aiProvider: AIProvider
model: string
}
let {
disabled = false,
apiKey = undefined,
workspace = undefined,
resourcePath = undefined,
aiProvider,
model
}: Props = $props()
let loading = $state(false)
</script>
<Button
unifiedSize="md"
variant="default"
{disabled}
{loading}
on:click={async () => {
loading = true
try {
const abortController = new AbortController()
setTimeout(() => {
abortController.abort()
}, 10000)
await testKey({
apiKey,
workspace,
resourcePath,
messages: [
{
role: 'user',
content: "this is a test, simply reply with 'ok'"
}
],
abortController,
aiProvider,
model
})
sendUserToast('Valid key')
} catch (err) {
if (err.message === 'Request was aborted.') {
sendUserToast('Could not validate key within 10s', true)
} else {
sendUserToast(`Invalid key: ${err}`, true)
}
} finally {
loading = false
}
}}
>Test key
</Button>