Sets up the basic project configuration for Cognitive Clarity. This includes: - Initializing `package.json` with necessary dependencies (React, Gemini API, Lucide React) and build scripts for Vite. - Creating a basic `index.html` with Tailwind CSS and Google Fonts integration. - Setting up `index.tsx` as the React application entry point. - Configuring `tsconfig.json` for TypeScript compilation with Vite. - Establishing `vite.config.ts` for development server setup and environment variable handling. - Adding a standard `.gitignore` file. - Updating `README.md` with local run instructions and AI Studio links. - Defining `metadata.json` for application details. - Creating core type definitions in `types.ts`. - Populating `constants.ts` with initial CBT glossary terms. - Adding utility functions for audio processing in `services/audioUtils.ts`.
204 lines
9.1 KiB
TypeScript
204 lines
9.1 KiB
TypeScript
|
|
import { Scenario } from './types';
|
|
import { Type } from "@google/genai";
|
|
|
|
export interface GlossaryEntry {
|
|
term: string;
|
|
definition: string;
|
|
category: 'Distortion' | 'Technique' | 'Concept';
|
|
example?: string;
|
|
}
|
|
|
|
export const CBT_GLOSSARY: GlossaryEntry[] = [
|
|
{
|
|
term: "Mind Reading",
|
|
category: "Distortion",
|
|
definition: "Assuming you know what others are thinking without sufficient evidence, usually assuming they are thinking something negative about you.",
|
|
example: "They haven't replied to my text for an hour; they must be angry with me."
|
|
},
|
|
{
|
|
term: "Catastrophizing",
|
|
category: "Distortion",
|
|
definition: "Predicting a future outcome will be a disaster, ignoring other more likely possibilities.",
|
|
example: "If I fail this presentation, I'll definitely lose my job and never work again."
|
|
},
|
|
{
|
|
term: "Fortune Telling",
|
|
category: "Distortion",
|
|
definition: "Predicting a negative future outcome without considering more likely possibilities.",
|
|
example: "I just know I'm going to stutter and look like a fool in front of everyone."
|
|
},
|
|
{
|
|
term: "All-or-Nothing Thinking",
|
|
category: "Distortion",
|
|
definition: "Viewing things in black-and-white terms. If a situation isn't perfect, it's a total failure.",
|
|
example: "I ate one cookie, so my entire diet is ruined. I might as well eat the whole box."
|
|
},
|
|
{
|
|
term: "Emotional Reasoning",
|
|
category: "Distortion",
|
|
definition: "Assuming that because you feel a certain way, it must be true, regardless of evidence.",
|
|
example: "I feel guilty, so I must have done something wrong."
|
|
},
|
|
{
|
|
term: "Maladaptive Guilt",
|
|
category: "Distortion",
|
|
definition: "Feeling excessive responsibility or shame for events that are not within your control or are not your fault.",
|
|
example: "I feel bad for taking a break when my coworkers are still working, even though I've finished my tasks."
|
|
},
|
|
{
|
|
term: "Spotlight Effect",
|
|
category: "Concept",
|
|
definition: "The phenomenon where people tend to believe they are being noticed more than they actually are.",
|
|
example: "Thinking everyone at the party is staring at the small stain on your shirt."
|
|
},
|
|
{
|
|
term: "Emotional Regulation",
|
|
category: "Technique",
|
|
definition: "The ability to monitor and manage your emotional state, identifying triggers and using tools to return to a baseline.",
|
|
example: "Using a box-breathing technique to calm down before responding to a frustrating email."
|
|
},
|
|
{
|
|
term: "Healthy Boundaries",
|
|
category: "Technique",
|
|
definition: "The practice of clearly stating your needs and limits to others to protect your mental health and time.",
|
|
example: "Saying, 'I can't take on more work this week, but I can look at it on Monday.'"
|
|
},
|
|
{
|
|
term: "Cognitive Reframing",
|
|
category: "Technique",
|
|
definition: "Identifying and then disputing irrational or maladaptive thoughts to view a situation more realistically.",
|
|
example: "Changing 'I'm a failure' to 'I struggled with this task, but I can learn from it.'"
|
|
},
|
|
{
|
|
term: "Behavioral Activation",
|
|
category: "Technique",
|
|
definition: "A specific CBT skill used to help people with depression or anxiety by increasing their participation in rewarding activities.",
|
|
example: "Scheduling a 10-minute walk even when you feel like staying in bed."
|
|
},
|
|
{
|
|
term: "Radical Acceptance",
|
|
category: "Technique",
|
|
definition: "Completely accepting reality as it is, without judgment or attempts to fight it, especially for situations out of your control.",
|
|
example: "Acknowledging that a relationship has ended and feeling the pain without trying to fix the past."
|
|
},
|
|
{
|
|
term: "Gray Rock Method",
|
|
category: "Concept",
|
|
definition: "A technique used to deal with manipulative or toxic people by acting as uninteresting as a gray rock.",
|
|
example: "Giving short, non-committal answers to a relative's intrusive questions."
|
|
},
|
|
{
|
|
term: "Should Statements",
|
|
category: "Distortion",
|
|
definition: "Having a list of ironclad rules about how you and other people 'should' act.",
|
|
example: "I should never feel anxious in public."
|
|
},
|
|
{
|
|
term: "Personalization",
|
|
category: "Distortion",
|
|
definition: "Believing you are responsible for events outside your control or that other people's behavior is a direct reaction to you.",
|
|
example: "My boss looks upset today; it must be because of that email I sent."
|
|
},
|
|
{
|
|
term: "Grounding Exercises",
|
|
category: "Technique",
|
|
definition: "Techniques used to pull you away from flashbacks, unwanted memories, or negative emotions and back into the present moment.",
|
|
example: "The 5-4-3-2-1 technique: noticing 5 things you see, 4 you feel, etc."
|
|
}
|
|
];
|
|
|
|
// Default clinical roleplay scenarios available for selection in the app
|
|
export const SCENARIOS: Scenario[] = [
|
|
{
|
|
id: 's1',
|
|
title: "The Silent Friend",
|
|
description: "You sent a text to a close friend hours ago and haven't heard back. You're starting to imagine they're angry with you or that you've done something wrong.",
|
|
category: 'Relationships',
|
|
difficulty: 'Beginner',
|
|
systemInstruction: "You are a busy friend who just hasn't had a chance to reply yet. You are friendly and non-confrontational. If asked, you explain you were just preoccupied with chores.",
|
|
initialMessage: "Hey! Sorry I'm just getting back to you, it's been a crazy day. What's up?",
|
|
cbtFocus: ["Mind Reading", "Fortune Telling"]
|
|
},
|
|
{
|
|
id: 's2',
|
|
title: "Critical Feedback",
|
|
description: "Your manager asks for a quick sync. You immediately assume the worst about your performance and upcoming review.",
|
|
category: 'Workplace',
|
|
difficulty: 'Intermediate',
|
|
systemInstruction: "You are a professional manager. You have one piece of constructive feedback regarding a recent report, but overall you're happy with the user's performance.",
|
|
initialMessage: "Hi there, thanks for jumping on. I wanted to chat briefly about the Q3 project report.",
|
|
cbtFocus: ["Catastrophizing", "All-or-Nothing Thinking"]
|
|
},
|
|
{
|
|
id: 's3',
|
|
title: "The Social Spotlight",
|
|
description: "You're at a networking event and you just made a small slip-up in a conversation. You feel like everyone noticed and is judging you.",
|
|
category: 'Social Anxiety',
|
|
difficulty: 'Advanced',
|
|
systemInstruction: "You are an attendee at a networking event. You are polite and didn't even notice the user's minor slip-up. You are focused on professional exchange.",
|
|
initialMessage: "That's an interesting point about the industry trends. So, how did you get started in this field?",
|
|
cbtFocus: ["Spotlight Effect", "Emotional Reasoning"]
|
|
},
|
|
{
|
|
id: 's4',
|
|
title: "Inner Critic Echo",
|
|
description: "A minor mistake at home triggers a spiral of self-deprecating thoughts. Practice internal cognitive restructuring by talking back to your personified inner critic.",
|
|
category: 'Self-Talk',
|
|
difficulty: 'Beginner',
|
|
systemInstruction: "You are the user's personified Inner Critic. You are harsh, cynical, and use common distortions. Your goal is to represent the user's negative self-talk so they can practice refuting it.",
|
|
initialMessage: "I can't believe you forgot to buy milk again. You're completely disorganized and you'll never get your life together.",
|
|
cbtFocus: ["Labeling", "Overgeneralization"]
|
|
}
|
|
];
|
|
|
|
export const CBT_ANALYSIS_SCHEMA = {
|
|
type: Type.OBJECT,
|
|
properties: {
|
|
analysis: {
|
|
type: Type.OBJECT,
|
|
properties: {
|
|
distortions: { type: Type.ARRAY, items: { type: Type.STRING } },
|
|
isAdaptive: { type: Type.BOOLEAN },
|
|
evidence: { type: Type.STRING },
|
|
},
|
|
required: ['distortions', 'isAdaptive', 'evidence']
|
|
},
|
|
rating: {
|
|
type: Type.OBJECT,
|
|
properties: {
|
|
score: { type: Type.INTEGER },
|
|
reason: { type: Type.STRING },
|
|
},
|
|
required: ['score', 'reason']
|
|
},
|
|
suggestions: {
|
|
type: Type.OBJECT,
|
|
properties: {
|
|
alternativeThought: { type: Type.STRING },
|
|
behavioralStep: { type: Type.STRING },
|
|
},
|
|
required: ['alternativeThought', 'behavioralStep']
|
|
}
|
|
},
|
|
required: ['analysis', 'rating', 'suggestions']
|
|
};
|
|
|
|
export const SYSTEM_ANALYSIS_PROMPT = `
|
|
You are an expert Clinical CBT Supervisor. Your task is to provide immediate, high-precision cognitive analysis of a patient's latest roleplay interaction.
|
|
|
|
CORE MISSION:
|
|
Identify cognitive distortions, evaluate the adaptiveness of the user's response, and provide a single powerful reframing thought.
|
|
|
|
Maintain a neutral, clinical, and encouraging tone. Focus purely on the cognitive and behavioral mechanics of the latest user turn.
|
|
`;
|
|
|
|
export const SYSTEM_SUMMARY_ANALYSIS_PROMPT = `
|
|
You are a Senior Clinical CBT Supervisor performing a post-session synthesis on a full roleplay transcript.
|
|
|
|
CORE MISSION:
|
|
Synthesize the entire interaction to identify recurring cognitive patterns, evaluate overall progress, and assign "homework" for behavioral activation.
|
|
|
|
Analyze the transcript for patterns, not just individual messages. Focus on how the user handles the "Internal CBT Logic" of the specific scenario.
|
|
`;
|