diff --git a/app/actions.tsx b/app/actions.tsx index 2a3fc388..624b7358 100644 --- a/app/actions.tsx +++ b/app/actions.tsx @@ -308,7 +308,7 @@ async function submit(formData?: FormData, skip?: boolean) { : answer.length === 0 && !errorOccurred ) { const { fullResponse, hasError, toolResponses } = await researcher( - currentSystemPrompt + calendarNotesContext, + (currentSystemPrompt ?? '') + calendarNotesContext, uiStream, streamText, messages, @@ -352,7 +352,7 @@ async function submit(formData?: FormData, skip?: boolean) { ) as CoreMessage[] const latestMessages = modifiedMessages.slice(maxMessages * -1) answer = await writer( - currentSystemPrompt + calendarNotesContext, + (currentSystemPrompt ?? '') + calendarNotesContext, uiStream, streamText, latestMessages diff --git a/lib/actions/calendar.ts b/lib/actions/calendar.ts index d8fa7d15..8df79a4e 100644 --- a/lib/actions/calendar.ts +++ b/lib/actions/calendar.ts @@ -137,23 +137,6 @@ export async function saveNote(noteData: NewCalendarNote | CalendarNote): Promis return savedNote; }); - if (result && result.chatId) { - const { createMessage } = await import('./chat-db'); - await createMessage({ - chatId: result.chatId, - userId: userId, - role: 'data', - content: JSON.stringify({ - type: 'calendar_note', - note: { - ...result, - locationTags, - userTags - }, - }), - }); - } - return result; } catch (error) { console.error('Error saving note:', error); diff --git a/lib/db/schema.ts b/lib/db/schema.ts index c6147057..6b621d00 100644 --- a/lib/db/schema.ts +++ b/lib/db/schema.ts @@ -121,6 +121,17 @@ export const calendarNoteUserTags = pgTable('calendar_note_user_tags', { noteTagUnique: unique('calendar_note_user_tags_note_tag_unique').on(t.noteId, t.tag), })); +export const promptGenerationJobs = pgTable('prompt_generation_jobs', { + id: uuid('id').primaryKey().defaultRandom(), + userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + domain: text('domain').notNull(), + status: text('status').notNull().default('pending'), // pending | processing | complete | error + resultPrompt: text('result_prompt'), + errorMessage: text('error_message'), + createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(), + updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(), +}); + // Relations export const usersRelations = relations(users, ({ many }) => ({ chats: many(chats), @@ -213,17 +224,6 @@ export const visualizationsRelations = relations(visualizations, ({ one }) => ({ }), })); -export const promptGenerationJobs = pgTable('prompt_generation_jobs', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - domain: text('domain').notNull(), - status: text('status').notNull().default('pending'), // pending | processing | complete | error - resultPrompt: text('result_prompt'), - errorMessage: text('error_message'), - createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(), - updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(), -}); - export const promptGenerationJobsRelations = relations(promptGenerationJobs, ({ one }) => ({ user: one(users, { fields: [promptGenerationJobs.userId],