Commit Graph

21 Commits

Author SHA1 Message Date
61fd7168f3 feat: Android commercialization finish (30/30), TTS SSML fix, DB restore sync
- android: remaining commercialization tasks, WeChat-style timestamp divider
  (no rules), send auto-scroll, failed-message retry, FeatureGate, avatar
- backend: fix Edge TTS reading SSML tags aloud — edge_tts.Communicate escapes
  input, so custom SSML was spoken as text; now plain text + rate param
  (_build_ssml/_VOICE_STYLE_MAP removed); add custom_presets & push_greetings
  APIs/models; alembic 029-032 + post-restore sync migrations
  1ab200d2d94d/a51ee94d762d with all DROP ops disabled
- frontend: AgentChat/company view updates, TTS markdown stripping
- docs: TTS bugfix record, Android fix docs
- repo hygiene: remove 25 committed tts_outputs mp3 artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-09 18:26:02 +08:00
52d8dabf9b feat: Android companion AI commercialization — phases 1-5 (24/30 tasks)
## Phase 1: Avatars + IM Layout (6/8 done)
- Timestamp dividers replacing per-message timestamps
- Long-press context menu (Copy/Read/Share/Like/Dislike/Regenerate)
- Bubble slide-up + fade-in appear animation
- Customizable chat background colors (6 presets)
- User avatar support (top bar, drawer, message bubbles)
- Notification badge clears on drawer open

## Phase 2: Streaming TTS + Recovery (4/7 done)
- Typing indicator with animated dots
- StopSpeaking integration on send/switch/stop
- Per-agent voice binding
- TTS speed control slider (0.5-2.0x)
- Reconnection timeout detection (15s) with retry UI
- Audio waveform animation on speaking message bubble

## Phase 3: Personality Immersion (5/7 done)
- Per-agent show-thinking-chain toggle via workflow_config
- Friendlier ThinkTrace labels with configurable iteration display
- Hide character counter until >= 1800 chars
- Send button warm pink gradient + scale press animation
- Softer user bubble color (tertiaryContainer)

## Phase 4: Message Quality (4/4 done)
- Message send states (sending/sent/failed indicators)
- Image rendering in LightweightMarkdown via AsyncImage
- Chat background image support (custom photo, compressed to 1920px)
- Font size control (small/normal/large)

## Phase 5: Commercial Loop (4/4 done)
- Intimacy/affinity tracking with level system (初识→灵魂伴侣)
- Icebreaker greeting flow for companion agents
- Chat background image support
- Conversation export/share as image card

## New files
- ChatTimestampDivider.kt, TypingIndicator.kt
- IntimacyStats.kt, ConversationExporter.kt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-05 10:41:25 +08:00
b20bafa598 fix: revert SpeechQueue TTS batching, keep TTS text cleaning
Reverted the sentence-batching SpeechQueue that caused duplicate playback.
TTS now uses the original simple approach: speak full text once on Final.
Retained: parenthetical content stripping + emoji removal for cleaner TTS output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-05 09:03:30 +08:00
1693292bbd feat: SSML emotional TTS, agent avatars, AgentChat UX overhaul, virtual company enhancements
- SSML TTS with emotional styles (_build_ssml, mstts:express-as) and natural pauses
- Agent avatar support: DB migration, API, frontend emoji/URL rendering
- AgentChat UX: highlight.js code blocks, copy buttons, streaming cursor, char count,
  auto-title, keyboard shortcuts, message feedback (thumbs), undo delete, mobile responsive
- Virtual company: M2 control, tier-3/4 capabilities, per-dept session fix, deliverable
  validator, insight analyzer enhancements
- New services: agent_profiler, deliverable_validator, redis_task_registry
- Android: auth refactor, launcher icons, network security config, update manager
- Frontend: useSpeechQueue composable, Agents/AgentConfig/AgentTest enhancements
- Various backend fixes and expanded test coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-01 23:22:38 +08:00
3483c6b3be fix: update TTS voice mapping to only use valid Edge TTS voices
Previously the voice map referenced 10+ non-existent Edge TTS voice names
(xiaohan, xiaochen, xiaoshuang, etc.), causing NoAudioReceived errors and
fallback to browser default TTS. Now only maps to the 6 actually available
Chinese voices (xiaoxiao, xiaoyi, yunxi, yunyang, yunjian, yunxia).
Added voice speed adjustments and fixed --rate argument format for Windows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-04 17:06:51 +08:00
fbf8dbbe86 fix: Android null-safety Gson crash + AgentChat full UX overhaul (Round 1-4)
Android:
- Add NullSafeStringAdapter to GsonBuilder globally to prevent null String injection into non-nullable Kotlin fields
- Add defensive null-safe mappings in AgentRepository and all UI Text() calls

Frontend AgentChat (4 rounds):
- Round 1: Stop generation button, server-side session history sync, smart scroll
- Round 2: Full markdown rendering (marked), file/image upload with drag-drop, message edit/delete
- Round 3: TTS speech (browser SpeechSynthesis), voice input (SpeechRecognition), empty state guidance, model/temperature selector
- Round 4: Extract shared chat core — useMarkdown, useFileUpload, ChatMessageBubble, ChatInputArea modules — merge AgentChat.vue and AgentChatPreview.vue divergent code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-04 14:45:55 +08:00
876789fac1 feat: multi-tenant workspace isolation, RBAC, sidebar nav, billing, and Android enhancements
- Backend: workspace_id isolation for 14 model tables + safe migration/backfill
- Backend: RBAC system with 4 roles and 23 permissions, seeded on startup
- Backend: workspace admin endpoints (list/manage all workspaces)
- Backend: admin user management API (CRUD, reset password)
- Backend: billing API with subscription plans, usage tracking, rate limiting
- Backend: fix system_logs.py UNION query and wrong column references
- Backend: WebSocket JWT auth and workspace enforcement
- Frontend: sidebar navigation replacing top dropdown menu
- Frontend: user management page (Users.vue) for admins
- Frontend: enhanced Workspaces.vue with admin table view
- Frontend: workspace RBAC computed properties in user store
- Android: agent marketplace, billing/subscription UI, onboarding wizard
- Android: phone login, analytics tracker, crash handler, network diagnostics
- Android: splash screen, encrypted token storage, app update enhancements
- Docs: multi-tenant RBAC guide with 8 sections and role-permission matrix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-04 01:00:22 +08:00
7e192d25c8 feat: add customer service agent entry in Settings
- "天工客服" agent (ID: 3490efa8) created on backend, status: published
- Settings > Account section now has "联系客服" button
- Tap navigates to chat with the CS agent directly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 23:14:13 +08:00
92ae0b5e46 feat: add manual 'Check Update' button in Settings > About section
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 22:30:25 +08:00
029abaa60c feat: add Account Security screen (change password, bind phone, delete account)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 22:28:31 +08:00
50de6f3dee fix: replace deprecated MediaType.parse() with toMediaType() extension
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 22:25:33 +08:00
21a06e8664 feat: complete P0-2 Token Refresh, P0-4 Android ProGuard, P0-5 App Update
- P0-2: Refresh token with Redis storage (UUID tokens, 30-day TTL, rotation on refresh)
- P0-2: Backend POST /auth/refresh and /auth/revoke endpoints
- P0-2: Android AuthInterceptor refresh-before-re-login flow
- P0-2: AuthRepository saves refresh_token on login, revokes on logout
- P0-4: Enable R8 minification (isMinifyEnabled=true) with comprehensive keep rules
- P0-5: Backend GET /api/v1/app/check-update with force_update support
- P0-5: Android AppUpdateManager with force/optional update dialogs on startup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 22:20:47 +08:00
3dcf769660 feat: Android login/register add mandatory agreement checkbox
- LoginScreen: add agreement checkbox, disabled until checked
- RegisterScreen: add agreement checkbox, disabled until checked
- RegisterViewModel: pass agreed_terms/agreed_terms_version to API
- RegisterRequest DTO: add agreedTerms/agreedTermsVersion fields
- Also include 3 template scripts missed in previous commit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 22:06:16 +08:00
96394c4b9f fix: duplicate messages on scroll-to-top in chat
Some checks failed
CI/CD Pipeline / Backend — Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend — Lint & Build (push) Has been cancelled
CI/CD Pipeline / Docker — Build Check (push) Has been cancelled
Three root causes fixed:
- Room Flow observer overwrote deduplicated list during loadMoreHistory()
  → Added isLoadingHistory flag to suppress Flow updates while loading
- beforeId used local IDs (user_/asst_ prefix) that server couldn't resolve,
  causing server to return ALL messages → Find oldest server-UUID message as cursor
- Scroll-to-top LaunchedEffect could double-fire → Added 800ms throttle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 20:56:32 +08:00
f1326bff95 fix: memory scope_id column overflow and API read mismatch
Some checks failed
CI/CD Pipeline / Backend — Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend — Lint & Build (push) Has been cancelled
CI/CD Pipeline / Docker — Build Check (push) Has been cancelled
AgentRuntime writes scope_id as {user_id}:{agent_id} (73 chars) but:
- DB columns were CHAR(36)/VARCHAR(36), causing Data too long errors
- Memory API queried with agent_id only, returning empty results

- Add _mem_scope() helper to build correct scope_id format
- Update all CRUD queries in agent_memory.py to use _mem_scope()
- Enhance login failure logging in auth.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 08:05:23 +08:00
e33aa6e0b7 fix: message ordering and duplicate messages
Some checks failed
CI/CD Pipeline / Backend — Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend — Lint & Build (push) Has been cancelled
CI/CD Pipeline / Docker — Build Check (push) Has been cancelled
Backend:
- Composite ORDER BY (created_at DESC, iteration ASC, id ASC) to fix
  non-deterministic ordering when multiple messages share same second
- Composite key cursor pagination to avoid missing messages at boundary

Android:
- Fix message duplication: guard loadMoreHistory from firing before
  initial scroll completes (isAtTop race → fetchOlderMessages →
  cacheMessagesFromApi with different IDs → Room duplicates)
- Add distinctBy(id) at all message assignment points in ViewModel
- cacheMessagesFromApi: skip insert if same ID or same content exists
- Add relative timestamp display on message bubbles

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-30 22:09:03 +08:00
cffe4a52d6 feat: agent memory management — CRUD API + Android management screen
Some checks failed
CI/CD Pipeline / Backend — Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend — Lint & Build (push) Has been cancelled
CI/CD Pipeline / Docker — Build Check (push) Has been cancelled
Backend:
- New /api/v1/agents/{id}/memory endpoints: CRUD for global_knowledge,
  knowledge_entities, learning_patterns, vector_memories + import/export
- Fix scope_id column overflow: 3 model columns expanded to hold compound
  keys (user_id:agent_id format, 73 chars vs old VARCHAR(36))
- Config: allow unknown env vars (extra="ignore") for optional overrides

Android:
- MemoryManageScreen: 4-tab UI (全局知识/知识实体/学习模式/对话记忆)
  with search, delete, and FAB to add new entries
- Import/export via ShareSheet and file picker
- AgentListScreen: long-press dropdown menu → 记忆管理 entry point
- NavGraph: memory_manage/{agentId}/{agentName} route with URL encoding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-30 02:23:45 +08:00
43d5347458 feat: add 200 character limit with counter to chat input field
Some checks failed
CI/CD Pipeline / Backend — Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend — Lint & Build (push) Has been cancelled
CI/CD Pipeline / Docker — Build Check (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-30 00:35:08 +08:00
971f0c33a9 fix: increase chat input maxLines from 4 to 8 for better long-text editing
Some checks failed
CI/CD Pipeline / Backend — Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend — Lint & Build (push) Has been cancelled
CI/CD Pipeline / Docker — Build Check (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-30 00:33:46 +08:00
a06082480a feat: persistent chat message storage + Android pull-to-load history
Some checks failed
CI/CD Pipeline / Backend — Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend — Lint & Build (push) Has been cancelled
CI/CD Pipeline / Docker — Build Check (push) Has been cancelled
Backend:
- Add ChatMessage model + Alembic migration 024
- Add on_message callback to AgentRuntime for persisting messages during SSE streaming
- Plumb session_id from ChatRequest to AgentContext in all 4 chat endpoints
- Add GET /agent-chat/{id}/sessions and /sessions/{sid}/messages with cursor pagination

Android:
- Add DTOs/ApiService/MessageDao for server-side chat history
- ChatRepository: fetchOlderMessages (API + Room cache), offline fallback
- ChatViewModel: loadMoreHistory with isLoadingMore/hasMoreMessages state
- ChatScreen: scroll-to-top detection + top loading indicator

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-30 00:07:26 +08:00
beff3fac8d fix: delete agent 500 error + dynamic personality + deployment guide
- Fix delete agent 500: clean up FK records (agent_llm_logs, permissions,
  schedules, executions, team_members) and unbind goals/tasks before delete
- Remove hardcoded personality templates in Android, replace with dynamic
  system prompt generation from name + description
- Set promptSectionsEnabled=false to bypass PromptComposer for personality
- Add Tencent Cloud Linux deployment guide (Docker Compose)
- Accumulated backend service updates, frontend UI fixes, Android app changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-29 01:17:21 +08:00