/** * Curated Sollinha opening-question chips (B191). * * The catalog is configuration data, not UI: each question is only included * when the current AI toolset answers it well for the actor's role. Staff see * election/dobradinha/overview questions backed by their tools; leaders get a * minimal safe set (meta + links via `buildCampaignLinks`, whose leader * allowlist is home/perfil/leaderContacts) — never an election tool, which * fails closed for the leader (B180). The communication assessor (C159) gets * acervo questions answerable by `findSpeechExcerpts`, her whole toolset. */ import type { CampaignRole } from '@/lib/campaignRoles' import { isStaffCampaignRole } from '@/lib/campaignRoles' /** * A text chip in the chat's quick-question slot (B191 opening catalog, B192 * follow-ups) — the exact text sent as the user message when picked. */ export type SollinhaChatChip = { text: string } /** Staff (coordinator/advisor/candidate): 4 chips on wide surfaces, 3 on mobile. */ const STAFF_OPENING_QUESTIONS: readonly SollinhaChatChip[] = [ { text: 'Quem foi o deputado mais votado em Feira de Santana?' }, { text: 'Quantos votos tivemos em Ilhéus em 2022?' }, { text: 'Quais dobradinhas temos em Salvador?' }, { text: 'Como está o município de Vitória da Conquista?' }, ] /** Leader: 3 chips, all answerable by the leader-facing toolset today. */ const LEADER_OPENING_QUESTIONS: readonly SollinhaChatChip[] = [ { text: 'O que você sabe fazer?' }, { text: 'Me manda o link dos meus contatos' }, { text: 'Me manda o link do meu perfil' }, ] /** Communicator (C159): 3 chips, all answerable by `findSpeechExcerpts`. */ const COMMUNICATOR_OPENING_QUESTIONS: readonly SollinhaChatChip[] = [ { text: 'O que o Solla já falou sobre Farmácia Popular?' }, { text: 'Me dá uma fala do deputado para um reels sobre saúde.' }, { text: 'Qual um trecho bom sobre o hospital do subúrbio?' }, ] const MOBILE_LIMIT = 3 /** * Opening-question chips for an empty conversation. Staff get the full catalog * (capped by viewport), the communication assessor the acervo set, and any * other role (leader — and unknown roles as a fail-closed fallback) the safe * leader set. Deterministic and client-safe. */ export const getSollinhaOpeningQuestions = ( role: CampaignRole, isMobile: boolean, ): readonly SollinhaChatChip[] => { const catalog = openingQuestionsForRole(role) return isMobile ? catalog.slice(0, MOBILE_LIMIT) : catalog } const openingQuestionsForRole = (role: CampaignRole): readonly SollinhaChatChip[] => { if (role === 'communicator') return COMMUNICATOR_OPENING_QUESTIONS if (isStaffCampaignRole(role)) return STAFF_OPENING_QUESTIONS return LEADER_OPENING_QUESTIONS }