Commit Graph

6 Commits

Author SHA1 Message Date
ZhenYi
fdca1fbf86 feat(ai): add comprehensive AI streaming and non-streaming processing services
Some checks are pending
CI / Rust Lint & Check (push) Waiting to run
CI / Rust Tests (push) Waiting to run
CI / Frontend Lint & Type Check (push) Waiting to run
CI / Frontend Build (push) Blocked by required conditions
2026-05-01 00:54:24 +08:00
ZhenYi
5b81e7d774 refactor(room): refactor AI service modules for cleaner separation
Simplify ai_streaming by delegating to ai_mode_streaming.
Extract sequence coordination into dedicated module.
Add worker pool management for concurrent AI task handling.
Refine ai_react_streaming for better delta chunk handling.
2026-04-30 19:16:23 +08:00
ZhenYi
bbeaea6614 fix(billing): remove old billing module, delegate to record_ai_session
Billing is now handled internally by chat_service.process via record_ai_session.
Remove the old billing.rs file and explicit record_ai_usage calls from all 4
AI streaming modes (nonstreaming, react_nonstreaming, react_streaming, streaming).
2026-04-28 13:12:25 +08:00
ZhenYi
32d7b3b902 fix(billing): use actual tokens in nonstreaming ReAct billing
- ai_react_nonstreaming now passes real input/output tokens to billing
- Was passing hardcoded 0,0 despite destructuring token data
- Also fix unused variable warnings
2026-04-28 11:06:57 +08:00
ZhenYi
6edacbcdf2 fix(billing): track actual tokens in ReAct mode instead of hardcoded 0/0
- process_react now returns (String, i64, i64) tuple with token counts
- Extract token stats from rig Agent FinalResponse usage field
- Both streaming and non-streaming ReAct modes now bill correctly
2026-04-28 10:04:54 +08:00
ZhenYi
f5e3da35b0 feat(room): store ordered streaming chunks + billing integration
- Save thinking_content as {"__chunks__": [{type, content}]} for replay
- Tool call sanitization — don't expose raw results to frontend
- Billing record_ai_usage integration
- Room service module refactoring into service/ directory
2026-04-26 13:10:42 +08:00