From ceb58e437eb7cbe0e2c46de57b983ceb8b6fa866 Mon Sep 17 00:00:00 2001 From: ymaomi Date: Mon, 15 Jun 2026 17:17:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20guard=20against=20missing=20session.get(?= =?UTF-8?q?)=20API=20=E2=80=94=20use=20fallback=20when=20unavailable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 57689f3..e69be67 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -431,7 +431,9 @@ function TokenCachePanel(props: { // 自然追踪 messages 和 provider(SDK 数据就绪时自动重新执行) const msgs = props.api.state.session.messages(sid) as Message[] - const session = props.api.state.session.get(sid) + const session = typeof props.api.state.session.get === "function" + ? props.api.state.session.get(sid) + : undefined // 累计值优先使用 Session 聚合字段(数据库级,不受 sync 层 limit:100 截断) // 若字段不存在(旧版本 SDK),降级到消息遍历累加