mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-21 20:18:11 +02:00
email view
This commit is contained in:
parent
e4244a8ce5
commit
296f7c75b7
7 changed files with 1065 additions and 47 deletions
|
|
@ -31,6 +31,15 @@ export interface GmailThreadSnapshot {
|
|||
date?: string;
|
||||
latest_email?: string;
|
||||
past_summary?: string;
|
||||
messages: Array<{
|
||||
id?: string;
|
||||
from?: string;
|
||||
to?: string;
|
||||
cc?: string;
|
||||
date?: string;
|
||||
subject?: string;
|
||||
body?: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
function summarizeGmailSync(threads: SyncedThread[]): string {
|
||||
|
|
@ -158,8 +167,10 @@ export async function fetchThreadSnapshot(threadId: string): Promise<GmailThread
|
|||
const parsed = messages.map((msg) => {
|
||||
const headers = msg.payload?.headers || [];
|
||||
return {
|
||||
id: msg.id || undefined,
|
||||
from: headerValue(headers, 'From') || 'Unknown',
|
||||
to: headerValue(headers, 'To'),
|
||||
cc: headerValue(headers, 'Cc'),
|
||||
date: headerValue(headers, 'Date'),
|
||||
subject: headerValue(headers, 'Subject') || '(No Subject)',
|
||||
body: msg.payload ? normalizeBody(getBody(msg.payload)) : '',
|
||||
|
|
@ -186,6 +197,7 @@ export async function fetchThreadSnapshot(threadId: string): Promise<GmailThread
|
|||
date: latest.date,
|
||||
latest_email: latest.body,
|
||||
past_summary: earlierSummary || undefined,
|
||||
messages: parsed,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue