diff --git a/apps/mail/actions/getSummary.ts b/apps/mail/actions/getSummary.ts index eea576b96..520b2c4e6 100644 --- a/apps/mail/actions/getSummary.ts +++ b/apps/mail/actions/getSummary.ts @@ -1,10 +1,6 @@ 'use server'; import { getAuthenticatedUserId } from '@/app/api/utils'; -import { connection, summary } from '@zero/db/schema'; -import { headers } from 'next/headers'; -import { and, eq } from 'drizzle-orm'; -import { auth } from '@/lib/auth'; -import { db } from '@zero/db'; +import { getActiveConnection } from './utils'; import axios from 'axios'; export const GetSummary = async (threadId: string) => { @@ -14,11 +10,7 @@ export const GetSummary = async (threadId: string) => { return null; } - const response = await axios.get(process.env.BRAIN_URL + `/brain/thread/summary/${threadId}`, { - headers: { - // 'Authorization': `Bearer ${}` - }, - }); + const response = await axios.get(process.env.BRAIN_URL + `/brain/thread/summary/${threadId}`); return response.data ?? null; } catch (error) { @@ -26,3 +18,21 @@ export const GetSummary = async (threadId: string) => { return null; } }; + +export const GetState = async () => { + try { + if (!process.env.BRAIN_URL) { + return null; + } + const connection = await getActiveConnection(); + if (!connection) { + return null; + } + + const response = await axios.get(process.env.BRAIN_URL + `/limit/${connection.id}`); + return response.data ?? null; + } catch (error) { + console.error('Error getting summary:', error); + return null; + } +}; diff --git a/apps/mail/app/(routes)/layout.tsx b/apps/mail/app/(routes)/layout.tsx index 948b7ef2b..68867671e 100644 --- a/apps/mail/app/(routes)/layout.tsx +++ b/apps/mail/app/(routes)/layout.tsx @@ -12,7 +12,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
${line}
`) - .join(''); - - // Set the content in the editor - editor.commands.setContent(formattedContent); - - // Find the create-email component and update its content - const createEmailElement = document.querySelector('[data-create-email]'); - if (createEmailElement) { - const handler = (createEmailElement as any).onContentGenerated; - if (handler && typeof handler === 'function') { - handler({ content: emailContent.content, subject: emailContent.subject }); - } - } - - toast.success('Email content applied successfully'); - } catch (error) { - console.error('Error applying suggestion:', error); - toast.error('Failed to apply email content'); - } - }; - - const handleRejectSuggestion = (messageId: string) => { - toast.info('Email suggestion rejected'); - }; - - const handleKeyDown = (e: React.KeyboardEventSource: {part.source.title}
; - // } - // if (part.type === 'step-start') { - // return{part.type}
; })} - - {/* {message.type === 'search' && - message.searchContent && - message.searchContent.results.length > 0 && ( -- {result.subject.toLowerCase().includes('meeting') ? ( - 📅 {result.subject} - ) : ( - result.subject || 'No subject' - )} -
- - from {result.from || 'Unknown sender'} - -Debug
-Clear Local Cache
-Clear Local Cache
Enable Brain Activity
-Enable Brain Activity
+