mirror of
https://github.com/intergalacticalvariable/reader.git
synced 2024-11-16 11:42:32 +08:00
fix: potential chargeAmount mismatch
This commit is contained in:
parent
8b0916f858
commit
e0e37ad4d7
|
@ -30,12 +30,14 @@ export interface ExtraScrappingOptions extends ScrappingOptions {
|
||||||
|
|
||||||
export interface FormattedPage {
|
export interface FormattedPage {
|
||||||
title?: string;
|
title?: string;
|
||||||
|
description?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
publishedTime?: string;
|
publishedTime?: string;
|
||||||
html?: string;
|
html?: string;
|
||||||
text?: string;
|
text?: string;
|
||||||
screenshotUrl?: string;
|
screenshotUrl?: string;
|
||||||
|
screenshot?: Buffer;
|
||||||
|
|
||||||
toString: () => string;
|
toString: () => string;
|
||||||
}
|
}
|
||||||
|
@ -727,13 +729,13 @@ ${this.content}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const textContent = formatted?.content || formatted?.text || formatted?.html;
|
const textContent = formatted?.content || formatted?.description || formatted?.text || formatted?.html;
|
||||||
|
|
||||||
if (typeof textContent === 'string') {
|
if (typeof textContent === 'string') {
|
||||||
return estimateToken(textContent);
|
return estimateToken(textContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageContent = formatted.screenshotUrl || (formatted as any)?.screenshot;
|
const imageContent = formatted.screenshotUrl || formatted.screenshot;
|
||||||
|
|
||||||
if (imageContent) {
|
if (imageContent) {
|
||||||
// OpenAI image token count for 1024x1024 image
|
// OpenAI image token count for 1024x1024 image
|
||||||
|
|
Loading…
Reference in New Issue
Block a user