nomagick commited on
Commit
e0e37ad
·
unverified ·
1 Parent(s): 8b0916f

fix: potential chargeAmount mismatch

Browse files
backend/functions/src/cloud-functions/crawler.ts CHANGED
@@ -30,12 +30,14 @@ export interface ExtraScrappingOptions extends ScrappingOptions {
30
 
31
  export interface FormattedPage {
32
  title?: string;
 
33
  url?: string;
34
  content?: string;
35
  publishedTime?: string;
36
  html?: string;
37
  text?: string;
38
  screenshotUrl?: string;
 
39
 
40
  toString: () => string;
41
  }
@@ -727,13 +729,13 @@ ${this.content}
727
  return undefined;
728
  }
729
 
730
- const textContent = formatted?.content || formatted?.text || formatted?.html;
731
 
732
  if (typeof textContent === 'string') {
733
  return estimateToken(textContent);
734
  }
735
 
736
- const imageContent = formatted.screenshotUrl || (formatted as any)?.screenshot;
737
 
738
  if (imageContent) {
739
  // OpenAI image token count for 1024x1024 image
 
30
 
31
  export interface FormattedPage {
32
  title?: string;
33
+ description?: string;
34
  url?: string;
35
  content?: string;
36
  publishedTime?: string;
37
  html?: string;
38
  text?: string;
39
  screenshotUrl?: string;
40
+ screenshot?: Buffer;
41
 
42
  toString: () => string;
43
  }
 
729
  return undefined;
730
  }
731
 
732
+ const textContent = formatted?.content || formatted?.description || formatted?.text || formatted?.html;
733
 
734
  if (typeof textContent === 'string') {
735
  return estimateToken(textContent);
736
  }
737
 
738
+ const imageContent = formatted.screenshotUrl || formatted.screenshot;
739
 
740
  if (imageContent) {
741
  // OpenAI image token count for 1024x1024 image