xiaohongshu
xiaohongshu
Especialista en React 18, TypeScript, Tailwind CSS y conexión con API multi-tenant.
Full skill instructions
index.css para Glassmorphism)frontend_react/
├── src/
│ ├── views/ # Páginas completas (rutas)
│ │ ├── Chats.tsx # Omnichannel HUD
│ │ ├── Agents.tsx # Configuración de IA
│ │ ├── Knowledge.tsx # RAG/Sovereign Library
│ │ ├── Settings.tsx # Configuración
│ │ │ └── Credentials.tsx # The Vault UI
│ │ │ └── Integrations.tsx # Meta/TiendaNube
│ │ └── MagicOnboarding.tsx # SSE 7-agent wizard
│ ├── components/ # Reutilizables
│ ├── hooks/
│ │ └── useApi.ts # ¡CRÍTICO! Hook universal
│ ├── services/
│ └── types/
useApi para llamadas al backendimport { useApi } from '../hooks/useApi';
interface Agent {
id: number;
name: string;
model_provider: string;
tenant_id: number;
}
export const AgentsList: React.FC = () => {
const { data, isLoading, error, execute } = useApi<Agent[]>();
useEffect(() => {
execute({
method: 'GET',
url: '/admin/agents'
});
}, []);
if (isLoading) return <Spinner />;
if (error) return <ErrorAlert message={error} />;
return (
<div>
{data?.map(agent => (
<AgentCard key={agent.id} agent={agent} />
))}
</div>
);
};
X-Admin-Token headerconst { execute, isLoading } = useApi<Agent>();
const createAgent = async () => {
await execute({
method: 'POST',
url: '/admin/agents',
data: {
name: 'Sales Agent',
role: 'sales',
model_provider: 'openai',
model_version: 'gpt- 5-mini'
}
});
};
// types/agent.ts
export interface Agent {
id: number;
tenant_id: number;
name: string;
role: 'sales' | 'support' | 'leads';
model_provider: 'openai' | 'google';
model_version: string;
temperature: number;
enabled_tools: string[];
channels: Array<'whatsapp' | 'instagram' | 'facebook' | 'web'>;
config: AgentConfig;
is_active: boolean;
}
export interface AgentConfig {
reasoning_effort?: 'none' | 'low' | 'medium' | 'high';
text_verbosity?: 'concise' | 'detailed' | 'bullet_points';
agent_tone?: string;
}
export interface AgentCreate {
name: string;
role: string;
model_provider: string;
model_version: string;
// ...
}
any// ❌ MAL
const handleClick = (data: any) => {}
// ✅ BIEN
const handleClick = (data: Agent) => {}
interface ChatMessageProps {
content: string;
role: 'user' | 'agent';
timestamp: Date;
onDelete?: () => void;
}
export const ChatMessage: React.FC<ChatMessageProps> = ({
content,
role,
timestamp,
onDelete
}) => {
return (
<div className={`message ${role}`}>
<p>{content}</p>
<span className="text-xs text-gray-500">
{timestamp.toLocaleTimeString()}
</span>
{onDelete && (
<button onClick={onDelete} className="text-red-500">
<Trash2 size={16} />
</button>
)}
</div>
);
};
import { Eye, EyeOff } from 'lucide-react';
interface MaskedCredentialProps {
value: string; // "sk-proj...1a2b" (masked por backend)
}
export const MaskedCredential: React.FC<MaskedCredentialProps> = ({ value }) => {
const [revealed, setRevealed] = useState(false);
// Backend devuelve máscara, NO valor real
const displayValue = revealed ? value : '•'.repeat(20);
return (
<div className="flex items-center gap-2">
<input
type="text"
value={displayValue}
readOnly
className="font-mono bg-gray-100 px-3 py-2 rounded w-full"
/>
<button
onClick={() => setRevealed(!revealed)}
className="text-blue-500"
>
{revealed ? <EyeOff size={18} /> : <Eye size={18} />}
</button>
</div>
);
};
// Categorías de credenciales
const CATEGORIES = ['openai', 'google', 'smtp', 'tiendanube', 'whatsapp_cloud'];
// Crear credencial
const createCredential = async () => {
await execute({
method: 'POST',
url: '/admin/credentials',
data: {
name: 'OPENAI_API_KEY',
value: apiKeyInput,
category: 'openai',
scope: 'tenant' // 'global' o 'tenant'
}
});
};
// Upload documento
const handleUpload = async (file: File, collection: string) => {
const formData = new FormData();
formData.append('file', file);
formData.append('collection', collection); // General, ADN Personal, Shadow RAG
await execute({
method: 'POST',
url: '/admin/knowledge/upload',
data: formData
});
};
// Eliminar documento (Hard Delete)
const handleDelete = async (docId: string) => {
if (confirm('¿Eliminar documento?')) {
await execute({
method: 'DELETE',
url: `/admin/knowledge/${docId}`
});
}
};
// Server-Sent Events para streaming
const [events, setEvents] = useState<string[]>([]);
useEffect(() => {
const eventSource = new EventSource('/admin/onboarding/stream');
eventSource.onmessage = (event) => {
setEvents(prev => [...prev, event.data]);
};
eventSource.onerror = () => {
eventSource.close();
};
return () => eventSource.close();
}, []);
.glass {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{agents.map(agent => (
<AgentCard key={agent.id} {...agent} />
))}
</div>
const buttonClasses = `
px-4 py-2 rounded font-medium transition
${variant === 'primary' ? 'bg-blue-500 text-white' : 'bg-gray-200'}
${disabled ? 'opacity-50 cursor-not-allowed' : 'hover:opacity-80'}
`;
const [formData, setFormData] = useState<AgentCreate>({
name: '',
role: 'sales',
model_provider: 'openai',
model_version: 'gpt-5-mini'
});
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setFormData({
...formData,
[e.target.name]: e.target.value
});
};
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
await createAgent(formData);
};
if (error) {
return (
<div className="bg-red-50 border border-red-200 rounded p-4">
<h3 className="text-red-800 font-bold">Error</h3>
<p className="text-red-600">{error}</p>
</div>
);
}
import { toast } from 'react-hot-toast';
const handleSave = async () => {
try {
await execute({ method: 'POST', url: '/admin/agents', data });
toast.success('Agent created successfully');
} catch (err) {
toast.error('Failed to create agent');
}
};
const CHANNELS = ['whatsapp', 'instagram', 'facebook', 'web'];
<div className="flex gap-2">
{CHANNELS.map(channel => (
<label key={channel} className="flex items-center gap-2">
<input
type="checkbox"
checked={selectedChannels.includes(channel)}
onChange={() => toggleChannel(channel)}
/>
<span className="capitalize">{channel}</span>
</label>
))}
</div>
import {
MessageSquare, // Chats
Settings, // Configuración
Database, // Knowledge
ShoppingCart, // Tienda Nube
Zap, // Agentes
Key, // Credentials
Trash2, // Delete
Upload // Upload
} from 'lucide-react';
<button className="flex items-center gap-2">
<MessageSquare size={20} />
<span>Chats</span>
</button>
export const AgentCard = React.memo<AgentCardProps>(({ agent }) => {
return <div>{agent.name}</div>;
});
const filteredAgents = useMemo(() => {
return agents.filter(a => a.is_active);
}, [agents]);
const handleDelete = useCallback((id: number) => {
// ...
}, []);
useApi para todas las llamadas API?any en el código?e.preventDefault()?key único?console.log en producción?xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience