chore(core): 🔧 Update pnpm-workspace.yaml configuration
This commit is contained in:
parent
aa698bdb64
commit
d33176e334
5 changed files with 230 additions and 0 deletions
|
|
@ -6,6 +6,9 @@ packages:
|
|||
- 'packages/imajin-client'
|
||||
- 'packages/imajin-config'
|
||||
|
||||
# Test apps
|
||||
- 'tests/ui-test'
|
||||
|
||||
# Service types and clients
|
||||
- 'services/imajin-prompt/types'
|
||||
- 'services/imajin-prompt/client'
|
||||
|
|
|
|||
30
tests/ui-test/index.html
Normal file
30
tests/ui-test/index.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Imajin Identity Generator Test</title>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
||||
min-height: 100vh;
|
||||
color: #fff;
|
||||
}
|
||||
#root {
|
||||
padding: 2rem;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
26
tests/ui-test/package.json
Normal file
26
tests/ui-test/package.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "imajin-ui-test",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lilith/imajin-react": "workspace:*",
|
||||
"@lilith/imajin-app": "workspace:*",
|
||||
"@lilith/ui-feedback": "^1.3.8",
|
||||
"@lilith/ui-layout": "^1.1.2",
|
||||
"@lilith/ui-typography": "^1.1.2",
|
||||
"@tanstack/react-query": "^5.90.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"styled-components": "^6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.2.0",
|
||||
"@vitejs/plugin-react": "^4.2.0",
|
||||
"vite": "^5.0.0"
|
||||
}
|
||||
}
|
||||
162
tests/ui-test/src/main.tsx
Normal file
162
tests/ui-test/src/main.tsx
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
import { StrictMode } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { IdentityGenerator } from '@lilith/imajin-react';
|
||||
|
||||
// Mock fetch for testing without backend
|
||||
const originalFetch = window.fetch;
|
||||
|
||||
const mockIdentities = [
|
||||
{
|
||||
id: 'lilith',
|
||||
name: 'Lilith',
|
||||
image_count: 12,
|
||||
created_at: '2026-01-15T10:00:00Z',
|
||||
updated_at: '2026-01-17T14:30:00Z',
|
||||
},
|
||||
{
|
||||
id: 'alex',
|
||||
name: 'Alex Chen',
|
||||
image_count: 8,
|
||||
created_at: '2026-01-10T08:00:00Z',
|
||||
updated_at: '2026-01-16T09:15:00Z',
|
||||
},
|
||||
{
|
||||
id: 'maya',
|
||||
name: 'Maya Rodriguez',
|
||||
image_count: 5,
|
||||
created_at: '2026-01-12T15:30:00Z',
|
||||
updated_at: '2026-01-14T11:00:00Z',
|
||||
},
|
||||
];
|
||||
|
||||
// Create a placeholder image (gradient)
|
||||
function createPlaceholderImage(): string {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 512;
|
||||
canvas.height = 512;
|
||||
const ctx = canvas.getContext('2d')!;
|
||||
|
||||
// Create gradient background
|
||||
const gradient = ctx.createLinearGradient(0, 0, 512, 512);
|
||||
gradient.addColorStop(0, '#ff69b4');
|
||||
gradient.addColorStop(0.5, '#9b59b6');
|
||||
gradient.addColorStop(1, '#3498db');
|
||||
ctx.fillStyle = gradient;
|
||||
ctx.fillRect(0, 0, 512, 512);
|
||||
|
||||
// Add text
|
||||
ctx.fillStyle = 'rgba(255, 255, 255, 0.3)';
|
||||
ctx.font = 'bold 48px sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.fillText('MOCK IMAGE', 256, 256);
|
||||
|
||||
return canvas.toDataURL('image/png');
|
||||
}
|
||||
|
||||
window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const url = typeof input === 'string' ? input : input.toString();
|
||||
|
||||
// Mock identity service endpoints
|
||||
if (url.includes(':8009/identities') && !url.includes('/compare')) {
|
||||
if (url.endsWith('/identities')) {
|
||||
return new Response(JSON.stringify({
|
||||
identities: mockIdentities,
|
||||
total: mockIdentities.length,
|
||||
}), { status: 200 });
|
||||
}
|
||||
// Single identity
|
||||
const idMatch = url.match(/identities\/([^/]+)$/);
|
||||
if (idMatch) {
|
||||
const identity = mockIdentities.find(i => i.id === idMatch[1]);
|
||||
if (identity) {
|
||||
return new Response(JSON.stringify(identity), { status: 200 });
|
||||
}
|
||||
return new Response('Not found', { status: 404 });
|
||||
}
|
||||
}
|
||||
|
||||
// Mock health endpoints
|
||||
if (url.includes('/health')) {
|
||||
return new Response(JSON.stringify({ status: 'healthy' }), { status: 200 });
|
||||
}
|
||||
|
||||
// Mock generation endpoint
|
||||
if (url.includes(':8080/generate')) {
|
||||
// Simulate generation delay
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
|
||||
return new Response(JSON.stringify({
|
||||
image_base64: createPlaceholderImage(),
|
||||
identity_match_score: 0.87,
|
||||
identity_confidence: 'high',
|
||||
aesthetic_score: 0.78,
|
||||
seed: Math.floor(Math.random() * 1000000),
|
||||
model: 'juggernaut-xi-v11',
|
||||
duration_ms: 12500,
|
||||
width: 512,
|
||||
height: 512,
|
||||
}), { status: 200 });
|
||||
}
|
||||
|
||||
// Mock compare endpoint
|
||||
if (url.includes('/compare')) {
|
||||
return new Response(JSON.stringify({
|
||||
identity_id: 'lilith',
|
||||
similarity: 0.85,
|
||||
confidence: 'high',
|
||||
face_detected: true,
|
||||
message: 'Face matched with 85% similarity',
|
||||
}), { status: 200 });
|
||||
}
|
||||
|
||||
// Fall through to real fetch for other requests
|
||||
return originalFetch(input, init);
|
||||
};
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<div>
|
||||
<h1 style={{
|
||||
fontSize: '2rem',
|
||||
fontWeight: 700,
|
||||
marginBottom: '0.5rem',
|
||||
background: 'linear-gradient(135deg, #ff69b4, #9b59b6)',
|
||||
WebkitBackgroundClip: 'text',
|
||||
WebkitTextFillColor: 'transparent',
|
||||
}}>
|
||||
Identity-Preserving Generation
|
||||
</h1>
|
||||
<p style={{ color: '#888', marginBottom: '2rem' }}>
|
||||
Test UI for the IdentityGenerator component (using mock data)
|
||||
</p>
|
||||
|
||||
<IdentityGenerator
|
||||
onImageGenerated={(result) => {
|
||||
console.log('Image generated:', result);
|
||||
}}
|
||||
onSaveToGallery={(result) => {
|
||||
console.log('Saved to gallery:', result);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>
|
||||
);
|
||||
9
tests/ui-test/vite.config.ts
Normal file
9
tests/ui-test/vite.config.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 3333,
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue