Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(insights): CSV export writes platform display names, not slugs (#234)
Gökhan Geyik07ba4c839a02
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/insights/_charts.tsx b/web/src/app/[locale]/(dashboard)/dashboard/insights/_charts.tsxindex c6e3e29ce..9b7188be9 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/insights/_charts.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/insights/_charts.tsx@@ -1,6 +1,7 @@'use client';import { useRef, useState, useEffect } from 'react';+import { PLATFORM_LABELS } from '@/config/platform-labels';import {AreaChart,Area,@@ -103,25 +104,6 @@ const PLATFORM_COLORS: Record<string, string> = {'gemini-2.5-flash': '#4ade80',};-const PLATFORM_LABELS: Record<string, string> = {- chatgpt: 'ChatGPT',- gemini: 'Gemini',- perplexity: 'Perplexity',- claude: 'Claude',- grok: 'Grok',- copilot: 'Copilot',- 'meta-ai': 'Meta AI',- 'google-ai-overviews': 'Google AI',- 'google-ai-mode': 'Google AI Mode',- 'google-aimode': 'Google AI Mode',- 'gpt-5-chat-latest': 'GPT-5',- 'gpt-5-mini': 'GPT-5 Mini',- 'claude-sonnet-4-6': 'Claude Sonnet 4.6',- 'claude-opus-4-6': 'Claude Opus 4.6',- 'gemini-2.5-pro': 'Gemini 2.5 Pro',- 'gemini-2.5-flash': 'Gemini 2.5 Flash',-};-// ─── Custom Tooltips ──────────────────────────────────────────────────────────function AreaTooltip({diff --git a/web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsxindex e50204b6e..da0206a95 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsx@@ -29,6 +29,7 @@ import {type BreakdownMetric,} from '@/lib/actions/tracking';import { getTopics } from '@/lib/actions/topic';+import { PLATFORM_LABELS } from '@/config/platform-labels';import type { Topic } from '@/types';import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';import { Badge } from '@/components/ui/badge';@@ -210,25 +211,6 @@ function VisibilityBar({ score, max = 100 }: { score: number; max?: number }) {);}-const PLATFORM_LABELS: Record<string, string> = {- chatgpt: 'ChatGPT',- gemini: 'Gemini',- perplexity: 'Perplexity',- claude: 'Claude',- grok: 'Grok',- copilot: 'Copilot',- 'meta-ai': 'Meta AI',- 'google-ai-overviews': 'Google AI',- 'google-ai-mode': 'Google AI Mode',- 'chatgpt-web': 'ChatGPT',- 'google-aio': 'Google AI Overview',- 'google-aimode': 'Google AI Mode',- 'copilot-web': 'Microsoft Copilot',- 'grok-web': 'Grok',- 'perplexity-web': 'Perplexity',- 'gemini-web': 'Google Gemini',-};-const MODEL_DISPLAY_NAME: Record<string, string> = {'gpt-4o': 'GPT-4o','gpt-4o-mini': 'GPT-4o Mini',@@ -1646,7 +1628,7 @@ export default function InsightsPage() {created_at: r.createdAt,prompt: r.promptText,topic: r.topicName ?? '',- platform: r.platform,+ platform: PLATFORM_LABELS[r.platform] ?? r.platform,model: r.modelUsed ?? '',region: r.region ?? '',mention_count: r.mentionCount,diff --git a/web/src/config/platform-labels.ts b/web/src/config/platform-labels.tsnew file mode 100644index 000000000..ef98de48a--- /dev/null+++ b/web/src/config/platform-labels.ts@@ -0,0 +1,40 @@+/**+ * Canonical platform display-name map.+ *+ * Centralized here so the insights charts, the page-level labels, and the CSV+ * export all render the same human-readable names instead of raw slugs. Always+ * look up with a fallback (`PLATFORM_LABELS[slug] ?? slug`) so unknown+ * platforms stay visible rather than disappearing.+ *+ * It also carries a few model-slug labels, because a couple of chart/progress+ * spots reuse this map to label models when no platform is available.+ */+export const PLATFORM_LABELS: Record<string, string> = {+ // Generic platform slugs.+ chatgpt: 'ChatGPT',+ gemini: 'Gemini',+ perplexity: 'Perplexity',+ claude: 'Claude',+ grok: 'Grok',+ copilot: 'Copilot',+ 'meta-ai': 'Meta AI',+ 'google-ai-overviews': 'Google AI',+ 'google-ai-mode': 'Google AI Mode',++ // Tracked scraper platform slugs, as stored in `prompt_results.platform`.+ 'chatgpt-web': 'ChatGPT',+ 'google-aio': 'Google AI Overview',+ 'google-aimode': 'Google AI Mode',+ 'copilot-web': 'Microsoft Copilot',+ 'grok-web': 'Grok',+ 'perplexity-web': 'Perplexity',+ 'gemini-web': 'Google Gemini',++ // Model slugs reused as a fallback label in a few chart/progress spots.+ 'gpt-5-chat-latest': 'GPT-5',+ 'gpt-5-mini': 'GPT-5 Mini',+ 'claude-sonnet-4-6': 'Claude Sonnet 4.6',+ 'claude-opus-4-6': 'Claude Opus 4.6',+ 'gemini-2.5-pro': 'Gemini 2.5 Pro',+ 'gemini-2.5-flash': 'Gemini 2.5 Flash',+};