mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 18:41:08 +02:00
fix(search): fix TypeScript errors in extract service
- Remove unsupported signal option from article-extractor - Use Promise.race for timeout handling instead - Remove non-existent language property from ArticleData https://claude.ai/code/session_01Rk3YVJCU3nM8uvVPghRz6r
This commit is contained in:
parent
bd72b4d6d5
commit
c0802af67f
1 changed files with 8 additions and 4 deletions
|
|
@ -70,9 +70,14 @@ export class ExtractService {
|
|||
}
|
||||
|
||||
try {
|
||||
const article = await extract(request.url, {
|
||||
signal: AbortSignal.timeout(request.options?.timeout || this.defaultTimeout),
|
||||
});
|
||||
// Use Promise.race for timeout since extract doesn't support AbortSignal
|
||||
const timeout = request.options?.timeout || this.defaultTimeout;
|
||||
const extractPromise = extract(request.url);
|
||||
const timeoutPromise = new Promise<null>((_, reject) =>
|
||||
setTimeout(() => reject(new Error('Extraction timeout')), timeout),
|
||||
);
|
||||
|
||||
const article = await Promise.race([extractPromise, timeoutPromise]);
|
||||
|
||||
if (!article) {
|
||||
return this.buildErrorResponse(
|
||||
|
|
@ -102,7 +107,6 @@ export class ExtractService {
|
|||
readingTime: Math.ceil(this.countWords(text) / 200),
|
||||
|
||||
ogImage: article.image,
|
||||
language: article.language,
|
||||
};
|
||||
|
||||
// Optional: Markdown conversion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue