Commit Graph
15 Commits
Author SHA1 Message Date
stefanfeng 25fb8fbee5 feat(avatar): add BOXIM chat takeover 2026-08-19 17:56:57 +08:00
stefanfeng cfcfe7146e feat(avatar): align authorization page with design 2026-08-19 17:05:22 +08:00
stefanfeng 2e2adeb9e2 feat(avatar): complete authorization management 2026-08-19 16:21:19 +08:00
stefanfeng 25d2494616 fix: surface missing knowledge files 2026-08-19 15:13:22 +08:00
stefanfeng c5bfa47a23 fix: await takeover polling jobs 2026-08-19 14:32:10 +08:00
stefanfeng 4ab7732da9 fix: preserve takeover and share token integrity 2026-08-19 14:23:43 +08:00
stefanfeng 4a2d788e85 feat: complete grounded digital avatar chat experience 2026-08-19 14:21:56 +08:00
stefanfeng f13d488f82 feat: add takeover config API endpoint
PUT /api/avatar/{avatar_id}/authorizations/takeover to update authorization
takeover settings (enabled, mode, delay_seconds) with validation.
2026-08-07 17:15:12 +08:00
stefanfeng 8e365e63e1 feat: add scheduled message polling for avatar takeover
Add APScheduler BackgroundScheduler to on_startup that polls
takeover_service.poll_and_process_messages every 10 seconds. Added
redis and apscheduler dependencies. Added poll_and_process_messages,
fetch_unread_messages, and process_message methods to TakeoverService.
Scheduler initialization is graceful — Redis/Box IM failures do not
prevent app startup.
2026-08-07 17:01:04 +08:00
stefanfeng dbd668e451 fix: resolve owner through Avatar model in takeover service
- Fix C1: check_takeover_enabled now uses owner_huihui_id to query Avatar first
- Fix C2: execute_takeover resolves owner_id via Avatar model (Authorization has no owner_id)
- Fix I1: add test for None case (no Avatar found)
- Fix I2: add test verifying filter arguments
- Fix I3: implement process_delayed_queue to scan and dispatch expired messages
2026-08-07 16:55:25 +08:00
stefanfeng 190ec48d9c feat: add takeover service core logic
Implement TakeoverService for avatar takeover chat feature:
- check_takeover_enabled: query Authorization for enabled takeover
- generate_reply: call local chat API via httpx to generate responses
- execute_takeover: get owner IM credentials, generate reply, send via BoxIM
- enqueue_delayed_message: Redis delayed queue with graceful degradation
- process_delayed_queue: placeholder for scheduled worker

Service degrades gracefully when Redis is unavailable.
2026-08-07 16:46:57 +08:00
stefanfeng 0cc43a0d8c fix: exclude signature from signing string in BoxIMClient
Prevents stale signature values from leaking into the MD5 signing
calculation, matching the news_service.py pattern. Adds a test that
passes a stale signature in extra params and verifies the returned
signature is freshly computed.
2026-08-07 16:42:00 +08:00
stefanfeng 43bb57eacf feat: add Box IM client for Netease Yunxin integration
Add BoxIMClient with get_credentials and send_p2p_message methods,
using Huihui platform MD5 signing mechanism (sorted keys, 24h timestamp,
12-char alphanumeric nonce). Includes full test coverage.
2026-08-07 16:36:50 +08:00
stefanfeng 7327939b4d feat: add takeover fields to Authorization model
Add takeover_enabled, takeover_mode, and takeover_delay_seconds columns
to the Authorization model with a SQLite migration, and include them
in to_dict(). Test: test_takeover_model.py.
2026-08-07 16:30:29 +08:00
stefanfeng 2d9f26a6f0 feat: add avatar chat and knowledge workflow 2026-07-23 17:21:49 +08:00