Recovered state: integrated TrendSurferAgent, restored frontend/backend files, and cleaned up recovery scripts

This commit is contained in:
ajaysi
2026-02-08 13:56:57 +05:30
parent 1db10ccd0f
commit e404a86502
333 changed files with 42223 additions and 10875 deletions

View File

@@ -44,10 +44,9 @@ export const ComingSoonSection: React.FC<ComingSoonSectionProps> = ({
color: '#3b82f6',
details: [
'Compare content generated with and without your persona',
'Test Core, Blog, and LinkedIn personas side-by-side',
'Choose from your content calendar topics',
'Provide feedback to improve your persona',
'AI model settings automatically optimized per persona'
'Test Brand, Blog, and LinkedIn brand voices side-by-side',
'Directly apply Brand Voice to any Alwrity tool',
'AI-powered feedback on brand voice consistency'
]
},
{

View File

@@ -80,10 +80,10 @@ export const PersonaPreviewSection: React.FC<PersonaPreviewSectionProps> = ({
}}>
<Box>
<Typography variant="h5" sx={{ fontWeight: 700, color: '#1e293b', mb: 0.5 }}>
Your AI Writing Persona
Your AI Writing Brand Voice
</Typography>
<Typography variant="body2" sx={{ color: '#64748b' }}>
Comprehensive analysis of your unique writing style and brand voice
Comprehensive analysis of your unique brand identity and communication style
</Typography>
</Box>
<Button
@@ -104,6 +104,25 @@ export const PersonaPreviewSection: React.FC<PersonaPreviewSectionProps> = ({
</Button>
</Box>
<Alert
severity="info"
icon={<AutoAwesomeIcon />}
sx={{
mb: 4,
borderRadius: 3,
backgroundColor: '#f0f9ff',
border: '1px solid #bae6fd',
'& .MuiAlert-message': { color: '#0369a1' }
}}
>
<Typography variant="subtitle2" sx={{ fontWeight: 600, mb: 0.5 }}>
Adaptive Learning Active
</Typography>
<Typography variant="body2">
This Brand Voice was initialized from your website's home page. As you generate more content, ALwrity will automatically refine and update your brand identity to match your evolving style.
</Typography>
</Alert>
{/* Core Persona */}
<Accordion
expanded={expandedAccordion === 'core'}
@@ -148,10 +167,10 @@ export const PersonaPreviewSection: React.FC<PersonaPreviewSectionProps> = ({
</Box>
<Box sx={{ flex: 1 }}>
<Typography variant="h6" sx={{ fontWeight: 600, color: '#1e293b', mb: 0.5 }}>
Core Writing Style
Brand Writing Style
</Typography>
<Typography variant="body2" sx={{ color: '#64748b' }}>
Your unique voice and writing characteristics
Your unique brand voice and communication characteristics
</Typography>
</Box>
{qualityMetrics && (

View File

@@ -28,14 +28,14 @@ export const QualityMetricsDisplay: React.FC<QualityMetricsDisplayProps> = ({ me
const metricItems = isNewMetrics ? [
{ label: 'Overall Quality', value: metrics.overall_score },
{ label: 'Core Completeness', value: metrics.core_completeness || 0 },
{ label: 'Brand Voice Accuracy', value: metrics.core_completeness || 0 },
{ label: 'Platform Consistency', value: metrics.platform_consistency || 0 },
{ label: 'Platform Optimization', value: metrics.platform_optimization || 0 },
{ label: 'Linguistic Quality', value: metrics.linguistic_quality || 0 }
] : [
{ label: 'Overall Quality', value: metrics.overall_score },
{ label: 'Style Consistency', value: metrics.style_consistency || 0 },
{ label: 'Brand Alignment', value: metrics.brand_alignment || 0 },
{ label: 'Brand Voice Accuracy', value: metrics.brand_alignment || 0 },
{ label: 'Platform Optimization', value: metrics.platform_optimization || 0 },
{ label: 'Engagement Potential', value: metrics.engagement_potential || 0 }
];

View File

@@ -1,6 +1,7 @@
import { useCallback } from 'react';
interface PersonaInitializationProps {
onboardingData?: any;
stepData?: {
corePersona?: any;
platformPersonas?: Record<string, any>;
@@ -23,6 +24,7 @@ interface PersonaInitializationProps {
}
export const usePersonaInitialization = ({
onboardingData,
stepData,
updateHeaderContent,
setCorePersona,
@@ -42,10 +44,30 @@ export const usePersonaInitialization = ({
const initialize = useCallback(async () => {
console.log('PersonaStep: Initialization started');
// Extract domain for personalization
const websiteUrl = onboardingData?.websiteAnalysis?.website_url ||
onboardingData?.website ||
onboardingData?.userUrl ||
'';
let domainName = '';
try {
if (websiteUrl) {
const url = new URL(websiteUrl.startsWith('http') ? websiteUrl : `https://${websiteUrl}`);
domainName = url.hostname.replace('www.', '');
}
} catch (e) {
domainName = websiteUrl;
}
const personalizedTitle = domainName
? `Brand Voice for ${domainName}`
: 'Your AI Brand Voice';
// Update header immediately
updateHeaderContent({
title: 'AI Writing Persona Generation',
description: 'ALwrity is analyzing your content and creating a sophisticated AI writing persona that captures your unique style, brand voice, and content preferences across all platforms.'
title: personalizedTitle,
description: "Your 'Brand Voice' is a unique AI profile that captures how your business sounds. It analyzes your website's tone, audience, and style to ensure every post generated matches your brand identity perfectly."
});
// Check if we already have persona data from stepData (when navigating back)
@@ -104,6 +126,7 @@ export const usePersonaInitialization = ({
await generatePersonas();
setHasCheckedCache(true);
}, [
onboardingData,
stepData,
updateHeaderContent,
setCorePersona,

View File

@@ -51,7 +51,7 @@ export const CorePersonaDisplay: React.FC<CorePersonaDisplayProps> = ({
{/* 1. Identity & Brand Voice Section */}
<SectionAccordion
title="Identity & Brand Voice"
subtitle="Core personality and brand characteristics"
subtitle="Brand personality and communication characteristics"
icon={<PsychologyIcon />}
defaultExpanded={true}
color="primary.main"
@@ -66,16 +66,16 @@ export const CorePersonaDisplay: React.FC<CorePersonaDisplayProps> = ({
overflow: 'visible'
}}>
<Typography variant="h6" sx={{ fontWeight: 600, color: '#1e293b', mb: 2 }}>
Core Identity
Brand Identity
</Typography>
<Grid container spacing={2} sx={{ width: '100%' }}>
<Grid item xs={12} sm={6} sx={{ width: '100%' }}>
<EditableTextField
label="Persona Name"
label="Brand Voice Name"
value={getNestedValue(persona, ['identity', 'persona_name'])}
onChange={(val) => updateField(['identity', 'persona_name'], val)}
placeholder="e.g., The Thought Leader"
helperText="A descriptive name for this writing persona"
helperText="A descriptive name for your brand voice"
tooltipInfo={corePersonaTooltips.personaName}
/>
</Grid>
@@ -85,17 +85,17 @@ export const CorePersonaDisplay: React.FC<CorePersonaDisplayProps> = ({
value={getNestedValue(persona, ['identity', 'archetype'])}
onChange={(val) => updateField(['identity', 'archetype'], val)}
placeholder="e.g., Expert Educator, Innovator, Storyteller"
helperText="The primary archetype this persona embodies"
helperText="The primary role your brand embodies"
tooltipInfo={corePersonaTooltips.archetype}
/>
</Grid>
<Grid item xs={12} sx={{ width: '100%' }}>
<EditableTextField
label="Core Belief"
label="Brand Mission & Belief"
value={getNestedValue(persona, ['identity', 'core_belief'])}
onChange={(val) => updateField(['identity', 'core_belief'], val)}
multiline
placeholder="What is the fundamental belief driving this persona?"
placeholder="What is the fundamental belief driving your brand?"
helperText="The underlying philosophy or conviction"
tooltipInfo={corePersonaTooltips.coreBelief}
/>

View File

@@ -12,31 +12,31 @@ export interface TooltipInfo {
}
/**
* Core Persona Tooltips
* Brand Voice Tooltips
*/
export const corePersonaTooltips = {
// Identity Section
personaName: {
title: "Persona Name",
title: "Brand Voice Name",
description: "A descriptive name that captures the essence of your writing personality and brand identity.",
howWeCalculated: "Generated by analyzing your writing style patterns, tone consistency, and brand positioning across all analyzed content.",
whyItMatters: "A memorable persona name helps you maintain consistency and makes it easier to switch between different writing contexts.",
whyItMatters: "A memorable brand voice name helps you maintain consistency and makes it easier to switch between different writing contexts.",
example: "E.g., 'The Tech Educator', 'Strategic Storyteller', 'Data-Driven Advisor'"
},
archetype: {
title: "Writing Archetype",
description: "The fundamental character or role your writing embodies - defines how readers perceive you.",
description: "The fundamental character or role your brand voice embodies - defines how readers perceive you.",
howWeCalculated: "AI analyzed your content themes, communication style, and how you position yourself relative to your audience (teacher, peer, expert, etc.).",
whyItMatters: "Your archetype guides tone, structure, and content approach - ensuring your writing consistently reflects your intended professional image.",
whyItMatters: "Your archetype guides tone, structure, and content approach - ensuring your writing consistently reflects your intended brand image.",
example: "Expert Educator teaches, Innovator challenges conventions, Sage provides wisdom"
},
coreBelief: {
title: "Core Belief",
title: "Brand Mission & Belief",
description: "The fundamental philosophy or conviction that drives your content and messaging.",
howWeCalculated: "Extracted from recurring themes, value statements, and the underlying message across your content. We looked at what you emphasize repeatedly.",
whyItMatters: "Your core belief creates authentic, purpose-driven content that resonates with your audience and builds trust over time.",
whyItMatters: "Your brand mission creates authentic, purpose-driven content that resonates with your audience and builds trust over time.",
example: "'Knowledge should be accessible to everyone' or 'Data-driven decisions lead to success'"
},
@@ -237,10 +237,27 @@ export const corePersonaTooltips = {
whyItMatters: "Strategic formatting guides attention and improves reading flow. Your style balances visual hierarchy with readability.",
example: "Heavy formatting = attention-guiding; Minimal = clean/traditional; Moderate = balanced"
},
// Content Strategy Section
bestPractices: {
title: "Writing Best Practices",
description: "Tailored recommendations for maintaining your brand voice across different platforms.",
howWeCalculated: "Synthesized from your top-performing content and industry standards for your brand archetype.",
whyItMatters: "Following these practices ensures your brand voice stays consistent and effective as you scale content production.",
example: "Use metaphors for complex tech, lead with data, end with a provocative question"
},
avoidElements: {
title: "What to Avoid",
description: "Specific styles, tones, or word choices that conflict with your brand identity.",
howWeCalculated: "Identified elements that are inconsistent with your successful content or dilute your brand positioning.",
whyItMatters: "Knowing what NOT to do is as important as knowing what to do for maintaining a pure, professional brand voice.",
example: "Avoid excessive jargon, stay away from clickbait titles, don't use slang"
}
};
/**
* Platform Persona Tooltips (LinkedIn-specific shown, similar for others)
* Platform Brand Voice Tooltips (LinkedIn-specific shown, similar for others)
*/
export const platformPersonaTooltips = {
// Content Format Rules