:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(conversations): add learn from support switch to support AI sett… (#130824)
Alex V9a609ab06ddc
diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsxindex 49b324f855ff..42d2959e576a 100644--- a/frontend/src/scenes/settings/SettingsMap.tsx+++ b/frontend/src/scenes/settings/SettingsMap.tsx@@ -1666,6 +1666,23 @@ export const SETTINGS_MAP: SettingSection[] = ['browser',],},+ {+ id: 'conversations-ai',+ title: (+ <>+ AI agent+ <LemonTag type="highlight" size="small" className="ml-1">+ Beta+ </LemonTag>+ </>+ ),+ description:+ 'Automatically generate AI-powered reply suggestions grounded in your business knowledge sources.',+ component: <AISection />,+ flag: 'PRODUCT_SUPPORT_AI_SUGGESTION_ORGS',+ allowForTeam: (t) => !!t?.conversations_enabled,+ keywords: ['ai', 'agent', 'suggestion', 'auto', 'reply', 'support', 'conversation', 'beta'],+ },{id: 'conversations-imports',title: (@@ -1689,23 +1706,6 @@ export const SETTINGS_MAP: SettingSection[] = [allowForTeam: (t) => !!t?.conversations_enabled,keywords: ['macro', 'canned', 'reply', 'shortcut', 'template', 'support', 'conversation'],},- {- id: 'conversations-ai',- title: (- <>- AI agent- <LemonTag type="highlight" size="small" className="ml-1">- Beta- </LemonTag>- </>- ),- description:- 'Automatically generate AI-powered reply suggestions grounded in your business knowledge sources.',- component: <AISection />,- flag: 'PRODUCT_SUPPORT_AI_SUGGESTION_ORGS',- allowForTeam: (t) => !!t?.conversations_enabled,- keywords: ['ai', 'agent', 'suggestion', 'auto', 'reply', 'support', 'conversation', 'beta'],- },],},{diff --git a/products/conversations/frontend/scenes/settings/AISection.tsx b/products/conversations/frontend/scenes/settings/AISection.tsxindex ea1e3e62a775..9aeddb3329c8 100644--- a/products/conversations/frontend/scenes/settings/AISection.tsx+++ b/products/conversations/frontend/scenes/settings/AISection.tsx@@ -13,6 +13,7 @@ import { SceneSection } from '~/layout/scenes/components/SceneSection'import { AIContextAccountPropertiesSection } from '../../components/AIContextAccountPropertiesSection/AIContextAccountPropertiesSection'import { SupportPlaybookSection } from '../../components/SupportPlaybookSection/SupportPlaybookSection'import { aiTriageTicketTypeLabel, TicketChannel } from '../../types'+import { LearnFromSupportCard } from './LearnFromSupportCard'import { supportSettingsLogic } from './supportSettingsLogic'import { CONVERSATIONS_LOGIC_KEY } from './SupportSettingsScene'@@ -98,17 +99,29 @@ export function AISection(): JSX.Element {/></div></LemonCard>- {aiSuggestionsEnabled && businessKnowledgeEnabled && (- <LemonBanner type="info" className="max-w-[800px] mt-3">- Add your documents, links, and general context to{' '}- <Link to={urls.businessKnowledge()} target="_blank">- Business knowledge- </Link>{' '}- so the AI can ground its replies in your company's information.- </LemonBanner>- )}</SceneSection>+ {businessKnowledgeEnabled && (+ <LemonBanner type="info" className="max-w-[800px] mt-3">+ Add your documents, links, and general context to{' '}+ <Link to={urls.businessKnowledge()} target="_blank">+ Business knowledge+ </Link>{' '}+ so the AI can ground its replies in your company's information.+ </LemonBanner>+ )}++ {businessKnowledgeEnabled && (+ <SceneSection+ title="Learn from support"+ titleSize="sm"+ className="my-8"+ description="When on, PostHog learns reusable answers from public human replies on resolved support tickets."+ >+ <LearnFromSupportCard />+ </SceneSection>+ )}+{aiSuggestionsEnabled && (<SceneSectiontitle="Investigate ticket data"diff --git a/products/conversations/frontend/scenes/settings/LearnFromSupportCard.tsx b/products/conversations/frontend/scenes/settings/LearnFromSupportCard.tsxnew file mode 100644index 000000000000..99a5b9a1a912--- /dev/null+++ b/products/conversations/frontend/scenes/settings/LearnFromSupportCard.tsx@@ -0,0 +1,48 @@+import { useActions, useValues } from 'kea'++import { LemonCard, LemonSwitch } from '@posthog/lemon-ui'++import { businessKnowledgeSettingsLogic } from 'products/business_knowledge/frontend/scenes/settings/businessKnowledgeSettingsLogic'+import { LearnFromPastTicketsSetting } from 'products/business_knowledge/frontend/scenes/settings/LearnFromPastTicketsSetting'++const SWITCH_ID = 'support-ai-learn-from-support-switch'++export function LearnFromSupportCard(): JSX.Element {+ const { settings, settingsLoading, settingsSaving } = useValues(businessKnowledgeSettingsLogic)+ const { setLearnFromSupportEnabled } = useActions(businessKnowledgeSettingsLogic)++ const disabledReason = !settings+ ? settingsLoading+ ? undefined+ : "Couldn't load this setting. Refresh the page to try again."+ : !settings.support_enabled && !settings.learn_from_support_enabled+ ? 'Turn on Support to learn from resolved tickets'+ : undefined++ return (+ <div className="flex flex-col gap-4">+ <LemonCard hoverEffect={false} className="flex flex-col gap-y-3 max-w-[800px] px-4 py-3">+ <div className="flex items-center gap-4 justify-between">+ <div>+ <label htmlFor={SWITCH_ID} className="font-medium">+ Learn from support+ </label>+ <p className="text-xs text-muted-alt mb-0">+ Learned answers are added to your Business knowledge sources.+ </p>+ </div>+ <LemonSwitch+ id={SWITCH_ID}+ checked={!!settings?.learn_from_support_enabled}+ onChange={setLearnFromSupportEnabled}+ loading={settingsLoading || settingsSaving}+ disabledReason={disabledReason}+ // data-attr is a frozen autocapture / Playwright key. Do not rename.+ data-attr="support-ai-learn-from-support"+ />+ </div>+ </LemonCard>+ <LearnFromPastTicketsSetting />+ </div>+ )+}