Add AI-powered chatbot for media outlets
Integrate an AI chatbot feature allowing users to interact with media outlets, fetch chat history, and generate AI responses using OpenAI. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9a264234-c5d7-4dcc-adf3-a954b149b30d Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/9a264234-c5d7-4dcc-adf3-a954b149b30d/d35d7YU
This commit is contained in:
@ -180,6 +180,16 @@ export const communityReplies = pgTable("community_replies", {
|
||||
updatedAt: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
// Chatbot messages for media outlets
|
||||
export const chatMessages = pgTable("chat_messages", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
mediaOutletId: varchar("media_outlet_id").notNull(),
|
||||
userId: varchar("user_id").notNull(),
|
||||
role: varchar("role").notNull(), // "user" or "assistant"
|
||||
content: text("content").notNull(),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
});
|
||||
|
||||
// Insert schemas
|
||||
export const insertUserSchema = createInsertSchema(users).omit({
|
||||
id: true,
|
||||
@ -245,6 +255,11 @@ export const insertCommunityReplySchema = createInsertSchema(communityReplies).o
|
||||
updatedAt: true,
|
||||
});
|
||||
|
||||
export const insertChatMessageSchema = createInsertSchema(chatMessages).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
});
|
||||
|
||||
// Types
|
||||
export type UpsertUser = typeof users.$inferInsert;
|
||||
export type User = typeof users.$inferSelect;
|
||||
@ -268,3 +283,5 @@ export type InsertCommunityPost = z.infer<typeof insertCommunityPostSchema>;
|
||||
export type CommunityPost = typeof communityPosts.$inferSelect;
|
||||
export type InsertCommunityReply = z.infer<typeof insertCommunityReplySchema>;
|
||||
export type CommunityReply = typeof communityReplies.$inferSelect;
|
||||
export type InsertChatMessage = z.infer<typeof insertChatMessageSchema>;
|
||||
export type ChatMessage = typeof chatMessages.$inferSelect;
|
||||
|
||||
Reference in New Issue
Block a user