diff --git a/frontend/src/__tests__/components/ai/aiSetupSubtitle.spec.ts b/frontend/src/__tests__/components/ai/aiSetupSubtitle.spec.ts new file mode 100644 index 00000000..69ad7f37 --- /dev/null +++ b/frontend/src/__tests__/components/ai/aiSetupSubtitle.spec.ts @@ -0,0 +1,17 @@ +import { describe, expect, it } from 'vitest' +import { aiSetupSubtitle } from '@/components/ai/aiSetupSubtitle' + +describe('aiSetupSubtitle', () => { + it('never mentions ChatterMate AI on a self-hosted install', () => { + expect(aiSetupSubtitle(false, false)).not.toContain('ChatterMate AI') + expect(aiSetupSubtitle(false, true)).not.toContain('ChatterMate AI') + }) + + it('says hosted agents run on ChatterMate AI by default', () => { + expect(aiSetupSubtitle(true, false)).toContain('already run on ChatterMate AI') + }) + + it('does not claim ChatterMate AI once a hosted org saved its own model', () => { + expect(aiSetupSubtitle(true, true)).not.toContain('already run') + }) +}) diff --git a/frontend/src/components/ai/AISetup.vue b/frontend/src/components/ai/AISetup.vue index 6552d0c9..6e67a779 100644 --- a/frontend/src/components/ai/AISetup.vue +++ b/frontend/src/components/ai/AISetup.vue @@ -21,6 +21,7 @@ import { useEnterpriseFeatures } from '@/composables/useEnterpriseFeatures' import { useSubscriptionStorage } from '@/utils/storage' import { planDisplayName, planShortName } from '@/utils/planDisplay' import { useUpgradePlan } from '@/composables/useUpgradePlan' +import { aiSetupSubtitle } from './aiSetupSubtitle' const { upgradeText: lockUpgradeText } = useUpgradePlan('custom_models') @@ -361,6 +362,9 @@ const chatterMateButtonText = computed(() => { /** The saved setup already runs on ChatterMate AI: nothing to switch to. */ const usingChatterMate = computed(() => savedProvider.value === 'chattermate') + +const subtitle = computed(() => + aiSetupSubtitle(hasEnterpriseModule, hasExistingConfig.value && !usingChatterMate.value))