fix(frontend): harden chat resources cache invalidation and dedup
- Invalidate the single-KB detail cache when editing a KB from the list page, matching the detail page so the sidebar/detail no longer show a stale name/config for up to the cache TTL. - Reject (instead of swallowing) listModels network failures so the cache layer can tell a transient failure apart from a genuinely empty model list and avoid caching the empty result for the whole TTL. All UI callers already wrap listModels in try/catch. - Guard the kb/agent in-flight handles with a generation counter so a concurrent force refresh cannot null out a still-running request, and clear all in-flight maps on invalidate() so stale requests cannot repopulate the cache after invalidation.
This commit is contained in:
@@ -1653,6 +1653,8 @@ const handleCreateKnowledgeBase = () => {
|
||||
const handleKBEditorSuccess = (kbId: string) => {
|
||||
console.log('[KnowledgeBaseList] knowledge operation success:', kbId)
|
||||
const shouldOpenDetailForUploadGuide = !isContextualGuideDone('kbDetail')
|
||||
// 列表页编辑同样要让单 KB 详情缓存失效,否则侧栏 / 详情页 60s 内仍显示旧信息
|
||||
chatResources.invalidateKnowledgeBaseDetail(kbId)
|
||||
fetchList(true).then(() => {
|
||||
if (shouldOpenDetailForUploadGuide && kbId) {
|
||||
goDetail(kbId)
|
||||
|
||||
Reference in New Issue
Block a user