fix(identity): 识别缓存不把一次指定扩散给不相容的同名资源,召回详情失败不写负缓存(H2、M8)
回填只认用户本人的指定,资源没有年份、或作品年份 / 类型与资源不相容时不回填; 读缓存时核对条目与资源的年份(±1,剧集允许更晚)与类型,不相容按未命中处理, 命中后的唯一候选仍经 resolveIdentity 按资源年份 / 类型打分。 TMDB 召回中有候选拉详情失败时,这一轮无匹配不算结论,不写负缓存。 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
4132324935
commit
dca3012227
4 files changed
+69
-15
No files matched your search
@@ -22,6 +22,8 @@ export interface TmdbRecallInput {
|
||||
maxDetails?: number;
|
||||
/** 候选池上限,默认 20 */
|
||||
limit?: number;
|
||||
/** 拉详情失败(保留搜索结果继续)时回调:调用方据此知道这一轮召回不完整,例如不写负缓存 */
|
||||
onDetailError?: (e: TmdbError, c: MetadataCandidate) => void;
|
||||
}
|
||||
|
||||
const yearDistance = (c: MetadataCandidate, year: number | undefined, type: MediaEntityType): number => {
|
||||
@@ -65,6 +67,7 @@ export async function recallTmdbCandidates(tmdb: TmdbClient, input: TmdbRecallIn
|
||||
} catch (e) {
|
||||
// 对照 MP get_info 失败返回 None 后继续:详情只用于补别名,取不到保留搜索结果
|
||||
if (!(e instanceof TmdbError)) throw e;
|
||||
input.onDetailError?.(e, c);
|
||||
}
|
||||
}
|
||||
return [...seen.values()].slice(0, input.limit ?? 20);
|
||||
|
||||
Reference in new issue
Block a user