- Next.js 14+ with App Router and TypeScript - Tailwind CSS and ShadCN UI styling - Zustand state management - Dexie.js for IndexedDB (local-first data) - Auth.js v5 for authentication - BMAD framework integration Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { faker } from '@faker-js/faker';
|
|
|
|
export interface ChatSession {
|
|
id: string;
|
|
title: string;
|
|
date: string; // ISO string
|
|
preview: string;
|
|
tags: string[];
|
|
status: 'active' | 'completed';
|
|
messages: Array<{
|
|
id: string;
|
|
role: 'user' | 'assistant';
|
|
content: string;
|
|
timestamp: number;
|
|
}>;
|
|
}
|
|
|
|
export const createChatSession = (overrides: Partial<ChatSession> = {}): ChatSession => {
|
|
const timestamp = faker.date.recent().getTime();
|
|
|
|
return {
|
|
id: faker.string.uuid(),
|
|
title: faker.lorem.sentence(3),
|
|
date: new Date(timestamp).toISOString(),
|
|
preview: faker.lorem.sentence(),
|
|
tags: [faker.word.sample(), faker.word.sample()],
|
|
status: 'completed',
|
|
messages: [
|
|
{
|
|
id: faker.string.uuid(),
|
|
role: 'user',
|
|
content: faker.lorem.paragraph(),
|
|
timestamp: timestamp - 10000,
|
|
},
|
|
{
|
|
id: faker.string.uuid(),
|
|
role: 'assistant',
|
|
content: faker.lorem.paragraph(),
|
|
timestamp: timestamp,
|
|
}
|
|
],
|
|
...overrides,
|
|
};
|
|
};
|
|
|
|
export const createChatSessions = (count: number, overrides: Partial<ChatSession> = {}): ChatSession[] => {
|
|
return Array.from({ length: count }, () => createChatSession(overrides));
|
|
};
|