feat: 从JWT解析userId并添加资源点余额提醒

- 新增 jwtUtils.ts 解析JWT token获取user_id
- dialogService 从登录session获取真实userId
- 添加 credit_update 事件处理
- 余额低于5点时弹窗提醒用户充值
- settings.ts 登录URL改为可配置
This commit is contained in:
XiaoFeng
2026-01-09 15:53:54 +08:00
parent 4037e9e2d7
commit 178f3a7498
6 changed files with 136 additions and 7 deletions

View File

@ -66,6 +66,7 @@ export type SSEEventType =
| "agent_error" // 子智能体错误
| "memory_compacted" // 记忆压缩完成
| "context_usage" // 上下文使用量
| "credit_update" // 资源点余额更新
| "complete" // 对话完成
| "error" // 错误
| "warning" // 警告
@ -201,6 +202,12 @@ export interface ContextUsageEvent {
percentage: number;
}
/** credit_update 事件数据 */
export interface CreditUpdateEvent {
deductedCredits: number;
remainingCredits: number;
}
// ============== 工具调用协议 (MCP 格式) ==============
/**