mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-06 08:36:02 +08:00
fix: base parameter
This commit is contained in:
parent
53821d0105
commit
e23d9f30a6
@ -832,7 +832,7 @@ export class CrawlerHost extends RPCHost {
|
||||
nominalUrl?: URL,
|
||||
urlValidMs?: number
|
||||
) {
|
||||
const presumedURL = crawlerOptions.base === 'eventual' ? new URL(snapshot.href) : nominalUrl;
|
||||
const presumedURL = crawlerOptions.base === 'final' ? new URL(snapshot.href) : nominalUrl;
|
||||
|
||||
const respondWith = crawlerOptions.respondWith;
|
||||
if (respondWith === CONTENT_FORMAT.READER_LM || respondWith === CONTENT_FORMAT.VLM) {
|
||||
|
@ -25,7 +25,7 @@ const CONTENT_FORMAT_VALUES = new Set<string>(Object.values(CONTENT_FORMAT));
|
||||
|
||||
export const IMAGE_RETENTION_MODES = ['none', 'all', 'alt', 'all_p', 'alt_p'] as const;
|
||||
const IMAGE_RETENTION_MODE_VALUES = new Set<string>(IMAGE_RETENTION_MODES);
|
||||
export const BASE_URL_MODES = ['initial', 'eventual'] as const;
|
||||
export const BASE_URL_MODES = ['initial', 'final'] as const;
|
||||
const BASE_URL_MODE_VALUES = new Set<string>(BASE_URL_MODES);
|
||||
|
||||
class Viewport extends AutoCastable {
|
||||
@ -199,7 +199,7 @@ class Viewport extends AutoCastable {
|
||||
schema: { type: 'string' }
|
||||
},
|
||||
'X-Base': {
|
||||
description: 'Select base modes of relative URLs.\n\nSupported: initial, eventual',
|
||||
description: 'Select base modes of relative URLs.\n\nSupported: initial, final',
|
||||
in: 'header',
|
||||
schema: { type: 'string' }
|
||||
},
|
||||
@ -490,7 +490,9 @@ export class CrawlerOptions extends AutoCastable {
|
||||
instance.tokenBudget ??= parseInt(tokenBudget || '') || undefined;
|
||||
|
||||
const baseMode = ctx?.req.get('x-base') || undefined;
|
||||
instance.base ??= baseMode as any;
|
||||
if (baseMode) {
|
||||
instance.base = baseMode as any;
|
||||
}
|
||||
|
||||
if (instance.cacheTolerance) {
|
||||
instance.cacheTolerance = instance.cacheTolerance * 1000;
|
||||
|
Loading…
x
Reference in New Issue
Block a user