iconsulting/packages/services/conversation-service
hailin ae99b78579 fix(conversation): track token usage and message count in conversation entity
Problem:
- Token usage was recorded to token_usage table but not to conversation entity
- Message count was not being incremented
- Dashboard showed 0 tokens for all conversations

Solution:
- Add inputTokens/outputTokens fields to StreamChunk interface
- Return token usage in 'end' chunk from ClaudeAgentServiceV2
- Capture token usage in conversation.service.ts sendMessage
- Call conversation.addTokens() and incrementMessageCount() after each exchange
- Consolidate conversation updates into single repo.update() call

Files changed:
- claude-agent-v2.service.ts: Add token fields to StreamChunk, return in 'end'
- conversation.service.ts: Track tokens and message counts properly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 17:08:23 -08:00
..
src fix(conversation): track token usage and message count in conversation entity 2026-01-25 17:08:23 -08:00
Dockerfile fix: 使用jq正确处理package.json移除workspace依赖 2026-01-09 08:49:41 -08:00
nest-cli.json Initial commit: iConsulting 香港移民咨询智能客服系统 2026-01-09 00:01:12 -08:00
package.json feat(admin): add conversation management with device tracking display 2026-01-25 10:04:17 -08:00
tsconfig.json Initial commit: iConsulting 香港移民咨询智能客服系统 2026-01-09 00:01:12 -08:00