Commit Graph

10 Commits

Author SHA1 Message Date
hailin 7ff701369b fix(tenant): use TenantContextModule.forRoot() for global tenant context
All services were providing TenantContextService directly without
making it global, causing DI resolution failures in child modules.
Now using TenantContextModule.forRoot() which exports TenantContextService
globally so all repositories can access it.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 04:31:56 -08:00
hailin 849a4a3099 feat(conversation): add token usage tracking for API cost analysis
- Add TokenUsageEntity to store per-request token consumption
- Add TokenUsageService with cost calculation and statistics APIs
  - Record input/output/cache tokens per API call
  - Calculate estimated cost based on Claude pricing
  - Provide user/conversation/global stats aggregation
  - Support daily stats and top users ranking
- Integrate token tracking in ClaudeAgentService
  - Track latency, tool calls, response length
  - Accumulate tokens across tool loop iterations
- Add token_usages table to init-db.sql with proper indexes

This enables:
- Per-user token consumption tracking
- Cost analysis and optimization
- Future billing/quota features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 08:23:58 -08:00
hailin d4925719fc feat(multimodal): add file upload and image support for chat
- Add MinIO object storage to docker-compose infrastructure
- Create file-service microservice for upload management with presigned URLs
- Add files table to database schema
- Update nginx and Kong for MinIO proxy routes
- Implement file upload UI in chat InputArea with drag-and-drop
- Add attachment preview in MessageBubble component
- Update conversation-service to handle multimodal messages
- Add Claude Vision API integration for image analysis

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 05:34:41 -08:00
hailin 4718d60bff fix(web): sidebar collapsed by default on all devices 2026-01-09 22:07:17 -08:00
hailin f12ca7a821 feat(web): add collapsible sidebar and delete conversation
Frontend:
- Add sidebarOpen state to chatStore with toggle functionality
- Make sidebar collapsible with smooth animation
- Add mobile-friendly drawer behavior with overlay
- Add toggle button for desktop view
- Implement delete conversation functionality with loading state

Backend:
- Add DELETE /conversations/:id endpoint
- Implement deleteConversation service method
- Delete messages before conversation (foreign key constraint)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 21:42:07 -08:00
hailin 210e752223 fix(conversation): add class-validator decorators to DTO classes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:20:46 -08:00
hailin ec66d58e61 fix(nginx): preserve query string for Socket.IO proxy
Add $is_args$args to proxy_pass for /socket.io/ and /ws/ locations
to fix "Transport unknown" error caused by missing query parameters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:19:52 -08:00
hailin c9b5c4d2d7 fix: add POSTGRES_* environment variables for TypeORM
TypeORM config reads individual POSTGRES_HOST, POSTGRES_PORT, etc.
environment variables instead of DATABASE_URL. Added these variables
to all backend services in docker-compose.yml.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 10:46:16 -08:00
hailin 3ac83e9305 feat: 添加 SSL 证书自动申请和 Kong API Gateway 配置
新增功能:
- deploy.sh 添加 ssl 命令支持 Let's Encrypt 证书自动申请
- deploy.sh 添加 kong 命令支持 API Gateway 路由配置
- deploy.sh 添加 deploy-full 命令一键完整部署(含SSL)
- Nginx 配置更新为 HTTPS,支持 HTTP->HTTPS 重定向
- 域名配置为 iconsulting.szaiai.com

SSL 功能:
- ./deploy.sh ssl install    安装 certbot
- ./deploy.sh ssl obtain     申请证书
- ./deploy.sh ssl renew      续期证书
- ./deploy.sh ssl auto-renew 配置自动续期

Kong 功能:
- ./deploy.sh kong setup     配置所有微服务路由
- ./deploy.sh kong status    查看网关状态
- ./deploy.sh kong services  查看服务列表
- ./deploy.sh kong routes    查看路由列表

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 00:07:26 -08:00
hailin a7add8ff90 Initial commit: iConsulting 香港移民咨询智能客服系统
项目架构:
- Monorepo (pnpm + Turborepo)
- 后端: NestJS 微服务 + Claude Agent SDK
- 前端: React + Vite + Ant Design

包含服务:
- conversation-service: 对话服务 (Claude AI)
- user-service: 用户认证服务
- payment-service: 支付服务 (支付宝/微信/Stripe)
- knowledge-service: 知识库服务 (RAG + Neo4j)
- evolution-service: 自我进化服务
- web-client: 用户前端
- admin-client: 管理后台

基础设施:
- PostgreSQL + Redis + Neo4j
- Kong API Gateway
- Nginx 反向代理
- Docker Compose 部署配置

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 00:01:12 -08:00