Commit Graph

80 Commits

Author SHA1 Message Date
matevip
3d213eb281 chore: sync multiple commits from private dev
Covers 15 upstream commits (private mirror → public):

Multi-provider failover (RFC-009):
- PR-0: extract ChatModelBuilder strategy seam
- PR-1a: AvailableProviderPool data structure
- PR-1b: startup provider liveness probe + 4 protocol strategies
- PR-1c: wire AvailableProviderPool into runtime chat-model selection
- PR-1d: provider pool REST endpoint + UI badges
- PR-1e: manual reprobe trigger + auto-reprobe on provider config change
- PR-3: per-agent provider preferences (agents can override the
  org-wide fallback chain)

Wiki subsystem (RFC-029~033):
- Relation model, resilient background jobs, light-weight processing
  path, retrieval enhancement, frontend redesign (single landing commit)
- Follow-up fixes: null guards + stats query + i18n polish, move
  WikiProcessingJobMapper to repository/ for @MapperScan, align
  implementation with RFC-029~031 spec
- Copy pass: replace "富化 / enrich" wording with clearer "链接 / link"
- Style: switch enrich/repair buttons to @element-plus/icons-vue
2026-04-19 18:37:44 +08:00
matevip
3b11a3def6 fix(failover): AUTH_ERROR triggers fallback chain + UI splits provider 401 from session expiry
Two related issues from the Kimi-401 user report:

1. Backend (NodeStreamingChatHelper): a primary AUTH_ERROR (e.g. Kimi 401
   with an invalid API key) returned immediately without trying the
   fallback chain — a fallback provider with a different, valid key
   never got a chance. Even with DashScope correctly configured as the
   fallback, the user chat dead-ended on a 401.

   The original assumption ("auth never self-heals so do not retry")
   holds for the primary same-model retry loop but is wrong for the
   fallback chain — different providers have different keys. Apply the
   same break-into-fallback policy that BILLING and MODEL_NOT_FOUND
   already use. recordPrimary(false) is preserved so the cooldown
   counter still accumulates.

2. Frontend (chatError.ts + i18n): the error-text matching for
   /认证|auth|unauthorized|401/i was so broad it matched the substring
   "auth" inside URLs like https://api.kimi.com/.../auth, classifying
   any model 401 as user "session expired" and rendering the misleading
   "页面将自动跳转到登录页" copy. (The redirect itself only fires from
   /api/v1/auth/* axios paths and SSE-connection 401s, not from this
   payload-text path — but the copy alone is the worst kind of false
   alarm.)

   Add a new ChatErrorCategory provider_auth_error and split the
   pattern matching: narrow auth_expired (HTTP 401 / 登录已过期 /
   session expired / 凭证失效) is matched FIRST, then the broad
   401-ish pattern routes to provider_auth_error. BACKEND_ERROR_TYPE_MAP
   for AUTH_ERROR is also remapped, since structured backend payloads
   currently always come from LLM providers — never from our own
   /api/v1/auth path.

Tests
- NodeStreamingChatHelperFailoverTest (5 cases): primary 401 →
  fallback succeeds; chain skips auth-failing fallback to next healthy
  one; whole-chain failure surfaces last AUTH_ERROR (no silent drop);
  BILLING regression unchanged; primary-success path does not touch
  chain
- Browser preview verified: new i18n keys resolve in en-US, classifier
  correctly routes "[错误] 401 from kimi.com" → provider_auth_error
  while "[错误] HTTP 401 from /api/v1/auth/ping" stays auth_expired
- 186 tests pass (was 181 + 5 new); vue-tsc clean

Do-not-touch list: handleAuthFailure() in useStream/api/index.ts (real
session-expiry path) is unmodified — only the misclassification
upstream is fixed. auth_expired i18n copy is unchanged.
2026-04-19 17:45:15 +08:00
matevip
7b12c5f0c9 feat(llm): provider health tracker + UI editor for failover priority
UI — Failover priority editor
- ProviderConfigRequest + ProviderInfoDTO carry fallbackPriority
- ModelProviderService.updateProviderConfig persists it (null = unchanged);
  toProviderInfo exposes the current value to the UI (defaults to 0)
- ProviderConfigModal advanced panel exposes a number input with hint
- ProviderCard shows a "Fallback #N" badge for chain members so the
  priority order is visible at a glance without opening the modal
- 5 new i18n keys (zh + en) — verified to resolve at runtime via i18n.global.t

Backend — Per-provider health tracker
- ProviderHealthTracker: ConcurrentHashMap-backed counters; N consecutive
  failures (default 3) push the provider into a cooldown window (default
  5 min) during which the chain walker skips it. Success resets both
  counter and cooldown atomically. Lazy expiry on lookup so dead entries
  do not accumulate.
- ProviderHealthProperties exposed under mateclaw.llm.failover.health.*
  with sane production defaults
- New FallbackEntry record (providerId + ChatModel) replaces raw
  List<ChatModel> in the chain so the walker can correlate cooldown
  state to entries; AgentGraphBuilder.buildFallbackChain returns the
  new type
- NodeStreamingChatHelper takes the tracker through a new 4-arg
  constructor and consults it before each fallback call; records
  success/failure on each chain attempt. Legacy 2/3-arg constructors
  preserved as @Deprecated wrappers (synthetic providerId means no
  health tracking on the legacy path — that path is opt-out anyway)

Tests
- ProviderHealthTrackerTest (9 tests): below/at threshold, success
  reset, cooldown expiry (via reflection on the min-clamp setter),
  disabled-tracker no-op, null-providerId safety, per-provider
  isolation, snapshot output
- NodeStreamingChatHelperFallbackChainTest updated to FallbackEntry
  field type — verifies providerId + ChatModel survive the chain
- 168 tests pass (was 159 + 9 new)

Verification
- mvn test green; vue-tsc clean; live UI confirms i18n resolution
2026-04-19 16:57:03 +08:00
matevip
980b16109d feat(ui): plain-text user messages with 8-line auto-collapse
Pasted prompts (test cases, structured asks, JSON dumps) currently render
through the same markdown pipeline as assistant output, so '#'/'-'/'**'
characters are processed and long prompts dominate the scrollback.

- New UserMessageContent.vue: plain-text rendering (white-space: pre-wrap
  preserves user-typed newlines and indentation), with auto-collapse beyond
  8 lines and a "Show more (N more lines) / Show less" toggle. Soft mask
  gradient at the collapse boundary instead of a hard cut.
- MessageBubble.vue: route role==='user' messages through the new component;
  assistant messages keep the existing markdown pipeline unchanged.
- Add chat.expandLines / chat.collapse i18n keys (zh + en).

Verified end-to-end in browser preview: 15-line content collapses to 8,
toggle expands to full 15 with "Show less" label, raw '#' / '**' / '`' chars
shown literally with no <strong>/<h1>/<li> tags emitted.
2026-04-19 09:06:14 +08:00
matevip
7221d36bab fix: mysql migration compatibility + ollama tool-support gating + actionable error UI
- db/migration/mysql: replace ADD COLUMN/CREATE INDEX IF NOT EXISTS with
  idempotent checks via information_schema (MySQL 8.0 <8.0.29 and some
  forks don't support IF NOT EXISTS for ADD COLUMN). Affects V2/V4/V5/V7
  /V8/V9/V11/V12/V13/V14. Fix: gitee#IIYHLJ.
- application-mysql.yml: add createDatabaseIfNotExist=true so MySQL
  Connector/J auto-creates the schema on first connection (requires
  CREATE privilege — documented fallback for restricted accounts).
- llm/OllamaAutoDiscoveryRunner: rewrite seed tag when fuzzy-matching,
  prefer exact tag for default; skip models without tool support when
  auto-activating a default (prevents the phantom ':latest' trap when
  users pulled a specific size).
- agent/graph/NodeStreamingChatHelper: detect 'does not support tools'
  and 'model not found' errors from Ollama and emit actionable Chinese
  prompts guiding users to qwen3 / qwen2.5:7b+ / llama3.1:8b+ etc.
- ui/MessageBubble + types/chatError: surface the backend's actionable
  rawMessage in the failed-message card instead of a generic '未知错误';
  strip redundant prefixes (Bad request: / [错误] / LLM 调用失败:) since
  the title already conveys the category.
2026-04-17 11:17:27 +08:00
matevip
a3e6724cf4 fix(chat): channel conversation sync + running indicator
- ChannelMessageRouter: include assistantMessageId in message_complete
  and done broadcasts so ChatConsole observers can reconcile the
  streaming placeholder to the persisted DB row by id instead of
  falling back to the FIFO 'claim' heuristic (which occasionally
  dropped the assistant bubble on external channel conversations).
  Capture the id from ConversationService.saveMessage in both the
  sync agentService.chat path and the streaming processWithStreaming
  path; switch to HashMap since Map.of rejects null values when save
  is skipped (e.g. under approval).

- ChatConsole: add a 'running' indicator on the sidebar so users can
  tell which conversations have an in-flight agent run. Pulsing amber
  dot on the channel icon (both expanded and collapsed modes) plus a
  '生成中…' / 'Generating…' pill in expanded mode.

- ChatConsole: don't cancel the previous conversation's streaming run
  when switching conversations — let it keep running in the background
  and reconcile when the user comes back.
2026-04-17 10:03:56 +08:00
matevip
b35c29767c feat(chat): realtime sync for external channel conversations 2026-04-17 08:25:32 +08:00
matevip
8fbe30d7ac feat(auth): password change dialog + workspace member provisioning improvements 2026-04-17 00:11:10 +08:00
matevip
ba086d75f2 fix(llm): purge unavailable DashScope models + protocol-aware discovery probe 2026-04-16 18:13:13 +08:00
matevip
25978ceb12 feat(llm): UI-configurable embedding models with per-KB binding and dynamic factory 2026-04-16 17:12:00 +08:00
matevip
a6e9a17208 feat(skill): Agent-autonomous skill synthesis — create/edit/patch via @Tool with security scanning 2026-04-16 17:10:59 +08:00
matevip
a3373ef906 fix(wiki): show reprocess button for partial materials 2026-04-15 11:18:40 +08:00
matevip
ef8120413c feat(wiki): real-time SSE progress + parallel page generation + partial-resume; fix concurrent slug collisions; fix skill overwrite + hub retry 2026-04-15 10:34:11 +08:00
matevip
2a2f862257 feat(wiki): per-raw progress bar in raw-material card (RFC-012 M2 v2 UI) 2026-04-14 18:56:45 +08:00
matevip
0adb3dddf1 feat(plugin): Plugin SDK + UI layout improvements 2026-04-13 18:38:03 +08:00
matevip
97e101ab52 feat(channel): auto-start on create, multi-account UX, wecom mixed message 2026-04-13 17:10:34 +08:00
matevip
d5e3502829 fix(wiki): backend hardening + batch delete UI 2026-04-13 15:37:12 +08:00
matevip
e4679796b8 feat(wiki): performance + quality + delete redesign (RFC-008) 2026-04-13 09:35:26 +08:00
matevip
80b7b8e126 feat(agent): multi-agent delegation with parallel execution (RFC-004) 2026-04-12 23:40:27 +08:00
matevip
46f77c281b fix(agent): complete RFC-001 — Anthropic thinking, iteration budget, UI fixes 2026-04-12 17:28:15 +08:00
matevip
2a8b90365b feat(agent): add deep thinking toggle (RFC-001) 2026-04-12 11:29:32 +08:00
matevip
379422101c refactor(ui): minimalist login redesign, MCP fixes, Flyway upgrade compatibility 2026-04-11 23:01:08 +08:00
matevip
b3c1f8403d feat(skill): add ZIP file import for skill installation 2026-04-11 19:29:01 +08:00
matevip
d3b72929c7 fix(security): login rate limiting, SQL injection fix, error boundary 2026-04-11 18:31:51 +08:00
matevip
8dbb437e40 fix(security): remove debug console.log and hide internal error details 2026-04-11 18:26:41 +08:00
matevip
c619ffee4e fix(ui): prevent modals from closing on backdrop click 2026-04-11 18:06:48 +08:00
matevip
408ad980dd feat(i18n): complete remaining i18n — DefaultToolGuard, LLM/Datasource services, Channels UI 2026-04-11 18:02:03 +08:00
matevip
af9addaaec feat(i18n): structured i18n keys for exceptions and auto-translate 100+ error messages 2026-04-11 17:52:25 +08:00
matevip
81ff1bf491 feat(i18n): complete backend i18n — guard rules, tool errors, response codes 2026-04-11 17:26:58 +08:00
matevip
e662cce91a fix(chat): improve thinking segment display and message bubble rendering 2026-04-11 17:09:25 +08:00
matevip
cc28f665f1 feat(db): introduce Flyway migration framework and unify H2/MySQL schemas
- Add Flyway baseline migration (V1) for both H2 and MySQL
- Remove 5 legacy SchemaMigration ApplicationRunner classes
- Add WorkspacePathGuard for file tool sandbox enforcement
- Inject workspace basePath context into agent graph state and tool executor
- Add workspace basePath config UI in frontend
- Fix workspace slug preservation on update
2026-04-11 16:34:09 +08:00
matevip
f98f4d68b9 refactor(ui): publish tested chat UI simplification 2026-04-11 14:25:37 +08:00
matevip
795fb5eb0a feat(ui): extract ModelSelector component with grouped layout and search 2026-04-11 10:29:37 +08:00
matevip
79c31ead32 fix(chat): prevent stale approval UI after SSE error/done 2026-04-11 10:04:41 +08:00
matevip
bfd1cbac56 feat(chat): ChatGPT tool calling + fix cross-turn message pollution 2026-04-11 08:46:21 +08:00
matevip
c41bda0f95 fix(chat): prevent cross-conversation message leakage and tool call duplication 2026-04-11 06:48:14 +08:00
matevip
7cc4788c97 fix(wiki): use markdown renderer for wiki page content 2026-04-11 01:27:37 +08:00
matevip
b002db65f1 fix(ui): replace sidebar footer icons with Element Plus, fix collapsed workspace dropdown 2026-04-11 01:21:50 +08:00
matevip
281b1efffd fix(chat): enrich stream metadata with plan/approval/browser tracking, fix thinking segment ordering 2026-04-11 00:20:47 +08:00
matevip
8725ecd0c7 fix(chat): merge persisted and local assistant timelines 2026-04-11 00:16:42 +08:00
matevip
f28ad8d9d4 fix(chat): preserve refresh history and thinking order 2026-04-11 00:16:33 +08:00
matevip
16d22f7e6f feat(ui): design system upgrade — responsive layout, collapsible panels, and unified tokens 2026-04-10 18:14:23 +08:00
matevip
367dd4bed0 fix(agent): preserve per-subtask results in multi-task answer synthesis, add listAvailableSkills tool 2026-04-10 17:10:02 +08:00
matevip
ba34f1eed3 fix(chat): preserve intermediate reasoning in segments via phase-based splitting 2026-04-10 07:58:19 +08:00
matevip
dafdcb4182 feat(chat): segmented message display, progressive loading, and real-time segment persistence 2026-04-10 07:36:24 +08:00
matevip
a219f92410 feat: productize webchat channel config 2026-04-09 21:28:47 +08:00
matevip
1c2acfd2e9 refactor(ux): simplify interactions and humanize UI with Jobs-inspired review 2026-04-09 20:56:50 +08:00
matevip
4cd373dcdd feat(ux): agent templates, chat status indicator, dashboard trend chart 2026-04-09 20:11:19 +08:00
matevip
62b7998975 refactor(ui): move Workspaces/Members/Activity from Security to Settings 2026-04-09 19:55:51 +08:00
matevip
c4edcbd95c feat(ui): unify workspace and platform console surfaces 2026-04-09 19:48:17 +08:00