Add LLM digest setup and share timestamp context
This commit is contained in:
@@ -66,7 +66,7 @@ extension LocalRepositoryAiDigestOperations on LocalRepository {
|
||||
? IdeaType.gift
|
||||
: IdeaType.event,
|
||||
title: draft.title,
|
||||
details: _aiDraftDetails(draft),
|
||||
details: _aiIdeaDetails(draft),
|
||||
createdAt: now,
|
||||
);
|
||||
await _setState(
|
||||
@@ -156,6 +156,18 @@ String _aiDraftDetails(AiSuggestionDraft draft) {
|
||||
return '${draft.details.trim()}$reason'.trim();
|
||||
}
|
||||
|
||||
String _aiIdeaDetails(AiSuggestionDraft draft) {
|
||||
final List<String> parts = <String>[
|
||||
_aiDraftDetails(draft),
|
||||
if (draft.eventLocation != null && draft.eventLocation!.trim().isNotEmpty)
|
||||
'Location: ${draft.eventLocation!.trim()}',
|
||||
if (draft.eventUrl != null && draft.eventUrl!.trim().isNotEmpty)
|
||||
'Event: ${draft.eventUrl!.trim()}',
|
||||
if (draft.sourceUrls.isNotEmpty) 'Sources: ${draft.sourceUrls.join(', ')}',
|
||||
].where((String value) => value.trim().isNotEmpty).toList(growable: false);
|
||||
return parts.join('\n\n').trim();
|
||||
}
|
||||
|
||||
extension<T> on Iterable<T> {
|
||||
T? get firstOrNull => isEmpty ? null : first;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ extension LocalRepositoryShareOperations on LocalRepository {
|
||||
rawText: input.messageText.trim(),
|
||||
createdAt: input.sharedAt ?? now,
|
||||
receivedAt: now,
|
||||
sharedMessageDateTime: input.sharedAt,
|
||||
platform: 'legacy',
|
||||
sourceDisplayName: _trimToNull(input.sourceDisplayName),
|
||||
sourceUserId: _trimToNull(input.sourceUserId),
|
||||
@@ -390,7 +391,8 @@ extension LocalRepositoryShareOperations on LocalRepository {
|
||||
String? consumedInboxEntryId,
|
||||
}) async {
|
||||
final String sourceApp = payload.sourceApp;
|
||||
final DateTime sharedAt = payload.createdAt;
|
||||
final DateTime sharedAt =
|
||||
payload.sharedMessageDateTime ?? payload.createdAt;
|
||||
final String? sourceUserId = payload.sourceUserId;
|
||||
final String? sourceThreadId = payload.sourceThreadId;
|
||||
final bool createdSourceLink = matchedLink == null;
|
||||
|
||||
Reference in New Issue
Block a user