chore: add pnpm workspace configuration for apps and packages

This commit is contained in:
GW_MC
2026-02-23 21:04:19 +08:00
parent ab02758382
commit 932f384f0d
31 changed files with 9081 additions and 203 deletions

View File

@@ -0,0 +1,55 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('🌱 Seeding database...');
// Create default admin user
const admin = await prisma.user.upsert({
where: { email: 'admin@dreamchat.local' },
update: {},
create: {
email: 'admin@dreamchat.local',
username: 'admin',
role: 'ADMIN',
passwordHash: '$2b$10$YourHashedPasswordHere', // Replace with actual hash
},
});
console.log(`✅ Created admin user: ${admin.email}`);
// Create a sample character
const character = await prisma.character.upsert({
where: {
id: '00000000-0000-0000-0000-000000000001'
},
update: {},
create: {
id: '00000000-0000-0000-0000-000000000001',
name: 'Alice',
personalityPrompt: 'You are Alice, a curious and adventurous explorer who loves discovering new things. You are friendly, witty, and always eager to help.',
backstory: 'Alice grew up in a small village at the edge of a vast forest. From a young age, she was fascinated by the unknown and would often venture into the woods to explore.',
attributes: {
traits: ['curious', 'brave', 'witty', 'friendly'],
age: 25,
species: 'human',
skills: ['navigation', 'survival', 'cartography'],
},
userId: admin.id,
},
});
console.log(`✅ Created sample character: ${character.name}`);
console.log('✅ Seeding complete!');
}
main()
.catch((e) => {
console.error('❌ Seeding failed:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});