Introduce horoscope generation via OpenAI API, including new API endpoints and database schema. Adjust card components in `home.tsx` to use `aspect-[16/9]` for consistent image sizing, resolving previous height stretching issues. Update dependencies in `package.json`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 413891e8-d784-4bea-b9f5-91a5a68316b4 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: ca1aa952-242c-43c1-9e28-47aed39cee1b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/413891e8-d784-4bea-b9f5-91a5a68316b4/nTLKCC5 Replit-Helium-Checkpoint-Created: true
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { pgTable, serial, integer, text, timestamp } from "drizzle-orm/pg-core";
|
|
import { createInsertSchema } from "drizzle-zod";
|
|
import { z } from "zod";
|
|
import { sql } from "drizzle-orm";
|
|
|
|
export const conversations = pgTable("conversations", {
|
|
id: serial("id").primaryKey(),
|
|
title: text("title").notNull(),
|
|
createdAt: timestamp("created_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
|
|
});
|
|
|
|
export const messages = pgTable("messages", {
|
|
id: serial("id").primaryKey(),
|
|
conversationId: integer("conversation_id").notNull().references(() => conversations.id, { onDelete: "cascade" }),
|
|
role: text("role").notNull(),
|
|
content: text("content").notNull(),
|
|
createdAt: timestamp("created_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
|
|
});
|
|
|
|
export const insertConversationSchema = createInsertSchema(conversations).omit({
|
|
id: true,
|
|
createdAt: true,
|
|
});
|
|
|
|
export const insertMessageSchema = createInsertSchema(messages).omit({
|
|
id: true,
|
|
createdAt: true,
|
|
});
|
|
|
|
export type Conversation = typeof conversations.$inferSelect;
|
|
export type InsertConversation = z.infer<typeof insertConversationSchema>;
|
|
export type Message = typeof messages.$inferSelect;
|
|
export type InsertMessage = z.infer<typeof insertMessageSchema>;
|
|
|