mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-23 00:00:33 +00:00
nit: show disabled message when lang not supported (#5925)
* show disabled message when lang not supported * remove open effect
This commit is contained in:
@@ -353,12 +353,6 @@
|
||||
let testPanelSize = $state(30)
|
||||
let storedTestPanelSize = untrack(() => testPanelSize)
|
||||
|
||||
$effect(() => {
|
||||
if (SUPPORTED_CHAT_SCRIPT_LANGUAGES.includes(lang ?? '') == !aiChatManager.open) {
|
||||
untrack(() => aiChatManager.toggleOpen())
|
||||
}
|
||||
})
|
||||
|
||||
function toggleTestPanel() {
|
||||
if (testPanelSize > 0) {
|
||||
storedTestPanelSize = testPanelSize
|
||||
|
||||
@@ -12,15 +12,26 @@
|
||||
import { aiChatManager, AIMode } from './AIChatManager.svelte'
|
||||
import { base } from '$lib/base'
|
||||
import HideButton from '$lib/components/apps/editor/settingsPanel/HideButton.svelte'
|
||||
import { SUPPORTED_CHAT_SCRIPT_LANGUAGES } from './script/core'
|
||||
|
||||
const isAdmin = $derived($userStore?.is_admin || $userStore?.is_super_admin)
|
||||
const hasCopilot = $derived($copilotInfo.enabled)
|
||||
const disabled = $derived(
|
||||
!hasCopilot ||
|
||||
(aiChatManager.mode === AIMode.SCRIPT &&
|
||||
aiChatManager.scriptEditorOptions?.lang &&
|
||||
!SUPPORTED_CHAT_SCRIPT_LANGUAGES.includes(aiChatManager.scriptEditorOptions.lang))
|
||||
)
|
||||
const disabledMessage = $derived(
|
||||
hasCopilot
|
||||
? ''
|
||||
: isAdmin
|
||||
!hasCopilot
|
||||
? isAdmin
|
||||
? `Enable Windmill AI in your [workspace settings](${base}/workspace_settings?tab=ai) to use this chat`
|
||||
: 'Ask an admin to enable Windmill AI in this workspace to use this chat'
|
||||
: aiChatManager.mode === AIMode.SCRIPT &&
|
||||
aiChatManager.scriptEditorOptions?.lang &&
|
||||
!SUPPORTED_CHAT_SCRIPT_LANGUAGES.includes(aiChatManager.scriptEditorOptions.lang)
|
||||
? `Windmill AI does not support the ${aiChatManager.scriptEditorOptions.lang} language yet.`
|
||||
: ''
|
||||
)
|
||||
|
||||
const suggestions = [
|
||||
@@ -143,7 +154,7 @@
|
||||
!!aiChatManager.scriptEditorOptions.lastDeployedCode &&
|
||||
aiChatManager.scriptEditorOptions.lastDeployedCode !== aiChatManager.scriptEditorOptions.code}
|
||||
diffMode={aiChatManager.scriptEditorOptions?.diffMode ?? false}
|
||||
disabled={!hasCopilot}
|
||||
{disabled}
|
||||
{disabledMessage}
|
||||
{suggestions}
|
||||
></AIChatDisplay>
|
||||
|
||||
Reference in New Issue
Block a user