mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #3958 from omnivore-app/fix/authro-in-chapter
fix: add author to the chapter in digest
This commit is contained in:
commit
854ca08142
6 changed files with 20 additions and 11 deletions
|
|
@ -27,14 +27,15 @@ import {
|
|||
findUserAndPersonalization,
|
||||
sendPushNotifications,
|
||||
} from '../../services/user'
|
||||
import { ANTHROPIC_MODEL, OPENAI_MODEL } from '../../utils/ai'
|
||||
import { analytics } from '../../utils/analytics'
|
||||
import { enqueueSendEmail } from '../../utils/createTask'
|
||||
import { wordsCount } from '../../utils/helpers'
|
||||
import { createThumbnailProxyUrl } from '../../utils/imageproxy'
|
||||
import { logger } from '../../utils/logger'
|
||||
import { htmlToMarkdown, markdownToHtml } from '../../utils/parser'
|
||||
import { uploadToBucket } from '../../utils/uploads'
|
||||
import { getImageSize, _findThumbnail } from '../find_thumbnail'
|
||||
import { ANTHROPIC_MODEL, OPENAI_MODEL } from '../../utils/ai'
|
||||
|
||||
export type CreateDigestJobSchedule = 'daily' | 'weekly'
|
||||
|
||||
|
|
@ -174,7 +175,9 @@ const getCandidatesList = async (
|
|||
// reason: "most recent 100 items saved over 500 words
|
||||
|
||||
if (selectedLibraryItemIds) {
|
||||
return findLibraryItemsByIds(selectedLibraryItemIds, userId)
|
||||
return findLibraryItemsByIds(selectedLibraryItemIds, userId, {
|
||||
select: ['id', 'title', 'readableContent', 'author', 'thumbnail'],
|
||||
})
|
||||
}
|
||||
|
||||
// // get the existing candidate ids from cache
|
||||
|
|
@ -647,7 +650,9 @@ const findThumbnail = async (
|
|||
|
||||
try {
|
||||
for (const thumbnail of thumbnails) {
|
||||
const size = await getImageSize(thumbnail)
|
||||
const proxyUrl = createThumbnailProxyUrl(thumbnail)
|
||||
// pre-cache thumbnail first if exists
|
||||
const size = await getImageSize(proxyUrl)
|
||||
if (!size) {
|
||||
continue
|
||||
}
|
||||
|
|
@ -829,9 +834,12 @@ export const createDigest = async (jobData: CreateDigestData) => {
|
|||
title: item.libraryItem.title,
|
||||
id: item.libraryItem.id,
|
||||
url: getItemUrl(item.libraryItem.id),
|
||||
thumbnail: item.libraryItem.thumbnail ?? undefined,
|
||||
thumbnail: item.libraryItem.thumbnail
|
||||
? createThumbnailProxyUrl(item.libraryItem.thumbnail)
|
||||
: undefined,
|
||||
wordCount: speechFiles[index].wordCount,
|
||||
html: summariesInHtml[index],
|
||||
author: item.libraryItem.author ?? undefined,
|
||||
})),
|
||||
createdAt: new Date(),
|
||||
description: '',
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {
|
|||
findLibraryItemById,
|
||||
updateLibraryItem,
|
||||
} from '../services/library_item'
|
||||
import { createThumbnailUrl } from '../utils/imageproxy'
|
||||
import { createThumbnailProxyUrl } from '../utils/imageproxy'
|
||||
import { logger } from '../utils/logger'
|
||||
|
||||
interface Data {
|
||||
|
|
@ -137,7 +137,7 @@ export const findThumbnail = async (data: Data) => {
|
|||
|
||||
const thumbnail = item.thumbnail
|
||||
if (thumbnail) {
|
||||
const proxyUrl = createThumbnailUrl(thumbnail)
|
||||
const proxyUrl = createThumbnailProxyUrl(thumbnail)
|
||||
// pre-cache thumbnail first if exists
|
||||
const image = await fetchImage(proxyUrl)
|
||||
if (!image) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
import { findActiveUser } from '../../services/user'
|
||||
import createHttpTaskWithToken from '../../utils/createTask'
|
||||
import { cleanUrl } from '../../utils/helpers'
|
||||
import { createThumbnailUrl } from '../../utils/imageproxy'
|
||||
import { createThumbnailProxyUrl } from '../../utils/imageproxy'
|
||||
import { logger } from '../../utils/logger'
|
||||
import { RSSRefreshContext } from './refreshAllFeeds'
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ const createItemWithFeedContent = async (
|
|||
})
|
||||
|
||||
const thumbnail = getThumbnail(item)
|
||||
const previewImage = thumbnail && createThumbnailUrl(thumbnail)
|
||||
const previewImage = thumbnail && createThumbnailProxyUrl(thumbnail)
|
||||
const url = cleanUrl(item.link)
|
||||
|
||||
const user = await findActiveUser(userId)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { createAndSaveLabelsInLibraryItem } from '../../services/labels'
|
|||
import { createOrUpdateLibraryItem } from '../../services/library_item'
|
||||
import { parsedContentToLibraryItem } from '../../services/save_page'
|
||||
import { cleanUrl, generateSlug } from '../../utils/helpers'
|
||||
import { createThumbnailUrl } from '../../utils/imageproxy'
|
||||
import { createThumbnailProxyUrl } from '../../utils/imageproxy'
|
||||
import { logger } from '../../utils/logger'
|
||||
import {
|
||||
ParsedContentPuppeteer,
|
||||
|
|
@ -72,7 +72,7 @@ export function followingServiceRouter() {
|
|||
|
||||
const feedUrl = req.body.addedToFollowingBy
|
||||
const thumbnail =
|
||||
req.body.thumbnail && createThumbnailUrl(req.body.thumbnail)
|
||||
req.body.thumbnail && createThumbnailProxyUrl(req.body.thumbnail)
|
||||
const url = cleanUrl(req.body.url)
|
||||
|
||||
const preparedDocument: PreparedDocumentInput = {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ export interface Chapter {
|
|||
wordCount: number
|
||||
thumbnail?: string
|
||||
html: string
|
||||
author?: string
|
||||
}
|
||||
|
||||
export interface Digest {
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ export function createImageProxyUrl(
|
|||
return `${env.imageProxy.url}/${width}x${height},s${signature}/${url}`
|
||||
}
|
||||
|
||||
export const createThumbnailUrl = (url: string): string =>
|
||||
export const createThumbnailProxyUrl = (url: string): string =>
|
||||
createImageProxyUrl(url, 320, 320)
|
||||
|
|
|
|||
Loading…
Reference in a new issue