Commit Graph

824 Commits

Author SHA1 Message Date
matevip
3c3c2a938f perf(feishu): prefetch bot open_id + DCL + 60s negative cache 2026-05-20 10:13:40 +08:00
matevip
73ab31a13c fix(feishu): fail open when bot open_id is unavailable 2026-05-20 10:13:34 +08:00
倪程伟
16b5d75d2c
fix(llm): exclude soft-deleted models from uniqueness check in validateModel (#173)
Closes #169

ModelConfigService.validateModel() flagged a duplicate when re-adding a
manually-typed (provider, modelName) pair that happened to match a row
with deleted=1 in mate_model_config. The user-visible symptom: adding
'dashscope/qwen3-plus' fails with 'model identifier already exists',
yet the management page shows no such model.

The project itself runs hard-delete via deleteById(), so the user-facing
delete path doesn't create deleted=1 rows. The stale rows come from
schema migrations (V44, V81) that intentionally tombstone bogus catalog
entries — for instance V81 sets deleted=1 on the non-existent
'qwen3-plus' (id=1000000172) so it stays out of routing but preserves
the id for audit. ModelConfigEntity has no @TableLogic, and the project
has no global logic-delete-field config, so LambdaQueryWrapper queries
do not auto-append the deleted filter; the migration tombstones leak
into the validate-model query.

Add an explicit .eq(getDeleted, 0) to the uniqueness check so migration
tombstones don't block legitimate re-adds.

Follow-up: several other queries in ModelConfigService share the same
oversight (list/get methods), and a future migration could drop the
tombstones entirely to align with the V20 hard-delete posture.
2026-05-20 09:33:33 +08:00
倪程伟
828ece526e
fix(llm): add text-embedding- prefix to DashScope native model allow-list (#172)
Closes #168

The native DashScope provider exposes both chat and embedding models, but
DASHSCOPE_NATIVE_ALLOW_PREFIXES only listed chat families
(qwen-/qwen2-/qwen3-/deepseek-/baichuan/yi-/llama). When a user manually
added text-embedding-v1/v2/v3/v4 to the dashscope provider,
assertModelIdAcceptable() rejected the id because no allow prefix matched.

Add 'text-embedding-' to the allow-list and broaden the doc comment from
"native chat protocol" to "native protocol (chat or embedding)" so the
intent is clear.

Discovery probing is chat-based and will still mark embedding entries
probeOk=false; surfacing them as discoverable embedding suggestions is a
separate follow-up.
2026-05-20 09:29:11 +08:00
倪程伟
e0f66eef25
fix(embedding): respect requireApiKey flag in OpenAI-compatible embedding factory (#171)
Closes #167

EmbeddingModelFactory.buildOpenAi() hard-failed on any provider whose API
key was empty or unusable, so keyless providers like Ollama and OpenCode
(declared with requireApiKey=false) could pass the chat connectivity test
but bounce when the same provider's embedding model was tested.

Mirror the chat path in OpenAiCompatibleChatModelBuilder.buildOpenAiApi:

- If requireApiKey is not explicitly false, an unusable key still throws.
- If requireApiKey == false, the key check is skipped and an empty string
  is passed to OpenAiApi.builder() so no Authorization: Bearer header is
  attached to the outgoing request.
2026-05-20 09:25:16 +08:00
倪程伟
8e00613e69
fix(embedding): use chatModel field for protocol routing instead of providerId matching (#170)
Closes #166

EmbeddingModelFactory used EmbeddingProtocol.fromProviderId() to pick the
embedding protocol, which substring-matches 'dashscope' / 'qwen' / 'aliyun'
in the providerId. The dashscope-compat provider carries 'dashscope' in its
id but runs in OpenAI compatible mode (chatModel='OpenAIChatModel',
baseUrl='https://dashscope.aliyuncs.com/compatible-mode/v1'). Routing it to
DASHSCOPE_EMBEDDING made DashScopeApi build its native path against the
compat base, producing 404s on every embedding call.

Switch to the chatModel column instead — the same signal ModelProtocol
.fromChatModel() uses for the chat path. chatModel='DashScopeChatModel'
takes the native protocol; everything else (including dashscope-compat)
takes OpenAI-compatible.

EmbeddingProtocol.fromProviderId() is retained for reference but is no
longer called; future callers should follow the chatModel pattern.
2026-05-20 09:22:06 +08:00
倪程伟
af3e68d271 fix(feishu): use SDK mentions field for require_mention group filtering (#163)
Closes #162

require_mention=true previously degraded to a no-op when botPrefix was unset:
shouldProcess() returned true for all messages and checkAccess() fell through
unconditionally, so any group message would be answered — including ones where
the @mention targeted another user.

FeishuChannelAdapter now consults the Feishu SDK's mentions field directly:

- WebSocket: read EventMessage.getMentions(); webhook: read mentions[] from the
  JSON payload. In both paths each mention's id.open_id is compared against the
  bot's own open_id.
- Bot open_id is fetched lazily via /open-apis/bot/v3/info and cached on the
  adapter instance. If the call fails the message is allowed through, matching
  the previous behaviour.
- The require_mention gate is applied at the top of handleFeishuMessage so 1:1
  chats are unaffected.

Tests: 15 unit cases covering null/empty inputs, bot mentioned, only-other
mentioned, bot among multiple mentions, and malformed payloads.
2026-05-20 08:49:11 +08:00
倪程伟
ee0c229f52
feat(feishu): support Interactive Card JSON for structured message rendering (#161)
Auto-route Agent replies to Feishu Interactive Card (schema 2.0) when the
content carries structure — JSON object / array, Markdown with code blocks
or headings, or long-form prose — and keep the original text path for
short plain replies.

- FeishuCardFormatter: package-private detect() + render() helper
  - JSON object → two-column summary card
  - JSON array (≤4 fields) → table component; (>4 fields) → div per item
  - Markdown → lark_md card with 'AI 助手' header
  - Long text (>300 chars with paragraph breaks) → plain_text card
  - JSON embedded in Markdown code blocks is recognised across all fences
- FeishuChannelAdapter
  - sendMessage() honours channel config 'card_format' (auto | always | never)
  - sendCard() POSTs interactive messages; ou_-prefixed targets use open_id
  - updateCard() PATCHes an existing message (streaming-update hook)
- Tests: 32 unit cases covering every detect path and render branch

Closes #141
2026-05-20 08:42:02 +08:00
matevip
db16ff02a5 chore: drop external project name references from code comments 2026-05-20 08:09:43 +08:00
matevip
a828de1306 feat(skill): add skill-authoring builtin + retarget node-inspect-debugger to Electron/Vite 2026-05-20 08:09:34 +08:00
matevip
daeef4e3c2 feat(scheduler): unify cron jobs and triggers into a tabbed Scheduler page 2026-05-19 21:23:18 +08:00
matevip
c0f9d1d9fb test(wiki): add adversarial HTML normalization tests and harden skeleton-tag handling 2026-05-19 21:23:13 +08:00
matevip
9ffe7aa399 fix(wiki): strip script/style/nav/footer text from HTML-typed material 2026-05-19 21:23:07 +08:00
matevip
32d633ae4b fix(workspace): verify a path-bound agent belongs to the request workspace 2026-05-19 20:07:02 +08:00
matevip
92d35a3d3d fix(workspace): keep workspace ids as strings so a switch survives reload 2026-05-19 20:06:56 +08:00
matevip
651d53050e fix(workspace): return 403 instead of 500 for cross-workspace access 2026-05-19 20:06:50 +08:00
matevip
0a57cb3358 fix(workspace): harden workspace create and delete 2026-05-19 20:06:44 +08:00
matevip
b2f9976f44 fix(i18n): stop logging missing-key noise for optional tool descriptions 2026-05-19 20:06:38 +08:00
matevip
d629c945ee fix(wiki): return the new page id from the create-page tool 2026-05-19 20:06:33 +08:00
matevip
57ca69d674 fix(wiki): return HTTP 404 for missing knowledge bases and pages 2026-05-19 20:06:27 +08:00
matevip
c1b878b7e1 fix(agent): fail over to backup providers when the primary is rate-limited 2026-05-19 20:06:21 +08:00
matevip
95ce1bae24 docs(agent): describe binding-service helpers functionally 2026-05-19 16:53:24 +08:00
matevip
d1b7e76f5b fix(tool): support top-level await in the browser eval action 2026-05-19 16:53:18 +08:00
matevip
c6d51f8ced fix(wiki): resolve an agent's own knowledge base before shared ones 2026-05-19 16:53:12 +08:00
matevip
b0d9bde664 fix(agent): clamp DashScope max_tokens to the provider's 8192 ceiling 2026-05-19 16:53:06 +08:00
matevip
3d643f909d feat(skill): typed wrapper tools for declared script entrypoints 2026-05-19 09:56:39 +08:00
matevip
31d4d014ed fix(skill): normalize runSkillScript JSON args 2026-05-19 09:56:33 +08:00
matevip
520429ac6f test(skill): end-to-end coverage for the lifecycle curator 2026-05-19 09:56:27 +08:00
matevip
0383740fec fix(ui): rename the wiki nav item to "Wiki" / "知识库" 2026-05-19 09:56:21 +08:00
matevip
99718d276e feat(ui): frosted-glass tooltip and collapsed-rail alignment 2026-05-19 09:56:15 +08:00
matevip
2c1e673fba feat(skill): SkillMarket lifecycle UI + curator control panel 2026-05-19 09:56:08 +08:00
matevip
4cd21056a0 feat(skill): automatic lifecycle archival for idle skills 2026-05-19 09:55:59 +08:00
matevip
cfb123dda2 fix(wiki): keep the raw-material filter across page-list refreshes (#156) 2026-05-18 23:28:56 +08:00
matevip
fb4206e356 fix(wiki): count only the latest job per raw in KB failure stats 2026-05-18 22:00:36 +08:00
matevip
7949b6ff38 fix(chat): keep the runtime model indicator synced with the selector 2026-05-18 22:00:30 +08:00
matevip
33a40ad9d9 feat(wiki): support HTML, Excel, PowerPoint and CSV raw materials 2026-05-18 21:57:43 +08:00
倪程伟
b763022810
fix(feishu): add handler for im.chat.member.bot.added_v1 event
Register a no-op handler for the bot-added-to-chat event on the Feishu WebSocket EventDispatcher. Without it, adding the bot to a group chat raises HandlerNotFoundException and drops the long connection. Mirrors the existing reaction-event handlers. Fixes #153.
2026-05-18 17:46:28 +08:00
matevip
cda001b818 fix(workflow): generate runnable drafts — snake_case names, correct output refs 2026-05-18 17:35:00 +08:00
matevip
4cf991851b fix(workflow): keep the editor canvas and status correct after publish 2026-05-18 17:34:53 +08:00
matevip
8cfc78e7b4 fix(ui): keep model group-header chip and Fix button on one line 2026-05-18 16:27:34 +08:00
matevip
d53d66abe3 feat(chat): per-conversation model selection (#150) 2026-05-18 16:27:27 +08:00
matevip
0ff8da0caa fix(llm): stop MODEL_NOT_FOUND from evicting the whole provider (#150) 2026-05-18 16:27:20 +08:00
matevip
8a0c0a76a8 refactor(memory-ui): extract shared icon, empty-state, skeleton and section components (#148) 2026-05-18 16:26:19 +08:00
matevip
7a650dc667 refactor(memory-ui): replace emoji icons with inline SVG line-art 2026-05-18 13:51:20 +08:00
matevip
3157dde1f4 fix(memory): route long-term memory edits to the file being edited (#148) 2026-05-18 11:28:01 +08:00
matevip
c92b579924 chore(build): bump flatten-maven-plugin to 1.7.3 2026-05-18 10:45:36 +08:00
matevip
247c607b3c fix(build): flatten ${revision} into installed POMs 2026-05-18 10:45:30 +08:00
matevip
b06bd66435 fix(build): repackage server as executable jar 2026-05-18 10:21:42 +08:00
matevip
f0dfae931f fix(build): emit -parameters so Spring MVC can bind path/request params 2026-05-18 10:17:25 +08:00
matevip
55af602f67 chore(build): centralize Maven revision management 2026-05-18 10:01:11 +08:00