|
1 | 1 | import { createLogger } from '@sim/logger' |
2 | 2 | import { getErrorMessage, toError } from '@sim/utils/errors' |
3 | | -import { omit } from '@sim/utils/object' |
4 | 3 | import { FathomIcon } from '@/components/icons' |
5 | 4 | import { fetchWithRetry, VALIDATE_RETRY_OPTIONS } from '@/lib/knowledge/documents/utils' |
6 | 5 | import type { ConnectorConfig, ExternalDocument, ExternalDocumentList } from '@/connectors/types' |
@@ -104,6 +103,7 @@ interface FathomMeetingHeader { |
104 | 103 | recordedByEmail?: string |
105 | 104 | recordedByName?: string |
106 | 105 | team?: string |
| 106 | + sourceUrl?: string |
107 | 107 | contentHash: string |
108 | 108 | } |
109 | 109 |
|
@@ -191,15 +191,16 @@ function buildHeader(meeting: FathomMeeting): FathomMeetingHeader { |
191 | 191 | recordedByEmail: meeting.recorded_by?.email, |
192 | 192 | recordedByName: meeting.recorded_by?.name, |
193 | 193 | team: meeting.recorded_by?.team ?? undefined, |
| 194 | + sourceUrl: buildSourceUrl(meeting), |
194 | 195 | contentHash: buildContentHash(meeting), |
195 | 196 | } |
196 | 197 | } |
197 | 198 |
|
198 | 199 | /** |
199 | 200 | * Builds a metadata-based content hash. Fathom recordings are immutable once |
200 | | - * processed, so the recording id plus its end/creation timestamps fully |
201 | | - * identify a version. The stub hash is authoritative for change detection; |
202 | | - * `getDocument` omits the hash so the engine reuses this value verbatim. |
| 201 | + * processed, so the recording id plus its end/creation timestamps fully identify |
| 202 | + * a version. The same value is cached in the header and returned by `getDocument`, |
| 203 | + * so the stub and hydrated document hash identically. |
203 | 204 | */ |
204 | 205 | function buildContentHash(meeting: FathomMeeting): string { |
205 | 206 | return `fathom:${meeting.recording_id ?? ''}:${meeting.recording_end_time ?? ''}:${meeting.created_at ?? ''}` |
@@ -491,21 +492,15 @@ export const fathomConnector: ConnectorConfig = { |
491 | 492 | const content = formatMeetingContent(header, transcript, summary).trim() |
492 | 493 | if (!content) return null |
493 | 494 |
|
494 | | - const hydrated: ExternalDocument = { |
| 495 | + return { |
495 | 496 | externalId, |
496 | 497 | title: header?.title ?? 'Untitled Fathom Meeting', |
497 | 498 | content, |
498 | 499 | contentDeferred: false, |
499 | 500 | mimeType: 'text/plain', |
500 | | - sourceUrl: undefined, |
501 | | - contentHash: header?.contentHash ?? '', |
502 | | - } |
503 | | - |
504 | | - if (header?.contentHash) { |
505 | | - return hydrated |
| 501 | + sourceUrl: header?.sourceUrl, |
| 502 | + contentHash: header?.contentHash ?? `fathom:${externalId}`, |
506 | 503 | } |
507 | | - |
508 | | - return omit(hydrated, ['contentHash']) as ExternalDocument |
509 | 504 | } catch (error) { |
510 | 505 | logger.warn('Failed to get Fathom meeting', { |
511 | 506 | externalId, |
|
0 commit comments