refactor: Business logic and dependencies updates
- 核心服务代码更新 (db, server, auth, proxy) - Agent 相关模块更新 (mindspace, experience) - 前端组件和 hooks 更新 - 数据库 schema 更新 - 依赖版本更新
This commit is contained in:
@@ -24,6 +24,11 @@ import {
|
||||
updateProvider,
|
||||
} from '../api/client';
|
||||
import { appConfig } from '../config';
|
||||
import {
|
||||
clearStoredSessionId,
|
||||
readStoredSessionId,
|
||||
writeStoredSessionId,
|
||||
} from '../utils/sessionStorage';
|
||||
import type {
|
||||
CapabilityMap,
|
||||
ChatState,
|
||||
@@ -57,36 +62,6 @@ import {
|
||||
} from '../utils/message';
|
||||
import { prependUnique, shouldShowNewChatTitle, sortAndTrim, touchSession } from '../utils/sessions';
|
||||
|
||||
const LEGACY_SESSION_KEY = 'tkmind-h5-session-id';
|
||||
|
||||
function resolveSessionStorageKey(userId?: string | null): string {
|
||||
return userId ? `${LEGACY_SESSION_KEY}:${userId}` : LEGACY_SESSION_KEY;
|
||||
}
|
||||
|
||||
function readStoredSessionId(userId?: string | null): string | null {
|
||||
const scopedKey = resolveSessionStorageKey(userId);
|
||||
const scopedValue = localStorage.getItem(scopedKey);
|
||||
if (scopedValue) return scopedValue;
|
||||
const legacyValue = localStorage.getItem(LEGACY_SESSION_KEY);
|
||||
if (legacyValue && userId) {
|
||||
localStorage.setItem(scopedKey, legacyValue);
|
||||
localStorage.removeItem(LEGACY_SESSION_KEY);
|
||||
return legacyValue;
|
||||
}
|
||||
return legacyValue;
|
||||
}
|
||||
|
||||
function writeStoredSessionId(userId: string | null | undefined, sessionId: string) {
|
||||
localStorage.setItem(resolveSessionStorageKey(userId), sessionId);
|
||||
}
|
||||
|
||||
function clearStoredSessionId(userId?: string | null) {
|
||||
localStorage.removeItem(resolveSessionStorageKey(userId));
|
||||
if (!userId) {
|
||||
localStorage.removeItem(LEGACY_SESSION_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
const INSUFFICIENT_BALANCE_NOTICE = '余额不足,请充值后继续使用';
|
||||
|
||||
export { INSUFFICIENT_BALANCE_NOTICE };
|
||||
|
||||
Reference in New Issue
Block a user