Merge pull request #338 from lly835/fix/codex-cache-key-cross-model

fix: 修复同会话跨模型缓存键不命中问题
This commit is contained in:
何夕2077 2026-02-26 11:50:11 +08:00 committed by GitHub
commit 85b9efb110
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -310,13 +310,11 @@ export class CodexApiService {
delete cleanedBody.metadata;
// 生成会话缓存键
// 默认弱化 model 依赖,以提升同会话跨模型的缓存命中率
// 如果 sessionId 为 'default',则必须加上 model 以提供基础隔离
// 弱化 model 依赖,以提升同会话跨模型的缓存命中率
// 仅当 sessionId 为 'default' 时加上 model 前缀,提供基础隔离
let cacheKey = sessionId;
if (sessionId === 'default') {
cacheKey = `${model}-default`;
} else {
cacheKey = `${model}-${sessionId}`;
}
let cache = this.conversationCache.get(cacheKey);