Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions frontend/src/__tests__/components/ai/aiSetupSubtitle.spec.ts
Original file line number Diff line number Diff line change
@@ -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')
})
})
6 changes: 5 additions & 1 deletion frontend/src/components/ai/AISetup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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))
</script>

<template>
Expand All @@ -376,7 +380,7 @@ const usingChatterMate = computed(() => savedProvider.value === 'chattermate')

<header class="page-header">
<h1 class="page-title">AI Configuration</h1>
<p class="page-subtitle">Your agents already run on ChatterMate AI. Switch to your own model any time — this is optional.</p>
<p class="page-subtitle">{{ subtitle }}</p>
</header>

<div class="tabs-container">
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/ai/aiSetupSubtitle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* The AI Configuration subtitle. Only hosted editions have ChatterMate AI, so a
* self-hosted install is never told its agents "already run" on it.
*/
export function aiSetupSubtitle(hosted: boolean, onOwnModel: boolean): string {
if (!hosted) return 'Choose the AI model your agents use.'
if (onOwnModel) return 'Your agents run on your own model. Switch to ChatterMate AI any time.'
return 'Your agents already run on ChatterMate AI. Switch to your own model any time — this is optional.'
}
Loading