: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(aio): improve online evals list controls and columns (#70861)
Radu Raicea231f90f54f11
diff --git a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsx b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsxindex 89632feb908c..c6dfef934839 100644--- a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsx+++ b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsx@@ -1,7 +1,8 @@import { BindLogic, useActions, useMountedLogic, useValues } from 'kea'import { combineUrl, router } from 'kea-router'+import { useEffect, useRef, useState } from 'react'-import { IconPencil, IconPlus, IconSearch, IconTrash, IconWarning } from '@posthog/icons'+import { IconEye, IconHide, IconPencil, IconPlus, IconSearch, IconTrash, IconWarning } from '@posthog/icons'import {LemonBanner,LemonButton,@@ -20,10 +21,12 @@ import { AccessControlAction } from 'lib/components/AccessControlAction'import { DateFilter } from 'lib/components/DateFilter/DateFilter'import { FEATURE_FLAGS } from 'lib/constants'import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'+import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'import { deleteWithUndo } from 'lib/utils/deleteWithUndo'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'+import { fullName } from 'lib/utils/strings'import { SceneExport } from 'scenes/sceneTypes'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -117,6 +120,37 @@ function getEvaluationConfigPreview(evaluation: EvaluationConfig): string {return evaluation.evaluation_config.prompt}+function EvaluationDescription({ description }: { description: string }): JSX.Element {+ const [expanded, setExpanded] = useState(false)+ const [isClamped, setIsClamped] = useState(false)+ const textRef = useRef<HTMLDivElement | null>(null)++ // line-clamp-1 constrains clientHeight to a single line; if scrollHeight exceeds it the text is+ // truncated and worth a toggle. Only measure while collapsed — expanded, scrollHeight === clientHeight.+ useEffect(() => {+ if (textRef.current && !expanded) {+ setIsClamped(textRef.current.scrollHeight > textRef.current.clientHeight)+ }+ }, [description, expanded])++ return (+ <div className="flex items-start gap-1">+ <div ref={textRef} className={`text-muted text-sm ${expanded ? '' : 'line-clamp-1'}`}>+ {description}+ </div>+ {(isClamped || expanded) && (+ <LemonButton+ size="xsmall"+ onClick={() => setExpanded(!expanded)}+ data-attr="toggle-evaluation-description"+ >+ {expanded ? 'Show less' : 'Show more'}+ </LemonButton>+ )}+ </div>+ )+}+function AIObservabilityEvaluationsContent(): JSX.Element {const evaluationsLogic = llmEvaluationsLogic()const metricsLogic = evaluationMetricsLogic()@@ -125,12 +159,14 @@ function AIObservabilityEvaluationsContent(): JSX.Element {filteredEvaluations,evaluationsLoading,evaluationsFilter,+ showDisabledEvaluations,dateFilter,providerKeys,unhealthyProviderKeysUsedByEvaluations,canEnableEvaluation,} = useValues(evaluationsLogic)- const { setEvaluationsFilter, toggleEvaluationEnabled, loadEvaluations, setDates } = useActions(evaluationsLogic)+ const { setEvaluationsFilter, setShowDisabledEvaluations, toggleEvaluationEnabled, loadEvaluations, setDates } =+ useActions(evaluationsLogic)const { evaluationsWithMetrics } = useValues(metricsLogic)const { currentTeamId } = useValues(teamLogic)const { push } = useActions(router)@@ -155,7 +191,7 @@ function AIObservabilityEvaluationsContent(): JSX.Element {<Link to={evaluationUrl(evaluation.id)} className="font-semibold text-primary">{evaluation.name}</Link>- {evaluation.description && <div className="text-muted text-sm">{evaluation.description}</div>}+ {evaluation.description && <EvaluationDescription description={evaluation.description} />}</div>),sorter: (a, b) => a.name.localeCompare(b.name),@@ -302,6 +338,22 @@ function AIObservabilityEvaluationsContent(): JSX.Element {)},},+ {+ title: 'Created by',+ key: 'created_by',+ render: (_, evaluation) =>+ evaluation.created_by ? (+ <ProfilePicture user={evaluation.created_by} size="md" showName />+ ) : (+ <span className="text-muted text-sm">–</span>+ ),+ sorter: (a, b) => {+ // Match the displayed identity: full name, falling back to email when no name is set.+ const sortKey = (e: EvaluationConfig): string =>+ e.created_by ? fullName(e.created_by) || e.created_by.email : ''+ return sortKey(a).localeCompare(sortKey(b))+ },+ },{title: 'Actions',key: 'actions',@@ -420,6 +472,16 @@ function AIObservabilityEvaluationsContent(): JSX.Element {prefix={<IconSearch />}className="max-w-sm"/>+ <LemonButton+ type="secondary"+ active={!showDisabledEvaluations}+ icon={showDisabledEvaluations ? <IconEye /> : <IconHide />}+ onClick={() => setShowDisabledEvaluations(!showDisabledEvaluations)}+ data-attr="toggle-show-disabled-evaluations"+ tooltip={showDisabledEvaluations ? 'Hide disabled evals' : 'Show disabled evals'}+ >+ {showDisabledEvaluations ? 'Hide disabled' : 'Show disabled'}+ </LemonButton></div><LemonTablediff --git a/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.test.ts b/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.test.tsindex 075384f9dd29..a3e3f11c0a82 100644--- a/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.test.ts+++ b/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.test.ts@@ -244,4 +244,23 @@ describe('llmEvaluationsLogic', () => {})})})++ describe('filteredEvaluations', () => {+ const enabledEval = evaluationWithKey('eval-enabled', null)+ const disabledEval = { ...evaluationWithKey('eval-disabled', null), enabled: false }++ it('includes disabled evaluations by default and excludes them when hidden', async () => {+ logic.actions.loadEvaluationsSuccess([enabledEval, disabledEval])++ await expectLogic(logic).toMatchValues({+ filteredEvaluations: [enabledEval, disabledEval],+ })++ logic.actions.setShowDisabledEvaluations(false)++ await expectLogic(logic).toMatchValues({+ filteredEvaluations: [enabledEval],+ })+ })+ })})diff --git a/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.ts b/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.tsindex 95df95c8f324..47b25199b05e 100644--- a/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.ts+++ b/products/ai_observability/frontend/evaluations/llmEvaluationsLogic.ts@@ -63,6 +63,7 @@ export const llmEvaluationsLogic = kea<llmEvaluationsLogicType>([toggleEvaluationEnabledSuccess: (id: string) => ({ id }),toggleEvaluationEnabledFailure: (id: string, error: string) => ({ id, error }),setEvaluationsFilter: (filter: string) => ({ filter }),+ setShowDisabledEvaluations: (show: boolean) => ({ show }),}),reducers({@@ -114,6 +115,12 @@ export const llmEvaluationsLogic = kea<llmEvaluationsLogicType>([setEvaluationsFilter: (_, { filter }) => filter,},],+ showDisabledEvaluations: [+ true,+ {+ setShowDisabledEvaluations: (_, { show }) => show,+ },+ ],}),listeners(({ actions, values }) => ({@@ -212,12 +219,15 @@ export const llmEvaluationsLogic = kea<llmEvaluationsLogicType>([selectors({filteredEvaluations: [- (s) => [s.evaluations, s.evaluationsFilter],- (evaluations: EvaluationConfig[], filter: string) => {+ (s) => [s.evaluations, s.evaluationsFilter, s.showDisabledEvaluations],+ (evaluations: EvaluationConfig[], filter: string, showDisabledEvaluations: boolean) => {+ const visible = showDisabledEvaluations+ ? evaluations+ : evaluations.filter((e: EvaluationConfig) => e.enabled)if (!filter) {- return evaluations+ return visible}- return evaluations.filter(+ return visible.filter((e: EvaluationConfig) =>e.name.toLowerCase().includes(filter.toLowerCase()) ||e.description?.toLowerCase().includes(filter.toLowerCase()) ||diff --git a/products/ai_observability/frontend/evaluations/types.ts b/products/ai_observability/frontend/evaluations/types.tsindex 666cb51e610a..e235d139eeae 100644--- a/products/ai_observability/frontend/evaluations/types.ts+++ b/products/ai_observability/frontend/evaluations/types.ts@@ -1,4 +1,4 @@-import { AnyPropertyFilter } from '~/types'+import { AnyPropertyFilter, UserBasicType } from '~/types'import { LLMProvider } from '../settings/llmProviderKeysLogic'@@ -68,6 +68,7 @@ export interface BaseEvaluationConfig {last_run_at?: stringcreated_at: stringupdated_at: string+ created_by?: UserBasicType | nulldeleted?: boolean}