Skip to content

: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.

1.3 KB
Raw Blame
import { MakeLogicType, actions, kea, path, reducers } from 'kea'

type PromptSource = 'custom_prompt' | 'starter_question'

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface dashboardAiPromptComposerLogicValues {
    prompt: string
    promptSource: PromptSource
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface dashboardAiPromptComposerLogicActions {
    setPrompt: (
        prompt: string,
        promptSource?: PromptSource
    ) => {
        prompt: string
        promptSource: PromptSource
    }
}

export type dashboardAiPromptComposerLogicType = MakeLogicType<
    dashboardAiPromptComposerLogicValues,
    dashboardAiPromptComposerLogicActions
>

export const dashboardAiPromptComposerLogic = kea<dashboardAiPromptComposerLogicType>([
    path(['scenes', 'dashboard', 'dashboardAiPromptComposerLogic']),
    actions({
        setPrompt: (prompt: string, promptSource: PromptSource = 'custom_prompt') => ({
            prompt,
            promptSource,
        }),
    }),
    reducers({
        prompt: ['', { setPrompt: (_, { prompt }) => prompt }],
        promptSource: ['custom_prompt' as PromptSource, { setPrompt: (_, { promptSource }) => promptSource }],
    }),
])