iconsulting/packages/services
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
..
conversation-service fix(conversation): track token usage and message count in conversation entity 2026-01-25 17:08:23 -08:00
evolution-service fix(audit): reorder routes to fix NestJS route collision 2026-01-25 08:40:56 -08:00
file-service fix(orm): add explicit PostgreSQL column types for all ORM entities 2026-01-25 02:14:07 -08:00
knowledge-service fix(orm): add explicit PostgreSQL column types for all ORM entities 2026-01-25 02:14:07 -08:00
payment-service feat(payment): add transaction reliability and idempotency support 2026-01-25 07:00:01 -08:00
user-service fix(user-service): add jsonwebtoken dependency for admin auth 2026-01-25 09:02:30 -08:00