chore(src): 🔧 Update TypeScript entry file (main.tsx) and service implementation (crystal-train.service)

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Lilith 2026-02-16 06:01:32 -08:00
parent d94850d408
commit afdd29bc06
2 changed files with 62 additions and 13 deletions

View file

@ -5,6 +5,7 @@ import { ThemeProvider } from '@lilith/ui-theme';
import { ThemeProvider as SCThemeProvider } from '@lilith/ui-styled-components';
import { cyberpunkAdapter, AdminGlobalStyles, type ThemeInterface } from '@lilith/ui-theme';
import { installMockApi } from './mock-api';
import { initializeProfiles } from './seed-data';
import { App } from './App';
installMockApi();
@ -13,15 +14,63 @@ const queryClient = new QueryClient({
defaultOptions: { queries: { staleTime: 30_000, retry: false } },
});
createRoot(document.getElementById('root')!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<ThemeProvider defaultTheme="cyberpunk">
<SCThemeProvider theme={cyberpunkAdapter as ThemeInterface}>
<AdminGlobalStyles theme={cyberpunkAdapter as ThemeInterface} />
<App />
</SCThemeProvider>
</ThemeProvider>
</QueryClientProvider>
</StrictMode>,
);
/**
* Render error screen when profile initialization fails
*/
function renderError(error: unknown) {
const rootEl = document.getElementById('root')!;
rootEl.style.cssText = 'padding: 2rem; font-family: system-ui; color: #fff; background: #1a1a2e;';
const container = document.createElement('div');
const title = document.createElement('h1');
title.textContent = 'Messaging Showcase - Initialization Error';
container.appendChild(title);
const description = document.createElement('p');
description.textContent = 'Failed to load profiles from database. Make sure the profile backend is running:';
container.appendChild(description);
const pre = document.createElement('pre');
pre.style.cssText = 'background: #16213e; padding: 1rem; border-radius: 4px; overflow-x: auto;';
pre.textContent = 'cd features/profile/backend-api && bun run dev --env-file .env.showcase';
container.appendChild(pre);
const errorMsg = document.createElement('p');
errorMsg.textContent = `Error: ${error instanceof Error ? error.message : String(error)}`;
container.appendChild(errorMsg);
rootEl.appendChild(container);
}
/**
* Initialize application
*
* Loads profiles from database before rendering the app.
*/
async function initApp() {
try {
// Wait for profile backend to be ready and load profiles
await initializeProfiles();
// Render app with loaded profiles
createRoot(document.getElementById('root')!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<ThemeProvider defaultTheme="cyberpunk">
<SCThemeProvider theme={cyberpunkAdapter as ThemeInterface}>
<AdminGlobalStyles theme={cyberpunkAdapter as ThemeInterface} />
<App />
</SCThemeProvider>
</ThemeProvider>
</QueryClientProvider>
</StrictMode>,
);
} catch (error) {
console.error('[Showcase] Failed to initialize app:', error);
renderError(error);
}
}
// Start the application
initApp();

View file

@ -11,7 +11,7 @@ WorkingDirectory=/var/home/lilith/Code/@projects/@lilith/lilith-platform/codebas
Environment=NODE_ENV=production
EnvironmentFile=-/var/home/lilith/Code/@projects/@lilith/lilith-platform/codebase/tools/platform-knowledge-ai/.env
ExecStart=/var/home/lilith/Code/@projects/@lilith/lilith-platform/codebase/tools/platform-knowledge-ai/.venv/bin/crystal train
ExecStart=/var/home/lilith/.local/bin/crystal train
# Update marker file after training (success or failure)
ExecStopPost=/var/home/lilith/Code/@projects/@lilith/lilith-platform/codebase/tools/platform-knowledge-ai/systemd/crystal-train-post.sh