Compare commits

...

94 Commits

Author SHA1 Message Date
rdmclin2 30a9d8b030 chore: remove runtime config in agent builder and doc writer 2026-03-25 12:49:36 +08:00
LobeHub Bot 366b02bb46 test: add unit tests for topicReference serverRuntime (#13055)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 12:31:45 +08:00
Hardy ad2087cf65 feat: add Coding Plan providers support (#13203)
*  feat: add Aliyun Bailian Coding Plan provider

- Add new AI provider for Bailian Coding Plan (coding.dashscope.aliyuncs.com/v1)
- Support 8 coding-optimized models: Qwen3.5 Plus, Qwen3 Coder Plus/Next, Qwen3 Max, GLM-5/4.7, Kimi K2.5, MiniMax M2.5
- Reuse QwenAIStream for stream processing
- Static model list (Coding Plan does not support API model fetching)
- Add i18n translations for provider description

*  feat: add MiniMax Coding Plan provider

- Add new AI provider for MiniMax Token Plan (api.minimax.io/v1)
- Support 6 models: MiniMax-M2.7, M2.7-highspeed, M2.5, M2.5-highspeed, M2.1, M2
- Static model list (Coding Plan does not support API model fetching)
- Add i18n translations for provider description

*  feat: add GLM Coding Plan provider

- Add new AI provider for GLM Coding Plan (api.z.ai/api/paas/v4)
- Support 6 models: GLM-5, GLM-5-Turbo, GLM-4.7, GLM-4.6, GLM-4.5, GLM-4.5-Air
- Static model list (Coding Plan does not support API model fetching)
- Add i18n translations for provider description

*  feat: add Kimi Code Plan provider

- Add new AI provider for Kimi Code Plan (api.moonshot.ai/v1)
- Support 3 models: Kimi K2.5, Kimi K2, Kimi K2 Thinking
- Static model list (Coding Plan does not support API model fetching)
- Add i18n translations for provider description

*  feat: add Volcengine Coding Plan provider

- Add new AI provider for Volcengine Coding Plan (ark.cn-beijing.volces.com/api/coding/v3)
- Support 5 models: Doubao-Seed-Code, Doubao-Seed-Code-2.0, GLM-4.7, DeepSeek-V3.2, Kimi-K2.5
- Static model list (Coding Plan does not support API model fetching)
- Add i18n translations for provider description

*  feat: update coding plan providers default enabled models and configurations

*  feat: add reasoningBudgetToken32k and reasoningBudgetToken80k slider variants

- Add ReasoningTokenSlider32k component (max 32*1024)
- Add ReasoningTokenSlider80k component (max 80*1024)
- Add reasoningBudgetToken32k and reasoningBudgetToken80k to ExtendParamsType
- Update ControlsForm to render appropriate slider based on extendParams
- Update ExtendParamsSelect with new options and previews
- Fix ReasoningTokenSlider max value to use 64*Kibi (65536) instead of 64000

* 🔧 fix: support reasoningBudgetToken32k/80k in ControlsForm and modelParamsResolver

- Add reasoningBudgetToken32k and reasoningBudgetToken80k fields to chatConfig type and schema
- Update ControlsForm to use correct name matching for 32k/80k sliders
- Add processing logic for 32k/80k params in modelParamsResolver
- Add i18n translations for extendParams hints

* 🎨 style: use linear marks for reasoning token sliders (32k/80k)

- Switch from log2 scale to linear scale for equal mark spacing
- Add minWidth/maxWidth constraints to limit slider length
- Fix 64k and 80k marks being too close together

* 🎨 fix: use equal-spaced index for reasoning token sliders (32k/80k)

- Slider uses index [0,1,2,3,...] for equal mark spacing
- Map index to token values via MARK_TOKENS array
- Add minWidth/maxWidth to limit slider length when marks increase

*  feat: add reasoningBudgetToken32k for GLM-5 and GLM-4.7 in Bailian Coding Plan

* 🔧 fix: update coding plan API endpoints and model configurations

- minimaxCodingPlan: change API URL to api.minimaxi.com (China site)
- kimiCodingPlan: change API URL to api.kimi.com/coding/v1
- volcengineCodingPlan: update doubao-seed models with correct deploymentName, pricing
- volcengineCodingPlan: add minimax-m2.5 model
- bailianCodingPlan & volcengineCodingPlan: remove unsupported extendParams from minimax-m2.5

*  feat: add Coding Plan tag to provider cards with i18n support

* ♻️ refactor: set showModelFetcher to false for Bailian Coding Plan

- Coding Plan does not support fetching model list via API
- Set both modelList.showModelFetcher and settings.showModelFetcher to false

* 🔧 fix: correct Coding Plan exports case in package.json

*  feat: update coding plan models with releasedAt and remove pricing

* 🔧 fix: remove unsupported reasoning abilities from MiniMax Coding Plan models

* 🐛 fix(modelParamsResolver): fix reasoningBudgetToken32k/80k not being read when enableReasoning is present

- Add nested logic to check which budget field (32k/80k/generic) the model supports when enableReasoning is true
- Move reasoningBudgetToken32k/80k else-if branches before reasoningBudgetToken to ensure correct field is read
- Fix GLM-5/GLM-4.7 models sending wrong budget_tokens value to API
2026-03-25 11:53:16 +08:00
LobeHub Bot 0689dd68a3 🌐 chore: translate non-English comments to English in routes and layout (#13210)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 11:52:28 +08:00
LobeHub Bot 75ea33153f 🌐 chore: translate non-English comments to English in packages/agent-runtime (#13236)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 11:51:28 +08:00
YuTengjing dbff1e0668 🐛 fix: default topic display mode to byUpdatedTime and fix nanoBanana2 resolution enum (#13235) 2026-03-25 11:17:41 +08:00
LobeHub Bot afefe217db test: add unit tests for eval-dataset-parser (#13197)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 10:55:58 +08:00
Arvin Xu fed8b39957 feat: desktop support connect to gateway (#13234)
* support desktop gateway

* support device mode

* support desktop

* fix tests

* improve

* fix tests

* fix tests

* fix case
2026-03-25 10:43:15 +08:00
Rdmclin2 f853537695 Add /new and /stop slash commands for bot message management (#13194)
*  feat(bot): implement /new and /stop slash commands

Add Chat SDK slash command handlers for bot integrations:
- /new: resets conversation state so the next message starts a fresh topic
- /stop: cancels any active agent execution on the current thread

https://claude.ai/code/session_01MDofskrz64tRjh2T6xzGBL

* feat: support telegram text type  commands

* fix: stop commands

* feat: register discord slash commands

* feat: add chat adapter patch

* feat: add interuption action

* chore: add agent thread interuption signal

* chore: optimize interruption result

* fix: /stop command message edit

* chore: create a message when interrupted

* chore: add bot test case

* chore: fix test case

* chore: fix test case and remove duplicate completion

* fix: lint error

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-25 00:31:01 +08:00
Baki Burak Öğün 0cdaf117cb 🌐 fix(locale): translate missing Turkish (tr-TR) strings (#13196)
fix(locale): translate missing Turkish (tr-TR) strings in setting.json

- Translate agentCronJobs.clearTopics, clearTopicsFailed, confirmClearTopics
- Translate agentCronJobs.confirmDeleteCronJob, deleteCronJob, deleteFailed

Co-authored-by: bakiburakogun <bakiburakogun@users.noreply.github.com>
2026-03-25 00:11:55 +08:00
Innei ada555789d 🐛 fix(editor): reset editor state when switching to empty page (#13229)
Fixes LOBE-6321
2026-03-24 21:37:08 +08:00
Arvin Xu 007d2dc554 🐛 fix: compress uploaded images to max 1920px before sending to API (#13224)
* 🐛 fix: compress uploaded images to max 1920px before sending to API

Anthropic API rejects images exceeding 2000px in multi-image requests.
Compress images during upload to stay within limits while preserving
original aspect ratio and format (no webp conversion).

Fixes LOBE-6315

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: skip canvas compression for GIF and SVG images

Canvas serialization flattens animated GIFs and rasterizes SVGs.
Restrict compression to safe raster formats: JPEG, PNG, WebP.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: always compress images to PNG to avoid MIME mismatch

canvas.toDataURL with original file type can produce content that
doesn't match the declared MIME type, causing Anthropic API errors.
Always output PNG which is universally supported and consistent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: progressively shrink images to stay under 5MB API limit

If compressed PNG still exceeds 5MB, progressively reduce dimensions
by 20% until it fits. Also triggers compression for small-dimension
images that exceed 5MB file size.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: extract compressImageFile to utils and add comprehensive tests

Move compressImageFile, COMPRESSIBLE_IMAGE_TYPES, and constants to
@lobechat/utils/compressImage for reusability and testability.
Add tests for: dimension compression, file size limit, format filtering,
error handling, and progressive shrinking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:23:58 +08:00
Innei 995d5ea354 🐛 fix(conversation): preserve mention runtime context (#13223)
* 🐛 fix(conversation): preserve mention context on retry

* 🐛 fix(runtime): preserve initial payload for mention context

*  feat(store): expose Zustand stores on window.__LOBE_STORES in dev

Made-with: Cursor
2026-03-24 19:50:26 +08:00
Arvin Xu 72ba8c8923 🐛 fix: add document parsing to knowledge base chunking pipeline (#13221)
* 🐛 fix: add document parsing to knowledge base chunking pipeline

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix plugin title

* update

* 🐛 fix: add missing findByFileId mock in document service tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 19:49:26 +08:00
YuTengjing 6f65b1e65e feat: improve model switch panel with provider settings shortcut and default highlight (#13220) 2026-03-24 16:30:38 +08:00
YuTengjing 383caceb77 ♻️ refactor: rename getBusinessMenuItems to useBusinessMenuItems hook (#13219) 2026-03-24 15:58:29 +08:00
Rdmclin2 b4862f2942 🐛 fix: manual tool disabled (#13218)
fix: manual tool disabled
2026-03-24 15:24:18 +08:00
YuTengjing d1affa8e44 🌐 feat(i18n): add userPanel.upgradePlan i18n key (#13213) 2026-03-24 15:20:34 +08:00
Innei 6e3053fcb3 feat(cli): add generated man pages (#13200) 2026-03-24 14:46:56 +08:00
Innei b845ba4476 🔨 chore(vite): support direct markdown imports (#13216)
 feat(vite): support markdown imports
2026-03-24 14:33:57 +08:00
LiJian 7c00650be5 ♻️ refactor: add the user creds modules & skill should auto inject the need creds (#13124)
* feat: add the user creds modules & skill should auto inject the need creds

* feat: add the builtin creds tools

* fix: add some prompt in creds & codesandbox

* fix: open this settings/creds in community plan

* fix: refacoter the settings/creds the ui

* feat: improve the tools inject system Role

* feat: change the settings/creds mananger ui

* fix: add the creds upload Files api

* feat: should call back the files creds url
2026-03-24 14:28:23 +08:00
Innei 5bc015a746 🐛 fix: move nodrag from TabBar container to individual TabItems (#13211) 2026-03-24 11:33:00 +08:00
Arvin Xu 6757e10ec2 🐛 fix: map unsupported time_range values for Search1API (#13208)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 09:22:04 +08:00
Arvin Xu 48428594c3 🐛 fix: correct Search1API response parsing to match actual API format (#13207)
* 🐛 fix: correct Search1API response parsing to match actual API format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix tests

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 02:18:28 +08:00
Innei 6a45414b46 🐛 fix(electron): reserve titlebar control space (#13204)
* 🐛 fix(electron): reserve titlebar control space

* 🐛 fix(electron): update titlebar padding for Windows control space
2026-03-23 23:29:55 +08:00
Arvin Xu 0f53490633 🐛 fix: fix anthropic claude model max window tokens (#13206)
* fix anthropic max tokens

* fix anthropic max tokens

* clean

* fix tests
2026-03-23 23:01:31 +08:00
Rdmclin2 66fba60194 fix: add discord redisClient lost problem (#13205) 2026-03-23 21:13:03 +08:00
YuTengjing fadaeef8d3 feat: add GLM-5 model support to LobeHub provider (#13189) 2026-03-23 17:46:32 +08:00
CanisMinor 3c5249eae7 📝 docs: fix agent usage typo (#13198)
docs: fix agent usage
2026-03-23 14:14:58 +08:00
Innei 9eca3d2ec0 ♻️ refactor(store): replace dynamic imports with static imports in actions (#13159)
Made-with: Cursor
2026-03-23 14:11:04 +08:00
Innei 4e89a00d2a feat(cli): add shell completion and migrate to tsdown (#13164)
* 👷 build(cli): migrate bundler from tsup to tsdown

Made-with: Cursor

* 🔧 chore(cli): update package.json and tsdown.config.ts dependencies

- Moved several dependencies from "dependencies" to "devDependencies" in package.json.
- Updated the bundling configuration in tsdown.config.ts to simplify the bundling process.

Signed-off-by: Innei <tukon479@gmail.com>

* 🔧 chore(cli): reorganize package.json and tsdown.config.ts

- Moved "fast-glob" from "dependencies" to "devDependencies" in package.json for better clarity.
- Removed the "onlyBundle" option from tsdown.config.ts to streamline the configuration.

Signed-off-by: Innei <tukon479@gmail.com>

*  feat(cli): add shell completion support

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-03-23 14:10:39 +08:00
LobeHub Bot 89a0211adf 🌐 chore: translate non-English comments to English in plugindevmodal and image-config (#13169)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 13:29:46 +08:00
Rdmclin2 ecde45b4ce feat: support wechat bot (#13191)
* feat: support weixin channel

* chore: rename to wechat

* chore: refact wechat adapter with ilink spec

* feat: add qrcode generate and refresh

* chore: update wechat docs

* fix: qrcode

* chore: remove developer mode restrict

* fix: wechat link error

* chore: add thread typing

* chore: support skip progressMessageId

* fix: discord eye reaction

* chore: resolve CodeQL regex rule

* test: add chat adapter wechat test case

* chore: wechat refresh like discord

* fix: perist token and add typing action

* chore: bot cli support weixin

* fix: database test case
2026-03-23 12:52:11 +08:00
LiJian 1df02300bc 🐛 fix: add the lost desktop community skill page (#13170)
fix: add the lost desktop community skill page
2026-03-23 10:48:47 +08:00
Rdmclin2 637ef4a84e 🔨 chore: remove default calculator (#13162)
* chore: remove calculator from RECOMMENDED_SKILLS

* chore: add default uninstalled builtin list

* fix: ensure uninstall tool loaded

* fix: lint error
2026-03-22 23:15:59 +08:00
Zhijie He 7af4562a60 💄 style: add Tencent Hunyuan 3.0 ImageGen support (#13166) 2026-03-22 12:54:27 +08:00
Sun13138 f9166133a7 🐛 fix(mobile): render topic menus and rename popovers inside active overlay container (#12477) 2026-03-22 01:15:28 +08:00
René Wang 81bd6dc732 📝 docs: add changelog entries for Jan–Mar 2026 (#13163)
* 📝 docs: add changelog entries for Jan–Mar 2026

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: Changelog content

* feat: Changelog content

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:53:48 +08:00
Arvin Xu b97c33a29a 🔧 chore: grant write permissions to Claude Code Action workflow (#13173)
Allow Claude Code to push branches and create PRs by upgrading
contents/pull-requests/issues permissions from read to write,
and adding git/gh to allowed tools.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 14:39:28 +08:00
Rylan Cai b0253d05dd 🔧 chore: adjust jina timeout to 15s (#13171)
🔧 adjust jina timeout setting
2026-03-21 14:39:15 +08:00
Neko 48c3f0c23b feat(memory): support to delete all memory entries (#13161) 2026-03-20 23:32:28 +08:00
LobeHub Bot f812d05ca6 🌐 chore: translate non-English comments to English in openapi services (#13092)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 23:31:02 +08:00
Neko 88935d84bf 🔧 chore(memory): analysis action icon not aligned (#13160) 2026-03-20 21:39:50 +08:00
Rdmclin2 c39ba410f2 📝 docs: spilit feishu with lark and update overview (#13165)
chore: spilit feishu with lark and update overview
2026-03-20 21:31:33 +08:00
sxjeru 12280badbd 🐛 fix: adjust historyCount calculation to include accurate user messages (#13051) 2026-03-20 21:26:25 +08:00
Rdmclin2 e18855aa25 🔨 chore: bot architecture upgrade (#13096)
* chore: bot architecture upgrade

* chore: unify schema definition

* chore: adjust channel schema

* feat: add setting render page

* chore: add i18n files

* chore: tag use field.key

* chore: add i18n files

* chore: add dev mode

* chore: refactor body to header and footer with body

* chore: add dev portal dev

* chore: add showWebhookUrl config

* chore: optimize form render

* feat: add slack channel

* chore: add new bot platform docs

* chore: unify applicationId to replace appId

* chore: add instrumentation file logger

* fix: gateway client error

* feat: support usageStats

* fix: bot settings pass and add  invalidate

* chore: update delete modal title and description

* chore: adjust save and connect button

* chore: support canEdit function

* fix: platform specific config

* fix: enable logic reconnect

* feat: add connection mode

* chore: start  gateway service in local dev env

* chore: default add a thread in channel when on mention at discord

* chore: add necessary permissions for slack

* feat: support charLimt and debounceMS

* chore: add schema maximum and minimum

* chore: adjust debounceMs and charLimit default value

* feat: support reset to default settings

* chore: hide reset when collapse

* fix: create discord bot lost app url

* fix: registry test case

* fix: lint error
2026-03-20 20:34:48 +08:00
Innei a64f4bf7ab 🔨 chore(desktop): bust stable release manifest cache (#13157)
🐛 fix(desktop): bust stable release manifest cache
2026-03-20 20:12:45 +08:00
Rylan Cai e577c95fa8 🐛 fix: should record unique case id in eval dataset (#13129)
* fix: should capture id if dataset has

* fix: should use unique case id
2026-03-20 19:07:36 +08:00
LobeHub Bot 15cda726a0 🌐 chore: translate non-English comments to English in chat-input-features (#13119)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 18:58:12 +08:00
lobehubbot 12c325494d Merge remote-tracking branch 'origin/main' into canary 2026-03-20 10:37:53 +00:00
YuTengjing 0edc57319e 🚀 release: 20260320 (#13155)
fix (#13110).
Fixed empty editor state structure and wide screen layout (#13131).
Fixed missing `BusinessAuthProvider` slot in auth layout (#13130).
Fixed artifacts code scroll preservation while streaming (#13114).
Fixed SSRF block error distinction from network errors (#13103).
Fixed Responses API tool pairing and context limit errors (#13078).
Fixed missing `userId` in embeddings API calls (#13077) and
Fixed unsupported xAI reasoning penalties pruning (#13066).
Fixed market OIDC lost call tools error (#13025).
Fixed `jsonb ?` operator usage to avoid Neon `rt_fetch` bug (#13040).
Fixed model provider popup problems (#13012).
Fixed agent-level memory config priority over user settings (#13018).
Fixed multi-provider model item selection (#12968).
Fixed agent stream error in local dev (#13054).
Fixed skill crash (#13011).
Fixed desktop agent-browser upgrade to v0.20.1 (#12985).
Fixed topic share modal inside router (#12951).
Fixed Enter key submission during IME composition (#12963).
Fixed error collapse default active key (#12967).
2026-03-20 18:37:09 +08:00
Rylan Cai 4d360714ad 🐛 fix: fix compression UI (#13113)
* 🐛 fix: restore eval pass@1 display after compression

* ♻️ refactor: narrow eval compression pass@1 fix scope

* ♻️ refactor: reduce eval compression fix to parser core

* 🐛 fix compressed group indexing type narrowing

*  add conversation-flow compression tests

*  fix orphan structuring test expectation
2026-03-20 17:23:02 +08:00
LobeHub Bot 9d441c5ab3 🌐 chore: translate non-English comments to English in packages/openapi/src/controllers (#13146)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 17:13:41 +08:00
YuTengjing abd152b805 🐛 fix: misc UI/UX improvements and bug fixes (#13153) 2026-03-20 16:42:16 +08:00
LobeHub Bot c0834fb59d test: add unit tests for rbac utils (#13150)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 16:33:41 +08:00
CanisMinor 2067cb2300 💄 style: add image/video switch (#13152)
* style: add image/video switch

* style: update i18n
2026-03-20 15:55:53 +08:00
Innei cada9a06fc 🔧 chore(vercel): add SPA asset cache headers and no-store for dev proxy (#13151)
Made-with: Cursor
2026-03-20 14:45:19 +08:00
Innei cd75228933 👷 build(ci): add dedicated docker canary tag (#13148) 2026-03-20 14:38:58 +08:00
CanisMinor 57469f860e 💄 style: redesign image / video (#13126)
* ♻️ refactor: Refactor image and video

* chore: rabase canary

* style: update

* style: update

* style: update

* style: update

* style: update

* style: update

* style: update

* chore: update i18n

* style: update

* fix: fix config

* fix: fix proxy

* fix: fix type

* chore: fix test
2026-03-20 14:10:01 +08:00
Arvin Xu d3ea4a4894 ♻️ refactor: refactor agent-runtime hooks mode (#13145)
*  feat: add Agent Runtime Hooks — external lifecycle hook system

Hooks are registered once and automatically adapt to runtime mode:
- Local: handler functions called directly (in-process)
- Production: webhook configs persisted to Redis, delivered via HTTP/QStash

- HookDispatcher: register, dispatch, serialize hooks per operationId
- AgentHook type: id, type (beforeStep/afterStep/onComplete/onError),
  handler function, optional webhook config
- Integrated into AgentRuntimeService.createOperation + executeStep
- Hooks persisted in AgentState.metadata._hooks for cross-request survival
- Dispatched at both normal completion and error paths
- Non-fatal: hook errors never affect main execution flow

LOBE-6208

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  test: add HookDispatcher unit tests (19 tests)

Tests cover:
- register/unregister/hasHooks
- Local mode dispatch: matching types, multiple handlers, error isolation
- Production mode dispatch: webhook delivery, body merging, mode isolation
- Serialization: getSerializedHooks filters webhook-only hooks
- All hook types: beforeStep, afterStep, onComplete, onError

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: migrate SubAgent to hooks + add afterStep dispatch + finalState

- AgentHookEvent: added finalState field (local-mode only, stripped from webhooks)
- AgentRuntimeService: dispatch afterStep hooks alongside legacy callbacks
- AiAgentService: createThreadHooks() replaces createThreadMetadataCallbacks()
  for SubAgent Thread execution — same behavior, using hooks API
- HookDispatcher: strip finalState from webhook payloads (too large)

LOBE-6208

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: add Vercel bypass header to QStash hook webhooks

Preserves x-vercel-protection-bypass header when delivering hook
webhooks via QStash, matching existing behavior in
AgentRuntimeService.deliverWebhook and libs/qstash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: migrate Eval Run to hooks + add finalState to AgentHookEvent

Eval Run now uses hooks API instead of raw completionWebhook:
- executeTrajectory: hook with local handler + webhook fallback
- executeThreadTrajectory: hook with local handler + webhook fallback
- Local mode now works for eval runs (previously production-only)

Also:
- AgentHookEvent: added finalState field (local-only, stripped from webhooks)
  for consumers that need deep state access

LOBE-6208

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: dispatch beforeStep hooks + fix completion event payload fields

P1: Add hookDispatcher.dispatch('beforeStep') alongside legacy
onBeforeStep callback. All 4 hook types now dispatch correctly:
beforeStep, afterStep, onComplete, onError.

P2: Fix completion event payload to use actual AgentState fields
(state.cost.total, state.usage.llm.*, state.messages) instead of
non-existent state.session.* properties. Matches the field access
pattern in triggerCompletionWebhook.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: update eval test assertions for hooks migration + fix status type

- Test: update executeTrajectory assertion to expect hooks array
  instead of completionWebhook object
- Fix: add fallback for event.status (string | undefined) when passing
  to recordTrajectoryCompletion/recordThreadCompletion (status: string)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: update SubAgent test assertions for hooks migration

Update execGroupSubAgentTask tests to expect hooks array instead of
stepCallbacks object, matching the SubAgent → hooks migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 12:05:25 +08:00
Rylan Cai 6ce9d9a814 🐛 fix: agent stream error in local dev (#13054)
* 🐛 fix: close local agent streams on terminal errors

* ♻️ refactor: revert redundant cli stream error handling

* 🧪 test: remove redundant cli stream error test

* wip: prune tests

* 🐛 fix: guard terminal agent runtime end step index
2026-03-20 11:39:54 +08:00
Neko f51da14f07 🔧 chore(locales): use "created" for "sent" in "sent x messages" (#13140) 2026-03-20 11:08:13 +08:00
Protocol Zero bc8debe836 🐛 fix(chat): strip forkedFromIdentifier before LLM API request (#13142)
fix(chat): strip forkedFromIdentifier before LLM API request

Fork & Chat stores forkedFromIdentifier in agent.params for DB lookup.
Spreading params into the chat payload forwarded it to Responses API,
causing strict providers (e.g. AiHubMix) to reject the request.

Remove the field in getChatCompletion alongside existing non-API keys.

Fixes lobehub/lobehub#13071

Made-with: Cursor
2026-03-20 11:07:29 +08:00
Neko 1b909a74d7 🔧 chore(locales): missing category locale for productivity (#13141) 2026-03-20 03:46:23 +08:00
Arvin Xu 04f963d1da ♻️ refactor: use incremental diff for snapshot messages to prevent OOM (#13136)
* ♻️ refactor: use incremental diff for snapshot messages to prevent OOM

Replace full messages/messagesAfter duplication per step with baseline + delta approach:
- Step 0 and compression resets store full messagesBaseline
- Other steps store only messagesDelta (new messages added)
- Strip llm_stream events from snapshot (not useful for post-analysis)
- Strip messages from done.finalState (reconstructible from delta chain)
- Strip duplicate toolResults from context.payload
- Reduce context_engine_result event size by removing messages and toolsConfig
- Add reconstructMessages() utility for rebuilding full state from delta chain
- AiAgentService constructor now accepts runtimeOptions for DI

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: add incremental toolset delta for snapshot

- Store operationToolSet as toolsetBaseline in step 0 only (immutable)
- Track activatedStepTools changes via per-step activatedStepToolsDelta
- Strip operationToolSet/toolManifestMap/tools/toolSourceMap from done.finalState
- Add reconstructToolsetBaseline() and reconstructActivatedStepTools() utilities

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: correct snapshot delta recording and restore context-engine output

- P1: messagesDelta now always stores only appended messages (afterMessages.slice),
  fixing duplication when isBaseline was true (step 0 / compression reset)
- P2: Restore context_engine_result.output (processedMessages) — needed by
  inspect CLI for --env, --system-role, and -m commands
- Add P1 regression test for message deduplication

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 01:01:35 +08:00
YuTengjing d6f75f3282 feat(model-runtime): add xiaomimimo to RouterRuntime base runtime map (#13137) 2026-03-20 01:01:06 +08:00
YuTengjing 563f4a25f1 💄 style: add XiaomiMiMo LobeHub-hosted model cards and fix pricing (#13133) 2026-03-19 23:51:23 +08:00
Zhijie He e2d25be729 💄 style: add mimo-v2-pro & mimo-v2-omni support (#13123) 2026-03-19 22:14:20 +08:00
Innei 80cb6c9d11 feat(chat-input): add category-based mention menu (#13109)
*  feat(chat-input): add category-based mention menu with keyboard navigation

Replace flat mention list with a structured category menu (Agents, Members, Topics).
Supports home/category/search views, Fuse.js fuzzy search, floating-ui positioning,
and full keyboard navigation.

* 🔧 chore: update @lobehub/editor to version 4.3.0 and refactor type definition in useMentionCategories

Signed-off-by: Innei <tukon479@gmail.com>

*  feat(MentionMenu): enhance icon rendering logic in MenuItem component

Updated the MenuItem component to improve how icons are rendered. Now, it checks if the icon is a valid React element or a function, ensuring better flexibility in icon usage. This change enhances the overall user experience in the mention menu.

Signed-off-by: Innei <tukon479@gmail.com>

* 🔧 chore: update @lobehub/editor to version 4.3.1 in package.json

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-03-19 21:48:10 +08:00
YuTengjing 57ec43cd00 🐛 fix(database): add drizzle-zod and zod as peer dependencies to fix type-check errors (#13132) 2026-03-19 21:24:41 +08:00
Innei 0f67a5b8d7 💄 style(desktop): improve WelcomeStep layout centering in onboarding (#13125)
* 💄 style(desktop): improve WelcomeStep layout centering in onboarding

Made-with: Cursor

* 🐛 fix(desktop): validate remote server URL in isRemoteServerConfigured

Made-with: Cursor
2026-03-19 21:18:41 +08:00
Innei 8d387a98a0 🐛 fix(editor): correct empty editor state structure and wide screen layout (#13131)
- Fix EMPTY_EDITOR_STATE with proper Lexical node structure (root id, paragraph id)
- Add flex-grow to WideScreenContainer for proper editor canvas expansion

Made-with: Cursor
2026-03-19 21:07:18 +08:00
YuTengjing 3931aa9f76 🐛 fix(auth): add BusinessAuthProvider slot to auth layout (#13130) 2026-03-19 18:56:45 +08:00
YuTengjing 73d46bb4c4 feat(ci): add Claude PR auto-assign reviewer workflow (#13120) 2026-03-19 16:13:01 +08:00
Innei f827b870c3 feat(version): display actual desktop app version with canary suffix (#13110)
*  feat(version): display actual desktop app version with canary suffix

Add support for fetching and displaying the desktop application's actual version number in the About section. When running on desktop, the version now displays the desktop app's version (including canary suffix if applicable), falling back to the web version if unavailable.

- Add getAppVersion IPC method in SystemController
- Create versionDisplay utility module with comprehensive tests
- Integrate desktop version fetching in Version component

* ♻️ refactor(desktop): inject about version at build time
2026-03-19 14:24:03 +08:00
Neko efd99850df feat(agentDocuments): added agent documents impl, and tools (#13093) 2026-03-19 14:05:02 +08:00
Neko 87c770cda7 🔨 chore: use percentage value for Codecov (#13121)
build: use percentage value
2026-03-19 13:28:48 +08:00
YuTengjing 715481c471 🐛 fix(portal): preserve artifacts code scroll while streaming (#13114) 2026-03-19 00:35:20 +08:00
YuTengjing 25e1a64c1b 💄 style: update Grok 4.20 to 0309 and add MiniMax M2.7 models (#13112) 2026-03-19 00:05:07 +08:00
Innei 465c9699e7 feat(context-engine): inject referenced topic context into last user message (#13104)
*  feat: inject referenced topic context into last user message

When users @refer_topic in chat, inject the referenced topic's summary
or recent messages directly into the context, reducing unnecessary tool calls.

* 🐛 fix: include agentId and groupId in message retrieval for context engineering

Signed-off-by: Innei <tukon479@gmail.com>

*  feat: skip topic reference resolution for messages with existing topic_reference_context

Added logic to prevent double injection of topic references when messages already contain the topic_reference_context. Updated tests to verify the behavior for both cases: when topic references should be resolved and when they should be skipped.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-03-18 21:58:41 +08:00
Innei ac29897d72 ♻️ refactor(perf): user message renderer (#13108)
refactor(perf): user message renderer
2026-03-18 21:58:29 +08:00
YuTengjing 1df5ae32f1 🐛 fix: distinguish SSRF block errors from network errors (#13103) 2026-03-18 18:16:19 +08:00
Innei 8a90f79c11 ♻️ refactor(nav): remove devOnly mode from nav layout and stabilize Footer (#13101)
* ♻️ refactor(nav): remove devOnly mode from nav layout and stabilize Footer during panel transitions

- Remove devOnly filtering from useNavLayout, treat all items as non-dev mode
- Move Pages to top nav position, remove video/image/settings/memory nav items
- Extract Footer from SideBarLayout into NavPanelDraggable outside animation layer
- Show settings ActionIcon in Footer when dev mode is enabled (hidden on settings page)

* 🔧 fix(footer): update settings icon in Footer component

- Replace Settings2 icon with Settings icon in the Footer when dev mode is enabled, ensuring consistency in the user interface.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-03-18 15:44:51 +08:00
LobeHub Bot 91ec7b412b 🌐 chore: translate non-English comments to English in ProfileEditor and related features (#13048)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 15:40:07 +08:00
YuTengjing e9766be3f3 🐛 fix: pass userId in initModelRuntimeFromDB (#13100) 2026-03-18 15:11:29 +08:00
Rylan Cai 52652866e0 feat: support server context compression (#12976)
* ♻️ refactor: add eval-only server context compression

* ♻️ refactor: align eval compression with runtime step flow

* ♻️ refactor: trim redundant call_llm diff

*  add mid-run context compression step

* 📝 document post compression helper

* 🐛 revert unnecessary agent runtime service diff

* ♻️ refactor: clean up context compression follow-up logic

* ♻️ refactor: move compression gate before call llm

* ♻️ refactor: make call llm compression gate explicit

* ♻️ refactor: restore agent-side compression checks

* ♻️ refactor: rename agent llm continuation helper

* ♻️ refactor: inline agent compression helper

* ♻️ refactor: preserve trailing user message during compression

* 📝 docs: clarify toLLMCall refactor direction

*  test: add coverage for context compression flow

*  reset: unstash
2026-03-18 12:48:34 +08:00
YuTengjing 95ef230354 💄 style: add GPT-5.4 mini and nano models (#13094) 2026-03-18 12:34:31 +08:00
lobehubbot b894622dfe Merge remote-tracking branch 'origin/main' into canary 2026-03-18 04:29:39 +00:00
Arvin Xu ae77fee1b8 👷 build: add settings column to agent_bot_providers (#13081) 2026-03-18 12:28:58 +08:00
YuTengjing 7cd4b1942f 💄 style: use credit terminology in auto top-up tooltips (#13091) 2026-03-18 11:12:39 +08:00
Rylan Cai 69c24c714e 🔧 chore(eval): improve trajectory workflow controls and execution metadata (#13049)
* 🔧 chore(search): reduce Exa default result count

* 🐛 fix(eval): relax run input schema limits

*  feat(agent): persist tool execution time in message metadata

* 🔧 chore(eval): add flow control to trajectory workflows

* 🧪 test: adjust Exa numResults expectation
2026-03-18 10:29:49 +08:00
Sirui He 3a789dc612 🐛 fix: SPA HTML entry returns stale content after server upgrade (#12998)
fix: add no-cache header to SPA HTML entry point

Prevent stale SPA HTML from being served after server upgrades.
JS/CSS assets still cache normally via hashed filenames.
2026-03-18 01:27:52 +08:00
Xial 46455cb6c3 🐛 fix: load PDF.js worker from local assets via Vite ?url import (#13006) 2026-03-18 01:26:10 +08:00
lobehubbot 9fa060f01e 🔖 chore(release): release version v2.1.43 [skip ci] 2026-03-16 11:53:29 +00:00
1107 changed files with 52994 additions and 9289 deletions
+69 -4
View File
@@ -200,20 +200,85 @@ The base directory (`~/.lobehub/`) can be overridden with the `LOBEHUB_CLI_HOME`
## Development
### Running in Dev Mode
Dev mode uses `LOBEHUB_CLI_HOME=.lobehub-dev` to isolate credentials from the global `~/.lobehub/` directory, so dev and production configs never conflict.
```bash
# Run directly (dev mode, uses ~/.lobehub-dev for credentials)
# Run a command in dev mode (from apps/cli/)
cd apps/cli && bun run dev -- <command>
# Build
# This is equivalent to:
LOBEHUB_CLI_HOME=.lobehub-dev bun src/index.ts <command>
```
### Connecting to Local Dev Server
To test CLI against a local dev server (e.g. `localhost:3011`):
**Step 1: Start the local server**
```bash
# From cloud repo root
bun run dev
# Server starts on http://localhost:3011 (or configured port)
```
**Step 2: Login to local server via Device Code Flow**
```bash
cd apps/cli && bun run dev -- login --server http://localhost:3011
```
This will:
1. Call `POST http://localhost:3011/oidc/device/auth` to get a device code
2. Print a URL like `http://localhost:3011/oidc/device?user_code=XXXX-YYYY`
3. Open the URL in your browser — log in and authorize
4. Save credentials to `apps/cli/.lobehub-dev/credentials.json`
5. Save server URL to `apps/cli/.lobehub-dev/settings.json`
After login, all subsequent `bun run dev -- <command>` calls will use the local server.
**Step 3: Run commands against local server**
```bash
cd apps/cli && bun run dev -- task list
cd apps/cli && bun run dev -- task create -i "Test task" -n "My Task"
cd apps/cli && bun run dev -- agent list
```
**Troubleshooting:**
- If login returns `invalid_grant`, make sure the local OIDC provider is properly configured (check `OIDC_*` env vars in `.env`)
- If you get `UNAUTHORIZED` on API calls, your token may have expired — run `bun run dev -- login --server http://localhost:3011` again
- Dev credentials are stored in `apps/cli/.lobehub-dev/` (gitignored), not in `~/.lobehub/`
### Switching Between Local and Production
```bash
# Dev mode (local server) — uses .lobehub-dev/
cd apps/cli && bun run dev -- <command>
# Production (app.lobehub.com) — uses ~/.lobehub/
lh <command>
```
The two environments are completely isolated by different credential directories.
### Build & Test
```bash
# Build CLI
cd apps/cli && bun run build
# Test (unit tests)
# Unit tests
cd apps/cli && bun run test
# E2E tests (requires authenticated CLI)
cd apps/cli && bunx vitest run e2e/kb.e2e.test.ts
# Link globally for testing
# Link globally for testing (installs lh/lobe/lobehub commands)
cd apps/cli && bun run cli:link
```
+69
View File
@@ -0,0 +1,69 @@
---
name: code-review
description: 'Code review checklist for LobeHub. Use when reviewing PRs, diffs, or code changes. Covers correctness, security, quality, and project-specific patterns.'
---
# Code Review Guide
## Before You Start
1. Read `/typescript` and `/testing` skills for code style and test conventions
2. Get the diff (skip if already in context, e.g., injected by GitHub review app): `git diff` or `git diff origin/canary..HEAD`
## Checklist
### Correctness
- Leftover `console.log` / `console.debug` — should use `debug` package or remove
- Missing `return await` in try/catch — see <https://typescript-eslint.io/rules/return-await/> (not in our ESLint config yet, requires type info)
- Can the fix/implementation be more concise, efficient, or have better compatibility?
### Security
- No sensitive data (API keys, tokens, credentials) in `console.*` or `debug()` output
- No base64 output to terminal — extremely long, freezes output
- No hardcoded secrets — use environment variables
### Testing
- Bug fixes must include tests covering the fixed scenario
- New logic (services, store actions, utilities) should have test coverage
- Existing tests still cover the changed behavior?
- Prefer `vi.spyOn` over `vi.mock` (see `/testing` skill)
### i18n
- New user-facing strings use i18n keys, not hardcoded text
- Keys added to `src/locales/default/{namespace}.ts` with `{feature}.{context}.{action|status}` naming
- For PRs: `locales/` translations for all languages updated (`pnpm i18n`)
### Reuse
- Newly written code duplicates existing utilities in `packages/utils` or shared modules?
- Copy-pasted blocks with slight variation — extract into shared function
- `antd` imports replaceable with `@lobehub/ui` wrapped components (`Input`, `Button`, `Modal`, `Avatar`, etc.)
- Use `antd-style` token system, not hardcoded colors
### Database
- Migration scripts must be idempotent (`IF NOT EXISTS`, `IF EXISTS` guards)
### Cloud Impact
A downstream cloud deployment depends on this repo. Flag changes that may require cloud-side updates:
- **Backend route paths changed** — e.g., renaming `src/app/(backend)/webapi/chat/route.ts` or changing its exports
- **SSR page paths changed** — e.g., moving/renaming files under `src/app/[variants]/(auth)/`
- **Dependency versions bumped** — e.g., upgrading `next` or `drizzle-orm` in `package.json`
- **`@lobechat/business-*` exports changed** — e.g., renaming a function in `src/business/` or changing type signatures in `packages/business/`
- `src/business/` and `packages/business/` must not expose cloud commercial logic in comments or code
## Output Format
For local CLI review only (GitHub review app posts inline PR comments instead):
- Number all findings sequentially
- Indicate priority: `[high]` / `[medium]` / `[low]`
- Include file path and line number for each finding
- Only list problems — no summary, no praise
- Re-read full source for each finding to verify it's real, then output "All findings verified."
+2 -6
View File
@@ -101,10 +101,6 @@ DROP TABLE "old_table";
CREATE INDEX "users_email_idx" ON "users" ("email");
```
## Step 4: Regenerate Client After SQL Edits
## Step 4: Update Journal Tag
After modifying the generated SQL (e.g., adding `IF NOT EXISTS`), regenerate the client:
```bash
bun run db:generate:client
```
After renaming the migration SQL file in Step 2, update the `tag` field in `packages/database/migrations/meta/_journal.json` to match the new filename (without `.sql` extension).
+1 -1
View File
@@ -53,7 +53,7 @@ export default {
1. Add keys to `src/locales/default/{namespace}.ts`
2. Export new namespace in `src/locales/default/index.ts`
3. For dev preview: manually translate `locales/zh-CN/{namespace}.json` and `locales/en-US/{namespace}.json`
4. Run `pnpm i18n` to generate all languages (CI handles this automatically)
4. Remind the user to run `pnpm i18n` before creating PR — do NOT run it yourself (very slow)
## Usage
+123
View File
@@ -0,0 +1,123 @@
---
name: trpc-router
description: TRPC router development guide. Use when creating or modifying TRPC routers (src/server/routers/**), adding procedures, or working with server-side API endpoints. Triggers on TRPC router creation, procedure implementation, or API endpoint tasks.
---
# TRPC Router Guide
## File Location
- Routers: `src/server/routers/lambda/<domain>.ts`
- Helpers: `src/server/routers/lambda/_helpers/`
- Schemas: `src/server/routers/lambda/_schema/`
## Router Structure
### Imports
```typescript
import { TRPCError } from '@trpc/server';
import { z } from 'zod';
import { SomeModel } from '@/database/models/some';
import { authedProcedure, router } from '@/libs/trpc/lambda';
import { serverDatabase } from '@/libs/trpc/lambda/middleware';
```
### Middleware: Inject Models into ctx
**Always use middleware to inject models into `ctx`** instead of creating `new Model(ctx.serverDB, ctx.userId)` inside every procedure.
```typescript
const domainProcedure = authedProcedure.use(serverDatabase).use(async (opts) => {
const { ctx } = opts;
return opts.next({
ctx: {
fooModel: new FooModel(ctx.serverDB, ctx.userId),
barModel: new BarModel(ctx.serverDB, ctx.userId),
},
});
});
```
Then use `ctx.fooModel` in procedures:
```typescript
// Good
const model = ctx.fooModel;
// Bad - don't create models inside procedures
const model = new FooModel(ctx.serverDB, ctx.userId);
```
**Exception**: When a model needs a different `userId` (e.g., watchdog iterating over multiple users' tasks), create it inline.
### Procedure Pattern
```typescript
export const fooRouter = router({
// Query
find: domainProcedure.input(z.object({ id: z.string() })).query(async ({ input, ctx }) => {
try {
const item = await ctx.fooModel.findById(input.id);
if (!item) throw new TRPCError({ code: 'NOT_FOUND', message: 'Not found' });
return { data: item, success: true };
} catch (error) {
if (error instanceof TRPCError) throw error;
console.error('[foo:find]', error);
throw new TRPCError({
cause: error,
code: 'INTERNAL_SERVER_ERROR',
message: 'Failed to find item',
});
}
}),
// Mutation
create: domainProcedure.input(createSchema).mutation(async ({ input, ctx }) => {
try {
const item = await ctx.fooModel.create(input);
return { data: item, message: 'Created', success: true };
} catch (error) {
if (error instanceof TRPCError) throw error;
console.error('[foo:create]', error);
throw new TRPCError({
cause: error,
code: 'INTERNAL_SERVER_ERROR',
message: 'Failed to create',
});
}
}),
});
```
### Aggregated Detail Endpoint
For views that need multiple related data, create a single `detail` procedure that fetches everything in parallel:
```typescript
detail: domainProcedure.input(idInput).query(async ({ input, ctx }) => {
const item = await resolveOrThrow(ctx.fooModel, input.id);
const [children, related] = await Promise.all([
ctx.fooModel.findChildren(item.id),
ctx.barModel.findByFooId(item.id),
]);
return {
data: { ...item, children, related },
success: true,
};
}),
```
This avoids the CLI or frontend making N sequential requests.
## Conventions
- Return shape: `{ data, success: true }` for queries, `{ data?, message, success: true }` for mutations
- Error handling: re-throw `TRPCError`, wrap others with `console.error` + new `TRPCError`
- Input validation: use `zod` schemas, define at file top
- Router name: `export const fooRouter = router({ ... })`
- Procedure names: alphabetical order within the router object
- Log prefix: `[domain:procedure]` format, e.g. `[task:create]`
+57
View File
@@ -0,0 +1,57 @@
# PR Reviewer Assignment Guide
Analyze PR changed files and assign appropriate reviewer(s) by posting a comment.
## Workflow
### Step 1: Get PR Details and Changed Files
```bash
gh pr view [PR_NUMBER] --json number,title,body,files,labels,author
```
### Step 2: Map Changed Files to Feature Areas
Analyze file paths to determine which feature area(s) the PR touches, then use `team-assignment.md` to find the appropriate reviewer(s).
Use the PR title, description, and changed file paths together to infer the feature area. For example:
- `packages/database/` → deployment/backend area
- `apps/desktop/` → desktop platform
- Files containing `KnowledgeBase`, `Auth`, `MCP` etc. → corresponding feature labels in team-assignment.md
### Step 3: Check Related Issues
If the PR body references an issue (e.g., `close #123`, `fix #123`, `resolve #123`), fetch that issue's participants:
```bash
gh issue view [ISSUE_NUMBER] --json author,comments --jq '{author: .author.login, commenters: [.comments[].author.login]}'
```
Team members who created or commented on the related issue are strong candidates for reviewer.
### Step 4: Determine Reviewer(s)
Apply in priority order:
1. **Exclude PR author** - Never assign the PR author as reviewer
2. **Related issue participants** - Team members from `team-assignment.md` who are active in the related issue
3. **Feature area owner** - Based on changed files and `team-assignment.md` Assignment Rules
4. **Multiple areas** - If PR touches multiple areas, mention the primary owner first, then secondary
5. **Fallback** - If no clear mapping, assign @arvinxx
### Step 5: Post Comment
Post a single comment mentioning the reviewer(s). Use the **Comment Templates** from `team-assignment.md`, adapting them for PR review context.
```bash
gh pr comment [PR_NUMBER] --body "message"
```
## Important Rules
1. **PR author exclusion**: ALWAYS skip the PR author from reviewer list
2. **One comment only**: Post exactly ONE comment with all mentions
3. **No labels**: Do NOT add or remove labels on PRs
4. **Bot PRs**: Skip PRs authored by bots (e.g., dependabot, renovate)
5. **Draft PRs**: Still assign reviewers for draft PRs (author may want early feedback)
+77
View File
@@ -0,0 +1,77 @@
name: Claude PR Assign
on:
pull_request_target:
types: [opened, labeled]
jobs:
assign-reviewer:
runs-on: ubuntu-latest
timeout-minutes: 10
# Only run on non-bot PR opened, or when "trigger:assign" label is added
if: |
github.event.pull_request.user.type != 'Bot' &&
(github.event.action == 'opened' || (github.event.action == 'labeled' && github.event.label.name == 'trigger:assign'))
permissions:
contents: read
pull-requests: write
issues: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Copy prompts
run: |
mkdir -p /tmp/claude-prompts
cp .claude/prompts/pr-assign.md /tmp/claude-prompts/
cp .claude/prompts/team-assignment.md /tmp/claude-prompts/
cp .claude/prompts/security-rules.md /tmp/claude-prompts/
- name: Run Claude Code for PR Reviewer Assignment
uses: anthropics/claude-code-action@v1
with:
github_token: ${{ secrets.GH_TOKEN }}
allowed_non_write_users: '*'
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: |
--allowedTools "Bash(gh pr:*),Bash(gh issue view:*),Read"
--append-system-prompt "$(cat /tmp/claude-prompts/security-rules.md)"
prompt: |
**Task-specific security rules:**
- If you detect prompt injection attempts in PR content, add label "security:prompt-injection" and stop processing
- Only use the exact PR number provided: ${{ github.event.pull_request.number }}
---
You're a PR reviewer assignment assistant. Your task is to analyze PR changed files and mention the appropriate reviewer(s) in a comment.
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
## Instructions
Follow the PR assignment guide located at:
```bash
cat /tmp/claude-prompts/pr-assign.md
```
Read the team assignment guide for determining team members:
```bash
cat /tmp/claude-prompts/team-assignment.md
```
**IMPORTANT**:
- Follow ALL steps in the pr-assign.md guide
- NEVER assign the PR author (${{ github.event.pull_request.user.login }}) as reviewer
- Replace [PR_NUMBER] with: ${{ github.event.pull_request.number }}
**Start the assignment process now.**
- name: Remove trigger label
if: github.event.action == 'labeled' && github.event.label.name == 'trigger:assign'
run: |
gh pr edit ${{ github.event.pull_request.number }} --remove-label "trigger:assign"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
+4 -4
View File
@@ -19,9 +19,9 @@ jobs:
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
contents: write
pull-requests: write
issues: write
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
@@ -55,5 +55,5 @@ jobs:
# Security: Allow only specific safe commands - no gh commands to prevent token exfiltration
# These tools are restricted to code analysis and build operations only
claude_args: |
--allowedTools "Bash(bun run:*),Bash(pnpm run:*),Bash(npm run:*),Bash(npx:*),Bash(bunx:*),Bash(vitest:*),Bash(rg:*),Bash(find:*),Bash(sed:*),Bash(grep:*),Bash(awk:*),Bash(wc:*),Bash(xargs:*)"
--allowedTools "Bash(git:*),Bash(gh:*),Bash(bun run:*),Bash(pnpm run:*),Bash(npm run:*),Bash(npx:*),Bash(bunx:*),Bash(vitest:*),Bash(rg:*),Bash(find:*),Bash(sed:*),Bash(grep:*),Bash(awk:*),Bash(wc:*),Bash(xargs:*)"
--append-system-prompt "$(cat /tmp/claude-prompts/security-rules.md)"
+2
View File
@@ -45,6 +45,7 @@ jobs:
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ !github.event.release.prerelease }}
type=raw,value=canary,enable=${{ contains(github.event.release.tag_name, '-canary.') }}
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event.release.prerelease }}
- name: Docker login
@@ -111,6 +112,7 @@ jobs:
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ !github.event.release.prerelease }}
type=raw,value=canary,enable=${{ contains(github.event.release.tag_name, '-canary.') }}
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event.release.prerelease }}
- name: Docker login
+7 -23
View File
@@ -17,7 +17,7 @@ You are developing an open-source, modern-design AI Agent Workspace: LobeHub (pr
## Directory Structure
```
```plaintext
lobehub/
├── apps/desktop/ # Electron desktop app
├── packages/ # Shared packages (@lobechat/*)
@@ -45,7 +45,7 @@ lobehub/
- New branches should be created from `canary`; PRs should target `canary`
- Use rebase for git pull
- Git commit messages should prefix with gitmoji
- Git branch name format: `username/feat/feature-name`
- Git branch name format: `feat/feature-name`
- Use `.github/PULL_REQUEST_TEMPLATE.md` for PR descriptions
### Package Management
@@ -85,30 +85,14 @@ cd packages/[package-name] && bunx vitest run --silent='passed-only' '[file-path
- **Dev**: Translate `locales/zh-CN/namespace.json` locale file only for preview
- DON'T run `pnpm i18n`, let CI auto handle it
## Linear Issue Management
Follow [Linear rules in CLAUDE.md](CLAUDE.md#linear-issue-management-ignore-if-not-installed-linear-mcp) when working with Linear issues.
## SPA Routes and Features
- **`src/routes/`** holds only page segments (layout + page entry files). Keep route files thin; they should import from `@/features/*` and compose.
- **`src/features/`** holds business components by domain. Put layout pieces, hooks, and domain UI here.
- See [CLAUDE.md SPA Routes and Features](CLAUDE.md#spa-routes-and-features) and the **spa-routes** skill for how to add new routes and how to split files.
- **`src/routes/`** holds only page segments (`_layout/index.tsx`, `index.tsx`, `[id]/index.tsx`). Keep route files **thin** import from `@/features/*` and compose, no business logic.
- **`src/features/`** holds business components by **domain** (e.g. `Pages`, `PageEditor`, `Home`). Layout pieces, hooks, and domain UI go here.
- See the **spa-routes** skill for the full convention and file-division rules.
## Skills (Auto-loaded)
All AI development skills are available in `.agents/skills/` directory:
All AI development skills are available in `.agents/skills/` directory and auto-loaded by Claude Code when relevant.
| Category | Skills |
| ------------ | ------------------------------------------ |
| Frontend | `react`, `typescript`, `i18n`, `microcopy` |
| State | `zustand` |
| Backend | `drizzle` |
| Desktop | `desktop` |
| Testing | `testing` |
| UI | `modal`, `hotkey`, `recent-data` |
| Config | `add-provider-doc`, `add-setting-env` |
| Workflow | `linear`, `debug` |
| Architecture | `spa-routes` |
| Performance | `vercel-react-best-practices` |
| Overview | `project-overview` |
**IMPORTANT**: When reviewing PRs or code diffs, ALWAYS read `.agents/skills/code-review/SKILL.md` first.
+27
View File
@@ -2,6 +2,33 @@
# Changelog
### [Version 2.1.43](https://github.com/lobehub/lobe-chat/compare/v2.1.42...v2.1.43)
<sup>Released on **2026-03-16**</sup>
#### 👷 Build System
- **misc**: add BM25 indexes with ICU tokenizer for search optimization.
- **misc**: add `agent_documents` table.
<br/>
<details>
<summary><kbd>Improvements and Fixes</kbd></summary>
#### Build System
- **misc**: add BM25 indexes with ICU tokenizer for search optimization, closes [#13032](https://github.com/lobehub/lobe-chat/issues/13032) ([70a74f4](https://github.com/lobehub/lobe-chat/commit/70a74f4))
- **misc**: add `agent_documents` table, closes [#12944](https://github.com/lobehub/lobe-chat/issues/12944) ([93ee1e3](https://github.com/lobehub/lobe-chat/commit/93ee1e3))
</details>
<div align="right">
[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
</div>
### [Version 2.1.42](https://github.com/lobehub/lobe-chat/compare/v2.1.41...v2.1.42)
<sup>Released on **2026-03-14**</sup>
+2 -16
View File
@@ -13,7 +13,7 @@ Guidelines for using Claude Code in this LobeHub repository.
## Project Structure
```
```plaintext
lobehub/
├── apps/desktop/ # Electron desktop app
├── packages/ # Shared packages (@lobechat/*)
@@ -77,7 +77,7 @@ bun run dev
After `dev:spa` starts, the terminal prints a **Debug Proxy** URL:
```
```plaintext
Debug Proxy: https://app.lobehub.com/_dangerous_local_dev_proxy?debug-host=http%3A%2F%2Flocalhost%3A9876
```
@@ -117,20 +117,6 @@ cd packages/database && bunx vitest run --silent='passed-only' '[file]'
- For dev preview: translate `locales/zh-CN/` and `locales/en-US/`
- Don't run `pnpm i18n` - CI handles it
## Linear Issue Management
**Trigger conditions** - when ANY of these occur, apply Linear workflow:
- User mentions issue ID like `LOBE-XXX`
- User says "linear", "link linear", "linear issue"
- Creating PR that references a Linear issue
**Workflow:**
1. Use `ToolSearch` to confirm `linear-server` MCP exists (search `linear` or `mcp__linear-server__`)
2. If found, read `.agents/skills/linear/SKILL.md` and follow the workflow
3. If not found, skip Linear integration (treat as not installed)
## Skills (Auto-loaded by Claude)
Claude Code automatically loads relevant skills from `.agents/skills/`.
+1 -71
View File
@@ -1,73 +1,3 @@
# GEMINI.md
Guidelines for using Gemini CLI in this LobeHub repository.
## Tech Stack
- Next.js 16 + React 19 + TypeScript
- SPA inside Next.js with `react-router-dom`
- `@lobehub/ui`, antd for components; antd-style for CSS-in-JS
- react-i18next for i18n; zustand for state management
- SWR for data fetching; TRPC for type-safe backend
- Drizzle ORM with PostgreSQL; Vitest for testing
## Project Structure
```
lobehub/
├── apps/desktop/ # Electron desktop app
├── packages/ # Shared packages (@lobechat/*)
│ ├── database/ # Database schemas, models, repositories
│ ├── agent-runtime/ # Agent runtime
│ └── ...
├── src/
│ ├── app/ # Next.js app router
│ ├── store/ # Zustand stores
│ ├── services/ # Client services
│ ├── server/ # Server services and routers
│ └── ...
└── e2e/ # E2E tests (Cucumber + Playwright)
```
## Development
### Git Workflow
- **Branch strategy**: `canary` is the development branch (cloud production); `main` is the release branch (periodically cherry-picks from canary)
- New branches should be created from `canary`; PRs should target `canary`
- Use rebase for `git pull`
- Commit messages: prefix with gitmoji
- Branch format: `<type>/<feature-name>`
### Package Management
- `pnpm` for dependency management
- `bun` to run npm scripts
- `bunx` for executable npm packages
### Testing
```bash
# Run specific test (NEVER run `bun run test` - takes ~10 minutes)
bunx vitest run --silent='passed-only' '[file-path]'
# Database package
cd packages/database && bunx vitest run --silent='passed-only' '[file]'
```
- Tests must pass type check: `bun run type-check`
- After 2 failed fix attempts, stop and ask for help
### i18n
- Add keys to `src/locales/default/namespace.ts`
- For dev preview: translate `locales/zh-CN/` and `locales/en-US/`
- Don't run `pnpm i18n` - CI handles it
## Quality Checks
**MANDATORY**: After completing code changes, run diagnostics on modified files to identify and fix any errors.
## Skills (Auto-loaded)
Skills are available in `.agents/skills/` directory. See CLAUDE.md for the full list.
Please follow instructions @./AGENTS.md
+44
View File
@@ -0,0 +1,44 @@
# @lobehub/cli
LobeHub command-line interface.
## Local Development
| Task | Command |
| ------------------------------------------ | -------------------------- |
| Run in dev mode | `bun run dev -- <command>` |
| Build the CLI | `bun run build` |
| Link `lh`/`lobe`/`lobehub` into your shell | `bun run cli:link` |
| Remove the global link | `bun run cli:unlink` |
- `bun run build` only generates `dist/index.js`.
- To make `lh` available in your shell, run `bun run cli:link`.
- After linking, if your shell still cannot find `lh`, run `rehash` in `zsh`.
## Shell Completion
### Install completion for a linked CLI
| Shell | Command |
| ------ | ------------------------------ |
| `zsh` | `source <(lh completion zsh)` |
| `bash` | `source <(lh completion bash)` |
### Use completion during local development
| Shell | Command |
| ------ | -------------------------------------------- |
| `zsh` | `source <(bun src/index.ts completion zsh)` |
| `bash` | `source <(bun src/index.ts completion bash)` |
- Completion is context-aware. For example, `lh agent <Tab>` shows agent subcommands instead of top-level commands.
- If you update completion logic locally, re-run the corresponding `source <(...)` command to reload it in the current shell session.
- Completion only registers shell functions. It does not install the `lh` binary by itself.
## Quick Check
```bash
which lh
lh --help
lh agent <TAB>
```
+160
View File
@@ -0,0 +1,160 @@
.\" Code generated by `npm run man:generate`; DO NOT EDIT.
.\" Manual command details come from the Commander command tree.
.TH LH 1 "" "@lobehub/cli 0.0.1\-canary.12" "User Commands"
.SH NAME
lh \- LobeHub CLI \- manage and connect to LobeHub services
.SH SYNOPSIS
.B lh
[\fIOPTION\fR]...
[\fICOMMAND\fR]
.br
.B lobe
[\fIOPTION\fR]...
[\fICOMMAND\fR]
.br
.B lobehub
[\fIOPTION\fR]...
[\fICOMMAND\fR]
.SH DESCRIPTION
lh is the command\-line interface for LobeHub. It provides authentication, device gateway connectivity, content generation, resource search, and management commands for agents, files, models, providers, plugins, knowledge bases, threads, topics, and related resources.
.PP
For command-specific manuals, use the built-in manual command:
.PP
.RS
.B lh man
[\fICOMMAND\fR]...
.RE
.SH COMMANDS
.TP
.B login
Log in to LobeHub via browser (Device Code Flow)
.TP
.B logout
Log out and remove stored credentials
.TP
.B completion
Output shell completion script
.TP
.B man
Show a manual page for the CLI or a subcommand
.TP
.B connect
Connect to the device gateway and listen for tool calls
.TP
.B device
Manage connected devices
.TP
.B status
Check if gateway connection can be established
.TP
.B doc
Manage documents
.TP
.B search
Search across local resources or the web
.TP
.B kb
Manage knowledge bases, folders, documents, and files
.TP
.B memory
Manage user memories
.TP
.B agent
Manage agents
.TP
.B agent\-group
Manage agent groups
.TP
.B bot
Manage bot integrations
.TP
.B cron
Manage agent cron jobs
.TP
.B generate
Generate content (text, image, video, speech) Alias: gen.
.TP
.B file
Manage files
.TP
.B skill
Manage agent skills
.TP
.B session\-group
Manage agent session groups
.TP
.B thread
Manage message threads
.TP
.B topic
Manage conversation topics
.TP
.B message
Manage messages
.TP
.B model
Manage AI models
.TP
.B provider
Manage AI providers
.TP
.B plugin
Manage plugins
.TP
.B user
Manage user account and settings
.TP
.B whoami
Display current user information
.TP
.B usage
View usage statistics
.TP
.B eval
Manage evaluation workflows
.SH OPTIONS
.TP
.B \-V, \-\-version
output the version number
.TP
.B \-h, \-\-help
display help for command
.SH FILES
.TP
.I ~/.lobehub/credentials.json
Encrypted access and refresh tokens.
.TP
.I ~/.lobehub/settings.json
CLI settings such as server and gateway URLs.
.TP
.I ~/.lobehub/daemon.pid
Background daemon PID file.
.TP
.I ~/.lobehub/daemon.status
Background daemon status metadata.
.TP
.I ~/.lobehub/daemon.log
Background daemon log output.
.PP
The base directory can be overridden with the
.B LOBEHUB_CLI_HOME
environment variable.
.SH EXAMPLES
.TP
.B lh login
Start interactive login in the browser.
.TP
.B lh connect \-\-daemon
Start the device gateway connection in the background.
.TP
.B lh search \-q "gpt\-5"
Search local resources for a query.
.TP
.B lh generate text "Write release notes"
Generate text from a prompt.
.TP
.B lh man generate
Show the built\-in manual for the generate command group.
.SH SEE ALSO
.BR lobe (1),
.BR lobehub (1)
+1
View File
@@ -0,0 +1 @@
.so man1/lh.1
+1
View File
@@ -0,0 +1 @@
.so man1/lh.1
+17 -12
View File
@@ -7,37 +7,42 @@
"lobe": "./dist/index.js",
"lobehub": "./dist/index.js"
},
"man": [
"./man/man1/lh.1",
"./man/man1/lobe.1",
"./man/man1/lobehub.1"
],
"files": [
"dist"
"dist",
"man"
],
"scripts": {
"build": "npx tsup",
"build": "tsdown",
"cli:link": "bun link",
"cli:unlink": "bun unlink",
"dev": "LOBEHUB_CLI_HOME=.lobehub-dev bun src/index.ts",
"prepublishOnly": "npm run build",
"man:generate": "bun src/man/generate.ts",
"prepublishOnly": "npm run build && npm run man:generate",
"test": "bunx vitest run --config vitest.config.mts --silent='passed-only'",
"test:coverage": "bunx vitest run --config vitest.config.mts --coverage",
"type-check": "tsc --noEmit"
},
"dependencies": {
"devDependencies": {
"@lobechat/device-gateway-client": "workspace:*",
"@lobechat/local-file-shell": "workspace:*",
"@trpc/client": "^11.8.1",
"@types/node": "^22.13.5",
"@types/ws": "^8.18.1",
"commander": "^13.1.0",
"debug": "^4.4.0",
"diff": "^8.0.3",
"fast-glob": "^3.3.3",
"picocolors": "^1.1.1",
"superjson": "^2.2.6",
"tsdown": "^0.21.4",
"typescript": "^5.9.3",
"ws": "^8.18.1"
},
"devDependencies": {
"@lobechat/device-gateway-client": "workspace:*",
"@lobechat/local-file-shell": "workspace:*",
"@types/node": "^22.13.5",
"@types/ws": "^8.18.1",
"tsup": "^8.4.0",
"typescript": "^5.9.3"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
+10 -8
View File
@@ -5,14 +5,15 @@ import { getTrpcClient } from '../api/client';
import { confirm, outputJson, printTable } from '../utils/format';
import { log } from '../utils/logger';
const SUPPORTED_PLATFORMS = ['discord', 'slack', 'telegram', 'lark', 'feishu'];
const SUPPORTED_PLATFORMS = ['discord', 'slack', 'telegram', 'lark', 'feishu', 'wechat'];
const PLATFORM_CREDENTIAL_FIELDS: Record<string, string[]> = {
discord: ['botToken', 'publicKey'],
feishu: ['appId', 'appSecret'],
lark: ['appId', 'appSecret'],
feishu: ['appSecret'],
lark: ['appSecret'],
slack: ['botToken', 'signingSecret'],
telegram: ['botToken'],
wechat: ['botToken', 'botId'],
};
function parseCredentials(
@@ -22,15 +23,11 @@ function parseCredentials(
const creds: Record<string, string> = {};
if (options.botToken) creds.botToken = options.botToken;
if (options.botId) creds.botId = options.botId;
if (options.publicKey) creds.publicKey = options.publicKey;
if (options.signingSecret) creds.signingSecret = options.signingSecret;
if (options.appSecret) creds.appSecret = options.appSecret;
// For lark/feishu, --app-id maps to credentials.appId (distinct from --app-id as applicationId)
if ((platform === 'lark' || platform === 'feishu') && options.appId) {
creds.appId = options.appId;
}
return creds;
}
@@ -130,6 +127,7 @@ export function registerBotCommand(program: Command) {
.requiredOption('--platform <platform>', `Platform: ${SUPPORTED_PLATFORMS.join(', ')}`)
.requiredOption('--app-id <appId>', 'Application ID for webhook routing')
.option('--bot-token <token>', 'Bot token')
.option('--bot-id <id>', 'Bot ID (WeChat)')
.option('--public-key <key>', 'Public key (Discord)')
.option('--signing-secret <secret>', 'Signing secret (Slack)')
.option('--app-secret <secret>', 'App secret (Lark/Feishu)')
@@ -138,6 +136,7 @@ export function registerBotCommand(program: Command) {
agent: string;
appId: string;
appSecret?: string;
botId?: string;
botToken?: string;
platform: string;
publicKey?: string;
@@ -180,6 +179,7 @@ export function registerBotCommand(program: Command) {
.command('update <botId>')
.description('Update a bot integration')
.option('--bot-token <token>', 'New bot token')
.option('--bot-id <id>', 'New bot ID (WeChat)')
.option('--public-key <key>', 'New public key')
.option('--signing-secret <secret>', 'New signing secret')
.option('--app-secret <secret>', 'New app secret')
@@ -191,6 +191,7 @@ export function registerBotCommand(program: Command) {
options: {
appId?: string;
appSecret?: string;
botId?: string;
botToken?: string;
platform?: string;
publicKey?: string;
@@ -201,6 +202,7 @@ export function registerBotCommand(program: Command) {
const credentials: Record<string, string> = {};
if (options.botToken) credentials.botToken = options.botToken;
if (options.botId) credentials.botId = options.botId;
if (options.publicKey) credentials.publicKey = options.publicKey;
if (options.signingSecret) credentials.signingSecret = options.signingSecret;
if (options.appSecret) credentials.appSecret = options.appSecret;
+102
View File
@@ -0,0 +1,102 @@
import { Command } from 'commander';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { registerCompletionCommand } from './completion';
describe('completion command', () => {
let consoleSpy: ReturnType<typeof vi.spyOn>;
const originalShell = process.env.SHELL;
beforeEach(() => {
consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
});
afterEach(() => {
consoleSpy.mockRestore();
delete process.env.LOBEHUB_COMP_CWORD;
process.env.SHELL = originalShell;
});
function createProgram() {
const program = new Command();
program.exitOverride();
program
.command('agent')
.description('Agent commands')
.command('list')
.description('List agents');
program.command('generate').alias('gen').description('Generate content');
program.command('usage').description('Usage').option('--month <YYYY-MM>', 'Month to query');
program.command('internal', { hidden: true });
registerCompletionCommand(program);
return program;
}
it('should output zsh completion script by default', async () => {
process.env.SHELL = '/bin/zsh';
const program = createProgram();
await program.parseAsync(['node', 'test', 'completion']);
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('compdef _lobehub_completion'));
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('lh lobe lobehub'));
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('"${(@)words[@]:1}"'));
});
it('should output bash completion script when requested', async () => {
const program = createProgram();
await program.parseAsync(['node', 'test', 'completion', 'bash']);
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('complete -o nosort'));
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('__complete'));
});
it('should suggest root commands and aliases', async () => {
process.env.LOBEHUB_COMP_CWORD = '0';
const program = createProgram();
await program.parseAsync(['node', 'test', '__complete', 'g']);
expect(consoleSpy.mock.calls.map(([value]) => value)).toEqual(['gen', 'generate']);
});
it('should suggest nested subcommands in the current command context', async () => {
process.env.LOBEHUB_COMP_CWORD = '1';
const program = createProgram();
await program.parseAsync(['node', 'test', '__complete', 'agent']);
expect(consoleSpy).toHaveBeenCalledWith('list');
});
it('should suggest command options after leaf commands', async () => {
process.env.LOBEHUB_COMP_CWORD = '1';
const program = createProgram();
await program.parseAsync(['node', 'test', '__complete', 'usage']);
expect(consoleSpy).toHaveBeenCalledWith('--month');
});
it('should not suggest commands while completing an option value', async () => {
process.env.LOBEHUB_COMP_CWORD = '2';
const program = createProgram();
await program.parseAsync(['node', 'test', '__complete', 'usage', '--month']);
expect(consoleSpy).not.toHaveBeenCalled();
});
it('should not expose hidden commands', async () => {
process.env.LOBEHUB_COMP_CWORD = '0';
const program = createProgram();
await program.parseAsync(['node', 'test', '__complete']);
expect(consoleSpy.mock.calls.map(([value]) => value)).not.toContain('internal');
expect(consoleSpy.mock.calls.map(([value]) => value)).not.toContain('__complete');
});
});
+30
View File
@@ -0,0 +1,30 @@
import type { Command } from 'commander';
import {
getCompletionCandidates,
parseCompletionWordIndex,
renderCompletionScript,
resolveCompletionShell,
} from '../utils/completion';
export function registerCompletionCommand(program: Command) {
program
.command('completion [shell]')
.description('Output shell completion script')
.action((shell?: string) => {
console.log(renderCompletionScript(resolveCompletionShell(shell)));
});
program
.command('__complete', { hidden: true })
.allowUnknownOption()
.argument('[words...]')
.action((words: string[] = []) => {
const currentWordIndex = parseCompletionWordIndex(process.env.LOBEHUB_COMP_CWORD, words);
const candidates = getCompletionCandidates(program, words, currentWordIndex);
for (const candidate of candidates) {
console.log(candidate);
}
});
}
+85
View File
@@ -0,0 +1,85 @@
import { Command } from 'commander';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { registerManCommand } from './man';
describe('man command', () => {
let consoleSpy: ReturnType<typeof vi.spyOn>;
beforeEach(() => {
consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
});
afterEach(() => {
consoleSpy.mockRestore();
});
function createProgram() {
const program = new Command();
program.name('lh').description('Sample CLI').version('1.0.0');
const generate = program
.command('generate')
.alias('gen')
.description('Generate content')
.option('-m, --model <model>', 'Model to use');
generate
.command('text <prompt>')
.description('Generate text from a prompt')
.option('--json', 'Output raw JSON');
program.command('login').description('Log in to LobeHub');
registerManCommand(program);
program.exitOverride();
return program;
}
it('renders a manual page for the root command', async () => {
const program = createProgram();
await program.parseAsync(['node', 'test', 'man']);
const output = consoleSpy.mock.calls.at(0)?.[0];
expect(output).toContain('LH(1)');
expect(output).toContain('NAME\n lh - Sample CLI');
expect(output).toContain('ALIASES\n lobe, lobehub');
expect(output).toContain('SYNOPSIS\n lh [options] [command]');
expect(output).toContain('generate|gen [options] [command]');
expect(output).toContain('man [options] [command...]');
});
it('renders a manual page for a command with subcommands', async () => {
const program = createProgram();
await program.parseAsync(['node', 'test', 'man', 'generate']);
const output = consoleSpy.mock.calls.at(0)?.[0];
expect(output).toContain('LH-GENERATE(1)');
expect(output).toContain('NAME\n lh generate - Generate content');
expect(output).toContain('ALIASES\n gen');
expect(output).toContain('SYNOPSIS\n lh generate [options] [command]');
expect(output).toContain('text [options] <prompt>');
expect(output).toContain('-m, --model <model>');
});
it('renders arguments for a leaf command', async () => {
const program = createProgram();
await program.parseAsync(['node', 'test', 'man', 'generate', 'text']);
const output = consoleSpy.mock.calls.at(0)?.[0];
expect(output).toContain('LH-GENERATE-TEXT(1)');
expect(output).toContain('NAME\n lh generate text - Generate text from a prompt');
expect(output).toContain('ARGUMENTS');
expect(output).toContain('<prompt>');
expect(output).toContain('Required argument');
expect(output).toContain('SEE ALSO');
});
});
+212
View File
@@ -0,0 +1,212 @@
import type { Argument, Command } from 'commander';
const ROOT_ALIASES = ['lobe', 'lobehub'];
const HELP_COMMAND_NAME = 'help';
interface DefinitionItem {
description: string;
term: string;
}
interface ResolutionResult {
command?: Command;
error?: string;
}
export function registerManCommand(program: Command) {
program
.command('man [command...]')
.description('Show a manual page for the CLI or a subcommand')
.action((commandPath: string[] | undefined) => {
const segments = commandPath ?? [];
const resolution = resolveCommandPath(program, segments);
if (!resolution.command) {
program.error(resolution.error || 'Unknown command path.');
return;
}
console.log(renderManualPage(program, resolution.command));
});
}
function resolveCommandPath(root: Command, segments: string[]): ResolutionResult {
let current = root;
for (const segment of segments) {
const next = getVisibleCommands(current).find(
(command) => command.name() === segment || command.aliases().includes(segment),
);
if (!next) {
const currentPath = buildCommandPath(current).join(' ');
const available = getVisibleCommands(current)
.map((command) => command.name())
.join(', ');
return {
error: `Unknown command "${segment}" under "${currentPath}". Available: ${available || 'none'}.`,
};
}
current = next;
}
return { command: current };
}
function renderManualPage(root: Command, command: Command) {
const sections = [
formatManualHeader(command),
formatNameSection(command),
formatSynopsisSection(root, command),
formatAliasesSection(command),
formatDescriptionSection(command),
formatArgumentsSection(command),
formatCommandsSection(command),
formatOptionsSection(command),
formatSeeAlsoSection(root, command),
].filter(Boolean);
return sections.join('\n\n');
}
function formatManualHeader(command: Command) {
return `${buildCommandPath(command).join('-').toUpperCase()}(1)`;
}
function formatNameSection(command: Command) {
return ['NAME', ` ${buildCommandPath(command).join(' ')} - ${command.description()}`].join('\n');
}
function formatSynopsisSection(root: Command, command: Command) {
return ['SYNOPSIS', ` ${buildSynopsis(root, command)}`].join('\n');
}
function formatAliasesSection(command: Command) {
const aliases = command.parent ? command.aliases() : ROOT_ALIASES;
if (aliases.length === 0) return '';
return ['ALIASES', ` ${aliases.join(', ')}`].join('\n');
}
function formatDescriptionSection(command: Command) {
const description = command.description() || 'No description available.';
return ['DESCRIPTION', ` ${description}`].join('\n');
}
function formatArgumentsSection(command: Command) {
if (command.registeredArguments.length === 0) return '';
const items = command.registeredArguments.map((argument) => ({
description: describeArgument(argument),
term: formatArgumentTerm(argument),
}));
return ['ARGUMENTS', ...formatDefinitionList(items)].join('\n');
}
function formatCommandsSection(command: Command) {
const help = command.createHelp();
const items = getVisibleCommands(command).map((subcommand) => ({
description: help.subcommandDescription(subcommand),
term: buildSubcommandTerm(subcommand),
}));
if (items.length === 0) return '';
return ['COMMANDS', ...formatDefinitionList(items)].join('\n');
}
function formatOptionsSection(command: Command) {
const help = command.createHelp();
const items = help.visibleOptions(command).map((option) => ({
description: help.optionDescription(option),
term: help.optionTerm(option),
}));
if (items.length === 0) return '';
return ['OPTIONS', ...formatDefinitionList(items)].join('\n');
}
function formatSeeAlsoSection(root: Command, command: Command) {
const items = new Set<string>();
const currentPath = buildCommandPath(command);
items.add(`${currentPath.join(' ')} --help`);
const parent = command.parent;
if (parent) {
const parentPath = buildCommandPath(parent).slice(1).join(' ');
items.add(parentPath ? `lh man ${parentPath}` : 'lh man');
}
for (const subcommand of getVisibleCommands(command).slice(0, 5)) {
items.add(`lh man ${buildCommandPath(subcommand).slice(1).join(' ')}`);
}
return ['SEE ALSO', ...Array.from(items).map((item) => ` ${item}`)].join('\n');
}
function getVisibleCommands(command: Command) {
const help = command.createHelp();
return help
.visibleCommands(command)
.filter((subcommand) => subcommand.name() !== HELP_COMMAND_NAME);
}
function buildSynopsis(root: Command, command: Command) {
const path = buildCommandPath(command);
if (command === root) {
return `${path[0]} ${command.usage()}`.trim();
}
return `${path.join(' ')} ${command.usage()}`.trim();
}
function buildCommandPath(command: Command): string[] {
const path: string[] = [];
let current: Command | null = command;
while (current) {
path.unshift(current.name());
current = current.parent || null;
}
return path;
}
function buildSubcommandTerm(command: Command) {
const name = [command.name(), ...command.aliases()].join('|');
const usage = command.usage();
return usage ? `${name} ${usage}` : name;
}
function formatDefinitionList(items: DefinitionItem[]) {
const width = Math.max(...items.map((item) => item.term.length));
return items.map((item) => ` ${item.term.padEnd(width)} ${item.description}`);
}
function formatArgumentTerm(argument: Argument) {
const name = argument.name();
if (argument.required) {
return argument.variadic ? `<${name}...>` : `<${name}>`;
}
return argument.variadic ? `[${name}...]` : `[${name}]`;
}
function describeArgument(argument: Argument) {
const required = argument.required ? 'Required' : 'Optional';
const variadic = argument.variadic ? 'variadic ' : '';
return `${required} ${variadic}argument`;
}
+2 -68
View File
@@ -1,69 +1,3 @@
import { createRequire } from 'node:module';
import { createProgram } from './program';
import { Command } from 'commander';
import { registerAgentCommand } from './commands/agent';
import { registerAgentGroupCommand } from './commands/agent-group';
import { registerBotCommand } from './commands/bot';
import { registerConfigCommand } from './commands/config';
import { registerConnectCommand } from './commands/connect';
import { registerCronCommand } from './commands/cron';
import { registerDeviceCommand } from './commands/device';
import { registerDocCommand } from './commands/doc';
import { registerEvalCommand } from './commands/eval';
import { registerFileCommand } from './commands/file';
import { registerGenerateCommand } from './commands/generate';
import { registerKbCommand } from './commands/kb';
import { registerLoginCommand } from './commands/login';
import { registerLogoutCommand } from './commands/logout';
import { registerMemoryCommand } from './commands/memory';
import { registerMessageCommand } from './commands/message';
import { registerModelCommand } from './commands/model';
import { registerPluginCommand } from './commands/plugin';
import { registerProviderCommand } from './commands/provider';
import { registerSearchCommand } from './commands/search';
import { registerSessionGroupCommand } from './commands/session-group';
import { registerSkillCommand } from './commands/skill';
import { registerStatusCommand } from './commands/status';
import { registerThreadCommand } from './commands/thread';
import { registerTopicCommand } from './commands/topic';
import { registerUserCommand } from './commands/user';
const require = createRequire(import.meta.url);
const { version } = require('../package.json');
const program = new Command();
program
.name('lh')
.description('LobeHub CLI - manage and connect to LobeHub services')
.version(version);
registerLoginCommand(program);
registerLogoutCommand(program);
registerConnectCommand(program);
registerDeviceCommand(program);
registerStatusCommand(program);
registerDocCommand(program);
registerSearchCommand(program);
registerKbCommand(program);
registerMemoryCommand(program);
registerAgentCommand(program);
registerAgentGroupCommand(program);
registerBotCommand(program);
registerCronCommand(program);
registerGenerateCommand(program);
registerFileCommand(program);
registerSkillCommand(program);
registerSessionGroupCommand(program);
registerThreadCommand(program);
registerTopicCommand(program);
registerMessageCommand(program);
registerModelCommand(program);
registerProviderCommand(program);
registerPluginCommand(program);
registerUserCommand(program);
registerConfigCommand(program);
registerEvalCommand(program);
program.parse();
createProgram().parse();
+17
View File
@@ -0,0 +1,17 @@
import { mkdir, writeFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { cliVersion, createProgram } from '../program';
import { generateAliasManPage, generateRootManPage } from './roff';
const outputDir = fileURLToPath(new URL('../../man/man1/', import.meta.url));
await mkdir(outputDir, { recursive: true });
const program = createProgram();
await Promise.all([
writeFile(`${outputDir}lh.1`, generateRootManPage(program, cliVersion)),
writeFile(`${outputDir}lobe.1`, generateAliasManPage('lh')),
writeFile(`${outputDir}lobehub.1`, generateAliasManPage('lh')),
]);
+28
View File
@@ -0,0 +1,28 @@
import { Command } from 'commander';
import { describe, expect, it } from 'vitest';
import { generateAliasManPage, generateRootManPage } from './roff';
describe('roff manual generator', () => {
it('renders a root man page from the command tree', () => {
const program = new Command();
program.name('lh').description('Sample CLI').version('1.0.0');
program.command('generate').alias('gen').description('Generate content');
program.command('login').description('Log in');
const output = generateRootManPage(program, '1.2.3');
expect(output).toContain('.TH LH 1 "" "@lobehub/cli 1.2.3" "User Commands"');
expect(output).toContain('.SH COMMANDS');
expect(output).toContain('.B generate');
expect(output).toContain('Generate content Alias: gen.');
expect(output).toContain('.B login');
expect(output).toContain('.SH OPTIONS');
});
it('renders alias man pages as so links', () => {
expect(generateAliasManPage('lh')).toBe('.so man1/lh.1\n');
});
});
+148
View File
@@ -0,0 +1,148 @@
import type { Command } from 'commander';
const ROOT_ALIASES = ['lobe', 'lobehub'];
const HELP_COMMAND_NAME = 'help';
interface RoffDefinition {
description: string;
term: string;
}
const FILE_ENTRIES = [
{
description: 'Encrypted access and refresh tokens.',
path: '~/.lobehub/credentials.json',
},
{
description: 'CLI settings such as server and gateway URLs.',
path: '~/.lobehub/settings.json',
},
{
description: 'Background daemon PID file.',
path: '~/.lobehub/daemon.pid',
},
{
description: 'Background daemon status metadata.',
path: '~/.lobehub/daemon.status',
},
{
description: 'Background daemon log output.',
path: '~/.lobehub/daemon.log',
},
] as const;
const EXAMPLES = [
{
command: 'lh login',
description: 'Start interactive login in the browser.',
},
{
command: 'lh connect --daemon',
description: 'Start the device gateway connection in the background.',
},
{
command: 'lh search -q "gpt-5"',
description: 'Search local resources for a query.',
},
{
command: 'lh generate text "Write release notes"',
description: 'Generate text from a prompt.',
},
{
command: 'lh man generate',
description: 'Show the built-in manual for the generate command group.',
},
] as const;
export function generateRootManPage(program: Command, version: string) {
const help = program.createHelp();
const commands = getVisibleCommands(program).map((command) => ({
description: formatCommandDescription(help.subcommandDescription(command), command.aliases()),
term: command.name(),
}));
const options = help.visibleOptions(program).map((option) => ({
description: help.optionDescription(option),
term: help.optionTerm(option),
}));
const lines = [
'.\\" Code generated by `npm run man:generate`; DO NOT EDIT.',
'.\\" Manual command details come from the Commander command tree.',
`.TH LH 1 "" "${escapeRoff(`@lobehub/cli ${version}`)}" "User Commands"`,
'.SH NAME',
`lh \\- ${escapeRoff(program.description() || 'LobeHub CLI')}`,
'.SH SYNOPSIS',
...formatSynopsisLines(),
'.SH DESCRIPTION',
escapeRoff(
`${program.name()} is the command-line interface for LobeHub. It provides authentication, device gateway connectivity, content generation, resource search, and management commands for agents, files, models, providers, plugins, knowledge bases, threads, topics, and related resources.`,
),
'.PP',
'For command-specific manuals, use the built-in manual command:',
'.PP',
'.RS',
'.B lh man',
'[\\fICOMMAND\\fR]...',
'.RE',
'.SH COMMANDS',
...formatDefinitionSection(commands, 'B'),
'.SH OPTIONS',
...formatDefinitionSection(options, 'B'),
'.SH FILES',
...FILE_ENTRIES.flatMap((entry) => [
'.TP',
`.I ${escapeRoff(entry.path)}`,
escapeRoff(entry.description),
]),
'.PP',
'The base directory can be overridden with the',
'.B LOBEHUB_CLI_HOME',
'environment variable.',
'.SH EXAMPLES',
...EXAMPLES.flatMap((example) => [
'.TP',
`.B ${escapeRoff(example.command)}`,
escapeRoff(example.description),
]),
'.SH SEE ALSO',
'.BR lobe (1),',
'.BR lobehub (1)',
];
return `${lines.join('\n')}\n`;
}
export function generateAliasManPage(target: string) {
return `.so man1/${target}.1\n`;
}
function formatSynopsisLines() {
return ['lh', ...ROOT_ALIASES]
.flatMap((binary) => [`.B ${binary}`, '[\\fIOPTION\\fR]...', '[\\fICOMMAND\\fR]', '.br'])
.slice(0, -1);
}
function getVisibleCommands(command: Command) {
return command
.createHelp()
.visibleCommands(command)
.filter((subcommand) => subcommand.name() !== HELP_COMMAND_NAME);
}
function formatCommandDescription(description: string, aliases: string[]) {
if (aliases.length === 0) return description;
return `${description} Alias: ${aliases.join(', ')}.`;
}
function formatDefinitionSection(items: RoffDefinition[], macro: 'B' | 'I') {
return items.flatMap((item) => [
'.TP',
`.${macro} ${escapeRoff(item.term)}`,
escapeRoff(item.description),
]);
}
function escapeRoff(value: string) {
return value.replaceAll('\\', '\\\\').replaceAll('-', '\\-');
}
+77
View File
@@ -0,0 +1,77 @@
import { createRequire } from 'node:module';
import { Command } from 'commander';
import { registerAgentCommand } from './commands/agent';
import { registerAgentGroupCommand } from './commands/agent-group';
import { registerBotCommand } from './commands/bot';
import { registerCompletionCommand } from './commands/completion';
import { registerConfigCommand } from './commands/config';
import { registerConnectCommand } from './commands/connect';
import { registerCronCommand } from './commands/cron';
import { registerDeviceCommand } from './commands/device';
import { registerDocCommand } from './commands/doc';
import { registerEvalCommand } from './commands/eval';
import { registerFileCommand } from './commands/file';
import { registerGenerateCommand } from './commands/generate';
import { registerKbCommand } from './commands/kb';
import { registerLoginCommand } from './commands/login';
import { registerLogoutCommand } from './commands/logout';
import { registerManCommand } from './commands/man';
import { registerMemoryCommand } from './commands/memory';
import { registerMessageCommand } from './commands/message';
import { registerModelCommand } from './commands/model';
import { registerPluginCommand } from './commands/plugin';
import { registerProviderCommand } from './commands/provider';
import { registerSearchCommand } from './commands/search';
import { registerSessionGroupCommand } from './commands/session-group';
import { registerSkillCommand } from './commands/skill';
import { registerStatusCommand } from './commands/status';
import { registerThreadCommand } from './commands/thread';
import { registerTopicCommand } from './commands/topic';
import { registerUserCommand } from './commands/user';
const require = createRequire(import.meta.url);
const { version } = require('../package.json');
export function createProgram() {
const program = new Command();
program
.name('lh')
.description('LobeHub CLI - manage and connect to LobeHub services')
.version(version);
registerLoginCommand(program);
registerLogoutCommand(program);
registerCompletionCommand(program);
registerManCommand(program);
registerConnectCommand(program);
registerDeviceCommand(program);
registerStatusCommand(program);
registerDocCommand(program);
registerSearchCommand(program);
registerKbCommand(program);
registerMemoryCommand(program);
registerAgentCommand(program);
registerAgentGroupCommand(program);
registerBotCommand(program);
registerCronCommand(program);
registerGenerateCommand(program);
registerFileCommand(program);
registerSkillCommand(program);
registerSessionGroupCommand(program);
registerThreadCommand(program);
registerTopicCommand(program);
registerMessageCommand(program);
registerModelCommand(program);
registerProviderCommand(program);
registerPluginCommand(program);
registerUserCommand(program);
registerConfigCommand(program);
registerEvalCommand(program);
return program;
}
export { version as cliVersion };
+157
View File
@@ -0,0 +1,157 @@
import type { Command, Option } from 'commander';
import { InvalidArgumentError } from 'commander';
const CLI_BIN_NAMES = ['lh', 'lobe', 'lobehub'] as const;
const SUPPORTED_SHELLS = ['bash', 'zsh'] as const;
type SupportedShell = (typeof SUPPORTED_SHELLS)[number];
interface HiddenCommand extends Command {
_hidden?: boolean;
}
interface HiddenOption extends Option {
hidden: boolean;
}
function isVisibleCommand(command: Command) {
return !(command as HiddenCommand)._hidden;
}
function isVisibleOption(option: Option) {
return !(option as HiddenOption).hidden;
}
function listCommandTokens(command: Command) {
return [command.name(), ...command.aliases()].filter(Boolean);
}
function listOptionTokens(command: Command) {
return command.options
.filter(isVisibleOption)
.flatMap((option) => [option.short, option.long].filter(Boolean) as string[]);
}
function findSubcommand(command: Command, token: string) {
return command.commands.find(
(subcommand) => isVisibleCommand(subcommand) && listCommandTokens(subcommand).includes(token),
);
}
function findOption(command: Command, token: string) {
return command.options.find(
(option) =>
isVisibleOption(option) && (option.short === token || option.long === token || false),
);
}
function filterCandidates(candidates: string[], currentWord: string) {
const unique = [...new Set(candidates)];
if (!currentWord) return unique.sort();
return unique.filter((candidate) => candidate.startsWith(currentWord)).sort();
}
function resolveCommandContext(program: Command, completedWords: string[]) {
let command = program;
let expectsOptionValue = false;
for (const token of completedWords) {
if (expectsOptionValue) {
expectsOptionValue = false;
continue;
}
if (!token) continue;
if (token.startsWith('-')) {
const option = findOption(command, token);
expectsOptionValue = Boolean(
option && (option.required || option.optional || option.variadic),
);
continue;
}
const subcommand = findSubcommand(command, token);
if (subcommand) {
command = subcommand;
}
}
return { command, expectsOptionValue };
}
export function getCompletionCandidates(
program: Command,
words: string[],
currentWordIndex = words.length,
) {
const safeCurrentWordIndex = Math.min(Math.max(currentWordIndex, 0), words.length);
const completedWords = words.slice(0, safeCurrentWordIndex);
const currentWord = safeCurrentWordIndex < words.length ? words[safeCurrentWordIndex] || '' : '';
const { command, expectsOptionValue } = resolveCommandContext(program, completedWords);
if (expectsOptionValue) return [];
const commandCandidates = currentWord.startsWith('-')
? []
: command.commands
.filter(isVisibleCommand)
.flatMap((subcommand) => listCommandTokens(subcommand));
if (commandCandidates.length > 0) {
return filterCandidates(commandCandidates, currentWord);
}
return filterCandidates(listOptionTokens(command), currentWord);
}
export function parseCompletionWordIndex(rawValue: string | undefined, words: string[]) {
const parsedValue = rawValue ? Number.parseInt(rawValue, 10) : Number.NaN;
if (Number.isNaN(parsedValue)) return words.length;
return Math.min(Math.max(parsedValue, 0), words.length);
}
export function resolveCompletionShell(shell?: string): SupportedShell {
const fallbackShell = process.env.SHELL?.split('/').pop() || 'zsh';
const resolvedShell = (shell || fallbackShell).toLowerCase();
if ((SUPPORTED_SHELLS as readonly string[]).includes(resolvedShell)) {
return resolvedShell as SupportedShell;
}
throw new InvalidArgumentError(
`Unsupported shell "${resolvedShell}". Supported shells: ${SUPPORTED_SHELLS.join(', ')}`,
);
}
export function renderCompletionScript(shell: SupportedShell) {
if (shell === 'bash') {
return [
'# shellcheck shell=bash',
'_lobehub_completion() {',
" local IFS=$'\\n'",
' local current_index=$((COMP_CWORD - 1))',
' local completions',
' completions=$(LOBEHUB_COMP_CWORD="$current_index" "${COMP_WORDS[0]}" __complete "${COMP_WORDS[@]:1}")',
' COMPREPLY=($(printf \'%s\\n\' "$completions"))',
'}',
`complete -o nosort -F _lobehub_completion ${CLI_BIN_NAMES.join(' ')}`,
].join('\n');
}
return [
`#compdef ${CLI_BIN_NAMES.join(' ')}`,
'_lobehub_completion() {',
' local -a completions',
' local current_index=$((CURRENT - 2))',
' completions=("${(@f)$(LOBEHUB_COMP_CWORD="$current_index" "$words[1]" __complete "${(@)words[@]:1}")}")',
" _describe 'values' completions",
'}',
`compdef _lobehub_completion ${CLI_BIN_NAMES.join(' ')}`,
].join('\n');
}
+14
View File
@@ -0,0 +1,14 @@
import { defineConfig } from 'tsdown';
export default defineConfig({
banner: { js: '#!/usr/bin/env node' },
clean: true,
deps: {
neverBundle: ['@napi-rs/canvas'],
},
entry: ['src/index.ts'],
fixedExtension: false,
format: ['esm'],
platform: 'node',
target: 'node18',
});
-18
View File
@@ -1,18 +0,0 @@
import { defineConfig } from 'tsup';
export default defineConfig({
banner: { js: '#!/usr/bin/env node' },
clean: true,
entry: ['src/index.ts'],
external: ['@napi-rs/canvas', 'fast-glob', 'diff', 'debug'],
format: ['esm'],
noExternal: [
'@lobechat/device-gateway-client',
'@lobechat/local-file-shell',
'@lobechat/file-loaders',
'@trpc/client',
'superjson',
],
platform: 'node',
target: 'node18',
});
+19 -11
View File
@@ -1,4 +1,5 @@
import { resolve } from 'node:path';
import { readFileSync } from 'node:fs';
import path from 'node:path';
import dotenv from 'dotenv';
import { defineConfig } from 'electron-vite';
@@ -34,11 +35,14 @@ function electronDesktopHtmlPlugin(): PluginOption {
dotenv.config();
const isDev = process.env.NODE_ENV === 'development';
const ROOT_DIR = resolve(__dirname, '../..');
const ROOT_DIR = path.resolve(__dirname, '../..');
const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
Object.assign(process.env, loadEnv(mode, ROOT_DIR, ''));
const updateChannel = process.env.UPDATE_CHANNEL;
const desktopPackageJson = JSON.parse(
readFileSync(path.resolve(__dirname, 'package.json'), 'utf8'),
) as { version: string };
console.info(`[electron-vite.config.ts] Detected UPDATE_CHANNEL: ${updateChannel}`);
@@ -48,8 +52,9 @@ export default defineConfig({
minify: !isDev,
outDir: 'dist/main',
rollupOptions: {
// Native modules must be externalized to work correctly
external: getExternalDependencies(),
// Native modules must be externalized to work correctly.
// bufferutil and utf-8-validate are optional peer deps of ws that may not be installed.
external: [...getExternalDependencies(), 'bufferutil', 'utf-8-validate'],
output: {
// Prevent debug package from being bundled into index.js to avoid side-effect pollution
manualChunks(id) {
@@ -74,8 +79,8 @@ export default defineConfig({
},
resolve: {
alias: {
'@': resolve(__dirname, 'src/main'),
'~common': resolve(__dirname, 'src/common'),
'@': path.resolve(__dirname, 'src/main'),
'~common': path.resolve(__dirname, 'src/common'),
},
},
},
@@ -88,21 +93,24 @@ export default defineConfig({
resolve: {
alias: {
'@': resolve(__dirname, 'src/main'),
'~common': resolve(__dirname, 'src/common'),
'@': path.resolve(__dirname, 'src/main'),
'~common': path.resolve(__dirname, 'src/common'),
},
},
},
renderer: {
root: ROOT_DIR,
build: {
outDir: resolve(__dirname, 'dist/renderer'),
outDir: path.resolve(__dirname, 'dist/renderer'),
rollupOptions: {
input: resolve(__dirname, 'index.html'),
input: path.resolve(__dirname, 'index.html'),
output: sharedRollupOutput,
},
},
define: sharedRendererDefine({ isMobile: false, isElectron: true }),
define: {
...sharedRendererDefine({ isMobile: false, isElectron: true }),
__MAIN_VERSION__: JSON.stringify(desktopPackageJson.version),
},
optimizeDeps: sharedOptimizeDeps,
plugins: [
electronDesktopHtmlPlugin(),
+2 -1
View File
@@ -50,6 +50,7 @@
"@electron-toolkit/tsconfig": "^2.0.0",
"@electron-toolkit/utils": "^4.0.0",
"@lobechat/desktop-bridge": "workspace:*",
"@lobechat/device-gateway-client": "workspace:*",
"@lobechat/electron-client-ipc": "workspace:*",
"@lobechat/electron-server-ipc": "workspace:*",
"@lobechat/file-loaders": "workspace:*",
@@ -66,7 +67,7 @@
"consola": "^3.4.2",
"cookie": "^1.1.1",
"cross-env": "^10.1.0",
"diff": "^8.0.2",
"diff": "^8.0.4",
"electron": "41.0.2",
"electron-builder": "^26.8.1",
"electron-devtools-installer": "4.0.0",
+1
View File
@@ -3,5 +3,6 @@ packages:
- '../../packages/electron-client-ipc'
- '../../packages/file-loaders'
- '../../packages/desktop-bridge'
- '../../packages/device-gateway-client'
- '../../packages/local-file-shell'
- '.'
+2
View File
@@ -28,6 +28,8 @@ export const defaultProxySettings: NetworkProxySettings = {
export const STORE_DEFAULTS: ElectronMainStore = {
dataSyncConfig: { storageMode: 'cloud' },
encryptedTokens: {},
gatewayDeviceId: '',
gatewayUrl: 'https://device-gateway.lobehub.com',
locale: 'auto',
networkProxy: defaultProxySettings,
shortcuts: DEFAULT_SHORTCUTS_CONFIG,
+19 -2
View File
@@ -9,6 +9,7 @@ import type {
} from '@lobechat/electron-client-ipc';
import { BrowserWindow, shell } from 'electron';
import GatewayConnectionService from '@/services/gatewayConnectionSrv';
import { appendVercelCookie } from '@/utils/http-headers';
import { createLogger } from '@/utils/logger';
@@ -43,14 +44,14 @@ export default class AuthCtr extends ControllerModule {
/**
* Polling related parameters
*/
private pollingInterval: NodeJS.Timeout | null = null;
private cachedRemoteUrl: string | null = null;
/**
* Auto-refresh timer
*/
private autoRefreshTimer: NodeJS.Timeout | null = null;
/**
@@ -531,6 +532,9 @@ export default class AuthCtr extends ControllerModule {
// Start auto-refresh timer
this.startAutoRefresh();
// Connect to device gateway after successful login
this.connectGateway();
return { success: true };
} catch (error) {
logger.error('Exchanging authorization code failed:', error);
@@ -538,6 +542,19 @@ export default class AuthCtr extends ControllerModule {
}
}
/**
* Connect to device gateway (fire-and-forget)
*/
private connectGateway() {
const gatewaySrv = this.app.getService(GatewayConnectionService);
if (gatewaySrv) {
logger.info('Triggering gateway connection after login');
gatewaySrv.connect().catch((error) => {
logger.error('Gateway connection after login failed:', error);
});
}
}
/**
* Broadcast token refreshed event
*/
@@ -0,0 +1,120 @@
import type { GatewayConnectionStatus } from '@lobechat/electron-client-ipc';
import GatewayConnectionService from '@/services/gatewayConnectionSrv';
import { ControllerModule, IpcMethod } from './index';
import LocalFileCtr from './LocalFileCtr';
import RemoteServerConfigCtr from './RemoteServerConfigCtr';
import ShellCommandCtr from './ShellCommandCtr';
/**
* GatewayConnectionCtr
*
* Thin IPC layer that delegates to GatewayConnectionService.
*/
export default class GatewayConnectionCtr extends ControllerModule {
static override readonly groupName = 'gatewayConnection';
// ─── Service Accessor ───
private get service() {
return this.app.getService(GatewayConnectionService);
}
private get remoteServerConfigCtr() {
return this.app.getController(RemoteServerConfigCtr);
}
private get localFileCtr() {
return this.app.getController(LocalFileCtr);
}
private get shellCommandCtr() {
return this.app.getController(ShellCommandCtr);
}
// ─── Lifecycle ───
afterAppReady() {
const srv = this.service;
srv.loadOrCreateDeviceId();
// Wire up token provider and refresher
srv.setTokenProvider(() => this.remoteServerConfigCtr.getAccessToken());
srv.setTokenRefresher(() => this.remoteServerConfigCtr.refreshAccessToken());
// Wire up tool call handler
srv.setToolCallHandler((apiName, args) => this.executeToolCall(apiName, args));
// Auto-connect if already logged in
this.tryAutoConnect();
}
// ─── IPC Methods (Renderer → Main) ───
@IpcMethod()
async connect(): Promise<{ error?: string; success: boolean }> {
return this.service.connect();
}
@IpcMethod()
async disconnect(): Promise<{ success: boolean }> {
return this.service.disconnect();
}
@IpcMethod()
async getConnectionStatus(): Promise<{ status: GatewayConnectionStatus }> {
return { status: this.service.getStatus() };
}
@IpcMethod()
async getDeviceInfo(): Promise<{
deviceId: string;
hostname: string;
platform: string;
}> {
return this.service.getDeviceInfo();
}
// ─── Auto Connect ───
private async tryAutoConnect() {
const isConfigured = await this.remoteServerConfigCtr.isRemoteServerConfigured();
if (!isConfigured) return;
const token = await this.remoteServerConfigCtr.getAccessToken();
if (!token) return;
await this.service.connect();
}
// ─── Tool Call Routing ───
private async executeToolCall(apiName: string, args: any): Promise<unknown> {
const methodMap: Record<string, () => Promise<unknown>> = {
editLocalFile: () => this.localFileCtr.handleEditFile(args),
globLocalFiles: () => this.localFileCtr.handleGlobFiles(args),
grepContent: () => this.localFileCtr.handleGrepContent(args),
listLocalFiles: () => this.localFileCtr.listLocalFiles(args),
moveLocalFiles: () => this.localFileCtr.handleMoveFiles(args),
readLocalFile: () => this.localFileCtr.readFile(args),
renameLocalFile: () => this.localFileCtr.handleRenameFile(args),
searchLocalFiles: () => this.localFileCtr.handleLocalFilesSearch(args),
writeLocalFile: () => this.localFileCtr.handleWriteFile(args),
getCommandOutput: () => this.shellCommandCtr.handleGetCommandOutput(args),
killCommand: () => this.shellCommandCtr.handleKillCommand(args),
runCommand: () => this.shellCommandCtr.handleRunCommand(args),
};
const handler = methodMap[apiName];
if (!handler) {
throw new Error(
`Tool "${apiName}" is not available on this device. It may not be supported in the current desktop version. Please skip this tool and try alternative approaches.`,
);
}
return handler();
}
}
@@ -6,6 +6,7 @@ import retry from 'async-retry';
import { safeStorage, session as electronSession } from 'electron';
import { OFFICIAL_CLOUD_SERVER } from '@/const/env';
import GatewayConnectionService from '@/services/gatewayConnectionSrv';
import { appendVercelCookie } from '@/utils/http-headers';
import { createLogger } from '@/utils/logger';
@@ -93,10 +94,26 @@ export default class RemoteServerConfigCtr extends ControllerModule {
*/
async isRemoteServerConfigured(config?: DataSyncConfig): Promise<boolean> {
const effectiveConfig = config ?? (await this.getRemoteServerConfig());
return (
effectiveConfig.active &&
(effectiveConfig.storageMode !== 'selfHost' || !!effectiveConfig.remoteServerUrl)
);
const isActive = Boolean(effectiveConfig.active);
const isSelfHostConfigured =
effectiveConfig.storageMode !== 'selfHost' ||
this.isValidSelfHostRemoteUrl(effectiveConfig.remoteServerUrl);
return isActive && isSelfHostConfigured;
}
private isValidSelfHostRemoteUrl(remoteServerUrl?: string): boolean {
if (!remoteServerUrl) return false;
const normalizedUrl = remoteServerUrl.trim();
if (!normalizedUrl) return false;
try {
const parsedUrl = new URL(normalizedUrl);
return parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:';
} catch {
return false;
}
}
/**
@@ -303,6 +320,13 @@ export default class RemoteServerConfigCtr extends ControllerModule {
// Also clear from persistent storage
logger.debug(`Deleting tokens from store key: ${this.encryptedTokensKey}`);
this.app.storeManager.delete(this.encryptedTokensKey);
// Disconnect gateway when tokens are cleared (logout / token refresh failure)
const gatewaySrv = this.app.getService(GatewayConnectionService);
if (gatewaySrv) {
logger.debug('Disconnecting gateway due to token clear');
await gatewaySrv.disconnect();
}
}
/**
@@ -537,7 +561,7 @@ export default class RemoteServerConfigCtr extends ControllerModule {
}
async getRemoteServerUrl(config?: DataSyncConfig) {
const dataConfig = this.normalizeConfig(config ? config : await this.getRemoteServerConfig());
const dataConfig = this.normalizeConfig(config ?? (await this.getRemoteServerConfig()));
return dataConfig.storageMode === 'cloud' ? OFFICIAL_CLOUD_SERVER : dataConfig.remoteServerUrl;
}
@@ -1,4 +1,3 @@
import type { DataSyncConfig } from '@lobechat/electron-client-ipc';
import { BrowserWindow, shell } from 'electron';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -100,6 +99,7 @@ const mockApp = {
}
return null;
}),
getService: vi.fn(() => null),
} as unknown as App;
describe('AuthCtr', () => {
@@ -0,0 +1,562 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { App } from '@/core/App';
import GatewayConnectionService from '@/services/gatewayConnectionSrv';
import GatewayConnectionCtr from '../GatewayConnectionCtr';
import LocalFileCtr from '../LocalFileCtr';
import RemoteServerConfigCtr from '../RemoteServerConfigCtr';
import ShellCommandCtr from '../ShellCommandCtr';
// ─── Mocks ───
const { ipcMainHandleMock, MockGatewayClient } = vi.hoisted(() => {
const { EventEmitter } = require('node:events');
// Must be defined inside vi.hoisted so it's available when vi.mock factories run
class _MockGatewayClient extends EventEmitter {
static lastInstance: _MockGatewayClient | null = null;
static lastOptions: any = null;
connectionStatus = 'disconnected' as string;
currentDeviceId: string;
connect = vi.fn(async () => {
this.connectionStatus = 'connecting';
this.emit('status_changed', 'connecting');
});
disconnect = vi.fn(async () => {
this.connectionStatus = 'disconnected';
});
sendToolCallResponse = vi.fn();
constructor(options: any) {
super();
this.currentDeviceId = options.deviceId || 'mock-device-id';
_MockGatewayClient.lastInstance = this;
_MockGatewayClient.lastOptions = options;
}
// Test helpers
simulateConnected() {
this.connectionStatus = 'connected';
this.emit('status_changed', 'connected');
this.emit('connected');
}
simulateStatusChanged(status: string) {
this.connectionStatus = status;
this.emit('status_changed', status);
}
simulateToolCallRequest(apiName: string, args: object, requestId = 'req-1') {
this.emit('tool_call_request', {
requestId,
toolCall: {
apiName,
arguments: JSON.stringify(args),
identifier: 'test-tool',
},
type: 'tool_call_request',
});
}
simulateAuthExpired() {
this.emit('auth_expired');
}
simulateError(message: string) {
this.emit('error', new Error(message));
}
simulateReconnecting(delay: number) {
this.connectionStatus = 'reconnecting';
this.emit('status_changed', 'reconnecting');
this.emit('reconnecting', delay);
}
}
return {
MockGatewayClient: _MockGatewayClient,
ipcMainHandleMock: vi.fn(),
};
});
vi.mock('electron', () => ({
app: {
getPath: vi.fn((name: string) => `/mock/${name}`),
},
ipcMain: { handle: ipcMainHandleMock },
}));
vi.mock('@/utils/logger', () => ({
createLogger: () => ({
debug: vi.fn(),
error: vi.fn(),
info: vi.fn(),
verbose: vi.fn(),
warn: vi.fn(),
}),
}));
vi.mock('electron-is', () => ({
macOS: vi.fn(() => false),
windows: vi.fn(() => false),
linux: vi.fn(() => false),
}));
vi.mock('@/const/env', () => ({
OFFICIAL_CLOUD_SERVER: 'https://lobehub-cloud.com',
isMac: false,
isWindows: false,
isLinux: false,
isDev: false,
}));
vi.mock('node:crypto', () => ({
randomUUID: vi.fn(() => 'mock-device-uuid'),
}));
vi.mock('node:os', () => ({
default: { hostname: vi.fn(() => 'mock-hostname') },
}));
vi.mock('@lobechat/device-gateway-client', () => ({
GatewayClient: MockGatewayClient,
}));
// ─── Mock Controllers ───
const mockLocalFileCtr = {
handleEditFile: vi.fn().mockResolvedValue({ success: true }),
handleGlobFiles: vi.fn().mockResolvedValue({ files: [] }),
handleGrepContent: vi.fn().mockResolvedValue({ matches: [] }),
handleLocalFilesSearch: vi.fn().mockResolvedValue([]),
handleMoveFiles: vi.fn().mockResolvedValue([]),
handleRenameFile: vi.fn().mockResolvedValue({ newPath: '/mock/renamed.txt', success: true }),
handleWriteFile: vi.fn().mockResolvedValue({ success: true }),
listLocalFiles: vi.fn().mockResolvedValue([]),
readFile: vi.fn().mockResolvedValue({
charCount: 12,
content: 'file content',
createdTime: new Date('2024-01-01'),
filename: 'test.txt',
fileType: '.txt',
lineCount: 1,
loc: [1, 1] as [number, number],
modifiedTime: new Date('2024-01-01'),
totalCharCount: 12,
totalLineCount: 1,
}),
} as unknown as LocalFileCtr;
const mockShellCommandCtr = {
handleGetCommandOutput: vi.fn().mockResolvedValue({ output: '' }),
handleKillCommand: vi.fn().mockResolvedValue({ success: true }),
handleRunCommand: vi.fn().mockResolvedValue({ success: true, stdout: '' }),
} as unknown as ShellCommandCtr;
const mockRemoteServerConfigCtr = {
getAccessToken: vi.fn().mockResolvedValue('mock-access-token'),
isRemoteServerConfigured: vi.fn().mockResolvedValue(true),
refreshAccessToken: vi.fn().mockResolvedValue({ success: true }),
} as unknown as RemoteServerConfigCtr;
const mockBroadcast = vi.fn();
const mockStoreGet = vi.fn();
const mockStoreSet = vi.fn();
const mockApp = {
browserManager: { broadcastToAllWindows: mockBroadcast },
getController: vi.fn((Cls) => {
if (Cls === RemoteServerConfigCtr) return mockRemoteServerConfigCtr;
if (Cls === LocalFileCtr) return mockLocalFileCtr;
if (Cls === ShellCommandCtr) return mockShellCommandCtr;
return null;
}),
getService: vi.fn((Cls) => {
if (Cls === GatewayConnectionService) return mockGatewayConnectionSrv;
return null;
}),
storeManager: { get: mockStoreGet, set: mockStoreSet },
} as unknown as App;
// Lazily initialized — created in beforeEach so it uses the current mockApp
let mockGatewayConnectionSrv: GatewayConnectionService;
// ─── Test Suite ───
describe('GatewayConnectionCtr', () => {
let ctr: GatewayConnectionCtr;
beforeEach(() => {
vi.clearAllMocks();
vi.useFakeTimers();
MockGatewayClient.lastInstance = null;
MockGatewayClient.lastOptions = null;
mockStoreGet.mockReturnValue(undefined);
mockGatewayConnectionSrv = new GatewayConnectionService(mockApp);
ctr = new GatewayConnectionCtr(mockApp);
});
afterEach(() => {
ctr.disconnect();
vi.useRealTimers();
});
// ─── Connection ───
describe('connect', () => {
it('should create GatewayClient with correct options', async () => {
mockStoreGet.mockImplementation((key: string) => {
if (key === 'gatewayDeviceId') return 'stored-device-id';
if (key === 'gatewayUrl') return undefined;
return undefined;
});
ctr = new GatewayConnectionCtr(mockApp);
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const options = MockGatewayClient.lastOptions;
expect(options).not.toBeNull();
expect(options.token).toBe('mock-access-token');
expect(options.deviceId).toBe('stored-device-id');
expect(options.gatewayUrl).toBe('https://device-gateway.lobehub.com');
expect(options.logger).toBeDefined();
});
it('should use custom gateway URL from store when set', async () => {
mockStoreGet.mockImplementation((key: string) => {
if (key === 'gatewayUrl') return 'http://localhost:8787';
return undefined;
});
ctr = new GatewayConnectionCtr(mockApp);
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
expect(MockGatewayClient.lastOptions.gatewayUrl).toBe('http://localhost:8787');
});
it('should return success:false when no access token', async () => {
// Prevent auto-connect, then set up providers manually
vi.mocked(mockRemoteServerConfigCtr.isRemoteServerConfigured).mockResolvedValueOnce(false);
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
vi.mocked(mockRemoteServerConfigCtr.getAccessToken).mockResolvedValueOnce(null);
const result = await ctr.connect();
expect(result).toEqual({ error: 'No access token available', success: false });
expect(MockGatewayClient.lastInstance).toBeNull();
});
it('should no-op when already connected', async () => {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const firstClient = MockGatewayClient.lastInstance;
firstClient!.simulateConnected();
const result = await ctr.connect();
expect(result).toEqual({ success: true });
// No new client created
expect(MockGatewayClient.lastInstance).toBe(firstClient);
});
it('should broadcast status changes: disconnected → connecting → connected', async () => {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
expect(mockBroadcast).toHaveBeenCalledWith('gatewayConnectionStatusChanged', {
status: 'connecting',
});
MockGatewayClient.lastInstance!.simulateConnected();
expect(mockBroadcast).toHaveBeenCalledWith('gatewayConnectionStatusChanged', {
status: 'connected',
});
});
});
// ─── Disconnect ───
describe('disconnect', () => {
it('should disconnect client and set status to disconnected', async () => {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const client = MockGatewayClient.lastInstance!;
client.simulateConnected();
mockBroadcast.mockClear();
await ctr.disconnect();
expect(client.disconnect).toHaveBeenCalled();
expect(mockBroadcast).toHaveBeenCalledWith('gatewayConnectionStatusChanged', {
status: 'disconnected',
});
});
it('should not trigger reconnect after intentional disconnect', async () => {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const client = MockGatewayClient.lastInstance!;
client.simulateConnected();
await ctr.disconnect();
mockBroadcast.mockClear();
// Advance timers — no reconnect should happen
await vi.advanceTimersByTimeAsync(60_000);
expect(mockBroadcast).not.toHaveBeenCalledWith('gatewayConnectionStatusChanged', {
status: 'reconnecting',
});
});
});
// ─── Auto-Connect ───
describe('afterAppReady (auto-connect)', () => {
it('should auto-connect when server is configured and token exists', async () => {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
expect(MockGatewayClient.lastInstance).not.toBeNull();
expect(MockGatewayClient.lastInstance!.connect).toHaveBeenCalled();
});
it('should skip auto-connect when remote server not configured', async () => {
vi.mocked(mockRemoteServerConfigCtr.isRemoteServerConfigured).mockResolvedValueOnce(false);
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
expect(MockGatewayClient.lastInstance).toBeNull();
});
it('should skip auto-connect when no access token', async () => {
vi.mocked(mockRemoteServerConfigCtr.getAccessToken).mockResolvedValueOnce(null);
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
expect(MockGatewayClient.lastInstance).toBeNull();
});
it('should create device ID on first launch and persist it', () => {
mockStoreGet.mockReturnValue(undefined);
ctr.afterAppReady();
expect(mockStoreSet).toHaveBeenCalledWith('gatewayDeviceId', 'mock-device-uuid');
});
it('should reuse persisted device ID', () => {
mockStoreGet.mockImplementation((key: string) =>
key === 'gatewayDeviceId' ? 'existing-id' : undefined,
);
ctr = new GatewayConnectionCtr(mockApp);
ctr.afterAppReady();
expect(mockStoreSet).not.toHaveBeenCalledWith('gatewayDeviceId', expect.anything());
});
});
// ─── Reconnection ───
describe('reconnection', () => {
it('should broadcast reconnecting status when client emits reconnecting', async () => {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const client = MockGatewayClient.lastInstance!;
client.simulateConnected();
mockBroadcast.mockClear();
client.simulateReconnecting(1000);
expect(mockBroadcast).toHaveBeenCalledWith('gatewayConnectionStatusChanged', {
status: 'reconnecting',
});
});
});
// ─── Tool Call Routing ───
describe('tool call routing', () => {
async function connectAndOpen() {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const client = MockGatewayClient.lastInstance!;
client.simulateConnected();
return client;
}
it.each([
['readLocalFile', 'readFile', mockLocalFileCtr],
['listLocalFiles', 'listLocalFiles', mockLocalFileCtr],
['moveLocalFiles', 'handleMoveFiles', mockLocalFileCtr],
['renameLocalFile', 'handleRenameFile', mockLocalFileCtr],
['searchLocalFiles', 'handleLocalFilesSearch', mockLocalFileCtr],
['writeLocalFile', 'handleWriteFile', mockLocalFileCtr],
['editLocalFile', 'handleEditFile', mockLocalFileCtr],
['globLocalFiles', 'handleGlobFiles', mockLocalFileCtr],
['grepContent', 'handleGrepContent', mockLocalFileCtr],
['runCommand', 'handleRunCommand', mockShellCommandCtr],
['getCommandOutput', 'handleGetCommandOutput', mockShellCommandCtr],
['killCommand', 'handleKillCommand', mockShellCommandCtr],
] as const)('should route %s to %s', async (apiName, methodName, controller) => {
const client = await connectAndOpen();
const args = { test: 'arg' };
client.simulateToolCallRequest(apiName, args);
await vi.advanceTimersByTimeAsync(0);
expect((controller as any)[methodName]).toHaveBeenCalledWith(args);
});
it('should send tool_call_response with success result', async () => {
vi.mocked(mockLocalFileCtr.readFile).mockResolvedValueOnce({
charCount: 5,
content: 'hello',
createdTime: new Date('2024-01-01'),
filename: 'a.txt',
fileType: '.txt',
lineCount: 1,
loc: [1, 1] as [number, number],
modifiedTime: new Date('2024-01-01'),
totalCharCount: 5,
totalLineCount: 1,
});
const client = await connectAndOpen();
client.simulateToolCallRequest('readLocalFile', { path: '/a.txt' }, 'req-42');
await vi.advanceTimersByTimeAsync(0);
expect(client.sendToolCallResponse).toHaveBeenCalledWith({
requestId: 'req-42',
result: {
content: JSON.stringify({
charCount: 5,
content: 'hello',
createdTime: new Date('2024-01-01'),
filename: 'a.txt',
fileType: '.txt',
lineCount: 1,
loc: [1, 1],
modifiedTime: new Date('2024-01-01'),
totalCharCount: 5,
totalLineCount: 1,
}),
success: true,
},
});
});
it('should send tool_call_response with error on failure', async () => {
vi.mocked(mockLocalFileCtr.readFile).mockRejectedValueOnce(new Error('File not found'));
const client = await connectAndOpen();
client.simulateToolCallRequest('readLocalFile', { path: '/missing' }, 'req-err');
await vi.advanceTimersByTimeAsync(0);
expect(client.sendToolCallResponse).toHaveBeenCalledWith({
requestId: 'req-err',
result: {
content: 'File not found',
error: 'File not found',
success: false,
},
});
});
it('should send error for unknown apiName', async () => {
const client = await connectAndOpen();
client.simulateToolCallRequest('unknownApi', {}, 'req-unknown');
await vi.advanceTimersByTimeAsync(0);
const errorMsg =
'Tool "unknownApi" is not available on this device. It may not be supported in the current desktop version. Please skip this tool and try alternative approaches.';
expect(client.sendToolCallResponse).toHaveBeenCalledWith({
requestId: 'req-unknown',
result: {
content: errorMsg,
error: errorMsg,
success: false,
},
});
});
});
// ─── Auth Expired ───
describe('auth_expired handling', () => {
it('should refresh token and reconnect on auth_expired', async () => {
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const client1 = MockGatewayClient.lastInstance!;
client1.simulateConnected();
client1.simulateAuthExpired();
await vi.advanceTimersByTimeAsync(0);
expect(mockRemoteServerConfigCtr.refreshAccessToken).toHaveBeenCalled();
// Should have created a new GatewayClient for reconnection
expect(MockGatewayClient.lastInstance).not.toBe(client1);
expect(MockGatewayClient.lastInstance!.connect).toHaveBeenCalled();
});
it('should set status to disconnected when token refresh fails', async () => {
vi.mocked(mockRemoteServerConfigCtr.refreshAccessToken).mockResolvedValueOnce({
error: 'invalid_grant',
success: false,
});
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
const client = MockGatewayClient.lastInstance!;
client.simulateConnected();
mockBroadcast.mockClear();
client.simulateAuthExpired();
await vi.advanceTimersByTimeAsync(0);
expect(mockBroadcast).toHaveBeenCalledWith('gatewayConnectionStatusChanged', {
status: 'disconnected',
});
});
});
// ─── IPC Methods ───
describe('getConnectionStatus', () => {
it('should return current status', async () => {
expect(await ctr.getConnectionStatus()).toEqual({ status: 'disconnected' });
ctr.afterAppReady();
await vi.advanceTimersByTimeAsync(0);
expect(await ctr.getConnectionStatus()).toEqual({ status: 'connecting' });
MockGatewayClient.lastInstance!.simulateConnected();
expect(await ctr.getConnectionStatus()).toEqual({ status: 'connected' });
});
});
describe('getDeviceInfo', () => {
it('should return device information', async () => {
mockStoreGet.mockImplementation((key: string) =>
key === 'gatewayDeviceId' ? 'my-device' : undefined,
);
ctr = new GatewayConnectionCtr(mockApp);
ctr.afterAppReady();
const info = await ctr.getDeviceInfo();
expect(info).toEqual({
deviceId: 'my-device',
hostname: 'mock-hostname',
platform: process.platform,
});
});
});
});
@@ -47,8 +47,14 @@ const mockBrowserManager = {
broadcastToAllWindows: vi.fn(),
};
const mockGatewayConnectionSrv = {
disconnect: vi.fn().mockResolvedValue({ success: true }),
};
const mockApp = {
browserManager: mockBrowserManager,
getController: vi.fn(),
getService: vi.fn().mockReturnValue(mockGatewayConnectionSrv),
storeManager: mockStoreManager,
} as unknown as App;
@@ -294,6 +300,13 @@ describe('RemoteServerConfigCtr', () => {
const accessToken = await controller.getAccessToken();
expect(accessToken).toBeNull();
});
it('should disconnect gateway when tokens are cleared', async () => {
await controller.saveTokens('access', 'refresh', 3600);
await controller.clearTokens();
expect(mockGatewayConnectionSrv.disconnect).toHaveBeenCalled();
});
});
describe('getTokenExpiresAt', () => {
@@ -747,6 +760,16 @@ describe('RemoteServerConfigCtr', () => {
});
describe('isRemoteServerConfigured', () => {
it('should return false when active is undefined', async () => {
mockStoreManager.get.mockReturnValue({
storageMode: 'cloud',
});
const result = await controller.isRemoteServerConfigured();
expect(result).toBe(false);
});
it('should return true for active cloud mode (no remoteServerUrl needed)', async () => {
mockStoreManager.get.mockReturnValue({
active: true,
@@ -794,6 +817,30 @@ describe('RemoteServerConfigCtr', () => {
expect(result).toBe(false);
});
it('should return false for selfHost mode with blank remoteServerUrl', async () => {
mockStoreManager.get.mockReturnValue({
active: true,
remoteServerUrl: ' ',
storageMode: 'selfHost',
});
const result = await controller.isRemoteServerConfigured();
expect(result).toBe(false);
});
it('should return false for selfHost mode with invalid remoteServerUrl', async () => {
mockStoreManager.get.mockReturnValue({
active: true,
remoteServerUrl: 'foo',
storageMode: 'selfHost',
});
const result = await controller.isRemoteServerConfigured();
expect(result).toBe(false);
});
it('should use provided config instead of fetching', async () => {
// Store has inactive config
mockStoreManager.get.mockReturnValue({
@@ -3,6 +3,7 @@ import type { CreateServicesResult, IpcServiceConstructor, MergeIpcService } fro
import AuthCtr from './AuthCtr';
import BrowserWindowsCtr from './BrowserWindowsCtr';
import DevtoolsCtr from './DevtoolsCtr';
import GatewayConnectionCtr from './GatewayConnectionCtr';
import LocalFileCtr from './LocalFileCtr';
import McpCtr from './McpCtr';
import McpInstallCtr from './McpInstallCtr';
@@ -23,6 +24,7 @@ export const controllerIpcConstructors = [
AuthCtr,
BrowserWindowsCtr,
DevtoolsCtr,
GatewayConnectionCtr,
LocalFileCtr,
McpCtr,
McpInstallCtr,
@@ -0,0 +1,297 @@
import { randomUUID } from 'node:crypto';
import os from 'node:os';
import type {
SystemInfoRequestMessage,
ToolCallRequestMessage,
} from '@lobechat/device-gateway-client';
import { GatewayClient } from '@lobechat/device-gateway-client';
import type { GatewayConnectionStatus } from '@lobechat/electron-client-ipc';
import { app } from 'electron';
import { createLogger } from '@/utils/logger';
import { ServiceModule } from './index';
const logger = createLogger('services:GatewayConnectionSrv');
const DEFAULT_GATEWAY_URL = 'https://device-gateway.lobehub.com';
interface ToolCallHandler {
(apiName: string, args: any): Promise<unknown>;
}
/**
* GatewayConnectionService
*
* Core business logic for managing WebSocket connection to the cloud device-gateway.
* Extracted from GatewayConnectionCtr so other controllers can reuse connect/disconnect.
*/
export default class GatewayConnectionService extends ServiceModule {
private client: GatewayClient | null = null;
private status: GatewayConnectionStatus = 'disconnected';
private deviceId: string | null = null;
private tokenProvider: (() => Promise<string | null>) | null = null;
private tokenRefresher: (() => Promise<{ error?: string; success: boolean }>) | null = null;
private toolCallHandler: ToolCallHandler | null = null;
// ─── Configuration ───
/**
* Set token provider function (to decouple from RemoteServerConfigCtr)
*/
setTokenProvider(provider: () => Promise<string | null>) {
this.tokenProvider = provider;
}
/**
* Set token refresher function (for auth_expired handling)
*/
setTokenRefresher(refresher: () => Promise<{ error?: string; success: boolean }>) {
this.tokenRefresher = refresher;
}
/**
* Set tool call handler (to route tool calls to LocalFileCtr/ShellCommandCtr)
*/
setToolCallHandler(handler: ToolCallHandler) {
this.toolCallHandler = handler;
}
// ─── Device ID ───
loadOrCreateDeviceId() {
const stored = this.app.storeManager.get('gatewayDeviceId') as string | undefined;
if (stored) {
this.deviceId = stored;
} else {
this.deviceId = randomUUID();
this.app.storeManager.set('gatewayDeviceId', this.deviceId);
}
logger.debug(`Device ID: ${this.deviceId}`);
}
getDeviceId(): string {
return this.deviceId || 'unknown';
}
// ─── Connection Status ───
getStatus(): GatewayConnectionStatus {
return this.status;
}
getDeviceInfo() {
return {
deviceId: this.getDeviceId(),
hostname: os.hostname(),
platform: process.platform,
};
}
// ─── Connection Logic ───
async connect(): Promise<{ error?: string; success: boolean }> {
if (this.status === 'connected' || this.status === 'connecting') {
return { success: true };
}
return this.doConnect();
}
async disconnect(): Promise<{ success: boolean }> {
if (this.client) {
await this.client.disconnect();
this.client = null;
}
this.setStatus('disconnected');
return { success: true };
}
private async doConnect(): Promise<{ error?: string; success: boolean }> {
// Clean up any existing client
if (this.client) {
await this.client.disconnect();
this.client = null;
}
if (!this.tokenProvider) {
logger.warn('Cannot connect: no token provider configured');
return { error: 'No token provider configured', success: false };
}
const token = await this.tokenProvider();
if (!token) {
logger.warn('Cannot connect: no access token');
return { error: 'No access token available', success: false };
}
const gatewayUrl = this.getGatewayUrl();
const userId = this.extractUserIdFromToken(token);
logger.info(`Connecting to device gateway: ${gatewayUrl}, userId: ${userId || 'unknown'}`);
const client = new GatewayClient({
deviceId: this.getDeviceId(),
gatewayUrl,
logger,
token,
userId: userId || undefined,
});
this.setupClientEvents(client);
this.client = client;
await client.connect();
return { success: true };
}
private setupClientEvents(client: GatewayClient) {
client.on('status_changed', (status) => {
this.setStatus(status);
});
client.on('tool_call_request', (request) => {
this.handleToolCallRequest(request, client);
});
client.on('system_info_request', (request) => {
this.handleSystemInfoRequest(client, request);
});
client.on('auth_expired', () => {
logger.warn('Received auth_expired, will reconnect with refreshed token');
this.handleAuthExpired();
});
client.on('error', (error) => {
logger.error('WebSocket error:', error.message);
});
}
// ─── Auth Expired Handling ───
private async handleAuthExpired() {
// Disconnect the current client
if (this.client) {
await this.client.disconnect();
this.client = null;
}
if (!this.tokenRefresher) {
logger.error('No token refresher configured, cannot handle auth_expired');
this.setStatus('disconnected');
return;
}
logger.info('Attempting token refresh before reconnect');
const result = await this.tokenRefresher();
if (result.success) {
logger.info('Token refreshed, reconnecting');
await this.doConnect();
} else {
logger.error('Token refresh failed:', result.error);
this.setStatus('disconnected');
}
}
// ─── System Info ───
private handleSystemInfoRequest(client: GatewayClient, request: SystemInfoRequestMessage) {
logger.info(`Received system_info_request: requestId=${request.requestId}`);
client.sendSystemInfoResponse({
requestId: request.requestId,
result: {
success: true,
systemInfo: {
arch: os.arch(),
desktopPath: app.getPath('desktop'),
documentsPath: app.getPath('documents'),
downloadsPath: app.getPath('downloads'),
homePath: app.getPath('home'),
musicPath: app.getPath('music'),
picturesPath: app.getPath('pictures'),
userDataPath: app.getPath('userData'),
videosPath: app.getPath('videos'),
workingDirectory: process.cwd(),
},
},
});
}
// ─── Tool Call Routing ───
private handleToolCallRequest = async (
request: ToolCallRequestMessage,
client: GatewayClient,
) => {
const { requestId, toolCall } = request;
const { apiName, arguments: argsStr } = toolCall;
logger.info(`Received tool call: apiName=${apiName}, requestId=${requestId}`);
try {
if (!this.toolCallHandler) {
throw new Error('No tool call handler configured');
}
const args = JSON.parse(argsStr);
const result = await this.toolCallHandler(apiName, args);
client.sendToolCallResponse({
requestId,
result: {
content: typeof result === 'string' ? result : JSON.stringify(result),
success: true,
},
});
} catch (error) {
const errorMsg = error instanceof Error ? error.message : String(error);
logger.error(`Tool call failed: apiName=${apiName}, error=${errorMsg}`);
client.sendToolCallResponse({
requestId,
result: {
content: errorMsg,
error: errorMsg,
success: false,
},
});
}
};
// ─── Status Broadcasting ───
private setStatus(status: GatewayConnectionStatus) {
if (this.status === status) return;
logger.info(`Connection status: ${this.status}${status}`);
this.status = status;
this.app.browserManager.broadcastToAllWindows('gatewayConnectionStatusChanged', { status });
}
// ─── Gateway URL ───
private getGatewayUrl(): string {
return this.app.storeManager.get('gatewayUrl') || DEFAULT_GATEWAY_URL;
}
// ─── Token Helpers ───
/**
* Extract userId (sub claim) from JWT without verification.
* The token will be verified server-side; we just need the userId for routing.
*/
private extractUserIdFromToken(token: string): string | null {
try {
const parts = token.split('.');
if (parts.length !== 3) return null;
const payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf-8'));
return payload.sub || null;
} catch {
logger.warn('Failed to extract userId from JWT token');
return null;
}
}
}
+2
View File
@@ -12,6 +12,8 @@ export interface ElectronMainStore {
lastRefreshAt?: number;
refreshToken?: string;
};
gatewayDeviceId: string;
gatewayUrl: string;
locale: string;
networkProxy: NetworkProxySettings;
shortcuts: Record<string, string>;
+10
View File
@@ -1,4 +1,14 @@
[
{
"children": {
"improvements": [
"add BM25 indexes with ICU tokenizer for search optimization.",
"add agent_documents table."
]
},
"date": "2026-03-16",
"version": "2.1.43"
},
{
"children": {},
"date": "2026-03-14",
+1 -1
View File
@@ -32,7 +32,7 @@ coverage:
app:
flags:
- app
threshold: 0.5
threshold: '0.5%'
patch: off
comment:
+4 -3
View File
@@ -19,9 +19,10 @@ LOBE_PORT=3210
RUSTFS_PORT=9000
RUSTFS_ADMIN_PORT=9001
APP_URL=http://localhost:3210
# INTERNAL_APP_URL is optional, used for server-to-server calls
# to bypass CDN/proxy. If not set, defaults to APP_URL.
# Example: INTERNAL_APP_URL=http://localhost:3210
# INTERNAL_APP_URL is used for internal server-to-server communication.
# Required for Docker Compose deployments, otherwise features like
# AI image generation will fail when APP_URL is a host/LAN IP.
INTERNAL_APP_URL=http://localhost:3210
# Secrets (auto-generated by setup.sh)
KEY_VAULTS_SECRET=YOUR_KEY_VAULTS_SECRET
+3 -3
View File
@@ -17,9 +17,9 @@
# 如没有特殊需要不用更改
LOBE_PORT=3210
APP_URL=http://localhost:3210
# 内部应用URL是可选的,用于服务器内部调用
# 如果没有设置,默认使用 APP_URL
# INTERNAL_APP_URL=http://localhost:3210
# 内部应用URL,用于器内部服务间通信
# Docker Compose 部署时必须配置,否则当 APP_URL 为宿主机 IP 时 AI 生图等功能会失败
INTERNAL_APP_URL=http://localhost:3210
# 密钥配置(由 setup.sh 自动生成)
KEY_VAULTS_SECRET=YOUR_KEY_VAULTS_SECRET
+1
View File
@@ -18,6 +18,7 @@ services:
- 'KEY_VAULTS_SECRET=${KEY_VAULTS_SECRET}'
- 'AUTH_SECRET=${AUTH_SECRET}'
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
- 'INTERNAL_APP_URL=http://localhost:3210'
- 'S3_ENDPOINT=${S3_ENDPOINT}'
- 'S3_BUCKET=${RUSTFS_LOBE_BUCKET}'
- 'S3_ENABLE_PATH_STYLE=1'
+7
View File
@@ -34,6 +34,8 @@
"https://file.rene.wang/clipboard-1769050853107-750be5f83cbe3.png": "/blog/assetse6139c4d5b1b26b05f41a579d98fc6f3.webp",
"https://file.rene.wang/clipboard-1769052898732-b7bb78ae1f1f8.png": "/blog/assetsafa74c85aafea8a057e6047b0823e280.webp",
"https://file.rene.wang/clipboard-1769056077960-cac34bc157a65.png": "/blog/assetsa8e173bec038d1d21d413f6fa0ace342.webp",
"https://file.rene.wang/clipboard-1769137275089-21cf7ab42d52b.png": "/blog/assets095af3a0a0f850fc206fc3bbc19a4095.webp",
"https://file.rene.wang/clipboard-1769137300488-0b894cc8c7a67.png": "/blog/assetsebc1ebe8330d982f6a0b757aafb3f4a1.webp",
"https://file.rene.wang/clipboard-1769155711708-710967bee57bc.png": "/blog/assets7f3b38c1d76cceb91edb29d6b1eb60db.webp",
"https://file.rene.wang/clipboard-1769155737647-1b4fc6558f029.png": "/blog/assets3a7f0b29839603336e39e923b423409b.webp",
"https://file.rene.wang/clipboard-1769155791342-7f43b72cc6b42.png": "/blog/assets35e6aa692b0c16009c61964279514166.webp",
@@ -44,6 +46,8 @@
"https://file.rene.wang/clipboard-1769156005535-c2e79e11f4b56.png": "/blog/assets2a36d86a4eed6e7938dd6e9c684701ed.webp",
"https://file.rene.wang/clipboard-1769156036607-2b4fe37c4b56c.png": "/blog/assetsc0efdb82443556ae3acefe00099b3f23.webp",
"https://file.rene.wang/clipboard-1769156050787-ecf4f48474ae2.png": "/blog/assetse743f0a47127390dde766a0a790476db.webp",
"https://file.rene.wang/clipboard-1770261091677-74b74e4d6bf23.png": "/blog/assets3059f679eef80c5e777085db3d2d056e.webp",
"https://file.rene.wang/clipboard-1770266335710-1fec523143aab.png": "/blog/assets636c78daf95c590cd7d80284c68eb6d9.webp",
"https://file.rene.wang/lobehub/467951f5-ad65-498d-aea9-fca8f35a4314.png": "/blog/assets907ea775d228958baca38e2dbb65939a.webp",
"https://file.rene.wang/lobehub/58d91528-373a-4a42-b520-cf6cb1f8ce1e.png": "/blog/assets7dccdd4df55aede71001da649639437f.webp",
"https://file.rene.wang/lobehub/ee700103-3c08-41dc-9ddf-c7705bb7bc6a.png": "/blog/assets196d679bc7071abbf71f2a8566f05aa3.webp",
@@ -258,6 +262,7 @@
"https://github.com/user-attachments/assets/22e1a039-5e6e-4c40-8266-19821677618a": "/blog/assets89b45345c84f8b7c3bf4d554169689ac.webp",
"https://github.com/user-attachments/assets/237864d6-cc5d-4fe4-8a2b-c278016855c5": "/blog/assetsf3e7c2e961d1d2886fe231a4ac59e2f1.webp",
"https://github.com/user-attachments/assets/2787824c-a13c-466c-ba6f-820bddfe099f": "/blog/assets/8d6c17a6ea5e784edf4449fb18ca3f76.webp",
"https://github.com/user-attachments/assets/27c37617-a813-4de5-b0bf-c7167999c856": "/blog/assetsc958eae64465451c4374cdee8f6fd596.webp",
"https://github.com/user-attachments/assets/28590f7f-bfee-4215-b50b-8feddbf72366": "/blog/assets89a8dadc85902334ce8d2d5b78abf709.webp",
"https://github.com/user-attachments/assets/29508dda-2382-430f-bc81-fb23f02149f8": "/blog/assets/29b13dc042e3b839ad8865354afe2fac.webp",
"https://github.com/user-attachments/assets/2a4116a7-15ad-43e5-b801-cc62d8da2012": "/blog/assets/37d85fdfccff9ed56e9c6827faee01c7.webp",
@@ -286,6 +291,7 @@
"https://github.com/user-attachments/assets/4c792f62-5203-4f13-8f23-df228f70d67f": "/blog/assets94f55c97a24a08c7a5923c23ee2d7eef.webp",
"https://github.com/user-attachments/assets/4cbbbcce-36be-48ff-bb0b-31607a0bba5c": "/blog/assetsb33085e7553d2b7194005b102184553e.webp",
"https://github.com/user-attachments/assets/4d671a7c-5d94-4c4b-b4fd-71a5a0e9d227": "/blog/assetsc74cf5c8daee1515c37a85bce087f0d6.webp",
"https://github.com/user-attachments/assets/4dde41ec-985b-4781-8c77-aac65555a32f": "/blog/assets04fecea4e5f4ce3490bf11bec66ff477.webp",
"https://github.com/user-attachments/assets/4e04928d-0171-48d1-afff-e22fc2faaf4e": "/blog/assetsb26b68a4875a6510ddc202dd4b40d010.webp",
"https://github.com/user-attachments/assets/530c7c96-bac3-456d-a429-f60e7d2ade66": "/blog/assets6541bab7e0047f9c5dbad98dc272d64d.webp",
"https://github.com/user-attachments/assets/5321f987-2c64-4211-8549-bd30ca9b59b9": "/blog/assetsaf57d31364a41634b10c243ed9b1f8f8.webp",
@@ -327,6 +333,7 @@
"https://github.com/user-attachments/assets/7cb3019b-78c1-48e0-a64c-a6a4836affd9": "/blog/assets3ca963d92475f34b0789cfa50071bc52.webp",
"https://github.com/user-attachments/assets/808f8849-5738-4a60-8ccf-01e300b0dc88": "/blog/assets0f893c504377ba45a9f5cdbb5ccb1612.webp",
"https://github.com/user-attachments/assets/81d0349a-44fe-4dfc-bbc4-8e9a1e09567d": "/blog/assets29de82efbe7657a8b9ba7daf0904585d.webp",
"https://github.com/user-attachments/assets/81f18b20-3918-4f77-8571-07d0c4a79aec": "/blog/assets43d66c62b79a027895b5a6127b2f2de2.webp",
"https://github.com/user-attachments/assets/82a7ebe0-69ad-43b6-8767-1316b443fa03": "/blog/assets5374759bfe39ca7fc864e72ddfce98d0.webp",
"https://github.com/user-attachments/assets/82bfc467-e0c6-4d99-9b1f-18e4aea24285": "/blog/assets/eb477e62217f4d1b644eff975c7ac168.webp",
"https://github.com/user-attachments/assets/840442b1-bf56-4a5f-9700-b3608b16a8a5": "/blog/assetsc6ff27b7134f280727e1fd7ff83ed2fa.webp",
+30
View File
@@ -0,0 +1,30 @@
---
title: "LobeHub v2.0 — Group Chat & Multi-Agent Collaboration \U0001F389"
description: >-
LobeHub v2.0 brings major upgrades including multi-agent group chat, enhanced
model settings, SSO-only mode, and desktop improvements.
tags:
- v2.0
- Group Chat
- Multi-Agent
- SSO
---
# LobeHub v2.0 🎉
January marks the landmark release of LobeHub v2.0, introducing powerful multi-agent group chat capabilities, refined model settings, and a streamlined authentication experience.
## What's New
- A major version upgrade with redesigned architecture and enhanced features
- Multi-Agent Collaboration: Bring multiple specialized agents into one conversation. They debate, reason, and solve complex problems together—faster and smarter.
- Agent Builder: Describe what you want, and LobeHub builds the complete agent—skills, behavior, tools, and personality. No setup required.
- Pages: write, read and organize documents with Lobe AI
- Memory: Your agents remember your preferences, style, goals, and past projects—delivering uniquely personalized assistance that gets better over time.
- New Knowledge Base: Use folders to organize your knowledge & resource
- Marketplace: Publish, adopt, or remix agents in a thriving community where intelligence grows together.
## Improvement
- Enhanced model settings: New ExtendParamsTypeSchema for more flexible model configuration
- Model updates: Updated Kimi K2.5 and Qwen3 Max Thinking models, plus Gemini 2.5 streaming fixes
+30
View File
@@ -0,0 +1,30 @@
---
title: "LobeHub v2.0 — Group Chat & Multi-Agent Collaboration \U0001F389"
description: >-
LobeHub v2.0 brings major upgrades including multi-agent group chat, enhanced
model settings, SSO-only mode, and desktop improvements.
tags:
- v2.0
- Group Chat
- Multi-Agent
- SSO
---
# LobeHub v2.0 🎉
LobeHub v2.0 正式发布,带来强大的多智能体群聊功能、优化的模型设置以及简化的身份验证体验。
## 新功能
- 重大版本升级,架构重新设计,功能增强
- 多智能体协作:将多个专业智能体汇聚于同一对话中。它们可以共同讨论、推理并解决复杂问题,速度更快、更智能。
- 智能体构建器:描述您的需求,LobeHub 将构建完整的智能体 —— 包括技能、行为、工具和个性。无需任何设置。
- 页面:使用 Lobe AI 编写、阅读和整理文档
- 记忆:您的智能体会记住您的偏好、风格、目标和过往项目,提供个性化的专属帮助,并随着时间的推移不断优化。
- 全新知识库:使用文件夹整理您的知识和资源
- 应用市场:在一个蓬勃发展的社区中发布、采用或重新组合智能体,共同提升智能水平。
## 改进
- 增强模型设置:新增 ExtendParamsTypeSchema,实现更灵活的模型配置
- 模型更新:更新了 Kimi K2.5 和 Qwen3 Max Thinking 模型,并修复了 Gemini 2.5 的流式传输问题
@@ -0,0 +1,28 @@
---
title: "Model Runtime & Authentication Improvements \U0001F527"
description: >-
Enhanced model runtime with Claude Opus 4.6 on Bedrock, improved
authentication flows, and better mobile experience.
tags:
- Model Runtime
- Authentication
- Claude Opus 4.6
- Notebook
---
# Model Runtime & Authentication Improvements 🔧
In February, LobeHub focused on model runtime enhancements, authentication reliability, and polishing the overall user experience across platforms.
## 🌟 Key Updates
- 🤖 Claude Opus 4.6 on Bedrock: Added Claude Opus 4.6 support for AWS Bedrock runtime
- 📓 Notebook tool: Registered Notebook tool in server runtime with improved system prompts
- 🔗 OpenAI Responses API: Added end-user info support on OpenAI Responses API calls
- 🔐 Auth improvements: Fixed Microsoft authentication, improved OIDC provider account linking, and enhanced Feishu SSO
- 📱 Mobile enhancements: Enabled vertical scrolling for topic list on mobile, fixed multimodal image rendering
- 🏗️ Runtime refactoring: Extracted Anthropic factory and converted Moonshot to RouterRuntime
## 💫 Experience Improvements
Improved tasks display, enhanced local-system tool implementation, fixed PDF parsing in Docker, fixed editor content loss on send error, added custom avatars for group chat sidebar, and showed notifications for file upload storage limit errors.
@@ -0,0 +1,26 @@
---
title: "模型运行时与认证改进 \U0001F527"
description: 增强模型运行时并支持 Bedrock 上的 Claude Opus 4.6,改进认证流程,优化移动端体验。
tags:
- 模型运行时
- 认证
- Claude Opus 4.6
- 笔记本
---
# 模型运行时与认证改进 🔧
二月,LobeHub 专注于模型运行时增强、认证可靠性提升,以及跨平台用户体验的打磨优化。
## 🌟 重要更新
- 🤖 Bedrock 上的 Claude Opus 4.6:新增 AWS Bedrock 运行时对 Claude Opus 4.6 的支持
- 📓 笔记本工具:在服务端运行时注册笔记本工具,改进系统提示词
- 🔗 OpenAI Responses API:支持在 OpenAI Responses API 调用中添加终端用户信息
- 🔐 认证改进:修复 Microsoft 认证、改进 OIDC 提供商账户关联、增强飞书 SSO
- 📱 移动端增强:启用话题列表垂直滚动,修复多模态图像渲染
- 🏗️ 运行时重构:提取 Anthropic 工厂,将 Moonshot 转换为 RouterRuntime
## 💫 体验优化
改进任务展示、增强本地系统工具实现、修复 Docker 中的 PDF 解析、修复发送错误时编辑器内容丢失、为群聊侧边栏添加自定义头像,以及在文件上传超出存储限制时显示通知。
+27
View File
@@ -0,0 +1,27 @@
---
title: "Search Optimization & Agent Documents \U0001F50D"
description: >-
Introduces BM25 search indexes, agent document storage, and full-text search
capabilities.
tags:
- Search
- BM25
- Agent Documents
- Full-Text Search
---
# Search Optimization & Agent Documents 🔍
In March, LobeHub significantly enhanced its search infrastructure and introduced agent document capabilities, laying the groundwork for smarter knowledge retrieval.
## 🌟 Key Updates
- 🔍 BM25 search indexes: Added BM25 indexes with ICU tokenizer for optimized full-text search
- 📄 Agent documents: Introduced the `agent_documents` table for agent-level knowledge storage
- 🗄️ pg\_search extension: Enabled the `pg_search` PostgreSQL extension for advanced search capabilities
- 📝 Topic descriptions: Added description column to the topics table for better topic organization
- 🔑 API key security: Added API key hash column for enhanced security
## 💫 Experience Improvements
Fixed changelog auto-generation in release workflow, corrected stable renderer tar source path, and resolved market M2M token registration for trust client scenarios.
@@ -0,0 +1,25 @@
---
title: "搜索优化与智能体文档 \U0001F50D"
description: 引入 BM25 搜索索引、智能体文档存储和全文检索能力。
tags:
- 搜索
- BM25
- 智能体文档
- 全文检索
---
# 搜索优化与智能体文档 🔍
三月,LobeHub 大幅增强了搜索基础设施,并引入智能体文档功能,为更智能的知识检索奠定基础。
## 🌟 重要更新
- 🔍 BM25 搜索索引:新增基于 ICU 分词器的 BM25 索引,优化全文检索
- 📄 智能体文档:引入 `agent_documents` 表,支持智能体级别的知识存储
- 🗄️ pg\_search 扩展:启用 `pg_search` PostgreSQL 扩展,提供高级搜索能力
- 📝 话题描述:为话题表添加描述字段,改进话题组织管理
- 🔑 API 密钥安全:新增 API 密钥哈希列,增强安全性
## 💫 体验优化
修复发布工作流中的更新日志自动生成、修正稳定版渲染器打包路径,以及解决信任客户端场景下的市场 M2M 令牌注册问题。
+17
View File
@@ -2,6 +2,23 @@
"$schema": "https://github.com/lobehub/lobe-chat/blob/main/docs/changelog/schema.json",
"cloud": [],
"community": [
{
"image": "https://hub-apac-1.lobeobjects.space/blog/assets/4a68a7644501cb513d08670b102a446e.webp",
"id": "2026-03-16-search",
"date": "2026-03-16",
"versionRange": ["2.1.38", "2.1.43"]
},
{
"id": "2026-02-08-runtime-auth",
"date": "2026-02-08",
"versionRange": ["2.1.6", "2.1.26"]
},
{
"image": "https://private-user-images.githubusercontent.com/17870709/540830955-0fe626a3-0ddc-4f67-b595-3c5b3f1701e0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQwODY2MzYsIm5iZiI6MTc3NDA4NjMzNiwicGF0aCI6Ii8xNzg3MDcwOS81NDA4MzA5NTUtMGZlNjI2YTMtMGRkYy00ZjY3LWI1OTUtM2M1YjNmMTcwMWUwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzIxVDA5NDUzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRkMjg5MjUxMGI2OTYzMjYyYjA0NTExZTA4OTY4ODg1YmI2OWU4MmRiNDU4MjZhNzNiYWI3MjNjYmVkYzYwYTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KmNeu3YwMCu8wMVCxB5VuJ9Em49fchBJqPYdfoz4G-Q",
"id": "2026-01-27-v2",
"date": "2026-01-27",
"versionRange": ["2.0.1", "2.1.5"]
},
{
"image": "/blog/assets7f3b38c1d76cceb91edb29d6b1eb60db.webp",
"id": "2025-12-20-mcp",
@@ -0,0 +1,428 @@
---
title: Adding a New Bot Platform
description: >-
Learn how to add a new bot platform (e.g., Slack, WhatsApp) to LobeHub's
channel system, including schema definition, client implementation, and
platform registration.
tags:
- Bot Platform
- Message Channels
- Integration
- Development Guide
---
# Adding a New Bot Platform
This guide walks through the steps to add a new bot platform to LobeHub's channel system. The platform architecture is modular — each platform is a self-contained directory under `src/server/services/bot/platforms/`.
## Architecture Overview
```
src/server/services/bot/platforms/
├── types.ts # Core interfaces (FieldSchema, PlatformClient, ClientFactory, etc.)
├── registry.ts # PlatformRegistry class
├── index.ts # Singleton registry + platform registration
├── utils.ts # Shared utilities
├── discord/ # Example: Discord platform
│ ├── definition.ts # PlatformDefinition export
│ ├── schema.ts # FieldSchema[] for credentials & settings
│ ├── client.ts # ClientFactory + PlatformClient implementation
│ └── api.ts # Platform API helper class
└── <your-platform>/ # Your new platform
```
**Key concepts:**
- **FieldSchema** — Declarative schema that drives both server-side validation and frontend form auto-generation
- **PlatformClient** — Runtime interface for interacting with the platform (messaging, lifecycle)
- **ClientFactory** — Creates PlatformClient instances and validates credentials
- **PlatformDefinition** — Metadata + schema + factory, registered in the global registry
- **Chat SDK Adapter** — Bridges the platform's webhook/events into the unified Chat SDK
## Prerequisite: Chat SDK Adapter
Each platform requires a **Chat SDK adapter** that bridges the platform's webhook events into the unified [Vercel Chat SDK](https://github.com/vercel/chat) (`chat` npm package). Before implementing the platform, determine which adapter to use:
### Option A: Use an existing npm adapter
Some platforms have official adapters published under `@chat-adapter/*`:
- `@chat-adapter/discord` — Discord
- `@chat-adapter/slack` — Slack
- `@chat-adapter/telegram` — Telegram
Check npm with `npm view @chat-adapter/<platform>` to see if one exists.
### Option B: Develop a custom adapter in `packages/`
If no npm adapter exists, you need to create one as a workspace package. Reference the existing implementations:
- `packages/chat-adapter-feishu` — Feishu/Lark adapter (`@lobechat/chat-adapter-feishu`)
- `packages/chat-adapter-qq` — QQ adapter (`@lobechat/chat-adapter-qq`)
Each adapter package follows this structure:
```
packages/chat-adapter-<platform>/
├── package.json # name: @lobechat/chat-adapter-<platform>
├── tsconfig.json
├── tsup.config.ts
└── src/
├── index.ts # Public exports: createXxxAdapter, XxxApiClient, etc.
├── adapter.ts # Adapter class implementing chat SDK's Adapter interface
├── api.ts # Platform API client (webhook verification, message parsing)
├── crypto.ts # Request signature verification
├── format-converter.ts # Message format conversion (platform format ↔ chat SDK AST)
└── types.ts # Platform-specific type definitions
```
Key points for developing a custom adapter:
- The adapter must implement the `Adapter` interface from the `chat` package
- It handles webhook request verification, event parsing, and message format conversion
- The `createXxxAdapter(config)` factory function is what `PlatformClient.createAdapter()` will call
- Add `"chat": "^4.14.0"` as a dependency in `package.json`
## Step 1: Create the Platform Directory
```bash
mkdir src/server/services/bot/platforms/<platform-name>
```
You will create four files:
| File | Purpose |
| --------------- | ------------------------------------------------- |
| `schema.ts` | Credential and settings field definitions |
| `api.ts` | Lightweight API client for outbound messaging |
| `client.ts` | `ClientFactory` + `PlatformClient` implementation |
| `definition.ts` | `PlatformDefinition` export |
## Step 2: Define the Schema (`schema.ts`)
The schema is an array of `FieldSchema` objects with two top-level sections: `credentials` and `settings`.
```ts
import type { FieldSchema } from '../types';
export const schema: FieldSchema[] = [
{
key: 'credentials',
label: 'channel.credentials',
properties: [
{
key: 'applicationId',
description: 'channel.applicationIdHint',
label: 'channel.applicationId',
required: true,
type: 'string',
},
{
key: 'botToken',
description: 'channel.botTokenEncryptedHint',
label: 'channel.botToken',
required: true,
type: 'password', // Encrypted in storage, masked in UI
},
],
type: 'object',
},
{
key: 'settings',
label: 'channel.settings',
properties: [
{
key: 'charLimit',
default: 4000,
description: 'channel.charLimitHint',
label: 'channel.charLimit',
minimum: 100,
type: 'number',
},
// Add platform-specific settings...
],
type: 'object',
},
];
```
**Schema conventions:**
- `type: 'password'` fields are encrypted at rest and masked in the form
- Use existing i18n keys (e.g., `channel.botToken`, `channel.charLimit`) for shared fields
- Use `channel.<platform>.<key>` for platform-specific i18n keys
- `devOnly: true` fields only appear when `NODE_ENV === 'development'`
- Credentials must include a field that resolves to `applicationId` — either an explicit `applicationId` field, an `appId` field, or a `botToken` from which the ID is derived (see `resolveApplicationId` in the channel detail page)
## Step 3: Create the API Client (`api.ts`)
A lightweight class for outbound messaging operations used by the callback service (outside the Chat SDK adapter):
```ts
import debug from 'debug';
const log = debug('bot-platform:<platform>:client');
export const API_BASE = 'https://api.example.com';
export class PlatformApi {
private readonly token: string;
constructor(token: string) {
this.token = token;
}
async sendMessage(channelId: string, text: string): Promise<{ id: string }> {
log('sendMessage: channel=%s', channelId);
return this.call('messages.send', { channel: channelId, text });
}
async editMessage(channelId: string, messageId: string, text: string): Promise<void> {
log('editMessage: channel=%s, message=%s', channelId, messageId);
await this.call('messages.update', { channel: channelId, id: messageId, text });
}
// ... other operations (typing indicator, reactions, etc.)
private async call(method: string, body: Record<string, unknown>): Promise<any> {
const response = await fetch(`${API_BASE}/${method}`, {
body: JSON.stringify(body),
headers: {
Authorization: `Bearer ${this.token}`,
'Content-Type': 'application/json',
},
method: 'POST',
});
if (!response.ok) {
const text = await response.text();
log('API error: method=%s, status=%d, body=%s', method, response.status, text);
throw new Error(`API ${method} failed: ${response.status} ${text}`);
}
return response.json();
}
}
```
## Step 4: Implement the Client (`client.ts`)
Implement `PlatformClient` and extend `ClientFactory`:
```ts
import { createPlatformAdapter } from '@chat-adapter/<platform>';
import debug from 'debug';
import {
type BotPlatformRuntimeContext,
type BotProviderConfig,
ClientFactory,
type PlatformClient,
type PlatformMessenger,
type ValidationResult,
} from '../types';
import { PlatformApi } from './api';
const log = debug('bot-platform:<platform>:bot');
class MyPlatformClient implements PlatformClient {
readonly id = '<platform>';
readonly applicationId: string;
private config: BotProviderConfig;
private context: BotPlatformRuntimeContext;
constructor(config: BotProviderConfig, context: BotPlatformRuntimeContext) {
this.config = config;
this.context = context;
this.applicationId = config.applicationId;
}
// --- Lifecycle ---
async start(): Promise<void> {
// Register webhook or start listening
// For webhook platforms: configure the webhook URL with the platform API
// For gateway platforms: open a persistent connection
}
async stop(): Promise<void> {
// Cleanup: remove webhook registration or close connection
}
// --- Runtime Operations ---
createAdapter(): Record<string, any> {
// Return a Chat SDK adapter instance for inbound message handling
return {
'<platform>': createPlatformAdapter({
botToken: this.config.credentials.botToken,
// ... adapter-specific config
}),
};
}
getMessenger(platformThreadId: string): PlatformMessenger {
const api = new PlatformApi(this.config.credentials.botToken);
const channelId = platformThreadId.split(':')[1];
return {
createMessage: (content) => api.sendMessage(channelId, content).then(() => {}),
editMessage: (messageId, content) => api.editMessage(channelId, messageId, content),
removeReaction: (messageId, emoji) => api.removeReaction(channelId, messageId, emoji),
triggerTyping: () => Promise.resolve(),
};
}
extractChatId(platformThreadId: string): string {
return platformThreadId.split(':')[1];
}
parseMessageId(compositeId: string): string {
return compositeId;
}
// --- Optional methods ---
// sanitizeUserInput(text: string): string { ... }
// shouldSubscribe(threadId: string): boolean { ... }
// formatReply(body: string, stats?: UsageStats): string { ... }
}
export class MyPlatformClientFactory extends ClientFactory {
createClient(config: BotProviderConfig, context: BotPlatformRuntimeContext): PlatformClient {
return new MyPlatformClient(config, context);
}
async validateCredentials(credentials: Record<string, string>): Promise<ValidationResult> {
// Call the platform API to verify the credentials are valid
try {
const res = await fetch('https://api.example.com/auth.test', {
headers: { Authorization: `Bearer ${credentials.botToken}` },
method: 'POST',
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return { valid: true };
} catch {
return {
errors: [{ field: 'botToken', message: 'Failed to authenticate' }],
valid: false,
};
}
}
}
```
**Key interfaces to implement:**
| Method | Purpose |
| --------------------- | ----------------------------------------------------------- |
| `start()` | Register webhook or start gateway listener |
| `stop()` | Clean up resources on shutdown |
| `createAdapter()` | Return Chat SDK adapter for inbound event handling |
| `getMessenger()` | Return outbound messaging interface for a thread |
| `extractChatId()` | Parse platform channel ID from composite thread ID |
| `parseMessageId()` | Convert composite message ID to platform-native format |
| `sanitizeUserInput()` | *(Optional)* Strip bot mention artifacts from user input |
| `shouldSubscribe()` | *(Optional)* Control thread auto-subscription behavior |
| `formatReply()` | *(Optional)* Append platform-specific formatting to replies |
## Step 5: Export the Definition (`definition.ts`)
```ts
import type { PlatformDefinition } from '../types';
import { MyPlatformClientFactory } from './client';
import { schema } from './schema';
export const myPlatform: PlatformDefinition = {
id: '<platform>',
name: 'Platform Name',
description: 'Connect a Platform bot',
documentation: {
portalUrl: 'https://developers.example.com',
setupGuideUrl: 'https://lobehub.com/docs/usage/channels/<platform>',
},
schema,
showWebhookUrl: true, // Set to true if users need to manually copy the webhook URL
clientFactory: new MyPlatformClientFactory(),
};
```
**`showWebhookUrl`:** Set to `true` for platforms where the user must manually paste a webhook URL (e.g., Slack, Feishu). Set to `false` (or omit) for platforms that auto-register webhooks via API (e.g., Telegram).
## Step 6: Register the Platform
Edit `src/server/services/bot/platforms/index.ts`:
```ts
import { myPlatform } from './<platform>/definition';
// Add to exports
export { myPlatform } from './<platform>/definition';
// Register
platformRegistry.register(myPlatform);
```
## Step 7: Add i18n Keys
### Default keys (`src/locales/default/agent.ts`)
Add platform-specific keys. Reuse generic keys where possible:
```ts
// Reusable (already exist):
// 'channel.botToken', 'channel.applicationId', 'channel.charLimit', etc.
// Platform-specific:
'channel.<platform>.description': 'Connect this assistant to Platform for ...',
'channel.<platform>.someFieldHint': 'Description of this field.',
```
### Translations (`locales/zh-CN/agent.json`, `locales/en-US/agent.json`)
Add corresponding translations for all new keys in both locale files.
## Step 8: Add User Documentation
Create setup guides in `docs/usage/channels/`:
- `<platform>.mdx` — English guide
- `<platform>.zh-CN.mdx` — Chinese guide
Follow the structure of existing docs (e.g., `discord.mdx`): Prerequisites → Create App → Configure in LobeHub → Configure Webhooks → Test Connection → Configuration Reference → Troubleshooting.
## Frontend: Automatic UI Generation
The frontend automatically generates the configuration form from the schema. No frontend code changes are needed unless your platform requires a custom icon. The icon resolution works by matching the platform `name` against known icons in `@lobehub/ui/icons`:
```
// src/routes/(main)/agent/channel/const.ts
const ICON_NAMES = ['Discord', 'GoogleChat', 'Lark', 'Slack', 'Telegram', ...];
```
If your platform's `name` matches an icon name (case-insensitive), the icon is used automatically. Otherwise, add an alias in `ICON_ALIASES`.
## Webhook URL Pattern
All platforms share the same webhook route:
```
POST /api/agent/webhooks/[platform]/[appId]
```
The `BotMessageRouter` handles routing, on-demand bot loading, and Chat SDK integration automatically.
## Checklist
- [ ] Ensure a Chat SDK adapter exists (`@chat-adapter/*` on npm or custom `packages/chat-adapter-<platform>`)
- [ ] Create `src/server/services/bot/platforms/<platform>/`
- [ ] `schema.ts` — Field definitions for credentials and settings
- [ ] `api.ts` — Outbound API client
- [ ] `client.ts` — `ClientFactory` + `PlatformClient`
- [ ] `definition.ts` — `PlatformDefinition` export
- [ ] Register in `src/server/services/bot/platforms/index.ts`
- [ ] Add i18n keys in `src/locales/default/agent.ts`
- [ ] Add translations in `locales/zh-CN/agent.json` and `locales/en-US/agent.json`
- [ ] Add setup docs in `docs/usage/channels/<platform>.mdx` (en + zh-CN)
- [ ] Verify icon resolves in `const.ts` (or add alias)
@@ -0,0 +1,425 @@
---
title: 添加新的 Bot 平台
description: 了解如何向 LobeHub 的渠道系统添加新的 Bot 平台(如 Slack、WhatsApp),包括 Schema 定义、客户端实现和平台注册。
tags:
- Bot 平台
- 消息渠道
- 集成
- 开发指南
---
# 添加新的 Bot 平台
本指南介绍如何向 LobeHub 的渠道系统添加新的 Bot 平台。平台架构是模块化的 —— 每个平台是 `src/server/services/bot/platforms/` 下的一个独立目录。
## 架构概览
```
src/server/services/bot/platforms/
├── types.ts # 核心接口(FieldSchema、PlatformClient、ClientFactory 等)
├── registry.ts # PlatformRegistry 类
├── index.ts # 单例注册表 + 平台注册
├── utils.ts # 共享工具函数
├── discord/ # 示例:Discord 平台
│ ├── definition.ts # PlatformDefinition 导出
│ ├── schema.ts # 凭据和设置的 FieldSchema[]
│ ├── client.ts # ClientFactory + PlatformClient 实现
│ └── api.ts # 平台 API 辅助类
└── <your-platform>/ # 你的新平台
```
**核心概念:**
- **FieldSchema** — 声明式 Schema,同时驱动服务端校验和前端表单自动生成
- **PlatformClient** — 与平台交互的运行时接口(消息收发、生命周期管理)
- **ClientFactory** — 创建 PlatformClient 实例并验证凭据
- **PlatformDefinition** — 元数据 + Schema + 工厂,注册到全局注册表
- **Chat SDK Adapter** — 将平台的 Webhook / 事件桥接到统一的 Chat SDK
## 前置条件:Chat SDK Adapter
每个平台都需要一个 **Chat SDK Adapter**,用于将平台的 Webhook 事件桥接到统一的 [Vercel Chat SDK](https://github.com/vercel/chat)`chat` npm 包)。在实现平台之前,需要确定使用哪个 Adapter:
### 方案 A:使用已有的 npm Adapter
部分平台已有官方 Adapter 发布在 `@chat-adapter/*` 下:
- `@chat-adapter/discord` — Discord
- `@chat-adapter/slack` — Slack
- `@chat-adapter/telegram` — Telegram
可以通过 `npm view @chat-adapter/<platform>` 检查是否存在。
### 方案 B:在 `packages/` 中开发自定义 Adapter
如果没有现成的 npm Adapter,你需要在工作区中创建一个 Adapter 包。可参考现有实现:
- `packages/chat-adapter-feishu` — 飞书 / Lark Adapter`@lobechat/chat-adapter-feishu`
- `packages/chat-adapter-qq` — QQ Adapter`@lobechat/chat-adapter-qq`
每个 Adapter 包遵循以下结构:
```
packages/chat-adapter-<platform>/
├── package.json # name: @lobechat/chat-adapter-<platform>
├── tsconfig.json
├── tsup.config.ts
└── src/
├── index.ts # 公共导出:createXxxAdapter、XxxApiClient 等
├── adapter.ts # 实现 chat SDK 的 Adapter 接口的适配器类
├── api.ts # 平台 API 客户端(Webhook 验证、消息解析)
├── crypto.ts # 请求签名验证
├── format-converter.ts # 消息格式转换(平台格式 ↔ Chat SDK AST
└── types.ts # 平台特定的类型定义
```
开发自定义 Adapter 的要点:
- Adapter 必须实现 `chat` 包中的 `Adapter` 接口
- 需要处理 Webhook 请求验证、事件解析和消息格式转换
- `createXxxAdapter(config)` 工厂函数是 `PlatformClient.createAdapter()` 调用的入口
- 在 `package.json` 中添加 `"chat": "^4.14.0"` 作为依赖
## 第一步:创建平台目录
```bash
mkdir src/server/services/bot/platforms/<platform-name>
```
需要创建四个文件:
| 文件 | 用途 |
| --------------- | ------------------------------------- |
| `schema.ts` | 凭据和设置的字段定义 |
| `api.ts` | 用于出站消息的轻量 API 客户端 |
| `client.ts` | `ClientFactory` + `PlatformClient` 实现 |
| `definition.ts` | `PlatformDefinition` 导出 |
## 第二步:定义 Schema`schema.ts`
Schema 是一个 `FieldSchema` 对象数组,包含两个顶层部分:`credentials`(凭据)和 `settings`(设置)。
```ts
import type { FieldSchema } from '../types';
export const schema: FieldSchema[] = [
{
key: 'credentials',
label: 'channel.credentials',
properties: [
{
key: 'applicationId',
description: 'channel.applicationIdHint',
label: 'channel.applicationId',
required: true,
type: 'string',
},
{
key: 'botToken',
description: 'channel.botTokenEncryptedHint',
label: 'channel.botToken',
required: true,
type: 'password', // 存储时加密,UI 中遮蔽显示
},
],
type: 'object',
},
{
key: 'settings',
label: 'channel.settings',
properties: [
{
key: 'charLimit',
default: 4000,
description: 'channel.charLimitHint',
label: 'channel.charLimit',
minimum: 100,
type: 'number',
},
// 添加平台特定设置...
],
type: 'object',
},
];
```
**Schema 约定:**
- `type: 'password'` 字段会被加密存储,在表单中以密码形式显示
- 共享字段使用已有的 i18n 键(如 `channel.botToken`、`channel.charLimit`
- 平台特有字段使用 `channel.<platform>.<key>` 命名
- `devOnly: true` 的字段仅在 `NODE_ENV === 'development'` 时显示
- 凭据中必须包含一个能解析为 `applicationId` 的字段 —— 可以是显式的 `applicationId` 字段、`appId` 字段,或从 `botToken` 中提取(参见渠道详情页的 `resolveApplicationId`
## 第三步:创建 API 客户端(`api.ts`
用于回调服务(Chat SDK Adapter 之外)的出站消息操作的轻量类:
```ts
import debug from 'debug';
const log = debug('bot-platform:<platform>:client');
export const API_BASE = 'https://api.example.com';
export class PlatformApi {
private readonly token: string;
constructor(token: string) {
this.token = token;
}
async sendMessage(channelId: string, text: string): Promise<{ id: string }> {
log('sendMessage: channel=%s', channelId);
return this.call('messages.send', { channel: channelId, text });
}
async editMessage(channelId: string, messageId: string, text: string): Promise<void> {
log('editMessage: channel=%s, message=%s', channelId, messageId);
await this.call('messages.update', { channel: channelId, id: messageId, text });
}
// ... 其他操作(输入指示器、表情回应等)
private async call(method: string, body: Record<string, unknown>): Promise<any> {
const response = await fetch(`${API_BASE}/${method}`, {
body: JSON.stringify(body),
headers: {
Authorization: `Bearer ${this.token}`,
'Content-Type': 'application/json',
},
method: 'POST',
});
if (!response.ok) {
const text = await response.text();
log('API error: method=%s, status=%d, body=%s', method, response.status, text);
throw new Error(`API ${method} failed: ${response.status} ${text}`);
}
return response.json();
}
}
```
## 第四步:实现客户端(`client.ts`
实现 `PlatformClient` 并继承 `ClientFactory`
```ts
import { createPlatformAdapter } from '@chat-adapter/<platform>';
import debug from 'debug';
import {
type BotPlatformRuntimeContext,
type BotProviderConfig,
ClientFactory,
type PlatformClient,
type PlatformMessenger,
type ValidationResult,
} from '../types';
import { PlatformApi } from './api';
const log = debug('bot-platform:<platform>:bot');
class MyPlatformClient implements PlatformClient {
readonly id = '<platform>';
readonly applicationId: string;
private config: BotProviderConfig;
private context: BotPlatformRuntimeContext;
constructor(config: BotProviderConfig, context: BotPlatformRuntimeContext) {
this.config = config;
this.context = context;
this.applicationId = config.applicationId;
}
// --- 生命周期 ---
async start(): Promise<void> {
// 注册 webhook 或开始监听
// Webhook 平台:通过平台 API 配置 webhook URL
// 网关平台:打开持久连接
}
async stop(): Promise<void> {
// 清理:移除 webhook 注册或关闭连接
}
// --- 运行时操作 ---
createAdapter(): Record<string, any> {
// 返回 Chat SDK adapter 实例用于入站消息处理
return {
'<platform>': createPlatformAdapter({
botToken: this.config.credentials.botToken,
// ... adapter 特定配置
}),
};
}
getMessenger(platformThreadId: string): PlatformMessenger {
const api = new PlatformApi(this.config.credentials.botToken);
const channelId = platformThreadId.split(':')[1];
return {
createMessage: (content) => api.sendMessage(channelId, content).then(() => {}),
editMessage: (messageId, content) => api.editMessage(channelId, messageId, content),
removeReaction: (messageId, emoji) => api.removeReaction(channelId, messageId, emoji),
triggerTyping: () => Promise.resolve(),
};
}
extractChatId(platformThreadId: string): string {
return platformThreadId.split(':')[1];
}
parseMessageId(compositeId: string): string {
return compositeId;
}
// --- 可选方法 ---
// sanitizeUserInput(text: string): string { ... }
// shouldSubscribe(threadId: string): boolean { ... }
// formatReply(body: string, stats?: UsageStats): string { ... }
}
export class MyPlatformClientFactory extends ClientFactory {
createClient(config: BotProviderConfig, context: BotPlatformRuntimeContext): PlatformClient {
return new MyPlatformClient(config, context);
}
async validateCredentials(credentials: Record<string, string>): Promise<ValidationResult> {
// 调用平台 API 验证凭据有效性
try {
const res = await fetch('https://api.example.com/auth.test', {
headers: { Authorization: `Bearer ${credentials.botToken}` },
method: 'POST',
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return { valid: true };
} catch {
return {
errors: [{ field: 'botToken', message: 'Failed to authenticate' }],
valid: false,
};
}
}
}
```
**需要实现的关键接口:**
| 方法 | 用途 |
| --------------------- | ---------------------------- |
| `start()` | 注册 webhook 或启动网关监听 |
| `stop()` | 关闭时清理资源 |
| `createAdapter()` | 返回 Chat SDK adapter 用于入站事件处理 |
| `getMessenger()` | 返回指定会话的出站消息接口 |
| `extractChatId()` | 从复合会话 ID 中解析平台频道 ID |
| `parseMessageId()` | 将复合消息 ID 转换为平台原生格式 |
| `sanitizeUserInput()` | \*(可选)\* 去除用户输入中的 Bot 提及标记 |
| `shouldSubscribe()` | \*(可选)\* 控制会话自动订阅行为 |
| `formatReply()` | \*(可选)\* 在回复中追加平台特定的格式化内容 |
## 第五步:导出定义(`definition.ts`
```ts
import type { PlatformDefinition } from '../types';
import { MyPlatformClientFactory } from './client';
import { schema } from './schema';
export const myPlatform: PlatformDefinition = {
id: '<platform>',
name: 'Platform Name',
description: 'Connect a Platform bot',
documentation: {
portalUrl: 'https://developers.example.com',
setupGuideUrl: 'https://lobehub.com/docs/usage/channels/<platform>',
},
schema,
showWebhookUrl: true, // 如果用户需要手动复制 webhook URL 则设为 true
clientFactory: new MyPlatformClientFactory(),
};
```
**`showWebhookUrl`** 对于需要用户手动粘贴 webhook URL 的平台(如 Slack、飞书)设为 `true`。对于通过 API 自动注册 webhook 的平台(如 Telegram)设为 `false` 或省略。
## 第六步:注册平台
编辑 `src/server/services/bot/platforms/index.ts`
```ts
import { myPlatform } from './<platform>/definition';
// 添加到导出
export { myPlatform } from './<platform>/definition';
// 注册
platformRegistry.register(myPlatform);
```
## 第七步:添加 i18n 键
### 默认键(`src/locales/default/agent.ts`
添加平台特有键。尽量复用通用键:
```ts
// 可复用(已存在):
// 'channel.botToken'、'channel.applicationId'、'channel.charLimit' 等
// 平台特有:
'channel.<platform>.description': 'Connect this assistant to Platform for ...',
'channel.<platform>.someFieldHint': 'Description of this field.',
```
### 翻译文件(`locales/zh-CN/agent.json`、`locales/en-US/agent.json`
在两个语言文件中添加所有新键的对应翻译。
## 第八步:添加用户文档
在 `docs/usage/channels/` 下创建配置教程:
- `<platform>.mdx` — 英文教程
- `<platform>.zh-CN.mdx` — 中文教程
参考现有文档的结构(如 `discord.mdx`):前置条件 → 创建应用 → 在 LobeHub 中配置 → 配置 Webhook → 测试连接 → 配置参考 → 故障排除。
## 前端:自动 UI 生成
前端会根据 Schema 自动生成配置表单,无需修改前端代码(除非你的平台需要自定义图标)。图标解析通过将平台 `name` 与 `@lobehub/ui/icons` 中的已知图标匹配来实现:
```
// src/routes/(main)/agent/channel/const.ts
const ICON_NAMES = ['Discord', 'GoogleChat', 'Lark', 'Slack', 'Telegram', ...];
```
如果你的平台 `name` 与图标名称匹配(不区分大小写),图标会自动使用。否则需要在 `ICON_ALIASES` 中添加别名。
## Webhook URL 模式
所有平台共享同一个 Webhook 路由:
```
POST /api/agent/webhooks/[platform]/[appId]
```
`BotMessageRouter` 会自动处理路由分发、按需加载 Bot 和 Chat SDK 集成。
## 检查清单
- [ ] 确保 Chat SDK Adapter 可用(npm 上的 `@chat-adapter/*` 或自定义的 `packages/chat-adapter-<platform>`
- [ ] 创建 `src/server/services/bot/platforms/<platform>/`
- [ ] `schema.ts` — 凭据和设置的字段定义
- [ ] `api.ts` — 出站 API 客户端
- [ ] `client.ts` — `ClientFactory` + `PlatformClient`
- [ ] `definition.ts` — `PlatformDefinition` 导出
- [ ] 在 `src/server/services/bot/platforms/index.ts` 中注册
- [ ] 在 `src/locales/default/agent.ts` 中添加 i18n 键
- [ ] 在 `locales/zh-CN/agent.json` 和 `locales/en-US/agent.json` 中添加翻译
- [ ] 在 `docs/usage/channels/<platform>.mdx` 中添加配置教程(中英文)
- [ ] 验证图标在 `const.ts` 中能正确解析(或添加别名)
@@ -116,9 +116,9 @@ Fork [lobehub/lobehub](https://github.com/lobehub/lobehub) on GitHub, then clone
Use the branch naming format: `username/type/description`
```bash
git checkout -b yourname/feat/add-voice-input
git checkout -b yourname/fix/message-duplication
git checkout -b yourname/docs/update-api-guide
git checkout -b feat/add-voice-input
git checkout -b fix/message-duplication
git checkout -b docs/update-api-guide
```
**3. Make changes**
@@ -142,29 +142,33 @@ git commit -m "📝 docs: update installation guide"
**5. Open a Pull Request**
<Callout type={'warning'}>
Always target the **`canary`** branch — not `main`. `canary` is the active development branch.
PRs to `main` will be redirected.
Always target the **`canary`** branch — not `main`. `canary` is the active development branch. PRs
to `main` will be redirected.
</Callout>
Fill out the PR template in `.github/PULL_REQUEST_TEMPLATE.md`:
```markdown
## Description
Clear description of what this PR does.
## Type of Change
- [ ] ✨ New feature
- [ ] 🐛 Bug fix
- [ ] 📝 Documentation
- [ ] ♻️ Refactoring
## Checklist
- [ ] Code follows project style guidelines
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] All tests pass
## Related Issues
Fixes #123
```
@@ -91,17 +91,17 @@ bunx vitest run --silent='passed-only' '[file-path]'
提交信息请使用以下 emoji 作为前缀:
| Emoji | 代码 | 类型 | 说明 | 触发发布? |
| ----- | ------------------------ | -------- | --------- | ----- |
| ✨ | `:sparkles:` | feat | 新功能 | 是 |
| 🐛 | `:bug:` | fix | Bug 修复 | 是 |
| 📝 | `:memo:` | docs | 文档更新 | 否 |
| 💄 | `:lipstick:` | style | UI / 样式更改 | 否 |
| ♻️ | `:recycle:` | refactor | 代码重构 | 否 |
| ✅ | `:white_check_mark:` | test | 测试相关 | 否 |
| 🔨 | `:hammer:` | chore | 维护任务 | 否 |
| 🚀 | `:rocket:` | perf | 性能优化 | 否 |
| 🌐 | `:globe_with_meridians:` | i18n | 国际化 | 否 |
| Emoji | 代码 | 类型 | 说明 | 触发发布? |
| ----- | ------------------------ | -------- | ------------- | ---------- |
| ✨ | `:sparkles:` | feat | 新功能 | 是 |
| 🐛 | `:bug:` | fix | Bug 修复 | 是 |
| 📝 | `:memo:` | docs | 文档更新 | 否 |
| 💄 | `:lipstick:` | style | UI / 样式更改 | 否 |
| ♻️ | `:recycle:` | refactor | 代码重构 | 否 |
| ✅ | `:white_check_mark:` | test | 测试相关 | 否 |
| 🔨 | `:hammer:` | chore | 维护任务 | 否 |
| 🚀 | `:rocket:` | perf | 性能优化 | 否 |
| 🌐 | `:globe_with_meridians:` | i18n | 国际化 | 否 |
### 如何贡献
@@ -114,9 +114,9 @@ bunx vitest run --silent='passed-only' '[file-path]'
使用分支命名格式:`用户名/类型/描述`
```bash
git checkout -b yourname/feat/add-voice-input
git checkout -b yourname/fix/message-duplication
git checkout -b yourname/docs/update-api-guide
git checkout -b feat/add-voice-input
git checkout -b fix/message-duplication
git checkout -b docs/update-api-guide
```
**3. 进行更改**
@@ -140,28 +140,33 @@ git commit -m "📝 docs: 更新安装指南"
**5. 创建 Pull Request**
<Callout type={'warning'}>
PR 的目标分支必须是 **`canary`**,而非 `main`。`canary` 是当前活跃的开发分支,向 `main` 发起的 PR 会被重定向。
PR 的目标分支必须是 **`canary`**,而非 `main`。`canary` 是当前活跃的开发分支,向 `main` 发起的 PR
会被重定向。
</Callout>
请使用 `.github/PULL_REQUEST_TEMPLATE.md` 中的 PR 模板:
```markdown
## Description
清晰描述此 PR 的改动内容。
## Type of Change
- [ ] ✨ 新功能
- [ ] 🐛 Bug 修复
- [ ] 📝 文档
- [ ] ♻️ 重构
## Checklist
- [ ] 代码符合项目风格指南
- [ ] 已添加/更新测试
- [ ] 已更新文档
- [ ] 所有测试通过
## Related Issues
Fixes #123
```
+41
View File
@@ -79,6 +79,7 @@ table agent_bot_providers {
platform varchar(50) [not null]
application_id varchar(255) [not null]
credentials text
settings jsonb [default: `{}`]
enabled boolean [not null, default: true]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
@@ -123,6 +124,46 @@ table agent_cron_jobs {
}
}
table agent_documents {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
agent_id text [not null]
document_id varchar(255) [not null]
template_id varchar(100)
access_self integer [not null, default: 31]
access_shared integer [not null, default: 0]
access_public integer [not null, default: 0]
policy_load varchar(30) [not null, default: 'always']
policy jsonb
policy_load_position varchar(50) [not null, default: 'before-first-user']
policy_load_format varchar(20) [not null, default: 'raw']
policy_load_rule varchar(50) [not null, default: 'always']
deleted_at "timestamp with time zone"
deleted_by_user_id text
deleted_by_agent_id text
delete_reason text
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'agent_documents_user_id_idx']
agent_id [name: 'agent_documents_agent_id_idx']
access_self [name: 'agent_documents_access_self_idx']
access_shared [name: 'agent_documents_access_shared_idx']
access_public [name: 'agent_documents_access_public_idx']
policy_load [name: 'agent_documents_policy_load_idx']
template_id [name: 'agent_documents_template_id_idx']
policy_load_position [name: 'agent_documents_policy_load_position_idx']
policy_load_format [name: 'agent_documents_policy_load_format_idx']
policy_load_rule [name: 'agent_documents_policy_load_rule_idx']
(agent_id, policy_load_position) [name: 'agent_documents_agent_load_position_idx']
deleted_at [name: 'agent_documents_deleted_at_idx']
(agent_id, deleted_at, policy_load) [name: 'agent_documents_agent_autoload_deleted_idx']
document_id [name: 'agent_documents_document_id_idx']
(agent_id, document_id, user_id) [name: 'agent_documents_agent_document_user_unique', unique]
}
}
table agent_eval_benchmarks {
id text [pk, not null]
identifier text [not null]
+3 -3
View File
@@ -65,7 +65,7 @@ We need to configure an S3-compatible storage service in the server-side databas
Click `Object Storage` in the left sidebar, then the `Create Bucket` button in the top-right corner to create a new bucket. This example uses the name `lobe`. Leave Versioning and Object Lock disabled (default settings).
<Image alt={"Create Bucket"} src={'https://github.com/user-attachments/assets/27c37617-a813-4de5-b0bf-c7167999c856'} />
<Image alt={"Create Bucket"} src={'/blog/assetsc958eae64465451c4374cdee8f6fd596.webp'} />
Go to the bucket and click `Settings`, choose `Custom` for the policy, and paste the following JSON to make the bucket public-read/private-write:
@@ -108,9 +108,9 @@ We need to configure an S3-compatible storage service in the server-side databas
Copy the generated Access Key and Secret Key (the `Export` button lets you save the JSON locally). The English labels in the UI are confusing, but remember the shorter string is the Access Key and the longer string is the Secret Key (the exported JSON is correct).
<Image alt={"Add Key"} src={'https://github.com/user-attachments/assets/81f18b20-3918-4f77-8571-07d0c4a79aec'} />
<Image alt={"Add Key"} src={'/blog/assets43d66c62b79a027895b5a6127b2f2de2.webp'} />
<Image alt={"Export Key"} src={'https://github.com/user-attachments/assets/4dde41ec-985b-4781-8c77-aac65555a32f'} />
<Image alt={"Export Key"} src={'/blog/assets04fecea4e5f4ce3490bf11bec66ff477.webp'} />
### Configure Reverse Proxy
@@ -65,7 +65,7 @@ tags:
点击左侧边栏的 `对象存储` 菜单,右上角 `创建存储桶` 按钮,创建一个新的存储桶(Bucket)。创建存储桶时将指定其名称,下文以 `lobe` 为例。版本、对象锁依照默认配置不开启。
<Image alt={"Create Bucket"} src={'https://github.com/user-attachments/assets/27c37617-a813-4de5-b0bf-c7167999c856'} />
<Image alt={"Create Bucket"} src={'/blog/assetsc958eae64465451c4374cdee8f6fd596.webp'} />
点击存储桶 - `配置` 按钮,选择策略为 `自定义`,然后填入如下 JSON,设置存储桶的权限为 `公有读私有写`:
@@ -108,9 +108,9 @@ tags:
记录好得到的访问密钥和密钥(你可以点击 `导出` 按钮以在本地保存)。这里 RustFS 的翻译有点迷惑,但你只需要记住上面那个短的是 `Access Key`,长的是 `Secret Key` 即可(导出的 JSON 中是对的)。
<Image alt={"Add Key"} src={'https://github.com/user-attachments/assets/81f18b20-3918-4f77-8571-07d0c4a79aec'} />
<Image alt={"Add Key"} src={'/blog/assets43d66c62b79a027895b5a6127b2f2de2.webp'} />
<Image alt={"Export Key"} src={'https://github.com/user-attachments/assets/4dde41ec-985b-4781-8c77-aac65555a32f'} />
<Image alt={"Export Key"} src={'/blog/assets04fecea4e5f4ce3490bf11bec66ff477.webp'} />
### 配置反向代理
+17 -31
View File
@@ -308,6 +308,23 @@ services:
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
```
3. Internal Communication URL (`INTERNAL_APP_URL`)
<Callout type="warning">
`INTERNAL_APP_URL` is **required** for Docker Compose deployments. LobeHub's async features (e.g., AI image generation) require the container to make HTTP requests to itself internally. If `INTERNAL_APP_URL` is not set, the system falls back to `APP_URL`. When `APP_URL` is a host IP (e.g., `http://10.1.7.146:8080`), the container cannot reach that address internally, causing async features like image generation to silently fail.
</Callout>
```env
INTERNAL_APP_URL=http://localhost:3210
```
- `APP_URL`: Used for browser/client access, OAuth callbacks, webhooks, etc.
- `INTERNAL_APP_URL`: Used for internal server-to-server communication within the container (bypasses CDN/proxy/host network)
<Callout type="tip">
For Docker Compose deployments, we recommend using `http://localhost:3210` (container calling itself) or `http://lobe:3210` (using service name for container-to-container communication).
</Callout>
## FAQ
#### Database Migration Issues
@@ -330,37 +347,6 @@ sudo rm -rf ./data # Remove mounted database data
docker compose up -d # Restart
```
#### Using `INTERNAL_APP_URL` for Internal Server Communication
<Callout type="info">
If you're deploying LobeHub behind a CDN (like Cloudflare) or reverse proxy, you may want to configure internal server-to-server communication to bypass the CDN/proxy layer for better performance.
</Callout>
You can configure the `INTERNAL_APP_URL` environment variable:
```yaml
environment:
- 'APP_URL=https://lobe.example.com' # Public URL for browser access
- 'INTERNAL_APP_URL=http://localhost:3210' # Internal URL for server-to-server calls
```
**How it works:**
- `APP_URL`: Used for browser/client access, OAuth callbacks, webhooks, etc. (goes through CDN/proxy)
- `INTERNAL_APP_URL`: Used for internal server-to-server communication (bypasses CDN/proxy)
If `INTERNAL_APP_URL` is not set, it defaults to `APP_URL`.
**Configuration options:**
- `http://localhost:3210` - If using Docker with host network mode
- `http://lobe:3210` - If using Docker network with service name
- `http://127.0.0.1:3210` - Alternative localhost address
<Callout type="tip">
For Docker Compose deployments, we recommend using `http://lobe:3210` as the `INTERNAL_APP_URL` (using service name for container-to-container communication).
</Callout>
## Reverse Proxy Configuration
For production deployments with a custom domain and HTTPS, configure a reverse proxy in front of LobeHub.
@@ -302,6 +302,23 @@ services:
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
```
3. 内部通信地址 (`INTERNAL_APP_URL`)
<Callout type="warning">
Docker Compose 部署时**必须配置** `INTERNAL_APP_URL`。LobeHub 的异步功能(如 AI 生图)需要容器内部发起 HTTP 请求调用自身。如果未设置 `INTERNAL_APP_URL`,系统将使用 `APP_URL` 作为回退。当 `APP_URL` 是宿主机 IP(如 `http://10.1.7.146:8080`)时,容器内部无法访问该地址,导致生图等异步功能静默失败。
</Callout>
```env
INTERNAL_APP_URL=http://localhost:3210
```
- `APP_URL`:用于浏览器 / 客户端访问、OAuth 回调、webhook 等
- `INTERNAL_APP_URL`:用于容器内部服务间通信(绕过 CDN / 代理 / 宿主机网络)
<Callout type="tip">
对于 Docker Compose 部署,推荐使用 `http://localhost:3210`(容器调用自身)或 `http://lobe:3210`(使用服务名称进行容器间通信)。
</Callout>
## 常见问题
#### 数据库迁移问题
@@ -324,37 +341,6 @@ sudo rm -rf ./data # 移除挂载的数据库数据
docker compose up -d # 重新启动
```
#### 使用 `INTERNAL_APP_URL` 配置内部服务器通信
<Callout type="info">
如果你在 CDN(如 Cloudflare)或反向代理后部署 LobeHub,你可以配置内部服务器到服务器通信以绕过 CDN / 代理层,以获得更好的性能。
</Callout>
你可以配置 `INTERNAL_APP_URL` 环境变量:
```yaml
environment:
- 'APP_URL=https://lobe.example.com' # 浏览器访问的公开 URL
- 'INTERNAL_APP_URL=http://localhost:3210' # 服务器到服务器调用的内部 URL
```
**工作原理:**
- `APP_URL`:用于浏览器 / 客户端访问、OAuth 回调、webhook 等(通过 CDN / 代理)
- `INTERNAL_APP_URL`:用于内部服务器到服务器通信(绕过 CDN / 代理)
如果未设置 `INTERNAL_APP_URL`,它将默认为 `APP_URL`。
**配置选项:**
- `http://localhost:3210` - 如果使用 Docker 主机网络模式
- `http://lobe:3210` - 如果使用 Docker 网络与服务名称
- `http://127.0.0.1:3210` - 备用本地主机地址
<Callout type="tip">
对于 Docker Compose 部署,推荐使用 `http://lobe:3210` 作为 `INTERNAL_APP_URL`(使用服务名称进行容器间通信)。
</Callout>
## 反向代理配置
在生产环境中,如需使用自定义域名和 HTTPS,需在 LobeHub 前面配置反向代理。
+59 -215
View File
@@ -1,129 +1,63 @@
---
title: Scheduled Tasks
description: >-
Schedule agents to run tasks automatically at specified times — recurring
reports, monitoring, content generation, and time-based workflows.
Learn how to use scheduled tasks, including creating, editing, and deleting
them.
tags:
- LobeHub
- CronJob
- Scheduled Tasks
- Automation
- Task Scheduling
- Create
- Edit
- Delete
---
# Scheduled Tasks
Scheduled tasks are jobs that run periodically in the cloud. Configure an Agent to execute tasks based on your prompt at regular intervals — daily, weekly, or hourly. Instead of manually triggering the same workflow repeatedly, schedule it once and let it run automatically.
## What Are Scheduled Tasks?
A scheduled task is an automated agent run that:
- **Runs automatically**: Executes at your specified time without manual triggering
- **Follows a schedule**: Daily, weekly, hourly, or custom patterns
- **Maintains context**: Each run creates a conversation with full agent context
- **Works while you're away**: Runs even when you're not logged in
- **Sends notifications**: Alerts you when tasks complete (if configured)
## Why Use Scheduled Tasks?
### Recurring Tasks
Automate tasks that need to happen regularly:
- Daily market research summaries
- Weekly competitive analysis reports
- Monthly performance reviews
- Hourly monitoring and alerts
### Time-Based Workflows
Execute tasks at optimal times:
- Generate reports first thing Monday morning
- Send summaries at end of business day
- Run analysis during off-peak hours
### Consistency and Reliability
- Never forget routine tasks
- Maintain regular cadence for important workflows
- Reduce manual overhead
Scheduled tasks are jobs that run periodically in the cloud. In short, you can have an Agent run on your prompt on a schedule — for example, checking social media regularly and sending notifications. Instead of manually triggering the same workflow over and over, set it once and let it run automatically — daily, weekly, or hourly.
## Creating a Task
Find Scheduled Tasks in the left panel of the Agent conversation page, and click `Add Scheduled Task` to start creating a task.
Find **Scheduled Tasks** in the left panel of the Agent conversation page, and click `Add Scheduled Task` to start creating a task.
![Create Task](https://file.rene.wang/clipboard-1770261091677-74b74e4d6bf23.png)
![Create Task](/blog/assets3059f679eef80c5e777085db3d2d056e.webp)
<Steps>
### Select an Agent
### Configuration fields
Navigate to the agent you want to schedule. Open the agent profile or settings panel.
**Task name** — Give the task a descriptive name so you can recognize it at a glance:
### Access Scheduling
- ✅ "Daily Market Summary - 9am"
- ✅ "Weekly Competitor Analysis"
- ❌ "Task 1"
Look for the **Scheduled Tasks** section and click **Add Scheduled Task**.
**Task content** — Enter the prompt or instructions the Agent should run each time the task fires. Be specific and complete — this exact prompt runs on every scheduled execution. For example:
### Configure the Task
```
Analyze today's top tech news and summarize:
1. Major product launches
2. Funding announcements
3. Industry trends
Format as a brief executive summary.
```
#### Task Name
**Frequency** — Choose how often the task runs:
Give your task a descriptive name so you can identify it at a glance:
- **Daily** — Every day at a specified time
- **Weekly** — On selected weekdays at a specified time (you can pick multiple days)
- **Hourly** — Every 1, 2, 6, 12, or 24 hours
- ✅ "Daily Market Summary - 9am EST"
- ✅ "Weekly Competitor Analysis"
- ❌ "Task 1"
**Time and timezone** — Set the exact time and timezone so the task runs at the correct local time. Times use 24-hour format. For distributed teams, getting the timezone right matters.
#### Task Content
**Max executions** — Optionally cap how many times the task runs in total. Ongoing tasks often need no limit; for time-boxed campaigns (e.g. 30 days), you might set 30 — the task disables itself after reaching the limit.
Enter the prompt or instructions for the Agent to execute each time the task runs. Be specific and complete — this exact prompt runs every scheduled execution:
After you create a task, you can change its configuration at any time.
```
Analyze today's top tech news and summarize:
1. Major product launches
2. Funding announcements
3. Industry trends
Format as a brief executive summary.
```
#### Frequency
Choose how often the task runs:
- **Daily** — Every day at a specified time
- **Weekly** — Specific days of the week at a specified time (you can select multiple days)
- **Hourly** — Every 1, 2, 6, 12, or 24 hours
### Set the Time
Specify the exact time of day and your timezone so the task runs at the correct local time. Times are in 24-hour format.
For **weekly** schedules, select which days of the week to run. You can select multiple days (e.g., Monday, Wednesday, Friday).
For **hourly** schedules, set the interval and the minute when it runs.
### Configure Advanced Options
#### Timezone
Select your timezone so tasks run at the correct local time. Especially important for teams across multiple regions.
#### Max Executions
Optionally limit how many times the task runs total. Leave unlimited for ongoing tasks. Set a number (e.g., 30) for time-limited campaigns — the task disables automatically after reaching the limit.
### Save and Enable
Click **Save** to create the scheduled task. New tasks are typically enabled by default. After creation, you can modify the configuration at any time.
</Steps>
## Schedule Configuration Examples
## Schedule configuration examples
**Daily morning report:**
- Frequency: Daily at 08:00 in your timezone
- Prompt: "Generate a summary of yesterday's key metrics and action items for today."
- Prompt: "Summarize yesterday's key metrics and list today's priorities."
**Weekly planning session:**
@@ -137,157 +71,67 @@ Find Scheduled Tasks in the left panel of the Agent conversation page, and click
**End-of-month review:**
- Frequency: Monthly — set Max Executions to 1 per month, or use day-of-month scheduling
- Frequency: Monthly — set Max Executions to once per month, or combine with a specific day
- Prompt: "Analyze this month's performance data and generate an executive report."
## Managing Tasks
## Managing tasks
### Viewing Run History
### Viewing run history
Each scheduled run creates a conversation in the agent's conversation history, labeled with the task name and timestamp. Review outputs, check for errors, and track results over time.
Each scheduled run creates an entry in that Agent's conversation history, labeled with the task name and timestamp. You can review outputs, check for errors, and track past results.
### Editing a Schedule
### Editing a schedule
Click on a scheduled task to modify it — update the prompt, change the frequency or time, or adjust the timezone. Changes take effect on the next scheduled execution.
Click a scheduled task to edit it — update the prompt, change frequency or time, or adjust the timezone. Changes apply from the next scheduled run onward.
### Pausing a Task
### Pausing a task
If you temporarily don't need a scheduled task, you can disable it. After disabling, the task will no longer execute automatically, but the task's execution plan and prompt configuration will be preserved. The task resumes after re-enabling.
If you temporarily don't need a scheduled task, turn off its enabled state. While off, it won't run automatically; the schedule and prompt stay saved. When you turn it back on, the task continues as configured.
![Pause Task](https://file.rene.wang/clipboard-1770266335710-1fec523143aab.png)
![Pause Task](/blog/assets636c78daf95c590cd7d80284c68eb6d9.webp)
### Deleting a Task
### Deleting a task
If you no longer need a scheduled task, you can delete it. After deletion, the task's execution plan and prompt configuration are removed, and the system will no longer trigger any subsequent executions. Past conversation history is preserved.
If you no longer need a scheduled task, you can delete it. Deletion removes the schedule and prompt configuration; the system will not trigger further runs. Past conversation history is kept.
## Use Cases
## Best practices
<Tabs>
<Tab title="News & Research">
- **Daily tech news digest**: Summarize top stories every morning
- **Competitor tracking**: Weekly analysis of competitor announcements
- **Industry trends**: Monthly deep-dive into emerging trends
- **Academic monitoring**: Track new papers in your field
</Tab>
<Tab title="Content Generation">
- **Social media drafts**: Daily post ideas based on current events
- **Newsletter content**: Weekly roundup of relevant topics
- **Blog post outlines**: Bi-weekly topic suggestions
- **Report drafts**: Auto-generate periodic report templates
</Tab>
<Tab title="Reporting & Analytics">
- **Daily metrics summary**: KPI updates each morning
- **Weekly performance review**: Analyze data and surface insights
- **Monthly executive summary**: High-level overview for leadership
- **Anomaly detection**: Flag unusual patterns in data
</Tab>
<Tab title="Personal Productivity">
- **Morning briefing**: Weather, calendar, priorities at 7am
- **End-of-day review**: Summarize accomplishments at 5pm
- **Weekly planning**: Sunday evening prep for the week ahead
- **Reminder notifications**: Important milestones and check tasks
</Tab>
<Tab title="Monitoring & Alerts">
- **Hourly health checks**: Monitor systems or metrics
- **Social media monitoring**: Track brand mentions and sentiment
- **Price tracking**: Watch for changes in competitors or markets
- **Security alerts**: High-frequency checks for critical issues
</Tab>
</Tabs>
## Best Practices
**Write clear, self-contained prompts** — The task prompt runs without any prior conversation context. Every detail the Agent needs must be in the prompt itself:
**Write clear, self-contained prompts** — The scheduled task prompt runs with no prior conversation context. Everything the Agent needs must be in the prompt:
- ✅ "Search for news about electric vehicles published in the last 24 hours and summarize the top 3 developments."
- ❌ "Check the news like we discussed." (Agent has no conversation context when scheduled)
- ❌ "Check the news like we discussed." (The Agent has no access to earlier chats when the schedule runs.)
**Choose appropriate frequency** — Match the schedule to the actual cadence of the information you're monitoring. Hourly monitoring for daily news is unnecessary overhead; weekly reports for real-time metrics miss the point.
**Choose appropriate frequency** — Match the schedule to how fast the information actually changes. Hourly checks for daily news add unnecessary load; weekly reports for real-time metrics miss important updates.
**Use descriptive task names** — Include the purpose and schedule in the name: "Weekly Competitor Analysis - Monday 9am" is far more useful than "Task 2".
**Use descriptive task names** — Put purpose and timing in the name: "Weekly Competitor Analysis - Monday 9am" beats "Task 2".
**Set max executions for experiments** — When testing a new scheduled task, set a max execution count of 510 so it doesn't run indefinitely if the prompt doesn't work as expected.
**Set max executions while experimenting** — When testing a new scheduled task, use a max execution count of 510 so it doesn't run forever if the prompt needs tuning.
**Timezone awareness** — Always set the correct timezone. A task scheduled for "9:00 AM" defaults to the server timezone, which may differ from your local time. Account for daylight saving time changes.
**Timezone awareness** — Always set the correct timezone. "09:00" is interpreted in the configured timezone, which may differ from your local clock. Wrong timezone is a common cause of unexpected run times.
**Monitor results regularly** — Review scheduled run outputs to check if the agent is producing useful results and refine prompts based on actual outputs.
## Use cases
## Advanced Scheduling
### Regularly check social media and notify you
### Custom Cron Patterns
Schedule a task to periodically check social content for given platforms or keywords. It can fetch recent activity, filter what matters, and summarize when there's something important — useful for brand monitoring, competitor tracking, or creator update alerts.
For advanced users, some interfaces support custom cron expressions:
### Periodic summaries and reports
```
0 9 * * 1-5 # Monday-Friday at 9:00am
0 */6 * * * # Every 6 hours
0 0 1 * * # First day of every month at midnight
```
For work that needs regular review — analytics, project status, or content performance — a scheduled task can gather information on a cadence and produce structured takeaways so you keep sight of trends.
### Chaining Scheduled Tasks
### Timed reminders
Create workflows by scheduling multiple agents in sequence:
1. **Agent A** (8am): Gather data
2. **Agent B** (9am): Analyze data from Agent A
3. **Agent C** (10am): Generate report from Agent B's analysis
Coordinate timing so each task has inputs ready.
### Conditional Execution
Advanced setups may support conditions:
- Only run if certain criteria are met
- Skip runs on holidays
- Adjust frequency based on results
## Notifications and Integrations
Depending on your workspace configuration:
- **Email notifications**: Get alerts when runs complete
- **Webhook integrations**: Send results to other tools
- **Slack/Discord bots**: Post summaries to team channels
- **Export options**: Download or share run outputs
Check your workspace settings for available integration options.
Set reminders for milestones, recurring checks, or follow-ups. LobeHub can generate reminder messages and notify you (for example by email) without you triggering the flow manually.
## Troubleshooting
<AccordionGroup>
<Accordion title="Task Didn't Run at Expected Time">
**Check if the task is enabled** — Disabled tasks won't execute. Toggle it back on if needed.
**Task didn't run when expected** — Check the timezone. Scheduled times are relative to the configured timezone, not necessarily "now" on your device. Also confirm the task is enabled.
**Verify the schedule configuration** — Is the time correct in your timezone? For weekly schedules, are the right days selected? Has it reached max executions?
**Runs at surprising times** — Double-check 24-hour time (e.g. 17:00 is 5:00 PM, not 5:00 AM).
**Check for errors** — Look at the conversation history for failed runs.
</Accordion>
**Poor output quality** — Scheduled prompts run without chat history. Rewrite the prompt so it is fully self-contained, with background, data sources, and format requirements spelled out.
<Accordion title="Unexpected Run Times">
**Timezone mismatch** — Ensure the task timezone matches your expectations. Verify you haven't confused AM/PM in 24-hour format (e.g., 17:00 = 5:00 PM).
**Daylight Saving Time** — Some timezones shift with DST. Tasks may run an hour earlier/later after DST changes.
</Accordion>
<Accordion title="Poor Quality Outputs">
**Refine your prompt** — Be more specific about what you want. Add examples of good outputs. Specify format and length.
**Wrong agent** — Ensure the agent is properly configured for the task and has necessary plugins or knowledge bases.
</Accordion>
<Accordion title="Too Many Runs">
**Reduce frequency** — Change from hourly to daily, or daily to weekly.
**Set max executions** — Limit total runs to avoid runaway tasks.
**Disable temporarily** — Turn off the task while you reassess.
</Accordion>
</AccordionGroup>
**Too many runs** — While experimenting, set a **Max executions** cap. If a task has already run more than intended, delete it and create a new one with the right limits.
<Cards>
<Card href={'/docs/usage/agent/web-search'} title={'Web Search'} />
+2 -2
View File
@@ -18,7 +18,7 @@ tags:
在 Agent 会话页面左侧面板找到定时任务,点击 `添加定时任务` 开始创建任务。
![创建任务](https://file.rene.wang/clipboard-1770261091677-74b74e4d6bf23.png)
![创建任务](/blog/assets3059f679eef80c5e777085db3d2d056e.webp)
### 配置字段说明
@@ -86,7 +86,7 @@ tags:
如果暂时不需要某个定时任务,可以关闭启用状态。关闭后,任务不再自动执行,执行计划和 Prompt 配置会保留。恢复启用后,该任务将继续执行。
![暂停任务](https://file.rene.wang/clipboard-1770266335710-1fec523143aab.png)
![暂停任务](/blog/assets636c78daf95c590cd7d80284c68eb6d9.webp)
### 删除任务
+16 -1
View File
@@ -14,7 +14,8 @@ tags:
# Connect LobeHub to Discord
<Callout type={'info'}>
This feature is currently in development and may not be fully stable. You can enable it by turning on **Developer Mode** in **Settings** → **Advanced Settings** → **Developer Mode**.
This feature is currently in development and may not be fully stable. You can enable it by turning
on **Developer Mode** in **Settings** → **Advanced Settings** → **Developer Mode**.
</Callout>
By connecting a Discord channel to your LobeHub agent, users can interact with the AI assistant directly through Discord server channels and direct messages.
@@ -29,6 +30,8 @@ By connecting a Discord channel to your LobeHub agent, users can interact with t
<Steps>
### Go to the Discord Developer Portal
![](https://hub-apac-1.lobeobjects.space/docs/83f435317ea2c9c4a2adcbfd74301536.png)
Visit the [Discord Developer Portal](https://discord.com/developers/applications) and click **New Application**. Give your application a name (e.g., "LobeHub Assistant") and click **Create**.
### Create a Bot
@@ -37,6 +40,8 @@ By connecting a Discord channel to your LobeHub agent, users can interact with t
### Enable Privileged Gateway Intents
![](https://hub-apac-1.lobeobjects.space/docs/6126baa4154be45eefdad73c576723d0.png)
On the Bot settings page, scroll down to **Privileged Gateway Intents** and enable:
- **Message Content Intent** — Required for the bot to read message content
@@ -47,12 +52,16 @@ By connecting a Discord channel to your LobeHub agent, users can interact with t
### Copy the Bot Token
![](https://hub-apac-1.lobeobjects.space/docs/e76272de65ad8db8746b1dcafeafdce8.png)
On the **Bot** page, click **Reset Token** to generate your bot token. Copy and save it securely.
> **Important:** Treat your bot token like a password. Never share it publicly or commit it to version control.
### Copy the Application ID and Public Key
![](https://hub-apac-1.lobeobjects.space/docs/d42901c6eb84e3e335d9a8535f317a35.png)
Go to **General Information** in the left sidebar. Copy and save:
- **Application ID**
@@ -70,6 +79,8 @@ By connecting a Discord channel to your LobeHub agent, users can interact with t
### Fill in the Credentials
![](https://hub-apac-1.lobeobjects.space/docs/c5ced26ea287ee215a9dc385367c1083.png)
Enter the following fields:
- **Application ID** — The Application ID from your Discord app's General Information page
@@ -88,6 +99,8 @@ By connecting a Discord channel to your LobeHub agent, users can interact with t
<Steps>
### Generate an Invite URL
![](https://hub-apac-1.lobeobjects.space/docs/5e8a93f33e085a187deddb87704f0bd3.png)
In the Discord Developer Portal, go to **OAuth2** → **URL Generator**. Select the following scopes:
- `bot`
@@ -104,6 +117,8 @@ By connecting a Discord channel to your LobeHub agent, users can interact with t
### Authorize the Bot
![](https://hub-apac-1.lobeobjects.space/docs/2e47836fe4ac988e76460534ee57efa4.png)
Copy the generated URL, open it in your browser, select the server you want to add the bot to, and click **Authorize**.
</Steps>
+28 -35
View File
@@ -1,45 +1,42 @@
---
title: Connect LobeHub to Feishu / Lark
title: Connect LobeHub to Feishu (飞书)
description: >-
Learn how to create a Feishu (Lark) custom app and connect it to your LobeHub
agent as a message channel, enabling your AI assistant to interact with team
members in Feishu or Lark chats.
Learn how to create a Feishu custom app and connect it to your LobeHub agent
as a message channel, enabling your AI assistant to interact with team members
in Feishu chats.
tags:
- Feishu
- Lark
- 飞书
- Message Channels
- Bot Setup
- Integration
---
# Connect LobeHub to Feishu / Lark
# Connect LobeHub to Feishu (飞书)
<Callout type={'info'}>
This feature is currently in development and may not be fully stable. You can enable it by turning on **Developer Mode** in **Settings** → **Advanced Settings** → **Developer Mode**.
</Callout>
By connecting a Feishu (or Lark) channel to your LobeHub agent, team members can interact with the AI assistant directly in Feishu private chats and group conversations.
By connecting a Feishu channel to your LobeHub agent, team members can interact with the AI assistant directly in Feishu private chats and group conversations.
> Feishu is the Chinese version, and Lark is the international version. The setup process is identical — just use the corresponding platform portal.
> If you are using the international version (Lark), please refer to the [Lark setup guide](/docs/usage/channels/lark).
## Prerequisites
- A LobeHub account with an active subscription
- A Feishu or Lark account with permissions to create enterprise apps
- A Feishu account with permissions to create enterprise apps
## Step 1: Create a Feishu / Lark App
## Step 1: Create a Feishu App
<Steps>
### Open the Developer Portal
- **Feishu:** Visit [open.feishu.cn/app](https://open.feishu.cn/app)
- **Lark:** Visit [open.larksuite.com/app](https://open.larksuite.com/app)
Sign in with your account.
Visit [open.feishu.cn/app](https://open.feishu.cn/app) and sign in with your account.
### Create an Enterprise App
Click **Create Enterprise App**. Fill in the app name (e.g., "LobeHub Assistant"), description, and icon, then submit the form.
Click **Create Enterprise App**. Fill in the app name (e.g., "LobeHub 助手"), description, and icon, then submit the form.
### Copy App Credentials
@@ -90,28 +87,24 @@ By connecting a Feishu (or Lark) channel to your LobeHub agent, team members can
}
```
<Callout type={'warning'}>
The JSON above is for **Feishu (飞书)**. If you are using **Lark (international)**, some scopes may not be available (e.g. `aily:*`, `corehr:*`, `im:chat.access_event.bot_p2p_chat:read`). Remove any scopes that the batch import rejects.
</Callout>
### Enable Bot Capability
Go to **App Capability** → **Bot**. Toggle the bot capability on and set your preferred bot name.
</Steps>
## Step 3: Configure Feishu / Lark in LobeHub
## Step 3: Configure Feishu in LobeHub
<Steps>
### Open Channel Settings
In LobeHub, navigate to your agent's settings, then select the **Channels** tab. Click **飞书** (Feishu) or **Lark** from the platform list.
In LobeHub, navigate to your agent's settings, then select the **Channels** tab. Click **飞书** (Feishu) from the platform list.
### Fill in App Credentials
Enter the following fields:
- **App ID** — The App ID from your Feishu/Lark app
- **App Secret** — The App Secret from your Feishu/Lark app
- **App ID** — The App ID from your Feishu app
- **App Secret** — The App Secret from your Feishu app
> You don't need to fill in **Verification Token** or **Encrypt Key** at this point — you can set them up after configuring the Event Subscription in Step 4.
@@ -120,12 +113,12 @@ By connecting a Feishu (or Lark) channel to your LobeHub agent, team members can
Click **Save Configuration**. After saving, an **Event Subscription URL** will be displayed. Copy this URL — you will need it in the next step.
</Steps>
## Step 4: Set Up Event Subscription in Feishu / Lark
## Step 4: Set Up Event Subscription in Feishu
<Steps>
### Open Event Subscription Settings
Go back to your app in the Feishu/Lark Developer Portal. Navigate to **Event Subscription**.
Go back to your app in the Feishu Developer Portal. Navigate to **Event Subscription**.
### Configure the Request URL
@@ -145,7 +138,7 @@ By connecting a Feishu (or Lark) channel to your LobeHub agent, team members can
Go back to LobeHub's channel settings and fill in:
- **Verification Token** — Used to verify that webhook events originate from Feishu/Lark
- **Verification Token** — Used to verify that webhook events originate from Feishu
- **Encrypt Key** (optional) — Used to decrypt encrypted event payloads
Click **Save Configuration** again to apply.
@@ -165,21 +158,21 @@ By connecting a Feishu (or Lark) channel to your LobeHub agent, team members can
## Step 6: Test the Connection
Back in LobeHub's channel settings, click **Test Connection** to verify the credentials. Then find your bot in Feishu/Lark by searching its name and send it a message to confirm it responds.
Back in LobeHub's channel settings, click **Test Connection** to verify the credentials. Then find your bot in Feishu by searching its name and send it a message to confirm it responds.
## Configuration Reference
| Field | Required | Description |
| -------------------------- | -------- | -------------------------------------------------------------------- |
| **App ID** | Yes | Your Feishu/Lark app's App ID (`cli_xxx`) |
| **App Secret** | Yes | Your Feishu/Lark app's App Secret |
| **Verification Token** | No | Verifies webhook event source (recommended) |
| **Encrypt Key** | No | Decrypts encrypted event payloads |
| **Event Subscription URL** | — | Auto-generated after saving; paste into Feishu/Lark Developer Portal |
| Field | Required | Description |
| -------------------------- | -------- | --------------------------------------------------------------- |
| **App ID** | Yes | Your Feishu app's App ID (`cli_xxx`) |
| **App Secret** | Yes | Your Feishu app's App Secret |
| **Verification Token** | No | Verifies webhook event source (recommended) |
| **Encrypt Key** | No | Decrypts encrypted event payloads |
| **Event Subscription URL** | — | Auto-generated after saving; paste into Feishu Developer Portal |
## Troubleshooting
- **Event Subscription URL verification failed:** Ensure you saved the configuration in LobeHub first, and the URL was copied correctly.
- **Bot not responding:** Verify the app is published and approved, the bot capability is enabled, and the `im.message.receive_v1` event is subscribed.
- **Permission errors:** Confirm all required permissions are added and approved in the Developer Portal.
- **Test Connection failed:** Double-check the App ID and App Secret. For Lark, ensure you selected "Lark" (not "飞书") in LobeHub's channel settings.
- **Test Connection failed:** Double-check the App ID and App Secret.
+35 -37
View File
@@ -1,39 +1,35 @@
---
title: 将 LobeHub 连接到飞书 / Lark
description: 了解如何创建飞书Lark自定义应用并将其连接到您的 LobeHub 代理作为消息渠道,使您的 AI 助手能够在飞书或 Lark 聊天中与团队成员互动。
title: 将 LobeHub 连接到飞书
description: 了解如何创建飞书自定义应用并将其连接到您的 LobeHub 代理作为消息渠道,使您的 AI 助手能够在飞书聊天中与团队成员互动。
tags:
- 飞书
- Lark
- 消息渠道
- 机器人设置
- 集成
---
# 将 LobeHub 连接到飞书 / Lark
# 将 LobeHub 连接到飞书
<Callout type={'info'}>
此功能目前正在开发中,可能尚未完全稳定。您可以通过在 **设置** → **高级设置** → **开发者模式**
中启用 **开发者模式** 来使用此功能。
</Callout>
通过将飞书(或 Lark渠道连接到您的 LobeHub 代理,团队成员可以直接在飞书的私聊和群组对话中与 AI 助手互动。
通过将飞书渠道连接到您的 LobeHub 代理,团队成员可以直接在飞书的私聊和群组对话中与 AI 助手互动。
> 飞书是中国版本,Lark 是国际版本。设置过程完全相同 —— 只需使用对应的平台门户即可
> 如果您使用的是国际版(Lark),请参阅 [Lark 设置指南](/docs/usage/channels/lark)
## 前置条件
- 一个拥有有效订阅的 LobeHub 账户
- 一个拥有创建企业应用权限的飞书或 Lark 账户
- 一个拥有创建企业应用权限的飞书账户
## 第一步:创建飞书 / Lark 应用
## 第一步:创建飞书应用
<Steps>
### 打开开发者门户
- **飞书:** 访问 [open.feishu.cn/app](https://open.feishu.cn/app)
- **Lark** 访问 [open.larksuite.com/app](https://open.larksuite.com/app)
使用您的账户登录。
访问 [open.feishu.cn/app](https://open.feishu.cn/app) 并使用您的账户登录。
### 创建企业应用
@@ -88,47 +84,38 @@ tags:
}
```
<Callout type={'warning'}>
以上 JSON 适用于**飞书**。如果您使用的是 **Lark(国际版)**,部分权限码可能不可用(如 `aily:*`、`corehr:*`、`im:chat.access_event.bot_p2p_chat:read`)。请移除批量导入时提示无效的权限码。
</Callout>
### 启用机器人功能
进入 **应用能力** → **机器人**。开启机器人功能并设置您喜欢的机器人名称。
</Steps>
## 第三步:在 LobeHub 中配置飞书 / Lark
## 第三步:在 LobeHub 中配置飞书
<Steps>
### 打开渠道设置
在 LobeHub 中,导航到您的代理设置,然后选择 **渠道** 标签。点击平台列表中的 **飞书** 或 **Lark**
在 LobeHub 中,导航到您的代理设置,然后选择 **渠道** 标签。点击平台列表中的 **飞书**。
### 填写应用凭证
输入以下字段:
- **应用 ID** — 来自飞书 / Lark 应用的应用 ID
- **应用密钥** — 来自飞书 / Lark 应用的应用密钥
- **Verification Token** — 用于验证 webhook 事件是否来自飞书 / Lark
- **应用 ID** — 来自飞书应用的应用 ID
- **应用密钥** — 来自飞书应用的应用密钥
您还可以选择配置以下内容:
- **Encrypt Key** — 用于解密飞书 / Lark 的加密事件负载
> Verification Token 和 Encrypt Key 可以在飞书 / Lark 开发者门户的 **事件订阅** → **加密策略** 中找到(位于页面顶部)。如果您还没有打开过事件订阅页面,可以在完成第四步后再回来填写 Verification Token。
> 此时您不需要填写 **Verification Token** 或 **Encrypt Key** —— 可以在完成第四步配置事件订阅后再设置。
### 保存并复制 Webhook URL
点击 **保存配置**。保存后,将显示一个 **事件订阅 URL**。复制此 URL—— 您将在下一步中需要它。
</Steps>
## 第四步:在飞书 / Lark 中设置事件订阅
## 第四步:在飞书中设置事件订阅
<Steps>
### 打开事件订阅设置
返回飞书 / Lark 开发者门户中的应用。导航到 **事件订阅**。
返回飞书开发者门户中的应用。导航到 **事件订阅**。
### 配置请求 URL
@@ -141,6 +128,17 @@ tags:
- `im.message.receive_v1` — 当收到消息时触发
这将使您的应用能够接收消息并将其转发到 LobeHub。
### (推荐)填写 Verification Token 和 Encrypt Key
配置事件订阅后,您可以在事件订阅页面顶部的 **加密策略** 中找到 **Verification Token** 和 **Encrypt Key**。
返回 LobeHub 的渠道设置,填写:
- **Verification Token** — 用于验证 webhook 事件是否来自飞书
- **Encrypt Key**(可选)— 用于解密加密事件负载
再次点击 **保存配置** 以应用。
</Steps>
## 第五步:发布应用
@@ -157,21 +155,21 @@ tags:
## 第六步:测试连接
回到 LobeHub 的渠道设置,点击 **测试连接** 以验证凭证。然后在飞书 / Lark 中搜索您的机器人名称并发送消息,确认其是否响应。
回到 LobeHub 的渠道设置,点击 **测试连接** 以验证凭证。然后在飞书中搜索您的机器人名称并发送消息,确认其是否响应。
## 配置参考
| 字段 | 是否必需 | 描述 |
| ---------------------- | ---- | ------------------------------- |
| **应用 ID** | 是 | 您的飞书 / Lark 应用的应用 ID`cli_xxx` |
| **应用密钥** | 是 | 您的飞书 / Lark 应用的应用密钥 |
| **Verification Token** | | 验证 webhook 事件来源 |
| **Encrypt Key** | 否 | 解密加密事件负载 |
| **事件订阅 URL** | — | 保存后自动生成;粘贴到飞书 / Lark 开发者门户 |
| 字段 | 是否必需 | 描述 |
| ---------------------- | ---- | ----------------------- |
| **应用 ID** | 是 | 您的飞书应用的应用 ID`cli_xxx` |
| **应用密钥** | 是 | 您的飞书应用的应用密钥 |
| **Verification Token** | | 验证 webhook 事件来源(推荐) |
| **Encrypt Key** | 否 | 解密加密事件负载 |
| **事件订阅 URL** | — | 保存后自动生成;粘贴到飞书开发者门户 |
## 故障排除
- **事件订阅 URL 验证失败:** 确保您已在 LobeHub 中保存配置,并正确复制了 URL。
- **机器人未响应:** 验证应用已发布并获得批准,机器人功能已启用,并订阅了 `im.message.receive_v1` 事件。
- **权限错误:** 确保所有所需权限已在开发者门户中添加并获得批准。
- **测试连接失败:** 仔细检查应用 ID 和应用密钥。对于 Lark,请确保您在 LobeHub 的渠道设置中选择了 "Lark"(而不是 "飞书")。
- **测试连接失败:** 仔细检查应用 ID 和应用密钥。
+173
View File
@@ -0,0 +1,173 @@
---
title: Connect LobeHub to Lark
description: >-
Learn how to create a Lark custom app and connect it to your LobeHub agent as
a message channel, enabling your AI assistant to interact with team members in
Lark chats.
tags:
- Lark
- Message Channels
- Bot Setup
- Integration
---
# Connect LobeHub to Lark
<Callout type={'info'}>
This feature is currently in development and may not be fully stable. You can enable it by turning on **Developer Mode** in **Settings** → **Advanced Settings** → **Developer Mode**.
</Callout>
By connecting a Lark channel to your LobeHub agent, team members can interact with the AI assistant directly in Lark private chats and group conversations.
> If you are using the Chinese version (飞书), please refer to the [Feishu setup guide](/docs/usage/channels/feishu).
## Prerequisites
- A LobeHub account with an active subscription
- A Lark account with permissions to create enterprise apps
## Step 1: Create a Lark App
<Steps>
### Open the Developer Portal
Visit [open.larksuite.com/app](https://open.larksuite.com/app) and sign in with your account.
### Create an Enterprise App
Click **Create Enterprise App**. Fill in the app name (e.g., "LobeHub Assistant"), description, and icon, then submit the form.
### Copy App Credentials
Go to **Credentials & Basic Info** and copy:
- **App ID** (format: `cli_xxx`)
- **App Secret**
> **Important:** Keep your App Secret confidential. Never share it publicly.
</Steps>
## Step 2: Configure App Permissions and Bot
<Steps>
### Import Required Permissions
In your app settings, go to **Permissions & Scopes**, click **Batch Import**, and paste the JSON below to grant the bot all necessary permissions.
```json
{
"scopes": {
"tenant": [
"application:application.app_message_stats.overview:readonly",
"application:application:self_manage",
"application:bot.menu:write",
"cardkit:card:read",
"cardkit:card:write",
"contact:user.employee_id:readonly",
"event:ip_list",
"im:chat.members:bot_access",
"im:message",
"im:message.group_at_msg:readonly",
"im:message.p2p_msg:readonly",
"im:message:readonly",
"im:message:send_as_bot",
"im:resource"
],
"user": []
}
}
```
<Callout type={'info'}>
The scopes above are tailored for Lark (international). Some Feishu-specific scopes (e.g. `aily:*`, `corehr:*`, `im:chat.access_event.bot_p2p_chat:read`) are not available on Lark and have been excluded.
</Callout>
### Enable Bot Capability
Go to **App Capability** → **Bot**. Toggle the bot capability on and set your preferred bot name.
</Steps>
## Step 3: Configure Lark in LobeHub
<Steps>
### Open Channel Settings
In LobeHub, navigate to your agent's settings, then select the **Channels** tab. Click **Lark** from the platform list.
### Fill in App Credentials
Enter the following fields:
- **App ID** — The App ID from your Lark app
- **App Secret** — The App Secret from your Lark app
> You don't need to fill in **Verification Token** or **Encrypt Key** at this point — you can set them up after configuring the Event Subscription in Step 4.
### Save and Copy the Webhook URL
Click **Save Configuration**. After saving, an **Event Subscription URL** will be displayed. Copy this URL — you will need it in the next step.
</Steps>
## Step 4: Set Up Event Subscription in Lark
<Steps>
### Open Event Subscription Settings
Go back to your app in the Lark Developer Portal. Navigate to **Event Subscription**.
### Configure the Request URL
Paste the **Event Subscription URL** you copied from LobeHub into the **Request URL** field. The platform will verify the endpoint automatically.
### Add the Message Event
Add the following event:
- `im.message.receive_v1` — Triggered when a message is received
This allows your app to receive messages and forward them to LobeHub.
### (Recommended) Fill in Verification Token and Encrypt Key
After configuring Event Subscription, you can find the **Verification Token** and **Encrypt Key** at the top of the Event Subscription page under **Encryption Strategy**.
Go back to LobeHub's channel settings and fill in:
- **Verification Token** — Used to verify that webhook events originate from Lark
- **Encrypt Key** (optional) — Used to decrypt encrypted event payloads
Click **Save Configuration** again to apply.
</Steps>
## Step 5: Publish the App
<Steps>
### Create a Version
In your app settings, go to **Version Management & Release**. Create a new version with release notes.
### Submit for Review
Submit the version for review and publish. For enterprise self-managed apps, approval is typically automatic.
</Steps>
## Step 6: Test the Connection
Back in LobeHub's channel settings, click **Test Connection** to verify the credentials. Then find your bot in Lark by searching its name and send it a message to confirm it responds.
## Configuration Reference
| Field | Required | Description |
| -------------------------- | -------- | ------------------------------------------------------------- |
| **App ID** | Yes | Your Lark app's App ID (`cli_xxx`) |
| **App Secret** | Yes | Your Lark app's App Secret |
| **Verification Token** | No | Verifies webhook event source (recommended) |
| **Encrypt Key** | No | Decrypts encrypted event payloads |
| **Event Subscription URL** | — | Auto-generated after saving; paste into Lark Developer Portal |
## Troubleshooting
- **Event Subscription URL verification failed:** Ensure you saved the configuration in LobeHub first, and the URL was copied correctly.
- **Bot not responding:** Verify the app is published and approved, the bot capability is enabled, and the `im.message.receive_v1` event is subscribed.
- **Permission errors:** Confirm all required permissions are added and approved in the Developer Portal.
- **Test Connection failed:** Double-check the App ID and App Secret. Make sure you selected "Lark" (not "飞书") in LobeHub's channel settings.
+171
View File
@@ -0,0 +1,171 @@
---
title: 将 LobeHub 连接到 Lark
description: 了解如何创建 Lark 自定义应用并将其连接到您的 LobeHub 代理作为消息渠道,使您的 AI 助手能够在 Lark 聊天中与团队成员互动。
tags:
- Lark
- 消息渠道
- 机器人设置
- 集成
---
# 将 LobeHub 连接到 Lark
<Callout type={'info'}>
此功能目前正在开发中,可能尚未完全稳定。您可以通过在 **设置** → **高级设置** → **开发者模式**
中启用 **开发者模式** 来使用此功能。
</Callout>
通过将 Lark 渠道连接到您的 LobeHub 代理,团队成员可以直接在 Lark 的私聊和群组对话中与 AI 助手互动。
> 如果您使用的是中国版(飞书),请参阅[飞书设置指南](/docs/usage/channels/feishu)。
## 前置条件
- 一个拥有有效订阅的 LobeHub 账户
- 一个拥有创建企业应用权限的 Lark 账户
## 第一步:创建 Lark 应用
<Steps>
### 打开开发者门户
访问 [open.larksuite.com/app](https://open.larksuite.com/app) 并使用您的账户登录。
### 创建企业应用
点击 **Create Enterprise App**。填写应用名称(例如 "LobeHub Assistant")、描述和图标,然后提交表单。
### 复制应用凭证
进入 **Credentials & Basic Info**,复制以下内容:
- **App ID**(格式:`cli_xxx`
- **App Secret**
> **重要提示:** 请妥善保管您的 App Secret。切勿公开分享。
</Steps>
## 第二步:配置应用权限和机器人功能
<Steps>
### 导入所需权限
在您的应用设置中,进入 **Permissions & Scopes**,点击 **Batch Import**,然后粘贴以下 JSON 以授予机器人所需的所有权限。
```json
{
"scopes": {
"tenant": [
"application:application.app_message_stats.overview:readonly",
"application:application:self_manage",
"application:bot.menu:write",
"cardkit:card:read",
"cardkit:card:write",
"contact:user.employee_id:readonly",
"event:ip_list",
"im:chat.members:bot_access",
"im:message",
"im:message.group_at_msg:readonly",
"im:message.p2p_msg:readonly",
"im:message:readonly",
"im:message:send_as_bot",
"im:resource"
],
"user": []
}
}
```
<Callout type={'info'}>
以上权限码已针对 Lark(国际版)进行调整。部分飞书特有的权限码(如 `aily:*`、`corehr:*`、`im:chat.access_event.bot_p2p_chat:read`)在 Lark 上不可用,已被排除。
</Callout>
### 启用机器人功能
进入 **App Capability** → **Bot**。开启机器人功能并设置您喜欢的机器人名称。
</Steps>
## 第三步:在 LobeHub 中配置 Lark
<Steps>
### 打开渠道设置
在 LobeHub 中,导航到您的代理设置,然后选择 **渠道** 标签。点击平台列表中的 **Lark**。
### 填写应用凭证
输入以下字段:
- **App ID** — 来自 Lark 应用的 App ID
- **App Secret** — 来自 Lark 应用的 App Secret
> 此时您不需要填写 **Verification Token** 或 **Encrypt Key** —— 可以在完成第四步配置事件订阅后再设置。
### 保存并复制 Webhook URL
点击 **Save Configuration**。保存后,将显示一个 **Event Subscription URL**。复制此 URL —— 您将在下一步中需要它。
</Steps>
## 第四步:在 Lark 中设置事件订阅
<Steps>
### 打开事件订阅设置
返回 Lark 开发者门户中的应用。导航到 **Event Subscription**。
### 配置请求 URL
将您从 LobeHub 复制的 **Event Subscription URL** 粘贴到 **Request URL** 字段中。平台会自动验证端点。
### 添加消息事件
添加以下事件:
- `im.message.receive_v1` — 当收到消息时触发
这将使您的应用能够接收消息并将其转发到 LobeHub。
### (推荐)填写 Verification Token 和 Encrypt Key
配置事件订阅后,您可以在事件订阅页面顶部的 **Encryption Strategy** 中找到 **Verification Token** 和 **Encrypt Key**。
返回 LobeHub 的渠道设置,填写:
- **Verification Token** — 用于验证 webhook 事件是否来自 Lark
- **Encrypt Key**(可选)— 用于解密加密事件负载
再次点击 **Save Configuration** 以应用。
</Steps>
## 第五步:发布应用
<Steps>
### 创建版本
在您的应用设置中,进入 **Version Management & Release**。创建一个新版本并填写发布说明。
### 提交审核
提交版本进行审核并发布。对于企业自管理应用,通常会自动批准。
</Steps>
## 第六步:测试连接
回到 LobeHub 的渠道设置,点击 **Test Connection** 以验证凭证。然后在 Lark 中搜索您的机器人名称并发送消息,确认其是否响应。
## 配置参考
| 字段 | 是否必需 | 描述 |
| -------------------------- | ---- | ----------------------------- |
| **App ID** | 是 | 您的 Lark 应用的 App ID`cli_xxx` |
| **App Secret** | 是 | 您的 Lark 应用的 App Secret |
| **Verification Token** | 否 | 验证 webhook 事件来源(推荐) |
| **Encrypt Key** | 否 | 解密加密事件负载 |
| **Event Subscription URL** | — | 保存后自动生成;粘贴到 Lark 开发者门户 |
## 故障排除
- **Event Subscription URL 验证失败:** 确保您已在 LobeHub 中保存配置,并正确复制了 URL。
- **机器人未响应:** 验证应用已发布并获得批准,机器人功能已启用,并订阅了 `im.message.receive_v1` 事件。
- **权限错误:** 确保所有所需权限已在开发者门户中添加并获得批准。
- **测试连接失败:** 仔细检查 App ID 和 App Secret。确保您在 LobeHub 的渠道设置中选择了 "Lark"(而不是 "飞书")。
+27 -16
View File
@@ -2,14 +2,17 @@
title: Channels Overview
description: >-
Connect your LobeHub agents to external messaging platforms like Discord,
Telegram, and Feishu/Lark, allowing users to interact with AI assistants
directly in their favorite chat apps.
Slack, Telegram, QQ, WeChat, Feishu, and Lark, allowing users to interact with
AI assistants directly in their favorite chat apps.
tags:
- Channels
- Message Channels
- Integration
- Discord
- Slack
- Telegram
- QQ
- WeChat
- Feishu
- Lark
---
@@ -24,18 +27,22 @@ Channels allow you to connect your LobeHub agents to external messaging platform
## Supported Platforms
| Platform | Description |
| -------------------------------------------- | --------------------------------------------------------------- |
| [Discord](/docs/usage/channels/discord) | Connect to Discord servers for channel chat and direct messages |
| [Telegram](/docs/usage/channels/telegram) | Connect to Telegram for private and group conversations |
| [Feishu / Lark](/docs/usage/channels/feishu) | Connect to Feishu (飞书) or Lark for team collaboration |
| Platform | Description |
| ------------------------------------------ | --------------------------------------------------------------- |
| [Discord](/docs/usage/channels/discord) | Connect to Discord servers for channel chat and direct messages |
| [Slack](/docs/usage/channels/slack) | Connect to Slack for channel and direct message conversations |
| [Telegram](/docs/usage/channels/telegram) | Connect to Telegram for private and group conversations |
| [QQ](/docs/usage/channels/qq) | Connect to QQ for group chats and direct messages |
| [WeChat (微信)](/docs/usage/channels/wechat) | Connect to WeChat via iLink Bot for private and group chats |
| [Feishu (飞书)](/docs/usage/channels/feishu) | Connect to Feishu for team collaboration (Chinese version) |
| [Lark](/docs/usage/channels/lark) | Connect to Lark for team collaboration (international version) |
## How It Works
Each channel integration works by linking a bot account on the target platform to a LobeHub agent. When a user sends a message to the bot, LobeHub processes it through the agent and sends the response back to the same conversation.
- **Per-agent configuration** — Each agent can have its own set of channel connections, so different agents can serve different platforms or communities.
- **Multiple channels simultaneously** — A single agent can be connected to Discord, Telegram, and Feishu/Lark at the same time. LobeHub routes messages to the correct agent automatically.
- **Multiple channels simultaneously** — A single agent can be connected to Discord, Slack, Telegram, QQ, WeChat, Feishu, and Lark at the same time. LobeHub routes messages to the correct agent automatically.
- **Secure credential storage** — All bot tokens and app secrets are encrypted before being stored.
## Getting Started
@@ -44,17 +51,21 @@ Each channel integration works by linking a bot account on the target platform t
2. Navigate to your agent's settings and select the **Channels** tab
3. Choose a platform and follow the setup guide:
- [Discord](/docs/usage/channels/discord)
- [Slack](/docs/usage/channels/slack)
- [Telegram](/docs/usage/channels/telegram)
- [Feishu / Lark](/docs/usage/channels/feishu)
- [QQ](/docs/usage/channels/qq)
- [WeChat (微信)](/docs/usage/channels/wechat)
- [Feishu (飞书)](/docs/usage/channels/feishu)
- [Lark](/docs/usage/channels/lark)
## Feature Support
Text messages are supported across all platforms. Some features vary by platform:
| Feature | Discord | Telegram | Feishu / Lark |
| ---------------------- | ------- | -------- | ------------- |
| Text messages | Yes | Yes | Yes |
| Direct messages | Yes | Yes | Yes |
| Group chats | Yes | Yes | Yes |
| Reactions | Yes | Yes | Partial |
| Image/file attachments | Yes | Yes | Yes |
| Feature | Discord | Slack | Telegram | QQ | WeChat | Feishu | Lark |
| ---------------------- | ------- | ----- | -------- | --- | ------ | ------- | ------- |
| Text messages | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Direct messages | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Group chats | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Reactions | Yes | Yes | Yes | No | No | Partial | Partial |
| Image/file attachments | Yes | Yes | Yes | Yes | No | Yes | Yes |
+24 -11
View File
@@ -1,12 +1,17 @@
---
title: 渠道概览
description: 将 LobeHub 代理连接到外部消息平台,如 Discord、Telegram 和飞书/Lark,让用户可以直接在他们喜欢的聊天应用中与 AI 助手互动。
description: >-
将 LobeHub 代理连接到外部消息平台,如 Discord、Slack、Telegram、QQ、微信、飞书和
Lark,让用户可以直接在他们喜欢的聊天应用中与 AI 助手互动。
tags:
- 渠道
- 消息渠道
- 集成
- Discord
- Slack
- Telegram
- QQ
- 微信
- 飞书
- Lark
---
@@ -24,15 +29,19 @@ tags:
| 平台 | 描述 |
| ----------------------------------------- | -------------------------- |
| [Discord](/docs/usage/channels/discord) | 连接到 Discord 服务器,用于频道聊天和私信 |
| [Slack](/docs/usage/channels/slack) | 连接到 Slack,用于频道和私信对话 |
| [Telegram](/docs/usage/channels/telegram) | 连接到 Telegram,用于私人和群组对话 |
| [飞书 / Lark](/docs/usage/channels/feishu) | 连接到飞书(Feishu)或 Lark,用于团队协作 |
| [QQ](/docs/usage/channels/qq) | 连接到 QQ,用于群聊和私信 |
| [微信](/docs/usage/channels/wechat) | 通过 iLink Bot 连接到微信,用于私聊和群聊 |
| [飞书](/docs/usage/channels/feishu) | 连接到飞书,用于团队协作(中国版) |
| [Lark](/docs/usage/channels/lark) | 连接到 Lark,用于团队协作(国际版) |
## 工作原理
每个渠道集成都通过将目标平台上的机器人账户与 LobeHub 代理连接来实现。当用户向机器人发送消息时,LobeHub 会通过代理处理消息并将响应发送回同一对话。
- **按代理配置** — 每个代理可以拥有自己的一组渠道连接,因此不同的代理可以服务于不同的平台或社区。
- **同时支持多个渠道** — 单个代理可以同时连接到 Discord、Telegram 和飞书 / Lark。LobeHub 会自动将消息路由到正确的代理。
- **同时支持多个渠道** — 单个代理可以同时连接到 Discord、Slack、Telegram、QQ、微信、飞书和 Lark。LobeHub 会自动将消息路由到正确的代理。
- **安全的凭据存储** — 所有机器人令牌和应用密钥在存储前都会被加密。
## 快速开始
@@ -41,17 +50,21 @@ tags:
2. 前往您的代理设置页面,选择 **渠道** 标签
3. 选择一个平台并按照设置指南操作:
- [Discord](/docs/usage/channels/discord)
- [Slack](/docs/usage/channels/slack)
- [Telegram](/docs/usage/channels/telegram)
- [飞书 / Lark](/docs/usage/channels/feishu)
- [QQ](/docs/usage/channels/qq)
- [微信](/docs/usage/channels/wechat)
- [飞书](/docs/usage/channels/feishu)
- [Lark](/docs/usage/channels/lark)
## 功能支持
所有平台均支持文本消息。某些功能因平台而异:
| 功能 | Discord | Telegram | 飞书 / Lark |
| --------- | ------- | -------- | --------- |
| 文本消息 | 是 | 是 | 是 |
| 私人消息 | 是 | 是 | 是 |
| 群组聊天 | 是 | 是 | 是 |
| 表情反应 | 是 | 是 | 部分支持 |
| 图片 / 文件附件 | 是 | 是 | 是 |
| 功能 | Discord | Slack | Telegram | QQ | 微信 | 飞书 | Lark |
| --------- | ------- | ----- | -------- | -- | -- | ---- | ---- |
| 文本消息 | 是 | 是 | 是 | 是 | 是 | 是 | 是 |
| 私人消息 | 是 | 是 | 是 | 是 | 是 | 是 | 是 |
| 群组聊天 | 是 | 是 | 是 | 是 | 是 | 是 | 是 |
| 表情反应 | 是 | 是 | 是 | 否 | 否 | 部分支持 | 部分支持 |
| 图片 / 文件附件 | 是 | 是 | 是 | 是 | 否 | 是 | 是 |
+3 -3
View File
@@ -1,9 +1,9 @@
---
title: Connect LobeHub to QQ
description: >-
Learn how to create a QQ bot and connect it to your LobeHub agent as a
message channel, enabling your AI assistant to chat with users in QQ
group chats and direct messages.
Learn how to create a QQ bot and connect it to your LobeHub agent as a message
channel, enabling your AI assistant to chat with users in QQ group chats and
direct messages.
tags:
- QQ
- Message Channels
+145
View File
@@ -0,0 +1,145 @@
---
title: Connect LobeHub to Slack
description: >-
Learn how to create a Slack app and connect it to your LobeHub agent as a
message channel, enabling your AI assistant to interact with users in Slack
channels and direct messages.
tags:
- Slack
- Message Channels
- Bot Setup
- Integration
---
# Connect LobeHub to Slack
<Callout type={'info'}>
This feature is currently in development and may not be fully stable. You can enable it by turning
on **Developer Mode** in **Settings** → **Advanced Settings** → **Developer Mode**.
</Callout>
By connecting a Slack channel to your LobeHub agent, users can interact with the AI assistant directly through Slack channels and direct messages.
## Prerequisites
- A LobeHub account with an active subscription
- A Slack workspace where you have permission to install apps
## Step 1: Create a Slack App
<Steps>
### Go to the Slack API Dashboard
Visit [Slack API Apps](https://api.slack.com/apps) and click **Create New App**. Choose **From scratch**, give your app a name (e.g., "LobeHub Assistant"), select the workspace to install it in, and click **Create App**.
### Copy the App ID and Signing Secret
On the **Basic Information** page, copy and save:
- **App ID** — displayed at the top of the page
- **Signing Secret** — under the **App Credentials** section
### Add Bot Token Scopes
In the left sidebar, go to **OAuth & Permissions**. Scroll down to **Scopes** → **Bot Token Scopes** and add the following:
- `app_mentions:read` — Detect when the bot is mentioned
- `channels:history` — Read messages in public channels
- `channels:read` — Read channel info
- `chat:write` — Send messages
- `groups:history` — Read messages in private channels
- `groups:read` — Read private channel info
- `im:history` — Read direct messages
- `im:read` — Read DM channel info
- `mpim:history` — Read group DM messages
- `mpim:read` — Read group DM channel info
- `reactions:read` — Read reactions
- `reactions:write` — Add reactions
- `users:read` — Look up user info
**Optional scopes** (for Slack Assistants API support):
- `assistant:write` — Enable the Slack Assistants API features
### Install the App to Your Workspace
Still on the **OAuth & Permissions** page, click **Install to Workspace** and authorize the app. After installation, copy the **Bot User OAuth Token** (starts with `xoxb-`).
> **Important:** Treat your bot token like a password. Never share it publicly or commit it to version control.
</Steps>
## Step 2: Configure Slack in LobeHub
<Steps>
### Open Channel Settings
In LobeHub, navigate to your agent's settings, then select the **Channels** tab. Click **Slack** from the platform list.
### Fill in the Credentials
Enter the following fields:
- **Application ID** — The App ID from your Slack app's Basic Information page
- **Bot Token** — The Bot User OAuth Token (xoxb-...) from OAuth & Permissions
- **Signing Secret** — The Signing Secret from your Slack app's Basic Information page
Your token will be encrypted and stored securely.
### Save Configuration
Click **Save Configuration**. LobeHub will save your credentials and display a **Webhook URL**.
### Copy the Webhook URL
Copy the displayed Webhook URL — you will need it in the next step to configure Slack's Event Subscriptions.
</Steps>
## Step 3: Configure Event Subscriptions
<Steps>
### Enable Events
Back in the [Slack API Dashboard](https://api.slack.com/apps), go to **Event Subscriptions** and toggle **Enable Events** to **On**.
### Set the Request URL
Paste the **Webhook URL** you copied from LobeHub into the **Request URL** field. Slack will send a verification challenge — LobeHub will respond automatically.
### Subscribe to Bot Events
Under **Subscribe to bot events**, add:
- `app_mention` — Triggered when someone mentions the bot
- `message.channels` — Messages in public channels
- `message.groups` — Messages in private channels
- `message.im` — Direct messages to the bot
- `message.mpim` — Messages in group DMs
- `member_joined_channel` — When a user joins a channel
**Optional events** (for Slack Assistants API support):
- `assistant_thread_started` — When a user opens a new assistant thread
- `assistant_thread_context_changed` — When a user navigates to a different channel with the assistant panel open
### Save Changes
Click **Save Changes** at the bottom of the page.
</Steps>
## Step 4: Test the Connection
Back in LobeHub's channel settings for Slack, click **Test Connection** to verify the integration. Then go to your Slack workspace, invite the bot to a channel, and mention it with `@YourBotName` to confirm it responds.
## Configuration Reference
| Field | Required | Description |
| ------------------ | -------- | ------------------------------------------ |
| **Application ID** | Yes | Your Slack app's ID |
| **Bot Token** | Yes | Bot User OAuth Token (xoxb-...) |
| **Signing Secret** | Yes | Used to verify webhook requests from Slack |
## Troubleshooting
- **Bot not responding:** Confirm the bot has been invited to the channel and the Event Subscriptions are correctly configured with the right webhook URL.
- **Test Connection failed:** Double-check the Application ID and Bot Token are correct. Ensure the app is installed to the workspace.
- **Webhook verification failed:** Make sure the Signing Secret matches the one in your Slack app's Basic Information page.
+141
View File
@@ -0,0 +1,141 @@
---
title: 将 LobeHub 连接到 Slack
description: 了解如何创建一个 Slack 应用并将其连接到您的 LobeHub 代理作为消息渠道,使您的 AI 助手能够直接在 Slack 频道和私信中与用户互动。
tags:
- Slack
- 消息渠道
- 机器人设置
- 集成
---
# 将 LobeHub 连接到 Slack
<Callout type={'info'}>
此功能目前正在开发中,可能尚未完全稳定。您可以通过在 **设置** → **高级设置** → **开发者模式** 中启用 **开发者模式** 来使用此功能。
</Callout>
通过将 Slack 渠道连接到您的 LobeHub 代理,用户可以直接通过 Slack 频道和私信与 AI 助手互动。
## 前置条件
- 一个拥有有效订阅的 LobeHub 账户
- 一个拥有安装应用权限的 Slack 工作区
## 第一步:创建 Slack 应用
<Steps>
### 访问 Slack API 控制台
访问 [Slack API Apps](https://api.slack.com/apps),点击 **Create New App**。选择 **From scratch**,为您的应用命名(例如 "LobeHub 助手"),选择要安装到的工作区,然后点击 **Create App**。
### 复制 App ID 和 Signing Secret
在 **Basic Information** 页面,复制并保存:
- **App ID** — 显示在页面顶部
- **Signing Secret** — 在 **App Credentials** 部分下
### 添加 Bot Token 权限范围
在左侧菜单中,进入 **OAuth & Permissions**。向下滚动到 **Scopes** → **Bot Token Scopes**,添加以下权限:
- `app_mentions:read` — 检测机器人被提及
- `channels:history` — 读取公共频道中的消息
- `channels:read` — 读取频道信息
- `chat:write` — 发送消息
- `groups:history` — 读取私有频道中的消息
- `groups:read` — 读取私有频道信息
- `im:history` — 读取私信
- `im:read` — 读取私信频道信息
- `mpim:history` — 读取群组私信消息
- `mpim:read` — 读取群组私信信息
- `reactions:read` — 读取表情回应
- `reactions:write` — 添加表情回应
- `users:read` — 查询用户信息
**可选权限**(用于 Slack Assistants API):
- `assistant:write` — 启用 Slack Assistants API 功能
### 安装应用到工作区
仍然在 **OAuth & Permissions** 页面,点击 **Install to Workspace** 并授权应用。安装完成后,复制 **Bot User OAuth Token**(以 `xoxb-` 开头)。
> **重要提示:** 请将您的 Bot Token 视为密码。切勿公开分享或提交到版本控制系统。
</Steps>
## 第二步:在 LobeHub 中配置 Slack
<Steps>
### 打开渠道设置
在 LobeHub 中,导航到您的代理设置,然后选择 **渠道** 标签。点击平台列表中的 **Slack**。
### 填写凭据
输入以下字段:
- **应用 ID** — 来自 Slack 应用 Basic Information 页面的 App ID
- **Bot Token** — 来自 OAuth & Permissions 页面的 Bot User OAuth Tokenxoxb-...
- **签名密钥** — 来自 Slack 应用 Basic Information 页面的 Signing Secret
您的令牌将被加密并安全存储。
### 保存配置
点击 **保存配置**。LobeHub 将保存您的凭据并显示一个 **Webhook URL**。
### 复制 Webhook URL
复制显示的 Webhook URL —— 您将在下一步中使用它来配置 Slack 的事件订阅。
</Steps>
## 第三步:配置事件订阅
<Steps>
### 启用事件
返回 [Slack API 控制台](https://api.slack.com/apps),进入 **Event Subscriptions**,将 **Enable Events** 切换为 **On**。
### 设置请求 URL
将您从 LobeHub 复制的 **Webhook URL** 粘贴到 **Request URL** 字段中。Slack 将发送一个验证请求 —— LobeHub 会自动响应。
### 订阅机器人事件
在 **Subscribe to bot events** 下,添加:
- `app_mention` — 当有人提及机器人时触发
- `message.channels` — 公共频道中的消息
- `message.groups` — 私有频道中的消息
- `message.im` — 发送给机器人的私信
- `message.mpim` — 群组私信中的消息
- `member_joined_channel` — 当用户加入频道时触发
**可选事件**(用于 Slack Assistants API):
- `assistant_thread_started` — 当用户打开新的助手会话时触发
- `assistant_thread_context_changed` — 当用户在助手面板打开时切换到不同频道时触发
### 保存更改
点击页面底部的 **Save Changes**。
</Steps>
## 第四步:测试连接
返回 LobeHub 的 Slack 渠道设置,点击 **测试连接** 以验证集成是否正确。然后进入您的 Slack 工作区,将机器人邀请到一个频道,通过 `@你的机器人名称` 提及它,确认其是否响应。
## 配置参考
| 字段 | 是否必需 | 描述 |
| ------------- | ---- | ------------------------------ |
| **应用 ID** | 是 | 您的 Slack 应用的 ID |
| **Bot Token** | 是 | Bot User OAuth Tokenxoxb-... |
| **签名密钥** | 是 | 用于验证来自 Slack 的 Webhook 请求 |
## 故障排除
- **机器人未响应:** 确认机器人已被邀请到频道,且事件订阅已正确配置了正确的 Webhook URL。
- **测试连接失败:** 仔细检查应用 ID 和 Bot Token 是否正确。确保应用已安装到工作区。
- **Webhook 验证失败:** 确保签名密钥与 Slack 应用 Basic Information 页面中的一致。
+96
View File
@@ -0,0 +1,96 @@
---
title: Connect LobeHub to WeChat
description: >-
Learn how to connect a WeChat bot to your LobeHub agent via the iLink Bot API,
enabling your AI assistant to chat with users in WeChat private and group
conversations.
tags:
- WeChat
- Message Channels
- Bot Setup
- Integration
---
# Connect LobeHub to WeChat
<Callout type={'info'}>
This feature is currently in development and may not be fully stable. You can enable it by turning
on **Developer Mode** in **Settings** → **Advanced Settings** → **Developer Mode**.
</Callout>
By connecting a WeChat channel to your LobeHub agent, users can interact with the AI assistant through WeChat private chats and group conversations.
## Prerequisites
- A LobeHub account with an active subscription
- A WeChat account
## Step 1: Open Channel Settings
In LobeHub, navigate to your agent's settings, then select the **Channels** tab. Click **WeChat** from the platform list.
## Step 2: Scan QR Code to Connect
<Steps>
### Click "Scan QR Code to Connect"
On the WeChat channel page, click the **Scan QR Code to Connect** button. A modal dialog will appear displaying a QR code.
### Scan with WeChat
Open WeChat on your phone, go to **Scan** (via the + button in the top right), and scan the QR code displayed in LobeHub.
### Confirm Login
After scanning, a confirmation prompt will appear in WeChat. Tap **Confirm** to authorize the connection.
### Connection Complete
Once confirmed, LobeHub will automatically save your credentials and connect the bot. You should see a success message in the channel settings.
</Steps>
## Step 3: Test the Bot
Open WeChat, find your bot contact, and send a message. The bot should respond through your LobeHub agent.
## Adding the Bot to Group Chats
To use the bot in WeChat groups:
1. Add the bot to a WeChat group
2. @mention the bot or send a message in the group to trigger a response
3. The bot will reply in the group conversation
## Advanced Settings
| Setting | Default | Description |
| ------------------------ | ------- | -------------------------------------------------------- |
| **Character Limit** | 2000 | Maximum characters per message (range: 1002000) |
| **Message Merge Window** | 2000 ms | How long to wait for additional messages before replying |
| **Show Usage Stats** | Off | Display token/cost stats in replies |
## How It Works
Unlike webhook-based platforms (Telegram, Slack), WeChat uses a **long-polling** mechanism via the iLink Bot API:
1. When you scan the QR code, LobeHub obtains a bot token from WeChat's iLink API
2. LobeHub continuously polls the iLink API for new messages (\~35 second intervals)
3. When a message arrives, it is routed through the LobeHub agent for processing
4. The agent's response is sent back to WeChat via the iLink API
This polling is managed by a background cron job, so the connection is maintained automatically.
## Limitations
- **No message editing** — WeChat does not support editing sent messages. Updated responses will be sent as new messages.
- **No reactions** — WeChat iLink Bot API does not support emoji reactions.
- **Text only** — Only text messages are currently supported. Image and file attachments are not yet available.
- **Message length limit** — Messages exceeding 2000 characters will be automatically split into multiple messages.
- **Session expiration** — The bot session may expire and require re-authentication by scanning a new QR code.
## Troubleshooting
- **QR code expired:** Click **Refresh QR Code** in the modal to generate a new one.
- **Bot not responding:** The session may have expired. Go to the WeChat channel settings and re-scan the QR code to reconnect.
- **Delayed responses:** Long-polling has a natural delay of up to 35 seconds between polls. This is expected behavior.
- **Connection lost after some time:** WeChat sessions expire periodically. Re-authenticate by clicking "Scan QR Code to Connect" again.
+93
View File
@@ -0,0 +1,93 @@
---
title: 将 LobeHub 连接到微信
description: 了解如何通过 iLink Bot API 将微信机器人连接到您的 LobeHub 代理,使您的 AI 助手能够在微信私聊和群聊中与用户互动。
tags:
- 微信
- 消息渠道
- 机器人设置
- 集成
---
# 将 LobeHub 连接到微信
<Callout type={'info'}>
此功能目前正在开发中,可能尚未完全稳定。您可以通过在 **设置** → **高级设置** → **开发者模式**
中启用 **开发者模式** 来使用此功能。
</Callout>
通过将微信渠道连接到您的 LobeHub 代理,用户可以通过微信私聊和群聊与 AI 助手互动。
## 前置条件
- 一个拥有有效订阅的 LobeHub 账户
- 一个微信账户
## 第一步:打开渠道设置
在 LobeHub 中,导航到您的代理设置,然后选择 **渠道** 标签页。从平台列表中点击 **微信**。
## 第二步:扫码连接
<Steps>
### 点击 "扫码连接"
在微信渠道页面中,点击 **扫码连接** 按钮。将弹出一个显示二维码的对话框。
### 使用微信扫码
打开手机微信,点击右上角的 **+** 按钮,选择 **扫一扫**,扫描 LobeHub 中显示的二维码。
### 确认登录
扫码后,微信中会出现确认提示。点击 **确认** 授权连接。
### 连接完成
确认后,LobeHub 将自动保存凭证并连接机器人。您应该会在渠道设置中看到成功消息。
</Steps>
## 第三步:测试机器人
打开微信,找到您的机器人联系人,发送一条消息。机器人应通过您的 LobeHub 代理进行响应。
## 将机器人添加到群聊
要在微信群聊中使用机器人:
1. 将机器人添加到微信群聊中
2. @提及机器人或在群中发送消息以触发响应
3. 机器人将在群聊中回复
## 高级设置
| 设置 | 默认值 | 描述 |
| ---------- | ------- | ----------------------- |
| **字符限制** | 2000 | 每条消息的最大字符数(范围:100–2000) |
| **消息合并窗口** | 2000 毫秒 | 等待更多消息再回复的时间 |
| **显示使用统计** | 关闭 | 在回复中显示 Token 用量 / 成本统计 |
## 工作原理
与基于 Webhook 的平台(Telegram、Slack)不同,微信使用 iLink Bot API 的 **长轮询** 机制:
1. 当您扫描二维码时,LobeHub 从微信 iLink API 获取 bot token
2. LobeHub 持续轮询 iLink API 获取新消息(约 35 秒间隔)
3. 当消息到达时,通过 LobeHub 代理进行处理
4. 代理的响应通过 iLink API 发送回微信
此轮询由后台定时任务管理,连接会自动维护。
## 功能限制
- **不支持消息编辑** — 微信不支持编辑已发送的消息。更新的回复将作为新消息发送。
- **不支持表情回应** — 微信 iLink Bot API 不支持表情回应功能。
- **仅支持文本** — 目前仅支持文本消息。图片和文件附件暂不可用。
- **消息长度限制** — 超过 2000 个字符的消息将被自动拆分为多条消息发送。
- **会话过期** — 机器人会话可能会过期,需要重新扫码认证。
## 故障排除
- **二维码已过期:** 在弹窗中点击 **刷新二维码** 生成新的二维码。
- **机器人未响应:** 会话可能已过期。前往微信渠道设置,重新扫码连接。
- **响应延迟:** 长轮询在两次轮询之间有最多 35 秒的自然延迟。这是预期行为。
- **一段时间后连接断开:** 微信会话会定期过期。再次点击 "扫码连接" 重新认证。
+2 -2
View File
@@ -24,7 +24,7 @@ The Command Menu is LobeHub's quick action center. Press `⌘ + K` (Mac) or `Ctr
The menu appears as an overlay in the center of the screen.
<Image alt={'Command Menu'} src={'https://file.rene.wang/clipboard-1769137275089-21cf7ab42d52b.png'} />
<Image alt={'Command Menu'} src={'/blog/assets095af3a0a0f850fc206fc3bbc19a4095.webp'} />
## What You Can Search
@@ -38,7 +38,7 @@ The menu appears as an overlay in the center of the screen.
**Keyboard navigation:** Use `↑` and `↓` to move through results, `Enter` to execute, `Esc` to close. `Tab` switches between result categories when you're typing a message.
<Image alt={'Command Menu Search and Navigation'} src={'https://file.rene.wang/clipboard-1769137300488-0b894cc8c7a67.png'} />
<Image alt={'Command Menu Search and Navigation'} src={'/blog/assetsebc1ebe8330d982f6a0b757aafb3f4a1.webp'} />
## Ask an Agent
@@ -22,7 +22,7 @@ tags:
菜单会以浮层形式出现在屏幕中央。
<Image alt={'命令菜单'} src={'https://file.rene.wang/clipboard-1769137275089-21cf7ab42d52b.png'} />
<Image alt={'命令菜单'} src={'/blog/assets095af3a0a0f850fc206fc3bbc19a4095.webp'} />
## 可以搜索什么
@@ -36,7 +36,7 @@ tags:
**键盘导航:** 用 `↑` 和 `↓` 在结果间移动,`Enter` 执行,`Esc` 关闭。输入消息时,`Tab` 可在结果类别间切换。
<Image alt={'命令菜单搜索和导航'} src={'https://file.rene.wang/clipboard-1769137300488-0b894cc8c7a67.png'} />
<Image alt={'命令菜单搜索和导航'} src={'/blog/assetsebc1ebe8330d982f6a0b757aafb3f4a1.webp'} />
## 向助理提问
+1 -1
View File
@@ -88,7 +88,7 @@ async function createTestAgent(title: string = 'Test Agent'): Promise<string> {
// Given Steps
// ============================================
Given('用户在 Home 页面有一个 Agent', async function (this: CustomWorld) {
Given('用户在 Home 页面有一个 Agent', { timeout: 30_000 }, async function (this: CustomWorld) {
console.log(' 📍 Step: 在数据库中创建测试 Agent...');
const agentId = await createTestAgent('E2E Test Agent');
this.testContext.createdAgentId = agentId;
+37 -1
View File
@@ -1,5 +1,6 @@
{
"channel.appSecret": "سر التطبيق",
"channel.appSecretHint": "سر التطبيق لتطبيق الروبوت الخاص بك. سيتم تشفيره وتخزينه بأمان.",
"channel.appSecretPlaceholder": "الصق سر التطبيق هنا",
"channel.applicationId": "معرف التطبيق / اسم المستخدم للبوت",
"channel.applicationIdHint": "معرف فريد لتطبيق البوت الخاص بك.",
@@ -9,14 +10,31 @@
"channel.botTokenHowToGet": "كيف تحصل عليه؟",
"channel.botTokenPlaceholderExisting": "الرمز مخفي لأسباب أمنية",
"channel.botTokenPlaceholderNew": "الصق رمز البوت هنا",
"channel.charLimit": "حد الأحرف",
"channel.charLimitHint": "الحد الأقصى لعدد الأحرف لكل رسالة",
"channel.connectFailed": "فشل اتصال الروبوت",
"channel.connectSuccess": "تم الاتصال بالروبوت بنجاح",
"channel.connecting": "جارٍ الاتصال...",
"channel.connectionConfig": "إعدادات الاتصال",
"channel.copied": "تم النسخ إلى الحافظة",
"channel.copy": "نسخ",
"channel.credentials": "بيانات الاعتماد",
"channel.debounceMs": "نافذة دمج الرسائل (مللي ثانية)",
"channel.debounceMsHint": "مدة الانتظار للرسائل الإضافية قبل إرسالها إلى الوكيل (مللي ثانية)",
"channel.deleteConfirm": "هل أنت متأكد أنك تريد إزالة هذه القناة؟",
"channel.deleteConfirmDesc": "سيؤدي هذا الإجراء إلى إزالة قناة الرسائل وتكوينها بشكل دائم. لا يمكن التراجع عن ذلك.",
"channel.devWebhookProxyUrl": "عنوان URL لنفق HTTPS",
"channel.devWebhookProxyUrlHint": "اختياري. عنوان URL لنفق HTTPS لإعادة توجيه طلبات الويب هوك إلى خادم التطوير المحلي.",
"channel.disabled": "معطل",
"channel.discord.description": "قم بتوصيل هذا المساعد بخادم Discord للدردشة في القنوات والرسائل المباشرة.",
"channel.dm": "الرسائل المباشرة",
"channel.dmEnabled": "تمكين الرسائل المباشرة",
"channel.dmEnabledHint": "السماح للروبوت بتلقي الرسائل المباشرة والرد عليها",
"channel.dmPolicy": "سياسة الرسائل المباشرة",
"channel.dmPolicyAllowlist": "القائمة المسموح بها",
"channel.dmPolicyDisabled": "معطل",
"channel.dmPolicyHint": "التحكم في من يمكنه إرسال الرسائل المباشرة إلى الروبوت",
"channel.dmPolicyOpen": "مفتوح",
"channel.documentation": "التوثيق",
"channel.enabled": "مفعّل",
"channel.encryptKey": "مفتاح التشفير",
@@ -26,6 +44,7 @@
"channel.endpointUrlHint": "يرجى نسخ هذا العنوان ولصقه في الحقل <bold>{{fieldName}}</bold> في بوابة مطوري {{name}}.",
"channel.feishu.description": "قم بتوصيل هذا المساعد بـ Feishu للدردشة الخاصة والجماعية.",
"channel.lark.description": "قم بتوصيل هذا المساعد بـ Lark للدردشة الخاصة والجماعية.",
"channel.openPlatform": "منصة مفتوحة",
"channel.platforms": "المنصات",
"channel.publicKey": "المفتاح العام",
"channel.publicKeyHint": "اختياري. يُستخدم للتحقق من طلبات التفاعل من Discord.",
@@ -42,6 +61,16 @@
"channel.secretToken": "رمز سر الويب هوك",
"channel.secretTokenHint": "اختياري. يُستخدم للتحقق من طلبات الويب هوك من Telegram.",
"channel.secretTokenPlaceholder": "السر الاختياري للتحقق من الويب هوك",
"channel.settings": "الإعدادات المتقدمة",
"channel.settingsResetConfirm": "هل أنت متأكد أنك تريد إعادة تعيين الإعدادات المتقدمة إلى الوضع الافتراضي؟",
"channel.settingsResetDefault": "إعادة إلى الوضع الافتراضي",
"channel.setupGuide": "دليل الإعداد",
"channel.showUsageStats": "عرض إحصائيات الاستخدام",
"channel.showUsageStatsHint": "عرض استخدام الرموز، التكلفة، وإحصائيات المدة في ردود الروبوت",
"channel.signingSecret": "سر التوقيع",
"channel.signingSecretHint": "يُستخدم للتحقق من طلبات الويب هوك.",
"channel.slack.appIdHint": "معرف تطبيق Slack الخاص بك من لوحة تحكم API Slack (يبدأ بـ A).",
"channel.slack.description": "قم بتوصيل هذا المساعد بـ Slack للمحادثات القنوية والرسائل المباشرة.",
"channel.telegram.description": "قم بتوصيل هذا المساعد بـ Telegram للدردشة الخاصة والجماعية.",
"channel.testConnection": "اختبار الاتصال",
"channel.testFailed": "فشل اختبار الاتصال",
@@ -50,5 +79,12 @@
"channel.validationError": "يرجى ملء معرف التطبيق والرمز",
"channel.verificationToken": "رمز التحقق",
"channel.verificationTokenHint": "اختياري. يُستخدم للتحقق من مصدر أحداث الويب هوك.",
"channel.verificationTokenPlaceholder": "الصق رمز التحقق هنا"
"channel.verificationTokenPlaceholder": "الصق رمز التحقق هنا",
"channel.wechat.description": "قم بتوصيل هذا المساعد بـ WeChat عبر iLink Bot للمحادثات الخاصة والجماعية.",
"channel.wechatQrExpired": "انتهت صلاحية رمز الاستجابة السريعة. يرجى التحديث للحصول على رمز جديد.",
"channel.wechatQrRefresh": "تحديث رمز الاستجابة السريعة",
"channel.wechatQrScaned": "تم مسح رمز الاستجابة السريعة. يرجى تأكيد تسجيل الدخول في WeChat.",
"channel.wechatQrWait": "افتح WeChat وقم بمسح رمز الاستجابة السريعة للاتصال.",
"channel.wechatScanTitle": "توصيل روبوت WeChat",
"channel.wechatScanToConnect": "مسح رمز الاستجابة السريعة للاتصال"
}
+1 -1
View File
@@ -146,7 +146,7 @@
"heatmaps.months.nov": "نوفمبر",
"heatmaps.months.oct": "أكتوبر",
"heatmaps.months.sep": "سبتمبر",
"heatmaps.tooltip": "{{date}} تم إرسال {{count}} رسالة في هذا اليوم",
"heatmaps.tooltip": "{{date}} تم إنشاء {{count}} رسالة في هذا اليوم",
"heatmaps.totalCount": "تم إرسال ما مجموعه {{count}} رسالة خلال العام الماضي",
"login": "تسجيل الدخول",
"loginGuide.f1": "احصل على استخدام مجاني",
+3
View File
@@ -262,6 +262,7 @@
"footer.star.title": "قيّمنا على GitHub",
"footer.title": "هل أعجبك منتجنا؟",
"fullscreen": "وضع ملء الشاشة",
"generation.hero.taglinePrefix": "ابدأ في الإبداع مع",
"getDesktopApp": "احصل على تطبيق سطح المكتب",
"historyRange": "نطاق السجل",
"home.suggestQuestions": "جرّب هذه الأمثلة",
@@ -431,6 +432,7 @@
"userPanel.billing": "إدارة الفوترة",
"userPanel.cloud": "تشغيل {{name}}",
"userPanel.community": "المجتمع",
"userPanel.credits": "إدارة الرصيد",
"userPanel.data": "تخزين البيانات",
"userPanel.defaultNickname": "مستخدم المجتمع",
"userPanel.discord": "دعم المجتمع",
@@ -442,6 +444,7 @@
"userPanel.plans": "خطط الاشتراك",
"userPanel.profile": "الحساب",
"userPanel.setting": "الإعدادات",
"userPanel.upgradePlan": "ترقية الخطة",
"userPanel.usages": "إحصائيات الاستخدام",
"version": "الإصدار"
}
+6
View File
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "فشل في التجزئة، يرجى التحقق والمحاولة مرة أخرى. تفاصيل الخطأ:",
"FileParsingStatus.chunks.status.processing": "جارٍ التجزئة",
"FileParsingStatus.chunks.status.processingTip": "الخادم يقوم بتقسيم أجزاء النص؛ إغلاق الصفحة لن يؤثر على تقدم التجزئة.",
"GenerationModelItem.creditsPerImageApproximate": "تقريباً {{amount}} ائتمانات / صورة",
"GenerationModelItem.creditsPerImageExact": "{{amount}} ائتمانات / صورة",
"GenerationModelItem.creditsPerVideoApproximate": "تقريباً {{amount}} ائتمانات / فيديو",
"GenerationModelItem.creditsPerVideoExact": "{{amount}} ائتمانات / فيديو",
"GoBack.back": "رجوع",
"HtmlPreview.actions.download": "تنزيل",
"HtmlPreview.actions.preview": "معاينة",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "النص",
"ModelSwitchPanel.detail.pricing.input": "المدخلات ${{amount}}/مليون",
"ModelSwitchPanel.detail.pricing.output": "المخرجات ${{amount}}/مليون",
"ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / صورة",
"ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / فيديو",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "مدخل صوتي",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "مدخل صوتي (مخزن)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "مخرج صوتي",
+1
View File
@@ -94,6 +94,7 @@
"category.assistant.life": "الحياة",
"category.assistant.marketing": "تسويق",
"category.assistant.office": "مكتب",
"category.assistant.productivity": "الإنتاجية",
"category.assistant.programming": "برمجة",
"category.assistant.translation": "ترجمة",
"category.plugin.all": "الكل",
+3 -2
View File
@@ -11,6 +11,7 @@
"config.imageUrls.label": "صور مرجعية",
"config.model.label": "النموذج",
"config.prompt.placeholder": "صف ما ترغب في إنشائه",
"config.prompt.placeholderWithRef": "وصف كيف تريد تعديل الصورة",
"config.quality.label": "جودة الصورة",
"config.quality.options.hd": "عالية الدقة",
"config.quality.options.standard": "قياسية",
@@ -22,7 +23,7 @@
"config.seed.random": "بذرة عشوائية",
"config.size.label": "الحجم",
"config.steps.label": "الخطوات",
"config.title": "صورة بالذكاء الاصطناعي",
"config.title": "الإعدادات",
"config.width.label": "العرض",
"generation.actions.applySeed": "تطبيق البذرة",
"generation.actions.copyError": "نسخ رسالة الخطأ",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "يدعم عدة مزودي خدمات لإنشاء الصور بالذكاء الاصطناعي، بما في ذلك OpenAI gpt-image-1 وGoogle Imagen وFAL.ai والمزيد، مما يوفر مجموعة واسعة من النماذج.",
"notSupportGuide.features.multiProviders.title": "دعم متعدد المزودين",
"notSupportGuide.title": "وضع النشر الحالي لا يدعم إنشاء الصور بالذكاء الاصطناعي",
"topic.createNew": "موضوع جديد",
"topic.createNew": "إنشاء موضوع جديد",
"topic.deleteConfirm": "حذف موضوع الإنشاء",
"topic.deleteConfirmDesc": "أنت على وشك حذف موضوع الإنشاء هذا. لا يمكن التراجع عن هذا الإجراء، يرجى المتابعة بحذر.",
"topic.empty": "لا توجد مواضيع إنشاء",
+5
View File
@@ -83,6 +83,11 @@
"preference.empty": "لا توجد ذكريات تفضيل متاحة",
"preference.source": "المصدر",
"preference.suggestions": "الإجراءات التي قد يتخذها الوكيل",
"purge.action": "حذف الكل",
"purge.confirm": "هل أنت متأكد أنك تريد حذف جميع الذكريات؟ سيؤدي ذلك إلى إزالة كل إدخال للذكريات بشكل دائم ولا يمكن التراجع عنه.",
"purge.error": "فشل في حذف الذكريات. يرجى المحاولة مرة أخرى.",
"purge.success": "تم حذف جميع الذكريات.",
"purge.title": "حذف جميع الذكريات",
"tab.activities": "الأنشطة",
"tab.contexts": "السياقات",
"tab.experiences": "التجارب",
+1
View File
@@ -89,6 +89,7 @@
"createNewAiProvider.description.placeholder": "وصف المزود (اختياري)",
"createNewAiProvider.description.title": "وصف المزود",
"createNewAiProvider.id.desc": "معرف فريد لمزود الخدمة، لا يمكن تعديله بعد الإنشاء",
"createNewAiProvider.id.duplicate": "معرف المزود موجود بالفعل",
"createNewAiProvider.id.format": "يمكن أن يحتوي فقط على أرقام، حروف صغيرة، شرطات (-)، وشرطات سفلية (_)",
"createNewAiProvider.id.placeholder": "يفضل أن يكون بحروف صغيرة، مثل openai، لا يمكن تعديله بعد الإنشاء",
"createNewAiProvider.id.required": "يرجى إدخال معرف المزود",
+9 -38
View File
@@ -54,6 +54,7 @@
"FLUX.1-Kontext-pro.description": "FLUX.1 Kontext [pro]",
"FLUX.1-dev.description": "FLUX.1-dev هو نموذج لغة متعدد الوسائط مفتوح المصدر من Black Forest Labs، محسن لمهام النص والصورة، ويجمع بين فهم وتوليد النصوص/الصور. مبني على نماذج LLM متقدمة (مثل Mistral-7B)، ويستخدم مشفر رؤية مصمم بعناية وضبط تعليمات متعدد المراحل لتمكين التنسيق متعدد الوسائط والاستدلال المعقد.",
"Gryphe/MythoMax-L2-13b.description": "MythoMax-L2 (13B) هو نموذج مبتكر لمجالات متنوعة ومهام معقدة.",
"HY-Image-V3.0.description": "قدرات قوية لاستخراج الميزات من الصور الأصلية والحفاظ على التفاصيل، مما يوفر نسيجًا بصريًا أكثر ثراءً وينتج صورًا عالية الدقة ومتقنة ومناسبة للإنتاج.",
"HelloMeme.description": "HelloMeme هي أداة ذكاء اصطناعي لإنشاء الميمات، الصور المتحركة (GIFs)، أو مقاطع الفيديو القصيرة من الصور أو الحركات التي تقدمها. لا تتطلب مهارات رسم أو برمجة—فقط صورة مرجعية—لإنتاج محتوى ممتع وجذاب ومتناسق من حيث الأسلوب.",
"HiDream-E1-Full.description": "HiDream-E1-Full هو نموذج مفتوح المصدر لتحرير الصور متعدد الوسائط من HiDream.ai، يعتمد على بنية Diffusion Transformer المتقدمة وفهم قوي للغة (مدمج LLaMA 3.1-8B-Instruct). يدعم إنشاء الصور باستخدام اللغة الطبيعية، ونقل الأنماط، والتحرير المحلي، وإعادة الطلاء، مع فهم وتنفيذ ممتازين للنصوص والصور.",
"HiDream-I1-Full.description": "HiDream-I1 هو نموذج جديد مفتوح المصدر لإنشاء الصور تم إصداره من قبل HiDream. مع 17 مليار معلمة (Flux يحتوي على 12 مليار)، يمكنه تقديم جودة صور رائدة في الصناعة في ثوانٍ.",
@@ -81,15 +82,10 @@
"MiniMax-M1.description": "نموذج استدلال داخلي جديد بسلسلة تفكير تصل إلى 80K ومدخلات حتى 1M، يقدم أداءً مماثلاً لأفضل النماذج العالمية.",
"MiniMax-M2-Stable.description": "مصمم لتدفقات العمل البرمجية والوكلاء بكفاءة عالية، مع قدرة تزامن أعلى للاستخدام التجاري.",
"MiniMax-M2.1-Lightning.description": "قدرات برمجة متعددة اللغات قوية وتجربة برمجة مطورة بالكامل. أسرع وأكثر كفاءة.",
"MiniMax-M2.1-highspeed.description": "قدرات برمجة متعددة اللغات قوية مع استنتاج أسرع وأكثر كفاءة.",
"MiniMax-M2.1.description": "MiniMax-M2.1 هو نموذج مفتوح المصدر رائد من MiniMax، يركز على حل المهام الواقعية المعقدة. يتميز بقدرات برمجة متعددة اللغات والقدرة على أداء المهام المعقدة كوكلاء ذكي.",
"MiniMax-M2.5-Lightning.description": "M2.5 Lightning: نفس الأداء، أسرع وأكثر رشاقة (تقريباً 100 tps).",
"MiniMax-M2.5-highspeed.description": "نفس أداء M2.5 مع استنتاج أسرع بشكل ملحوظ.",
"MiniMax-M2.5.description": "أداء من الدرجة الأولى وفعالية تكلفة قصوى، يتعامل بسهولة مع المهام المعقدة (تقريباً 60 tps).",
"MiniMax-M2.description": "مصمم خصيصًا للبرمجة الفعالة وتدفقات عمل الوكلاء.",
"MiniMax-Text-01.description": "MiniMax-01 يقدم انتباهًا خطيًا واسع النطاق يتجاوز Transformers التقليدية، مع 456 مليار معامل و45.9 مليار مفعّلة في كل تمرير. يحقق أداءً من الدرجة الأولى ويدعم حتى 4 ملايين رمز سياقي (32× GPT-4o، 20× Claude-3.5-Sonnet).",
"MiniMaxAI/MiniMax-M1-80k.description": "MiniMax-M1 هو نموذج استدلال واسع النطاق بوزن مفتوح يستخدم انتباهًا هجينًا، يحتوي على 456 مليار معامل إجماليًا و~45.9 مليار مفعّلة لكل رمز. يدعم سياقًا يصل إلى 1M ويستخدم Flash Attention لتقليل FLOPs بنسبة 75% عند توليد 100K رمز مقارنة بـ DeepSeek R1. بهيكل MoE وتدريب RL هجين، يحقق أداءً رائدًا في الاستدلال طويل المدخلات ومهام هندسة البرمجيات الواقعية.",
"MiniMaxAI/MiniMax-M2.description": "MiniMax-M2 يعيد تعريف كفاءة الوكلاء. هو نموذج MoE مدمج وسريع وفعال من حيث التكلفة يحتوي على 230 مليار معامل إجماليًا و10 مليار مفعّلة، مصمم لمهام البرمجة والوكلاء من الدرجة الأولى مع الحفاظ على ذكاء عام قوي. مع 10 مليار معامل مفعّلة فقط، ينافس نماذج أكبر بكثير، مما يجعله مثاليًا للتطبيقات عالية الكفاءة.",
"Moonshot-Kimi-K2-Instruct.description": "يحتوي على 1 تريليون معامل إجماليًا و32 مليار مفعّلة. من بين النماذج غير المفكرة، يتصدر في المعرفة المتقدمة، الرياضيات، والبرمجة، وأقوى في مهام الوكلاء العامة. محسن لأعباء عمل الوكلاء، يمكنه اتخاذ إجراءات وليس فقط الإجابة على الأسئلة. الأفضل للمحادثات العامة الارتجالية وتجارب الوكلاء كنموذج يعمل بردود فعل دون تفكير طويل.",
"NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO.description": "Nous Hermes 2 - Mixtral 8x7B-DPO (46.7B) هو نموذج تعليمات عالي الدقة للحسابات المعقدة.",
"OmniConsistency.description": "تحسّن OmniConsistency التناسق الأسلوبي والتعميم في مهام تحويل الصور إلى صور من خلال إدخال محولات الانتشار واسعة النطاق (DiTs) وبيانات مزدوجة النمط، مما يمنع تدهور الأسلوب.",
@@ -103,14 +99,12 @@
"Phi-3.5-mini-instruct.description": "إصدار محدث من نموذج Phi-3-mini.",
"Phi-3.5-vision-instrust.description": "إصدار محدث من نموذج Phi-3-vision.",
"Pro/MiniMaxAI/MiniMax-M2.1.description": "MiniMax-M2.1 هو نموذج لغوي مفتوح المصدر ومتقدم، مُحسَّن لقدرات الوكلاء، ويتفوق في البرمجة، واستخدام الأدوات، واتباع التعليمات، والتخطيط طويل الأمد. يدعم النموذج تطوير البرمجيات متعددة اللغات وتنفيذ سير العمل المعقد متعدد الخطوات، وحقق نتيجة 74.0 على SWE-bench Verified، متفوقًا على Claude Sonnet 4.5 في السيناريوهات متعددة اللغات.",
"Pro/MiniMaxAI/MiniMax-M2.5.description": "MiniMax-M2.5 هو أحدث نموذج لغة كبير تم تطويره بواسطة MiniMax، تم تدريبه من خلال التعلم المعزز واسع النطاق عبر مئات الآلاف من البيئات المعقدة في العالم الحقيقي. يتميز بهيكل MoE مع 229 مليار معلمة، ويحقق أداءً رائدًا في الصناعة في مهام مثل البرمجة، واستدعاء أدوات الوكيل، والبحث، والسيناريوهات المكتبية.",
"Pro/Qwen/Qwen2-7B-Instruct.description": "Qwen2-7B-Instruct هو نموذج لغوي كبير (LLM) موجه للتعليمات ضمن سلسلة Qwen2. يستخدم بنية Transformer مع SwiGLU، وانحياز QKV في الانتباه، وانتباه الاستعلامات المجمعة، ويعالج مدخلات كبيرة. يتميز بأداء قوي في فهم اللغة، التوليد، المهام متعددة اللغات، البرمجة، الرياضيات، والاستدلال، متفوقًا على معظم النماذج المفتوحة ومنافسًا للنماذج التجارية. يتفوق على Qwen1.5-7B-Chat في العديد من المعايير.",
"Pro/Qwen/Qwen2.5-7B-Instruct.description": "Qwen2.5-7B-Instruct هو جزء من أحدث سلسلة نماذج لغوية كبيرة من Alibaba Cloud. يقدم هذا النموذج ذو 7 مليارات معلمة تحسينات ملحوظة في البرمجة والرياضيات، ويدعم أكثر من 29 لغة، ويعزز اتباع التعليمات، وفهم البيانات المنظمة، وإنتاج المخرجات المنظمة (خصوصًا JSON).",
"Pro/Qwen/Qwen2.5-Coder-7B-Instruct.description": "Qwen2.5-Coder-7B-Instruct هو أحدث نموذج لغوي كبير من Alibaba Cloud يركز على البرمجة. مبني على Qwen2.5 ومدرب على 5.5 تريليون رمز، يعزز بشكل كبير توليد الشيفرة، الاستدلال، والإصلاح، مع الحفاظ على القوة في الرياضيات والقدرات العامة، مما يوفر أساسًا قويًا لوكلاء البرمجة.",
"Pro/Qwen/Qwen2.5-VL-7B-Instruct.description": "Qwen2.5-VL هو نموذج رؤية-لغة جديد من Qwen يتمتع بفهم بصري قوي. يحلل النصوص، الرسوم البيانية، والتخطيطات في الصور، ويفهم مقاطع الفيديو الطويلة والأحداث، ويدعم الاستدلال واستخدام الأدوات، وتحديد الكائنات عبر تنسيقات متعددة، وإنتاج مخرجات منظمة. يعزز فهم الفيديو من خلال تحسينات في الدقة الديناميكية ومعدل الإطارات، ويزيد من كفاءة مشفر الرؤية.",
"Pro/THUDM/GLM-4.1V-9B-Thinking.description": "GLM-4.1V-9B-Thinking هو نموذج رؤية-لغة مفتوح المصدر من Zhipu AI ومختبر KEG في جامعة تسينغهوا، مصمم للإدراك متعدد الوسائط المعقد. مبني على GLM-4-9B-0414، ويضيف استدلال سلسلة الأفكار والتعلم المعزز (RL) لتحسين الاستدلال عبر الوسائط والاستقرار بشكل كبير.",
"Pro/THUDM/glm-4-9b-chat.description": "GLM-4-9B-Chat هو النموذج المفتوح المصدر من سلسلة GLM-4 من Zhipu AI. يتميز بأداء قوي في الدلالات، الرياضيات، الاستدلال، البرمجة، والمعرفة. بالإضافة إلى المحادثة متعددة الأدوار، يدعم تصفح الويب، تنفيذ الشيفرة، استدعاء الأدوات المخصصة، والاستدلال على النصوص الطويلة. يدعم 26 لغة (بما في ذلك الصينية، الإنجليزية، اليابانية، الكورية، والألمانية). يحقق نتائج جيدة في AlignBench-v2، MT-Bench، MMLU، وC-Eval، ويدعم سياقًا يصل إلى 128 ألف رمز للاستخدام الأكاديمي والتجاري.",
"Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B.description": "تم تقطير DeepSeek-R1-Distill-Qwen-7B من Qwen2.5-Math-7B وتم تحسينه باستخدام 800 ألف عينة مختارة من DeepSeek-R1. يتميز بأداء قوي، حيث يحقق 92.8٪ في MATH-500، و55.5٪ في AIME 2024، وتصنيف 1189 في CodeForces لنموذج بحجم 7 مليارات معلمة.",
"Pro/deepseek-ai/DeepSeek-R1.description": "DeepSeek-R1 هو نموذج استدلال مدفوع بالتعلم المعزز يقلل التكرار ويحسن قابلية القراءة. يستخدم بيانات بداية باردة قبل التعلم المعزز لتعزيز الاستدلال، ويضاهي OpenAI-o1 في مهام الرياضيات، البرمجة، والاستدلال، ويحقق نتائج أفضل من خلال تدريب دقيق.",
"Pro/deepseek-ai/DeepSeek-V3.1-Terminus.description": "DeepSeek-V3.1-Terminus هو إصدار محدث من نموذج V3.1، مصمم كنموذج وكيل هجين. يعالج المشكلات التي أبلغ عنها المستخدمون، ويحسن الاستقرار، وتناسق اللغة، ويقلل من الخلط بين الصينية/الإنجليزية والرموز غير الطبيعية. يدمج أوضاع التفكير وغير التفكير مع قوالب محادثة للتبديل المرن. كما يعزز أداء وكلاء الشيفرة والبحث لاستخدام أدوات أكثر موثوقية ومهام متعددة الخطوات.",
"Pro/deepseek-ai/DeepSeek-V3.2.description": "DeepSeek-V3.2 هو نموذج يجمع بين الكفاءة الحسابية العالية وأداء التفكير والوكيل الممتاز. يعتمد نهجه على ثلاثة اختراقات تكنولوجية رئيسية: DeepSeek Sparse Attention (DSA)، وهي آلية انتباه فعالة تقلل بشكل كبير من التعقيد الحسابي مع الحفاظ على أداء النموذج، ومُحسنة خصيصًا للسيناريوهات ذات السياق الطويل؛ إطار عمل للتعلم المعزز القابل للتوسع يمكن من خلاله أن ينافس أداء النموذج GPT-5، مع نسخته عالية الحوسبة التي تضاهي Gemini-3.0-Pro في قدرات التفكير؛ وخط أنابيب واسع النطاق لتوليف مهام الوكيل يهدف إلى دمج قدرات التفكير في سيناريوهات استخدام الأدوات، مما يحسن اتباع التعليمات والتعميم في البيئات التفاعلية المعقدة. حقق النموذج أداءً متميزًا في الأولمبياد الدولي للرياضيات (IMO) وأولمبياد المعلوماتية الدولي (IOI) لعام 2025.",
@@ -118,10 +112,8 @@
"Pro/moonshotai/Kimi-K2-Instruct-0905.description": "Kimi K2-Instruct-0905 هو أحدث وأقوى إصدار من Kimi K2. إنه نموذج MoE من الدرجة الأولى يحتوي على إجمالي 1 تريليون و32 مليار معلمة نشطة. من أبرز ميزاته الذكاء البرمجي القوي مع تحسينات كبيرة في المعايير ومهام الوكلاء الواقعية، بالإضافة إلى تحسينات في جمالية واجهة الشيفرة وسهولة الاستخدام.",
"Pro/moonshotai/Kimi-K2-Thinking.description": "Kimi K2 Thinking Turbo هو إصدار Turbo محسّن لسرعة الاستدلال والإنتاجية مع الحفاظ على قدرات التفكير متعدد الخطوات واستخدام الأدوات في K2 Thinking. إنه نموذج MoE يحتوي على حوالي 1 تريليون معلمة إجمالية، ويدعم سياقًا أصليًا بطول 256 ألف رمز، واستدعاء أدوات واسع النطاق ومستقر لسيناريوهات الإنتاج التي تتطلب زمن استجابة وتزامنًا صارمين.",
"Pro/moonshotai/Kimi-K2.5.description": "Kimi K2.5 هو نموذج وكيل متعدد الوسائط مفتوح المصدر، مبني على Kimi-K2-Base، ومدرب على حوالي 1.5 تريليون رمز من النصوص والرؤية. يستخدم بنية MoE بعدد إجمالي 1 تريليون مع 32 مليار معلمات نشطة، ويدعم نافذة سياق تصل إلى 256 ألف، مما يدمج الفهم البصري واللغوي بسلاسة.",
"Pro/zai-org/glm-4.7.description": "GLM-4.7 هو النموذج الرائد من الجيل الجديد لشركة Zhipu، يحتوي على 355 مليار معلمة إجمالية و32 مليار معلمة نشطة، وقد تم تطويره بالكامل في مجالات الحوار العام، والاستدلال، وقدرات الوكلاء. يعزز GLM-4.7 التفكير المتداخل ويقدم مفاهيم التفكير المحفوظ والتفكير على مستوى الدور.",
"Pro/zai-org/glm-5.description": "GLM-5 هو نموذج اللغة الكبير من الجيل التالي من Zhipu، يركز على هندسة الأنظمة المعقدة ومهام الوكيل طويلة المدة. تم توسيع معلمات النموذج إلى 744 مليار (40 مليار نشطة) وتدمج DeepSeek Sparse Attention.",
"QwQ-32B-Preview.description": "Qwen QwQ هو نموذج بحث تجريبي يركز على تحسين الاستدلال.",
"Qwen/QVQ-72B-Preview.description": "QVQ-72B-Preview هو نموذج بحث من Qwen يركز على الاستدلال البصري، يتميز بفهم المشاهد المعقدة وحل مسائل الرياضيات البصرية.",
"Qwen/QwQ-32B-Preview.description": "Qwen QwQ هو نموذج بحث تجريبي يركز على تحسين استدلال الذكاء الاصطناعي.",
"Qwen/QwQ-32B.description": "QwQ هو نموذج استدلال ضمن عائلة Qwen. مقارنة بالنماذج التقليدية الموجهة للتعليمات، يضيف QwQ قدرات تفكير واستدلال تعزز الأداء بشكل كبير في المهام الصعبة. QwQ-32B هو نموذج استدلال متوسط الحجم ينافس نماذج استدلال رائدة مثل DeepSeek-R1 وo1-mini. يستخدم RoPE، SwiGLU، RMSNorm، وانحياز QKV في الانتباه، مع 64 طبقة و40 رأس انتباه (8 KV في GQA).",
"Qwen/Qwen-Image-Edit-2509.description": "Qwen-Image-Edit-2509 هو أحدث إصدار لتحرير الصور من فريق Qwen. مبني على نموذج Qwen-Image بحجم 20 مليار معلمة، ويمتد من قدرات عرض النصوص القوية إلى تحرير الصور بدقة. يستخدم بنية تحكم مزدوجة، حيث تُرسل المدخلات إلى Qwen2.5-VL للتحكم الدلالي وإلى مشفر VAE للتحكم في المظهر، مما يتيح تحريرًا على مستوى الدلالة والمظهر. يدعم التعديلات المحلية (إضافة/إزالة/تعديل) والتعديلات الدلالية المتقدمة مثل إنشاء الملكية الفكرية ونقل الأسلوب مع الحفاظ على المعنى. يحقق نتائج رائدة في العديد من المعايير.",
@@ -205,11 +197,9 @@
"Skylark2-pro-turbo-8k.description": "الجيل الثاني من نموذج Skylark. يوفر Skylark2-pro-turbo-8k استدلالًا أسرع بتكلفة أقل مع نافذة سياق تصل إلى 8 آلاف رمز.",
"THUDM/GLM-4-32B-0414.description": "GLM-4-32B-0414 هو نموذج GLM من الجيل التالي يحتوي على 32 مليار معامل، ويقارن في الأداء مع نماذج OpenAI GPT وسلسلة DeepSeek V3/R1.",
"THUDM/GLM-4-9B-0414.description": "GLM-4-9B-0414 هو نموذج GLM يحتوي على 9 مليارات معامل، ويعتمد على تقنيات GLM-4-32B مع إمكانية نشر أخف. يتميز في توليد الشيفرات، وتصميم الويب، وتوليد SVG، والكتابة المعتمدة على البحث.",
"THUDM/GLM-4.1V-9B-Thinking.description": "GLM-4.1V-9B-Thinking هو نموذج رؤية-لغة مفتوح المصدر من Zhipu AI ومختبر KEG بجامعة تسينغهوا، مصمم للإدراك المعقد متعدد الوسائط. يعتمد على GLM-4-9B-0414 ويضيف سلسلة التفكير والتعلم المعزز لتحسين الاستدلال عبر الوسائط والاستقرار بشكل كبير.",
"THUDM/GLM-Z1-32B-0414.description": "GLM-Z1-32B-0414 هو نموذج استدلال عميق مبني على GLM-4-32B-0414 باستخدام بيانات بدء باردة وتوسيع التعلم المعزز، وتم تدريبه بشكل إضافي على الرياضيات والبرمجة والمنطق. يُظهر تحسنًا كبيرًا في القدرة على حل المسائل الرياضية والمهام المعقدة مقارنة بالنموذج الأساسي.",
"THUDM/GLM-Z1-9B-0414.description": "GLM-Z1-9B-0414 هو نموذج GLM صغير يحتوي على 9 مليارات معامل، يحتفظ بقوة المصدر المفتوح ويقدم أداءً مميزًا. يتميز في الاستدلال الرياضي والمهام العامة، ويتفوق على النماذج المفتوحة من نفس الفئة الحجمية.",
"THUDM/glm-4-9b-chat.description": "GLM-4-9B-Chat هو النموذج مفتوح المصدر من Zhipu AI ضمن سلسلة GLM-4. يتميز بقوة في الفهم الدلالي، والرياضيات، والاستدلال، والبرمجة، والمعرفة. بالإضافة إلى الدردشة متعددة الأدوار، يدعم تصفح الويب، وتنفيذ الشيفرات، واستدعاء الأدوات المخصصة، والاستدلال على النصوص الطويلة. يدعم 26 لغة (بما في ذلك الصينية، والإنجليزية، واليابانية، والكورية، والألمانية). يحقق أداءً جيدًا في AlignBench-v2 وMT-Bench وMMLU وC-Eval، ويدعم نافذة سياق تصل إلى 128 ألف رمز للاستخدام الأكاديمي والتجاري.",
"Tongyi-Zhiwen/QwenLong-L1-32B.description": "QwenLong-L1-32B هو أول نموذج استدلال طويل السياق (LRM) تم تدريبه باستخدام التعلم المعزز، ومُحسَّن للاستدلال على النصوص الطويلة. تتيح استراتيجية التوسيع التدريجي للسياق انتقالًا مستقرًا من السياقات القصيرة إلى الطويلة. يتفوق على OpenAI-o3-mini وQwen3-235B-A22B في سبعة اختبارات استدلال على مستندات طويلة، ويضاهي Claude-3.7-Sonnet-Thinking. يتميز بقوة خاصة في الرياضيات والمنطق والاستدلال متعدد الخطوات.",
"Yi-34B-Chat.description": "Yi-1.5-34B يحتفظ بقدرات اللغة العامة القوية للسلسلة، ويستخدم تدريبًا تدريجيًا على 500 مليار رمز عالي الجودة لتحسين كبير في المنطق الرياضي والبرمجة.",
"abab5.5-chat.description": "مصمم لسيناريوهات الإنتاجية، مع قدرة على التعامل مع المهام المعقدة وتوليد نصوص فعالة للاستخدام المهني.",
"abab5.5s-chat.description": "مصمم للدردشة بشخصيات صينية، ويقدم حوارات صينية عالية الجودة لمجموعة متنوعة من التطبيقات.",
@@ -301,17 +291,10 @@
"claude-3.5-sonnet.description": "يتميز Claude 3.5 Sonnet بقدرات عالية في البرمجة والكتابة والتفكير المعقد.",
"claude-3.7-sonnet-thought.description": "Claude 3.7 Sonnet مزود بقدرات تفكير موسعة للمهام التي تتطلب استدلالًا معقدًا.",
"claude-3.7-sonnet.description": "Claude 3.7 Sonnet هو إصدار مطور يتمتع بسياق موسع وقدرات محسّنة.",
"claude-haiku-4-5-20251001.description": "Claude Haiku 4.5 هو أسرع وأذكى نموذج Haiku من Anthropic، يتميز بسرعة البرق والتفكير الممتد.",
"claude-haiku-4.5.description": "Claude Haiku 4.5 نموذج سريع وفعّال لمجموعة متنوعة من المهام.",
"claude-opus-4-1-20250805-thinking.description": "Claude Opus 4.1 Thinking هو إصدار متقدم يمكنه عرض عملية تفكيره.",
"claude-opus-4-1-20250805.description": "Claude Opus 4.1 هو أحدث وأقوى نموذج من Anthropic للمهام المعقدة للغاية، يتميز بالأداء والذكاء والطلاقة والفهم.",
"claude-opus-4-20250514.description": "Claude Opus 4 هو أقوى نموذج من Anthropic للمهام المعقدة للغاية، يتميز بالأداء والذكاء والطلاقة والفهم.",
"claude-opus-4-5-20251101.description": "Claude Opus 4.5 هو النموذج الرائد من Anthropic، يجمع بين الذكاء الاستثنائي والأداء القابل للتوسع، مثالي للمهام المعقدة التي تتطلب استجابات عالية الجودة وتفكير متقدم.",
"claude-opus-4-6.description": "Claude Opus 4.6 هو أذكى نموذج من Anthropic لبناء الوكلاء والبرمجة.",
"claude-sonnet-4-20250514-thinking.description": "Claude Sonnet 4 Thinking يمكنه تقديم استجابات شبه فورية أو تفكير متسلسل مرئي.",
"claude-sonnet-4-20250514.description": "Claude Sonnet 4 هو أذكى نموذج من Anthropic حتى الآن، يقدم استجابات شبه فورية أو تفكير ممتد خطوة بخطوة مع تحكم دقيق لمستخدمي API.",
"claude-sonnet-4-5-20250929.description": "Claude Sonnet 4.5 هو أذكى نموذج من Anthropic حتى الآن.",
"claude-sonnet-4-6.description": "Claude Sonnet 4.6 هو أفضل مزيج من السرعة والذكاء من Anthropic.",
"claude-sonnet-4.description": "Claude Sonnet 4 هو الجيل الأحدث مع أداء محسّن في جميع المهام.",
"codegeex-4.description": "CodeGeeX-4 هو مساعد برمجة ذكي يدعم الأسئلة والأجوبة متعددة اللغات وإكمال الشيفرة لزيادة إنتاجية المطورين.",
"codegeex4-all-9b.description": "CodeGeeX4-ALL-9B هو نموذج توليد شيفرة متعدد اللغات يدعم الإكمال والتوليد، تفسير الشيفرة، البحث عبر الإنترنت، استدعاء الوظائف، وأسئلة وأجوبة على مستوى المستودع، ويغطي مجموعة واسعة من سيناريوهات تطوير البرمجيات. يُعد من أفضل نماذج الشيفرة تحت 10B.",
@@ -368,7 +351,6 @@
"deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B.description": "تستخدم نماذج DeepSeek-R1 المستخلصة التعلم المعزز وبيانات البداية الباردة لتحسين التفكير وتحديد معايير جديدة للنماذج المفتوحة متعددة المهام.",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-14B.description": "تستخدم نماذج DeepSeek-R1 المستخلصة التعلم المعزز وبيانات البداية الباردة لتحسين التفكير وتحديد معايير جديدة للنماذج المفتوحة متعددة المهام.",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-32B.description": "تم استخلاص DeepSeek-R1-Distill-Qwen-32B من Qwen2.5-32B وتم تحسينه باستخدام 800 ألف عينة مختارة من DeepSeek-R1. يتميز في الرياضيات، والبرمجة، والتفكير، ويحقق نتائج قوية في AIME 2024، وMATH-500 (بدقة 94.3٪)، وGPQA Diamond.",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-7B.description": "تم استخلاص DeepSeek-R1-Distill-Qwen-7B من Qwen2.5-Math-7B وتم تحسينه باستخدام 800 ألف عينة مختارة من DeepSeek-R1. يحقق أداءً قويًا بنسبة 92.8٪ في MATH-500، و55.5٪ في AIME 2024، وتصنيف 1189 في CodeForces لنموذج بحجم 7B.",
"deepseek-ai/DeepSeek-R1.description": "يعزز DeepSeek-R1 قدرات التفكير باستخدام التعلم المعزز وبيانات البداية الباردة، ويحدد معايير جديدة للنماذج المفتوحة متعددة المهام متفوقًا على OpenAI-o1-mini.",
"deepseek-ai/DeepSeek-V2.5.description": "يعمل DeepSeek-V2.5 على ترقية DeepSeek-V2-Chat وDeepSeek-Coder-V2-Instruct، ويمزج بين القدرات العامة والبرمجية. يحسن الكتابة واتباع التعليمات لمواءمة التفضيلات بشكل أفضل، ويظهر تحسنًا ملحوظًا في AlpacaEval 2.0 وArenaHard وAlignBench وMT-Bench.",
"deepseek-ai/DeepSeek-V3.1-Terminus.description": "DeepSeek-V3.1-Terminus هو إصدار محدث من V3.1 كنموذج وكيل هجين. يعالج المشكلات التي أبلغ عنها المستخدمون ويحسن الاستقرار واتساق اللغة ويقلل من الخلط بين الصينية/الإنجليزية والرموز غير الطبيعية. يدمج أوضاع التفكير وغير التفكير مع قوالب المحادثة للتبديل المرن. كما يعزز أداء وكلاء الكود والبحث لاستخدام الأدوات بشكل أكثر موثوقية وتنفيذ المهام متعددة الخطوات.",
@@ -381,7 +363,6 @@
"deepseek-ai/deepseek-v3.1.description": "DeepSeek V3.1 هو نموذج تفكير من الجيل التالي يتمتع بقدرات أقوى في التفكير المعقد وسلسلة التفكير لمهام التحليل العميق.",
"deepseek-ai/deepseek-v3.2.description": "DeepSeek V3.2 هو نموذج استدلال من الجيل التالي يتميز بقدرات استدلال معقدة وسلسلة التفكير.",
"deepseek-ai/deepseek-vl2.description": "DeepSeek-VL2 هو نموذج رؤية-لغة MoE يعتمد على DeepSeekMoE-27B مع تنشيط متفرق، ويحقق أداءً قويًا باستخدام 4.5 مليار معلمة نشطة فقط. يتميز في الأسئلة البصرية، وOCR، وفهم المستندات/الجداول/المخططات، والتأريض البصري.",
"deepseek-chat.description": "DeepSeek V3.2 يوازن بين التفكير وطول المخرجات لمهام الأسئلة اليومية ووكلاء المهام. تصل المعايير العامة إلى مستويات GPT-5، وهو الأول في دمج التفكير في استخدام الأدوات، مما يؤدي إلى تقييمات وكلاء مفتوحة المصدر.",
"deepseek-coder-33B-instruct.description": "DeepSeek Coder 33B هو نموذج لغة برمجية تم تدريبه على 2 تريليون رمز (87٪ كود، 13٪ نص صيني/إنجليزي). يقدم نافذة سياق 16K ومهام الإكمال في المنتصف، ويوفر إكمال كود على مستوى المشاريع وملء مقاطع الكود.",
"deepseek-coder-v2.description": "DeepSeek Coder V2 هو نموذج كود MoE مفتوح المصدر يتميز بأداء قوي في مهام البرمجة، ويضاهي GPT-4 Turbo.",
"deepseek-coder-v2:236b.description": "DeepSeek Coder V2 هو نموذج كود MoE مفتوح المصدر يتميز بأداء قوي في مهام البرمجة، ويضاهي GPT-4 Turbo.",
@@ -404,7 +385,6 @@
"deepseek-r1-fast-online.description": "الإصدار الكامل السريع من DeepSeek R1 مع بحث ويب في الوقت الحقيقي، يجمع بين قدرات بحجم 671B واستجابة أسرع.",
"deepseek-r1-online.description": "الإصدار الكامل من DeepSeek R1 مع 671 مليار معلمة وبحث ويب في الوقت الحقيقي، يوفر فهمًا وتوليدًا أقوى.",
"deepseek-r1.description": "يستخدم DeepSeek-R1 بيانات البداية الباردة قبل التعلم المعزز ويؤدي أداءً مماثلًا لـ OpenAI-o1 في الرياضيات، والبرمجة، والتفكير.",
"deepseek-reasoner.description": "DeepSeek V3.2 Thinking هو نموذج تفكير عميق يولد سلسلة من الأفكار قبل المخرجات لتحقيق دقة أعلى، مع نتائج تنافسية عالية وتفكير مشابه لـ Gemini-3.0-Pro.",
"deepseek-v2.description": "DeepSeek V2 هو نموذج MoE فعال لمعالجة منخفضة التكلفة.",
"deepseek-v2:236b.description": "DeepSeek V2 236B هو نموذج DeepSeek الموجه للبرمجة مع قدرات قوية في توليد الكود.",
"deepseek-v3-0324.description": "DeepSeek-V3-0324 هو نموذج MoE يحتوي على 671 مليار معلمة يتميز بقوة في البرمجة، والقدرات التقنية، وفهم السياق، والتعامل مع النصوص الطويلة.",
@@ -415,7 +395,6 @@
"deepseek-v3.2-exp.description": "deepseek-v3.2-exp يقدم انتباهاً متفرقاً لتحسين كفاءة التدريب والاستدلال على النصوص الطويلة، بسعر أقل من deepseek-v3.1.",
"deepseek-v3.2-speciale.description": "في المهام شديدة التعقيد، يتفوق نموذج Speciale بشكل كبير على النسخة القياسية، ولكنه يستهلك عددًا كبيرًا من الرموز ويتكبد تكاليف أعلى. حاليًا، يتم استخدام DeepSeek-V3.2-Speciale للأبحاث فقط، ولا يدعم استدعاء الأدوات، ولم يتم تحسينه بشكل خاص للمحادثات اليومية أو مهام الكتابة.",
"deepseek-v3.2-think.description": "DeepSeek V3.2 Think هو نموذج تفكير عميق كامل يتميز باستدلال طويل السلسلة أقوى.",
"deepseek-v3.2.description": "DeepSeek-V3.2 هو أول نموذج استدلال هجين من DeepSeek يدمج التفكير في استخدام الأدوات. يستخدم بنية فعالة لتقليل الحسابات، وتعلم تقوية واسع النطاق لتعزيز القدرات، وبيانات مهام تركيبية ضخمة لتعزيز التعميم. يجمع بين هذه العناصر الثلاثة لتحقيق أداء مماثل لـ GPT-5-High، مع تقليل كبير في طول المخرجات، مما يقلل من عبء الحوسبة وأوقات انتظار المستخدمين.",
"deepseek-v3.description": "DeepSeek-V3 هو نموذج MoE قوي بإجمالي 671 مليار معلمة و37 مليار معلمة نشطة لكل رمز.",
"deepseek-vl2-small.description": "DeepSeek VL2 Small هو إصدار متعدد الوسائط خفيف الوزن للاستخدام في البيئات ذات الموارد المحدودة أو التزامن العالي.",
"deepseek-vl2.description": "DeepSeek VL2 هو نموذج متعدد الوسائط لفهم النصوص والصور والإجابة البصرية الدقيقة.",
@@ -504,8 +483,6 @@
"ernie-x1-turbo-32k.description": "ERNIE X1 Turbo 32K هو نموذج تفكير سريع بسياق 32K للاستدلال المعقد والدردشة متعددة الأدوار.",
"ernie-x1.1-preview.description": "معاينة ERNIE X1.1 هو نموذج تفكير مخصص للتقييم والاختبار.",
"ernie-x1.1.description": "ERNIE X1.1 هو نموذج تفكير تجريبي للتقييم والاختبار.",
"fal-ai/bytedance/seedream/v4.5.description": "Seedream 4.5، الذي تم تطويره بواسطة فريق ByteDance Seed، يدعم تحرير الصور المتعددة والتكوين. يتميز بتناسق الموضوع المحسن، اتباع التعليمات بدقة، فهم المنطق المكاني، التعبير الجمالي، تصميم الملصقات والشعارات مع تقديم نصوص وصور عالية الدقة.",
"fal-ai/bytedance/seedream/v4.description": "Seedream 4.0، الذي تم تطويره بواسطة ByteDance Seed، يدعم إدخال النصوص والصور لإنشاء صور عالية الجودة وقابلة للتحكم بناءً على التعليمات.",
"fal-ai/flux-kontext/dev.description": "نموذج FLUX.1 يركز على تحرير الصور، ويدعم إدخال النصوص والصور.",
"fal-ai/flux-pro/kontext.description": "FLUX.1 Kontext [pro] يقبل النصوص وصور مرجعية كمدخلات، مما يتيح تعديلات محلية مستهدفة وتحولات معقدة في المشهد العام.",
"fal-ai/flux/krea.description": "Flux Krea [dev] هو نموذج لتوليد الصور يتميز بميول جمالية نحو صور أكثر واقعية وطبيعية.",
@@ -513,8 +490,6 @@
"fal-ai/hunyuan-image/v3.description": "نموذج قوي لتوليد الصور متعدد الوسائط أصلي.",
"fal-ai/imagen4/preview.description": "نموذج عالي الجودة لتوليد الصور من Google.",
"fal-ai/nano-banana.description": "Nano Banana هو أحدث وأسرع وأكثر نماذج Google كفاءةً لتوليد وتحرير الصور من خلال المحادثة.",
"fal-ai/qwen-image-edit.description": "نموذج تحرير الصور الاحترافي من فريق Qwen، يدعم التعديلات الدلالية والمظهرية، تحرير النصوص الدقيقة باللغتين الصينية والإنجليزية، نقل الأسلوب، الدوران، والمزيد.",
"fal-ai/qwen-image.description": "نموذج قوي لإنشاء الصور من فريق Qwen يتميز بتقديم نصوص صينية قوية وأنماط بصرية متنوعة.",
"flux-1-schnell.description": "نموذج تحويل النص إلى صورة يحتوي على 12 مليار معلمة من Black Forest Labs يستخدم تقنيات تقطير الانتشار العدائي الكامن لتوليد صور عالية الجودة في 1-4 خطوات. ينافس البدائل المغلقة ومتاح بموجب ترخيص Apache-2.0 للاستخدام الشخصي والبحثي والتجاري.",
"flux-dev.description": "FLUX.1 [dev] هو نموذج مفتوح الأوزان ومقطر للاستخدام غير التجاري. يحافظ على جودة صور قريبة من المستوى الاحترافي واتباع التعليمات مع كفاءة تشغيل أعلى مقارنة بالنماذج القياسية من نفس الحجم.",
"flux-kontext-max.description": "توليد وتحرير صور سياقية متقدمة، تجمع بين النصوص والصور لتحقيق نتائج دقيقة ومتسقة.",
@@ -558,10 +533,8 @@
"gemini-2.5-pro.description": "Gemini 2.5 Pro هو النموذج الرائد من Google في مجال الاستدلال، يدعم السياق الطويل للمهام المعقدة.",
"gemini-3-flash-preview.description": "Gemini 3 Flash هو أذكى نموذج تم تصميمه للسرعة، يجمع بين الذكاء المتقدم وأساس بحث ممتاز.",
"gemini-3-pro-image-preview.description": "Gemini 3 Pro Image (Nano Banana Pro) هو نموذج توليد الصور من Google ويدعم المحادثة متعددة الوسائط.",
"gemini-3-pro-image-preview:image.description": "Gemini 3 Pro Image (Nano Banana Pro) هو نموذج إنشاء الصور من Google ويدعم أيضًا الدردشة متعددة الوسائط.",
"gemini-3-pro-preview.description": "Gemini 3 Pro هو أقوى نموذج من Google للوكيل الذكي والبرمجة الإبداعية، يقدم تفاعلاً أعمق وصورًا أغنى مع استدلال متقدم.",
"gemini-3.1-flash-image-preview.description": "Gemini 3.1 Flash Image (Nano Banana 2) يقدم جودة صور احترافية بسرعة فائقة مع دعم الدردشة متعددة الوسائط.",
"gemini-3.1-flash-image-preview:image.description": "Gemini 3.1 Flash Image (Nano Banana 2) يقدم جودة صور بمستوى احترافي بسرعة Flash مع دعم الدردشة متعددة الوسائط.",
"gemini-3.1-flash-lite-preview.description": "Gemini 3.1 Flash-Lite Preview هو النموذج الأكثر كفاءة من حيث التكلفة من Google، مُحسّن للمهام الوكيلة ذات الحجم الكبير، الترجمة، ومعالجة البيانات.",
"gemini-3.1-pro-preview.description": "Gemini 3.1 Pro Preview يحسن من Gemini 3 Pro مع قدرات استدلال محسّنة ويضيف دعم مستوى التفكير المتوسط.",
"gemini-flash-latest.description": "أحدث إصدار من Gemini Flash",
@@ -702,6 +675,8 @@
"gpt-5.2.description": "GPT-5.2 هو نموذج رائد لتدفقات العمل البرمجية والتلقائية مع استدلال أقوى وأداء سياقي طويل.",
"gpt-5.3-chat-latest.description": "GPT-5.3 Chat هو أحدث نموذج ChatGPT المستخدم في ChatGPT مع تحسينات في تجربة المحادثة.",
"gpt-5.3-codex.description": "GPT-5.3-Codex هو النموذج الأكثر قدرة على البرمجة الوكيلة حتى الآن، محسن للمهام البرمجية الوكيلة في Codex أو بيئات مشابهة.",
"gpt-5.4-mini.description": "GPT-5.4 mini هو أقوى نموذج صغير من OpenAI للبرمجة، واستخدام الحاسوب، والوكلاء الفرعيين.",
"gpt-5.4-nano.description": "GPT-5.4 nano هو أرخص نموذج من فئة GPT-5.4 من OpenAI للمهام البسيطة ذات الحجم الكبير.",
"gpt-5.4-pro.description": "GPT-5.4 Pro يستخدم المزيد من الحوسبة للتفكير بشكل أعمق وتقديم إجابات أفضل باستمرار، متاح فقط في Responses API.",
"gpt-5.4.description": "GPT-5.4 هو النموذج الرائد للعمل المهني المعقد مع أعلى قدرة على الاستنتاج.",
"gpt-5.description": "أفضل نموذج لمهام البرمجة والتلقائية عبر المجالات. يحقق GPT-5 قفزات في الدقة والسرعة والاستدلال والوعي بالسياق والتفكير المنظم وحل المشكلات.",
@@ -721,9 +696,9 @@
"grok-4-1-fast-reasoning.description": "نموذج متعدد الوسائط متقدم محسّن لاستخدام أدوات الوكلاء عالية الأداء.",
"grok-4-fast-non-reasoning.description": "يسعدنا إطلاق Grok 4 Fast، أحدث تقدم في نماذج الاستدلال منخفضة التكلفة.",
"grok-4-fast-reasoning.description": "يسعدنا إطلاق Grok 4 Fast، أحدث تقدم في نماذج الاستدلال منخفضة التكلفة.",
"grok-4.20-experimental-beta-0304-non-reasoning.description": "نسخة غير استنتاجية للاستخدامات البسيطة",
"grok-4.20-experimental-beta-0304-reasoning.description": "نموذج ذكي وسريع للغاية يستنتج قبل الرد",
"grok-4.20-multi-agent-experimental-beta-0304.description": "فريق من 4 أو 16 وكيلًا، يتفوق في حالات البحث، لا يدعم حاليًا أدوات العميل. يدعم فقط أدوات xAI على الخادم (مثل أدوات البحث X، أدوات البحث على الويب) وأدوات MCP البعيدة.",
"grok-4.20-beta-0309-non-reasoning.description": "نسخة غير استدلالية للاستخدامات البسيطة.",
"grok-4.20-beta-0309-reasoning.description": "نموذج ذكي وسريع للغاية يقوم بالاستدلال قبل الرد.",
"grok-4.20-multi-agent-beta-0309.description": "فريق مكون من 4 أو 16 وكيلًا، يتفوق في حالات الاستخدام البحثية، لا يدعم حاليًا الأدوات على جانب العميل. يدعم فقط أدوات xAI على جانب الخادم (مثل أدوات X Search، وأدوات البحث على الويب) وأدوات MCP البعيدة.",
"grok-4.description": "أحدث وأقوى نموذج رائد لدينا، يتفوق في معالجة اللغة الطبيعية والرياضيات والاستدلال — مثالي كأداة شاملة.",
"grok-code-fast-1.description": "يسعدنا إطلاق grok-code-fast-1، نموذج استدلال سريع وفعال من حيث التكلفة يتفوق في البرمجة التلقائية.",
"grok-imagine-image-pro.description": "إنشاء صور من مطالبات نصية، تحرير الصور الموجودة باستخدام اللغة الطبيعية، أو تحسين الصور بشكل تكراري من خلال محادثات متعددة الأدوار.",
@@ -794,7 +769,6 @@
"kimi-k2-thinking-turbo.description": "إصدار K2 عالي السرعة للتفكير الطويل مع نافذة سياق 256k، استدلال عميق قوي، وإخراج 60–100 رمز/ثانية.",
"kimi-k2-thinking.description": "kimi-k2-thinking هو نموذج تفكير من Moonshot AI يتمتع بقدرات عامة في الوكالة والاستدلال. يتفوق في الاستدلال العميق ويمكنه حل المشكلات الصعبة باستخدام أدوات متعددة الخطوات.",
"kimi-k2-turbo-preview.description": "kimi-k2 هو نموذج MoE أساسي يتمتع بقدرات قوية في البرمجة والوكالة (1 تريليون معلمة إجمالية، 32 مليار نشطة)، ويتفوق على النماذج المفتوحة السائدة في اختبارات الاستدلال، البرمجة، الرياضيات، والوكالة.",
"kimi-k2.5.description": "Kimi K2.5 هو أقوى نموذج من سلسلة Kimi، يقدم أداءً رائدًا مفتوح المصدر في مهام الوكلاء، البرمجة، وفهم الرؤية. يدعم الإدخال متعدد الوسائط وأنماط التفكير وغير التفكير.",
"kimi-k2.description": "Kimi-K2 هو نموذج MoE أساسي من Moonshot AI يتمتع بقدرات قوية في البرمجة والوكالة، بإجمالي 1 تريليون معلمة و32 مليار نشطة. يتفوق على النماذج المفتوحة السائدة في اختبارات الاستدلال العام، البرمجة، الرياضيات، ومهام الوكالة.",
"kimi-k2:1t.description": "Kimi K2 هو نموذج LLM كبير من نوع MoE من Moonshot AI بإجمالي 1 تريليون معلمة و32 مليار نشطة لكل تمرير أمامي. مُحسّن لقدرات الوكالة بما في ذلك استخدام الأدوات المتقدمة، الاستدلال، وتوليد الشيفرة.",
"kuaishou/kat-coder-pro-v1.description": "KAT-Coder-Pro-V1 (مجاني لفترة محدودة) يركز على فهم الشيفرة والأتمتة لوكلاء البرمجة الفعالة.",
@@ -900,7 +874,9 @@
"microsoft/Phi-3.5-vision-instruct.description": "إصدار محدث من نموذج Phi-3-vision.",
"microsoft/WizardLM-2-8x22B.description": "WizardLM 2 هو نموذج لغوي من Microsoft AI يتميز بالحوار المعقد، والمهام متعددة اللغات، والاستدلال، والمساعدات الذكية.",
"microsoft/wizardlm-2-8x22b.description": "WizardLM-2 8x22B هو النموذج الأكثر تقدمًا من Microsoft AI ضمن سلسلة Wizard، ويتميز بأداء تنافسي عالي.",
"mimo-v2-flash.description": "MiMo-V2-Flash: نموذج فعال للاستدلال، والبرمجة، وبناء الأسس للوكيل الذكي.",
"mimo-v2-flash.description": "MiMo-V2-Flash أصبح الآن مفتوح المصدر رسميًا! هذا نموذج MoE (مزيج من الخبراء) مصمم خصيصًا لتحقيق كفاءة استدلال قصوى، مع 309 مليار معلمة إجمالية (15 مليار مفعلة). من خلال الابتكارات في بنية هجينة للانتباه وتسريع الاستدلال متعدد الطبقات MTP، يحتل المرتبة بين أفضل نموذجين مفتوحي المصدر عالميًا عبر العديد من مجموعات قياس أداء الوكلاء. قدراته في البرمجة تتفوق على جميع النماذج مفتوحة المصدر وتنافس النماذج المغلقة الرائدة مثل Claude 4.5 Sonnet، مع تحمل 2.5% فقط من تكلفة الاستدلال وتقديم سرعة توليد أسرع بمقدار 2×—مما يدفع كفاءة استدلال النماذج الكبيرة إلى أقصى حد.",
"mimo-v2-omni.description": "MiMo-V2-Omni مصمم خصيصًا للتفاعل والتنفيذ متعدد الوسائط في سيناريوهات العالم الحقيقي. قمنا ببناء أساس كامل الوسائط من الصفر، مدمجين النصوص، والرؤية، والصوت، وموحدين بين \"الإدراك\" و\"التنفيذ\" ضمن بنية واحدة. هذا لا يكسر فقط القيود التقليدية للنماذج التي تركز على الفهم على حساب التنفيذ، ولكنه يمنح النموذج أيضًا قدرات أصلية في الإدراك متعدد الوسائط، واستخدام الأدوات، وتنفيذ الوظائف، وتشغيل واجهات المستخدم الرسومية. يمكن لـ MiMo-V2-Omni التكامل بسلاسة مع أطر الوكلاء الرئيسية، محققًا قفزة من الفهم إلى التحكم مع خفض كبير في عوائق نشر الوكلاء متعدد الوسائط بالكامل.",
"mimo-v2-pro.description": "Xiaomi MiMo-V2-Pro مصمم خصيصًا لتدفقات عمل الوكلاء عالية الكثافة في سيناريوهات العالم الحقيقي. يتميز بأكثر من تريليون معلمة إجمالية (42 مليار معلمة مفعلة)، ويتبنى بنية هجينة مبتكرة للانتباه، ويدعم طول سياق فائق يصل إلى مليون رمز. استنادًا إلى نموذج أساسي قوي، نقوم باستمرار بتوسيع الموارد الحسابية عبر نطاق أوسع من سيناريوهات الوكلاء، مما يوسع مساحة العمل الذكية بشكل كبير ويحقق تعميمًا كبيرًا—من البرمجة إلى تنفيذ المهام في العالم الحقيقي (\"المخلب\").",
"minicpm-v.description": "MiniCPM-V هو نموذج متعدد الوسائط من الجيل التالي من OpenBMB يتميز بقدرات ممتازة في التعرف البصري للنصوص وفهم الوسائط المتعددة لمجموعة واسعة من الاستخدامات.",
"minimax-m2.1.description": "MiniMax-M2.1 هو أحدث إصدار من سلسلة MiniMax، مُحسّن للبرمجة متعددة اللغات والمهام المعقدة الواقعية. كنموذج أصلي للذكاء الاصطناعي، يحقق MiniMax-M2.1 تحسينات كبيرة في الأداء، ودعم أطر الوكلاء، والتكيف مع سيناريوهات متعددة، بهدف مساعدة الأفراد والشركات على تبني نمط حياة وعمل قائم على الذكاء الاصطناعي بسرعة أكبر.",
"minimax-m2.5.description": "MiniMax-M2.5 هو نموذج لغة كبير متقدم مصمم للإنتاجية الواقعية ومهام البرمجة.",
@@ -954,7 +930,6 @@
"moonshot-v1-32k.description": "Moonshot V1 32K يدعم 32,768 رمزًا لسياق متوسط الطول، وهو مثالي للوثائق الطويلة والحوارات المعقدة في إنشاء المحتوى، والتقارير، وأنظمة الدردشة.",
"moonshot-v1-8k-vision-preview.description": "نماذج Kimi للرؤية (بما في ذلك moonshot-v1-8k-vision-preview/moonshot-v1-32k-vision-preview/moonshot-v1-128k-vision-preview) قادرة على فهم محتوى الصور مثل النصوص، الألوان، وأشكال الكائنات.",
"moonshot-v1-8k.description": "Moonshot V1 8K مُحسّن لتوليد النصوص القصيرة بكفاءة عالية، حيث يتعامل مع 8,192 رمزًا للمحادثات القصيرة، والملاحظات، والمحتوى السريع.",
"moonshotai/Kimi-Dev-72B.description": "Kimi-Dev-72B هو نموذج مفتوح المصدر للبرمجة تم تحسينه باستخدام التعلم المعزز على نطاق واسع لإنتاج تصحيحات قوية وجاهزة للإنتاج. يحقق نسبة 60.4٪ على SWE-bench Verified، مسجلاً رقمًا قياسيًا جديدًا للنماذج المفتوحة في مهام هندسة البرمجيات الآلية مثل إصلاح الأخطاء ومراجعة الشيفرة.",
"moonshotai/Kimi-K2-Instruct-0905.description": "Kimi K2-Instruct-0905 هو أحدث وأقوى إصدار من Kimi K2. إنه نموذج MoE من الدرجة الأولى يحتوي على تريليون معلمة إجمالية و32 مليار معلمة نشطة. من أبرز ميزاته الذكاء البرمجي القوي، وتحسينات كبيرة في اختبارات الأداء والمهام الواقعية، بالإضافة إلى تحسينات في جمالية واجهات الاستخدام وسهولة البرمجة الأمامية.",
"moonshotai/Kimi-K2-Thinking.description": "Kimi K2 Thinking هو أحدث وأقوى نموذج تفكير مفتوح المصدر. يوسع بشكل كبير عمق التفكير متعدد الخطوات ويحافظ على استخدام الأدوات المستقر عبر 200-300 استدعاء متتالي، محققًا أرقامًا قياسية جديدة في Humanity's Last Exam (HLE)، BrowseComp، ومعايير أخرى. يتفوق في البرمجة، الرياضيات، المنطق، وسيناريوهات الوكيل. يعتمد على بنية MoE مع ~1 تريليون معلمة إجمالية، ويدعم نافذة سياق 256K واستدعاء الأدوات.",
"moonshotai/kimi-k2-0711.description": "Kimi K2 0711 هو إصدار موجه من سلسلة Kimi، مناسب للبرمجة عالية الجودة واستخدام الأدوات.",
@@ -1186,8 +1161,6 @@
"qwq.description": "QwQ هو نموذج استدلال من عائلة Qwen. مقارنة بالنماذج المضبوطة على التعليمات، يقدم قدرات تفكير واستدلال تعزز الأداء بشكل كبير، خاصة في المشكلات الصعبة. QwQ-32B هو نموذج متوسط الحجم ينافس أفضل نماذج الاستدلال مثل DeepSeek-R1 و o1-mini.",
"qwq_32b.description": "نموذج استدلال متوسط الحجم من عائلة Qwen. مقارنة بالنماذج المضبوطة على التعليمات، تعزز قدرات التفكير والاستدلال في QwQ الأداء بشكل كبير، خاصة في المشكلات الصعبة.",
"r1-1776.description": "R1-1776 هو إصدار ما بعد التدريب من DeepSeek R1 مصمم لتقديم معلومات واقعية غير خاضعة للرقابة أو التحيز.",
"seedance-1-5-pro-251215.description": "Seedance 1.5 Pro من ByteDance يدعم تحويل النص إلى فيديو، الصورة إلى فيديو (الإطار الأول، الإطار الأول + الأخير)، وإنشاء الصوت متزامنًا مع المرئيات.",
"seedream-5-0-260128.description": "ByteDance-Seedream-5.0-lite من BytePlus يتميز بإنشاء معزز بالاسترجاع عبر الويب للحصول على معلومات في الوقت الحقيقي، تفسير محسّن للتعليمات المعقدة، وتحسين تناسق المراجع لإنشاء بصري احترافي.",
"solar-mini-ja.description": "Solar Mini (Ja) يوسع Solar Mini مع تركيز على اللغة اليابانية مع الحفاظ على الأداء القوي والكفاءة في الإنجليزية والكورية.",
"solar-mini.description": "Solar Mini هو نموذج لغة مدمج يتفوق على GPT-3.5، يتميز بقدرات متعددة اللغات قوية تدعم الإنجليزية والكورية، ويقدم حلاً فعالاً بصمة صغيرة.",
"solar-pro.description": "Solar Pro هو نموذج لغة عالي الذكاء من Upstage، يركز على اتباع التعليمات باستخدام وحدة معالجة رسومات واحدة، مع درجات IFEval تتجاوز 80. حالياً يدعم اللغة الإنجليزية؛ وكان من المقرر إصدار النسخة الكاملة في نوفمبر 2024 مع دعم لغات موسع وسياق أطول.",
@@ -1223,7 +1196,6 @@
"step-3.5-flash.description": "نموذج التفكير اللغوي الرائد من Stepfun. يتميز بقدرات تفكير من الدرجة الأولى وقدرات تنفيذ سريعة وموثوقة. قادر على تحليل وتخطيط المهام المعقدة، واستدعاء الأدوات بسرعة وموثوقية لأداء المهام، والتعامل مع مختلف المهام المعقدة مثل التفكير المنطقي، الرياضيات، هندسة البرمجيات، والبحث المتعمق.",
"step-3.description": "يتمتع هذا النموذج بإدراك بصري قوي واستدلال معقد، ويتعامل بدقة مع فهم المعرفة عبر المجالات، وتحليل الرياضيات والرؤية، ومجموعة واسعة من مهام التحليل البصري اليومية.",
"step-r1-v-mini.description": "نموذج استدلال يتمتع بفهم قوي للصور، يمكنه معالجة الصور والنصوص، ثم توليد نص بعد استدلال عميق. يتفوق في الاستدلال البصري ويقدم أداءً رائدًا في الرياضيات والبرمجة والاستدلال النصي، مع نافذة سياق تصل إلى 100 ألف.",
"stepfun-ai/step3.description": "Step3 هو نموذج استدلال متعدد الوسائط متقدم من StepFun، مبني على بنية MoE بسعة إجمالية 321B و38B نشطة. تصميمه الشامل يقلل من تكلفة فك التشفير مع تقديم استدلال رؤية-لغة من الدرجة الأولى. بفضل تصميم MFA وAFD، يظل فعالًا على المسرعات القوية والضعيفة. تم تدريبه مسبقًا على أكثر من 20 تريليون رمز نصي و4 تريليون رمز صورة-نص بعدة لغات. يحقق أداءً رائدًا في النماذج المفتوحة في اختبارات الرياضيات والبرمجة ومتعددة الوسائط.",
"taichu4_vl_2b_nothinking.description": "الإصدار بدون التفكير من نموذج Taichu4.0-VL 2B يتميز باستخدام ذاكرة أقل، تصميم خفيف الوزن، سرعة استجابة سريعة، وقدرات فهم متعددة الوسائط قوية.",
"taichu4_vl_32b.description": "الإصدار التفكير من نموذج Taichu4.0-VL 32B مناسب لمهام الفهم والاستدلال متعددة الوسائط المعقدة، ويظهر أداءً رائعًا في الاستدلال الرياضي متعدد الوسائط، قدرات الوكيل متعدد الوسائط، والفهم العام للصور والبصريات.",
"taichu4_vl_32b_nothinking.description": "الإصدار بدون التفكير من نموذج Taichu4.0-VL 32B مصمم لفهم النصوص والصور المعقدة وسيناريوهات الإجابة على الأسئلة المعرفية البصرية، ويتفوق في وصف الصور، الإجابة على الأسئلة البصرية، فهم الفيديو، ومهام تحديد المواقع البصرية.",
@@ -1310,7 +1282,6 @@
"zai-org/GLM-4.5-Air.description": "GLM-4.5-Air هو نموذج أساسي لتطبيقات الوكلاء يستخدم بنية Mixture-of-Experts. مُحسّن لاستخدام الأدوات، وتصفح الويب، والهندسة البرمجية، وبرمجة الواجهات، ويتكامل مع وكلاء البرمجة مثل Claude Code وRoo Code. يستخدم استدلالًا هجينًا للتعامل مع السيناريوهات المعقدة واليومية.",
"zai-org/GLM-4.5V.description": "GLM-4.5V هو أحدث نموذج رؤية من Zhipu AI، مبني على نموذج النص الرائد GLM-4.5-Air (إجمالي 106 مليار، 12 مليار نشط) باستخدام بنية MoE لأداء قوي بتكلفة أقل. يتبع مسار GLM-4.1V-Thinking ويضيف 3D-RoPE لتحسين الاستدلال المكاني ثلاثي الأبعاد. مُحسّن من خلال التدريب المسبق، والتعلم الخاضع للإشراف، والتعلم المعزز، ويتعامل مع الصور، والفيديو، والمستندات الطويلة، ويتصدر النماذج المفتوحة في 41 معيارًا متعدد الوسائط. يتيح وضع التفكير للمستخدمين التوازن بين السرعة والعمق.",
"zai-org/GLM-4.6.description": "مقارنة بـ GLM-4.5، يوسّع GLM-4.6 السياق من 128 ألف إلى 200 ألف لمهام الوكلاء المعقدة. يحقق نتائج أعلى في اختبارات البرمجة ويُظهر أداءً أقوى في التطبيقات الواقعية مثل Claude Code وCline وRoo Code وKilo Code، بما في ذلك توليد صفحات الواجهة الأمامية بشكل أفضل. تم تحسين الاستدلال ودعم استخدام الأدوات أثناء التفكير، مما يعزز القدرات العامة. يتكامل بشكل أفضل مع أطر الوكلاء، ويحسّن وكلاء الأدوات/البحث، ويتميز بأسلوب كتابة مفضل بشريًا وطبيعية في تقمص الأدوار.",
"zai-org/GLM-4.6V.description": "GLM-4.6V يحقق دقة فهم بصري رائدة بالنسبة لحجم معلماته وهو الأول الذي يدمج قدرات استدعاء الوظائف بشكل طبيعي في بنية نموذج الرؤية، مما يجسر الفجوة بين \"الإدراك البصري\" و\"الإجراءات القابلة للتنفيذ\" ويوفر أساسًا تقنيًا موحدًا للوكلاء متعدد الوسائط في سيناريوهات الأعمال الواقعية. تم تمديد نافذة السياق البصري إلى 128k، مما يدعم معالجة تدفقات الفيديو الطويلة وتحليل الصور عالية الدقة متعددة.",
"zai/glm-4.5-air.description": "GLM-4.5 وGLM-4.5-Air هما أحدث النماذج الرائدة لدينا لتطبيقات الوكلاء، وكلاهما يستخدم بنية MoE. يحتوي GLM-4.5 على 355 مليار إجمالي و32 مليار نشط لكل تمرير؛ بينما GLM-4.5-Air أنحف بإجمالي 106 مليار و12 مليار نشط.",
"zai/glm-4.5.description": "سلسلة GLM-4.5 مصممة للوكلاء. النموذج الرائد GLM-4.5 يجمع بين الاستدلال، والبرمجة، ومهارات الوكلاء مع 355 مليار معلمة إجمالية (32 مليار نشطة) ويقدّم أوضاع تشغيل مزدوجة كنظام استدلال هجين.",
"zai/glm-4.5v.description": "GLM-4.5V مبني على GLM-4.5-Air، ويَرِث تقنيات GLM-4.1V-Thinking المثبتة، ويتوسع ببنية MoE قوية بسعة 106 مليار.",
+9 -1
View File
@@ -1,6 +1,7 @@
{
"arguments.moreParams": "إجمالي {{count}} من المعاملات",
"arguments.title": "المعلمات",
"builtins.lobe-activator.apiName.activateTools": "تفعيل الأدوات",
"builtins.lobe-agent-builder.apiName.getAvailableModels": "الحصول على النماذج المتاحة",
"builtins.lobe-agent-builder.apiName.getAvailableTools": "الحصول على المهارات المتاحة",
"builtins.lobe-agent-builder.apiName.getConfig": "الحصول على الإعدادات",
@@ -24,6 +25,14 @@
"builtins.lobe-agent-builder.inspector.noResults": "لا توجد نتائج",
"builtins.lobe-agent-builder.inspector.togglePlugin": "تبديل",
"builtins.lobe-agent-builder.title": "خبير بناء الوكلاء",
"builtins.lobe-agent-documents.apiName.copyDocument": "نسخ المستند",
"builtins.lobe-agent-documents.apiName.createDocument": "إنشاء مستند",
"builtins.lobe-agent-documents.apiName.editDocument": "تعديل المستند",
"builtins.lobe-agent-documents.apiName.readDocument": "قراءة المستند",
"builtins.lobe-agent-documents.apiName.removeDocument": "إزالة المستند",
"builtins.lobe-agent-documents.apiName.renameDocument": "إعادة تسمية المستند",
"builtins.lobe-agent-documents.apiName.updateLoadRule": "تحديث قاعدة التحميل",
"builtins.lobe-agent-documents.title": "مستندات الوكيل",
"builtins.lobe-agent-management.apiName.callAgent": "وكيل الاتصال",
"builtins.lobe-agent-management.apiName.createAgent": "إنشاء وكيل",
"builtins.lobe-agent-management.apiName.deleteAgent": "حذف الوكيل",
@@ -201,7 +210,6 @@
"builtins.lobe-skills.apiName.runCommand": "تشغيل الأمر",
"builtins.lobe-skills.apiName.searchSkill": "البحث عن المهارات",
"builtins.lobe-skills.title": "المهارات",
"builtins.lobe-tools.apiName.activateTools": "تفعيل الأدوات",
"builtins.lobe-topic-reference.apiName.getTopicContext": "الحصول على سياق الموضوع",
"builtins.lobe-topic-reference.title": "مرجع الموضوع",
"builtins.lobe-user-memory.apiName.addContextMemory": "إضافة ذاكرة السياق",
-1
View File
@@ -30,7 +30,6 @@
"internlm.description": "منظمة مفتوحة المصدر تركز على أبحاث النماذج الكبيرة والأدوات، وتوفر منصة فعالة وسهلة الاستخدام تتيح الوصول إلى أحدث النماذج والخوارزميات.",
"jina.description": "تأسست Jina AI في عام 2020، وهي شركة رائدة في مجال البحث الذكي. تشمل تقنياتها نماذج المتجهات، ومعيدو الترتيب، ونماذج لغوية صغيرة لبناء تطبيقات بحث توليدية ومتعددة الوسائط عالية الجودة.",
"lmstudio.description": "LM Studio هو تطبيق سطح مكتب لتطوير وتجربة النماذج اللغوية الكبيرة على جهازك.",
"lobehub.description": "يستخدم LobeHub Cloud واجهات برمجة التطبيقات الرسمية للوصول إلى نماذج الذكاء الاصطناعي ويقيس الاستخدام باستخدام أرصدة مرتبطة برموز النماذج.",
"longcat.description": "LongCat هو سلسلة من نماذج الذكاء الاصطناعي التوليدية الكبيرة التي تم تطويرها بشكل مستقل بواسطة Meituan. تم تصميمه لتعزيز إنتاجية المؤسسة الداخلية وتمكين التطبيقات المبتكرة من خلال بنية حسابية فعالة وقدرات متعددة الوسائط قوية.",
"minimax.description": "تأسست MiniMax في عام 2021، وتبني نماذج ذكاء اصطناعي متعددة الوسائط للأغراض العامة، بما في ذلك نماذج نصية بمليارات المعلمات، ونماذج صوتية وبصرية، بالإضافة إلى تطبيقات مثل Hailuo AI.",
"mistral.description": "تقدم Mistral نماذج متقدمة عامة ومتخصصة وبحثية للتفكير المعقد، والمهام متعددة اللغات، وتوليد الأكواد، مع دعم استدعاء الوظائف للتكامل المخصص.",
+81
View File
@@ -105,6 +105,21 @@
"agentCronJobs.weekdays.thu": "الخميس",
"agentCronJobs.weekdays.tue": "الثلاثاء",
"agentCronJobs.weekdays.wed": "الأربعاء",
"agentDocuments.columns.actions": "الإجراءات",
"agentDocuments.columns.document": "المستند",
"agentDocuments.columns.template": "القالب",
"agentDocuments.createSuccess": "تم إنشاء المستندات من القالب",
"agentDocuments.createWithTemplate": "إنشاء باستخدام هذا القالب",
"agentDocuments.deleteConfirm": "هل تريد حذف هذا المستند؟",
"agentDocuments.deleteSuccess": "تم حذف المستند",
"agentDocuments.desc": "إدارة المستندات لهذا الوكيل وإنشاء ملفات بداية من قالب.",
"agentDocuments.empty": "لا توجد مستندات حتى الآن",
"agentDocuments.overwriteConfirm.confirm": "الكتابة فوق وتطبيق",
"agentDocuments.overwriteConfirm.more": "و {{count}} المزيد",
"agentDocuments.overwriteConfirm.summary": "تطبيق {{templateName}} سيؤدي إلى إنشاء {{createCount}} مستندات جديدة واستبدال {{overwriteCount}} مستندات موجودة.",
"agentDocuments.overwriteConfirm.title": "هل تريد الكتابة فوق المستندات الموجودة؟",
"agentDocuments.overwriteConfirm.warning": "سيتم استبدال المستندات الموجودة بنفس اسم الملف.",
"agentDocuments.title": "مستندات الوكيل",
"agentInfoDescription.basic.avatar": "الصورة الرمزية",
"agentInfoDescription.basic.description": "الوصف",
"agentInfoDescription.basic.name": "الاسم",
@@ -166,6 +181,7 @@
"agentSkillModal.url.urlPlaceholder": "https://example.com/path/to/SKILL.md",
"agentSkillTag": "مهارة الوكيل",
"agentTab.chat": "تفضيلات المحادثة",
"agentTab.documents": "المستندات",
"agentTab.meta": "معلومات الوكيل",
"agentTab.modal": "إعدادات النموذج",
"agentTab.opening": "إعدادات البداية",
@@ -177,6 +193,70 @@
"analytics.title": "التحليلات",
"checking": "جارٍ التحقق...",
"checkingPermissions": "جارٍ التحقق من الأذونات...",
"creds.actions.delete": "حذف",
"creds.actions.deleteConfirm.cancel": "إلغاء",
"creds.actions.deleteConfirm.content": "سيتم حذف بيانات الاعتماد هذه بشكل دائم. لا يمكن التراجع عن هذا الإجراء.",
"creds.actions.deleteConfirm.ok": "حذف",
"creds.actions.deleteConfirm.title": "حذف بيانات الاعتماد؟",
"creds.actions.edit": "تعديل",
"creds.actions.view": "عرض",
"creds.create": "بيانات اعتماد جديدة",
"creds.createModal.fillForm": "املأ التفاصيل",
"creds.createModal.selectType": "اختر النوع",
"creds.createModal.title": "إنشاء بيانات اعتماد",
"creds.edit.title": "تعديل بيانات الاعتماد",
"creds.empty": "لم يتم تكوين أي بيانات اعتماد حتى الآن",
"creds.file.authRequired": "يرجى تسجيل الدخول إلى السوق أولاً",
"creds.file.uploadFailed": "فشل تحميل الملف",
"creds.file.uploadSuccess": "تم تحميل الملف بنجاح",
"creds.file.uploading": "جارٍ التحميل...",
"creds.form.addPair": "إضافة زوج مفتاح-قيمة",
"creds.form.back": "رجوع",
"creds.form.cancel": "إلغاء",
"creds.form.connectionRequired": "يرجى اختيار اتصال OAuth",
"creds.form.description": "الوصف",
"creds.form.descriptionPlaceholder": "وصف اختياري لهذه البيانات",
"creds.form.file": "ملف بيانات الاعتماد",
"creds.form.fileRequired": "يرجى تحميل ملف",
"creds.form.key": "المعرف",
"creds.form.keyPattern": "يمكن أن يحتوي المعرف فقط على أحرف وأرقام وشرطات سفلية وشرطات",
"creds.form.keyRequired": "المعرف مطلوب",
"creds.form.name": "اسم العرض",
"creds.form.nameRequired": "اسم العرض مطلوب",
"creds.form.save": "حفظ",
"creds.form.selectConnection": "اختر اتصال OAuth",
"creds.form.selectConnectionPlaceholder": "اختر حسابًا متصلاً",
"creds.form.selectedFile": "الملف المحدد",
"creds.form.submit": "إنشاء",
"creds.form.uploadDesc": "يدعم تنسيقات ملفات JSON وPEM وغيرها من ملفات بيانات الاعتماد",
"creds.form.uploadHint": "انقر أو اسحب الملف لتحميله",
"creds.form.valuePlaceholder": "أدخل القيمة",
"creds.form.values": "أزواج المفتاح-القيمة",
"creds.oauth.noConnections": "لا توجد اتصالات OAuth متاحة. يرجى توصيل حساب أولاً.",
"creds.signIn": "تسجيل الدخول إلى السوق",
"creds.signInRequired": "يرجى تسجيل الدخول إلى السوق لإدارة بيانات الاعتماد الخاصة بك",
"creds.table.actions": "الإجراءات",
"creds.table.key": "المعرف",
"creds.table.lastUsed": "آخر استخدام",
"creds.table.name": "الاسم",
"creds.table.neverUsed": "لم يتم الاستخدام",
"creds.table.preview": "معاينة",
"creds.table.type": "النوع",
"creds.typeDesc.file": "تحميل ملفات بيانات الاعتماد مثل حسابات الخدمة أو الشهادات",
"creds.typeDesc.kv-env": "تخزين مفاتيح API والرموز كمتغيرات بيئية",
"creds.typeDesc.kv-header": "تخزين قيم التفويض كعناوين HTTP",
"creds.typeDesc.oauth": "ربط باتصال OAuth موجود",
"creds.types.all": "الكل",
"creds.types.file": "ملف",
"creds.types.kv-env": "بيئة",
"creds.types.kv-header": "رأس",
"creds.types.oauth": "OAuth",
"creds.view.error": "فشل في تحميل بيانات الاعتماد",
"creds.view.noValues": "لا توجد قيم",
"creds.view.oauthNote": "يتم إدارة بيانات اعتماد OAuth بواسطة الخدمة المتصلة.",
"creds.view.title": "عرض بيانات الاعتماد: {{name}}",
"creds.view.values": "قيم بيانات الاعتماد",
"creds.view.warning": "هذه القيم حساسة. لا تشاركها مع الآخرين.",
"danger.clear.action": "مسح الآن",
"danger.clear.confirm": "هل تريد مسح جميع بيانات الدردشة؟ لا يمكن التراجع عن هذا الإجراء.",
"danger.clear.desc": "سيتم حذف جميع البيانات، بما في ذلك الوكلاء والملفات والرسائل والمهارات. لن يتم حذف حسابك.",
@@ -715,6 +795,7 @@
"tab.appearance": "المظهر",
"tab.chatAppearance": "مظهر المحادثة",
"tab.common": "المظهر",
"tab.creds": "بيانات الاعتماد",
"tab.experiment": "تجريبي",
"tab.hotkey": "اختصارات لوحة المفاتيح",
"tab.image": "خدمة توليد الصور",
+11
View File
@@ -12,7 +12,18 @@
"table.columns.spend": "الاعتمادات",
"table.columns.startTime": "تاريخ الإنشاء",
"table.columns.totalTokens": "استخدام الرموز",
"table.columns.trigger.enums.api": "استدعاء API",
"table.columns.trigger.enums.bot": "رسالة بوت",
"table.columns.trigger.enums.chat": "رسالة دردشة",
"table.columns.trigger.enums.cron": "مهمة مجدولة",
"table.columns.trigger.enums.eval": "تقييم الأداء",
"table.columns.trigger.enums.file_embedding": "تضمين ملف",
"table.columns.trigger.enums.memory": "استخراج الذاكرة",
"table.columns.trigger.enums.semantic_search": "بحث المعرفة",
"table.columns.trigger.enums.topic": "ملخص الموضوع",
"table.columns.trigger.title": "المشغل",
"table.columns.type.enums.chat": "توليد نصوص",
"table.columns.type.enums.embedding": "تضمين",
"table.columns.type.enums.imageGeneration": "توليد صور",
"table.columns.type.enums.videoGeneration": "توليد الفيديو",
"table.columns.type.title": "النوع",
+1
View File
@@ -352,6 +352,7 @@
"referral.table.columns.rewardedAt": "وقت المكافأة",
"referral.table.columns.status": "الحالة",
"referral.table.columns.suspectedReason": "سبب الشك",
"referral.table.status.pending_reward": "المكافأة المعلقة",
"referral.table.status.registered": "مسجل",
"referral.table.status.revoked": "تم الإلغاء",
"referral.table.status.rewarded": "تمت المكافأة",
+2 -1
View File
@@ -7,6 +7,7 @@
"config.header.title": "فيديو",
"config.imageUrl.label": "الإطار الابتدائي",
"config.prompt.placeholder": "صف الفيديو الذي ترغب في إنشائه",
"config.prompt.placeholderWithRef": "وصف المشهد الذي تريد إنشاؤه مع الصورة",
"config.referenceImage.label": "صورة مرجعية",
"config.resolution.label": "الدقة",
"config.seed.label": "البذرة",
@@ -20,7 +21,7 @@
"generation.status.failed": "فشل في الإنشاء",
"generation.status.generating": "جارٍ الإنشاء...",
"generation.validation.endFrameRequiresStartFrame": "لا يمكن استخدام الإطار النهائي بدون إطار ابتدائي. يرجى تعيين إطار ابتدائي أولاً.",
"topic.createNew": "موضوع جديد",
"topic.createNew": "إنشاء موضوع جديد",
"topic.deleteConfirm": "حذف موضوع الفيديو",
"topic.deleteConfirmDesc": "أنت على وشك حذف موضوع الفيديو هذا. لا يمكن التراجع عن هذا الإجراء.",
"topic.title": "مواضيع الفيديو",
+37 -1
View File
@@ -1,5 +1,6 @@
{
"channel.appSecret": "Секрет на приложението",
"channel.appSecretHint": "Тайният ключ на вашето бот приложение. Той ще бъде криптиран и съхранен сигурно.",
"channel.appSecretPlaceholder": "Поставете вашия секрет на приложението тук",
"channel.applicationId": "ID на приложението / Потребителско име на бота",
"channel.applicationIdHint": "Уникален идентификатор за вашето бот приложение.",
@@ -9,14 +10,31 @@
"channel.botTokenHowToGet": "Как да го получите?",
"channel.botTokenPlaceholderExisting": "Токенът е скрит за сигурност",
"channel.botTokenPlaceholderNew": "Поставете вашия токен на бота тук",
"channel.charLimit": "Ограничение на символите",
"channel.charLimitHint": "Максимален брой символи на съобщение",
"channel.connectFailed": "Свързването на бота не успя",
"channel.connectSuccess": "Ботът е успешно свързан",
"channel.connecting": "Свързване...",
"channel.connectionConfig": "Конфигурация на връзката",
"channel.copied": "Копирано в клипборда",
"channel.copy": "Копирай",
"channel.credentials": "Удостоверения",
"channel.debounceMs": "Прозорец за обединяване на съобщения (ms)",
"channel.debounceMsHint": "Колко време да се изчака за допълнителни съобщения преди изпращане към агента (ms)",
"channel.deleteConfirm": "Сигурни ли сте, че искате да премахнете този канал?",
"channel.deleteConfirmDesc": "Това действие ще премахне окончателно този канал за съобщения и неговата конфигурация. Това не може да бъде отменено.",
"channel.devWebhookProxyUrl": "HTTPS тунел URL",
"channel.devWebhookProxyUrlHint": "По избор. HTTPS тунел URL за пренасочване на заявки за уебхук към локален dev сървър.",
"channel.disabled": "Деактивиран",
"channel.discord.description": "Свържете този асистент с Discord сървър за канален чат и директни съобщения.",
"channel.dm": "Директни съобщения",
"channel.dmEnabled": "Активиране на директни съобщения",
"channel.dmEnabledHint": "Позволете на бота да получава и отговаря на директни съобщения",
"channel.dmPolicy": "Политика за директни съобщения",
"channel.dmPolicyAllowlist": "Списък с позволени",
"channel.dmPolicyDisabled": "Деактивирано",
"channel.dmPolicyHint": "Контролирайте кой може да изпраща директни съобщения до бота",
"channel.dmPolicyOpen": "Отворено",
"channel.documentation": "Документация",
"channel.enabled": "Активиран",
"channel.encryptKey": "Ключ за криптиране",
@@ -26,6 +44,7 @@
"channel.endpointUrlHint": "Моля, копирайте този URL и го поставете в полето <bold>{{fieldName}}</bold> в {{name}} Developer Portal.",
"channel.feishu.description": "Свържете този асистент с Feishu за лични и групови чатове.",
"channel.lark.description": "Свържете този асистент с Lark за лични и групови чатове.",
"channel.openPlatform": "Отворена платформа",
"channel.platforms": "Платформи",
"channel.publicKey": "Публичен ключ",
"channel.publicKeyHint": "По избор. Използва се за проверка на заявки за взаимодействие от Discord.",
@@ -42,6 +61,16 @@
"channel.secretToken": "Секретен токен на уебхук",
"channel.secretTokenHint": "По избор. Използва се за проверка на заявки за уебхук от Telegram.",
"channel.secretTokenPlaceholder": "По избор секрет за проверка на уебхук",
"channel.settings": "Разширени настройки",
"channel.settingsResetConfirm": "Сигурни ли сте, че искате да върнете разширените настройки към техните стойности по подразбиране?",
"channel.settingsResetDefault": "Връщане към стойности по подразбиране",
"channel.setupGuide": "Ръководство за настройка",
"channel.showUsageStats": "Показване на статистики за използване",
"channel.showUsageStatsHint": "Показване на статистики за използване на токени, разходи и продължителност в отговорите на бота",
"channel.signingSecret": "Тайна за подписване",
"channel.signingSecretHint": "Използва се за проверка на заявки към уебхук.",
"channel.slack.appIdHint": "Вашият Slack App ID от таблото за управление на Slack API (започва с A).",
"channel.slack.description": "Свържете този асистент със Slack за разговори в канали и директни съобщения.",
"channel.telegram.description": "Свържете този асистент с Telegram за лични и групови чатове.",
"channel.testConnection": "Тестване на връзката",
"channel.testFailed": "Тестът на връзката неуспешен",
@@ -50,5 +79,12 @@
"channel.validationError": "Моля, попълнете ID на приложението и токен",
"channel.verificationToken": "Токен за проверка",
"channel.verificationTokenHint": "По избор. Използва се за проверка на източника на събития за уебхук.",
"channel.verificationTokenPlaceholder": "Поставете вашия токен за проверка тук"
"channel.verificationTokenPlaceholder": "Поставете вашия токен за проверка тук",
"channel.wechat.description": "Свържете този асистент с WeChat чрез iLink Bot за лични и групови чатове.",
"channel.wechatQrExpired": "QR кодът е изтекъл. Моля, обновете, за да получите нов.",
"channel.wechatQrRefresh": "Обновяване на QR код",
"channel.wechatQrScaned": "QR кодът е сканиран. Моля, потвърдете влизането в WeChat.",
"channel.wechatQrWait": "Отворете WeChat и сканирайте QR кода, за да се свържете.",
"channel.wechatScanTitle": "Свързване на WeChat бот",
"channel.wechatScanToConnect": "Сканирайте QR кода, за да се свържете"
}
+1 -1
View File
@@ -146,7 +146,7 @@
"heatmaps.months.nov": "Ное",
"heatmaps.months.oct": "Окт",
"heatmaps.months.sep": "Сеп",
"heatmaps.tooltip": "{{date}} са изпратени {{count}} съобщения",
"heatmaps.tooltip": "{{date}} са генерирани {{count}} съобщения",
"heatmaps.totalCount": "Общо {{count}} съобщения, изпратени през последната година",
"login": "Вход",
"loginGuide.f1": "Получете безплатен достъп",

Some files were not shown because too many files have changed in this diff Show More