Commit Graph

57 Commits

Author SHA1 Message Date
hailin 731323ad7c fix(admin): add basename to BrowserRouter for /admin/ deployment
The router needs basename="/admin" to work correctly when deployed
under the /admin/ subpath.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 07:50:22 -08:00
hailin cb0b8c6ea9 fix(admin): configure base path for /admin/ deployment
- Add base: '/admin/' to vite.config.ts for proper asset paths
- Replace vite.svg favicon with inline SVG emoji icon
- Fixes 404 errors when accessing admin panel at /admin/ path

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 07:35:52 -08:00
hailin 5ff53b8ba7 fix(chat): align input area elements vertically centered
- Change flex container from items-end to items-center
- Use top-1/2 -translate-y-1/2 for send button vertical centering
- Adjust paperclip button padding for consistent sizing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 06:49:20 -08:00
hailin 3d120e1ce3 fix(chat): hide textarea scrollbar when content fits
- Set overflow-hidden by default on textarea
- Only show scrollbar when content exceeds max height (200px)
- Fix scrollbar appearing on empty input

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 06:44:59 -08:00
hailin 8a39505ee6 feat(chat): add paste and drag-drop file upload support
- Add clipboard paste handler for images and files (Ctrl+V / Cmd+V)
- Add drag-and-drop zone with visual feedback
- Update placeholder text to inform users about new features
- Improve file upload UX with drop overlay

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 06:22:59 -08:00
hailin 2570e4add9 fix(file-service): specify explicit column types for TypeORM entities
Fix DataTypeNotSupportedError by explicitly specifying PostgreSQL column types
for nullable fields that TypeORM was incorrectly inferring as Object type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 06:05:36 -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 7adbaaa871 fix(db): use POSTGRES_* env vars in knowledge and evolution services
These services were using DB_HOST, DB_USER etc. but docker-compose
sets POSTGRES_HOST, POSTGRES_USER etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 02:57:39 -08:00
hailin c98cae2e39 fix(payment): use PORT env variable instead of PAYMENT_SERVICE_PORT
Payment service was listening on wrong port (3004) because it used
PAYMENT_SERVICE_PORT which wasn't set in docker-compose.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 02:48:44 -08:00
hailin 224e1fb509 fix(health): exclude /health endpoint from API prefix
The health check endpoint should be at /health not /api/v1/health
for Docker health checks to work properly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 02:30:24 -08:00
hailin 223aa25af1 fix(docker): add health check endpoints and fix IPv6 issue
- Add /health endpoints to all NestJS services (user, payment, knowledge, conversation, evolution)
- Fix nginx healthcheck to use 127.0.0.1 instead of localhost (IPv6 issue)
- Add healthcheck configuration to docker-compose for all backend services
- Use start_period to allow services time to initialize before health checks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 02:13:42 -08:00
hailin 93050b6889 perf(claude): enable Prompt Caching for ~90% cost savings on system prompt 2026-01-10 01:42:33 -08:00
hailin c914693f94 feat(web): add markdown rendering for AI responses 2026-01-10 01:33:00 -08:00
hailin 0cd667b5c8 fix(websocket): use singleton socket to prevent disconnection on re-render 2026-01-10 01:26:49 -08:00
hailin bd65a431aa fix(websocket): add debug logging for connection issues 2026-01-10 01:24:11 -08:00
hailin d073bd5a9d fix(websocket): configure Socket.IO path for nginx proxy 2026-01-10 01:12:58 -08:00
hailin ab9f479f81 fix(nginx): preserve full path for WebSocket proxy 2026-01-10 01:09:41 -08:00
hailin f8fcf7c74b fix(web): integrate menu toggle into ChatWindow header, remove duplicate headers 2026-01-09 22:09:52 -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 72e67fa5d9 fix(conversation): implement proper tool loop for Claude API
- Fix streaming JSON parsing for tool inputs by accumulating partial JSON
  and parsing only on content_block_stop
- Implement proper tool loop to continue conversation after tool execution
- Send tool results back to Claude to get final response
- Add safety limit of 10 iterations for tool loops

This fixes the issue where AI responses were truncated after using tools
like search_knowledge.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 21:29:18 -08:00
hailin 141b45bec2 chore(db): sync init-db.sql with complete postgres schema
Sync scripts/init-db.sql with infrastructure/docker/services/postgres/init.sql
to include all required database columns:
- users: fingerprint, nickname columns for anonymous auth support
- conversations: ended_at column for tracking conversation end time
- messages: type enum column (USER, ASSISTANT, SYSTEM)

This ensures the schema files are consistent and include all columns
needed by the application entities.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 21:15:53 -08:00
hailin 3a675bf3a3 fix(user-service): handle optional fingerprint parameter
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 21:02:44 -08:00
hailin 3efce36f92 fix(user-service): add class-validator decorators to auth DTOs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 21:01:54 -08:00
hailin f87c089ca2 fix: disable TLS verification for IP-based proxy
When ANTHROPIC_BASE_URL points to an IP address (proxy server),
disable TLS certificate verification to allow connection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:50:15 -08:00
hailin 7f2fc153b5 refactor: simplify Anthropic client config using baseURL
Remove https-proxy-agent dependency since ANTHROPIC_BASE_URL already
supports pointing to a proxy server directly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:45:44 -08:00
hailin a43e0b40e8 fix: use correct type for Anthropic client options
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:44:03 -08:00
hailin ea760b5695 chore: update pnpm-lock.yaml for https-proxy-agent
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:37:36 -08:00
hailin c6c9623f36 feat(conversation): add proxy support for Anthropic API
- Add https-proxy-agent dependency
- Configure httpAgent in ClaudeAgentService when ANTHROPIC_PROXY_URL is set
- Add ANTHROPIC_PROXY_URL environment variable to docker-compose.yml

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:34:13 -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 f06e6ee76e feat(scripts): add unified deployment management script
Commands:
- start/stop/restart/status - service lifecycle
- logs - view service logs
- build/pull - build and deploy
- health - health check all services
- kong - Kong routes/services/plugins management
- db - PostgreSQL/Redis/Neo4j access and backup
- clean - cleanup images/volumes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:45:47 -08:00
hailin e98b0a424f fix(kong): add missing API routes
- payment-service: add /api/v1/orders
- knowledge-service: add /api/v1/memory
- evolution-service: add /api/v1/admin

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:39:44 -08:00
hailin 462bd64651 fix(kong,nginx): fix API routing configuration
- nginx: preserve full path when proxying to Kong (remove trailing /)
- nginx: increase API timeout to 120s for AI streaming
- kong: use format_version 2.1 for Kong 3.4 compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:38:32 -08:00
hailin b4a84b76fc refactor(kong): use DB-less mode with declarative config
- Remove kong-database, kong-migrations, kong-init services
- Use KONG_DATABASE=off with declarative config file
- Add kong/kong.yml with all services, routes, and plugins
- Remove kong_data volume (no longer needed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:36:06 -08:00
hailin fd4f23accc refactor: move Kong config to kong/ directory
Organize infrastructure configs properly:
- nginx/ for Nginx configuration
- kong/ for Kong configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:34:04 -08:00
hailin 2512848d6c refactor(kong): consolidate Kong configuration into single init script
- Update init-kong.sh with complete service/route configuration
- Add CORS plugin configuration with all required headers
- Add timeout settings (120s for conversation-service)
- Simplify docker-compose kong-init to use the script
- Add kong-migrations service for database bootstrap

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:27:26 -08:00
hailin 572796f753 feat(kong): add Kong API gateway initialization script
Configures routes for all microservices:
- user-service: /api/v1/users, /api/v1/auth
- payment-service: /api/v1/payments, /api/v1/subscriptions
- knowledge-service: /api/v1/knowledge
- conversation-service: /api/v1/conversations, /api/v1/messages
- evolution-service: /api/v1/evolution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:24:31 -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 92e2b7e445 fix: add CORS_ORIGINS env for conversation-service websocket
Allow production domain https://iconsulting.szaiai.com for WebSocket CORS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 11:01:19 -08:00
hailin 5c44a1a1a1 fix: conversation-service use PORT env variable instead of CONVERSATION_SERVICE_PORT
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 10:54:49 -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 4b6778cc29 fix: 添加bcrypt原生编译支持
user-service和evolution-service使用bcrypt需要原生编译,
添加python3/make/g++编译工具,安装后删除以减小镜像体积

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:12:32 -08:00
hailin 2f9fd3995b fix: 使用jq正确处理package.json移除workspace依赖
sed直接删除行会导致JSON尾随逗号问题,改用jq
正确删除dependencies中的@iconsulting/shared键

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:49:41 -08:00
hailin 7417bc1d82 fix: 移除workspace协议依赖解决npm安装问题
npm不支持pnpm的workspace:*协议,在安装依赖前
使用sed移除@iconsulting相关依赖行,shared包
已通过COPY单独复制到node_modules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:45:38 -08:00
hailin 287aeb5c72 fix: 修复pnpm monorepo Docker构建问题
- 移除runner阶段的pnpm安装(不再需要)
- 使用npm install替代直接复制node_modules
- 单独复制@iconsulting/shared构建产物
- 解决pnpm符号链接在Docker中失效的问题

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:32:58 -08:00
hailin ac105a8c0b fix: nginx配置支持动态解析,解决后端服务不可用时启动失败问题
- 移除静态upstream定义,改用Docker DNS resolver动态解析
- 移除Docker nginx的SSL配置(系统nginx已处理SSL)
- 使用set变量方式引用后端服务,避免启动时DNS解析失败

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:24:28 -08:00
hailin 885e84f823 fix: 修复管理员默认密码哈希
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 07:58:04 -08:00
hailin cc3de9244c fix: 修改nginx SSL端口为18443避免冲突
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 07:53:33 -08:00
hailin f273e7be8d feat: 傻瓜式nginx反向代理配置
- Docker nginx使用8080端口避免与系统nginx冲突
- 启动nginx时自动配置系统nginx反向代理
- 支持Debian/Ubuntu和CentOS/RHEL两种配置目录
- 自动测试配置并重载nginx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 07:51:49 -08:00
hailin f0f098b769 fix: 使用正确的 Kong 官方镜像 kong:3.4
- 从 kong/kong-gateway:3.4 改为 kong:3.4 (官方镜像)
- 参考: https://hub.docker.com/_/kong

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