Files
memind/src/utils/balanceRefresh.ts
T
john 32fb2cdeaf feat: chat uploads, vision turn isolation, and MindSpace agent improvements
Add chat file/image upload UX, attachment proxying, vision thumbnails, and per-turn image scoping so agents only use the current upload. Extend MindSpace asset context, billing token state, OA/scenario verify scripts, and related runtime config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 00:23:01 +08:00

22 lines
773 B
TypeScript

import type { UserNotification } from '../types';
export const BALANCE_REFRESH_EVENT = 'tkmind:balance-refresh';
const RECHARGE_NOTIFICATION_TYPES = new Set(['admin_recharge', 'self_recharge', 'recharge']);
export function isRechargeNotification(
notification: Pick<UserNotification, 'notificationType' | 'title' | 'body'>,
): boolean {
if (RECHARGE_NOTIFICATION_TYPES.has(String(notification.notificationType ?? '').trim())) {
return true;
}
const title = String(notification.title ?? '');
const body = String(notification.body ?? '');
return /充值/.test(title) && /余额已更新/.test(body);
}
export function requestBalanceRefresh() {
if (typeof window === 'undefined') return;
window.dispatchEvent(new CustomEvent(BALANCE_REFRESH_EVENT));
}