Enterprise AI Workspace prototype: LobeChat (de-branded) + Enterprise Gateway + Postgres/Redis stack
Revalidate Docs / Revalidate Docs (push) Failing after 2s
E2E CI / Check Duplicate Run (push) Failing after 5s
Test CI / Check Duplicate Run (push) Failing after 6s
E2E CI / Test Web App (push) Has been skipped
Test CI / Test Packages (push) Has been skipped
Test CI / Test App (shard 1/3) (push) Has been skipped
Test CI / Test App (shard 2/3) (push) Has been skipped
Test CI / Test App (shard 3/3) (push) Has been skipped
Test CI / Test Desktop App (push) Has been skipped
🔄 Branch Synchronization / sync-branches (push) Failing after 11s
Test CI / Test Database (push) Has been skipped
Test CI / Merge and Upload App Coverage (push) Has been skipped
Database Schema Visualization CI / build (push) Failing after 4m14s
Revalidate Docs / Revalidate Docs (push) Failing after 2s
E2E CI / Check Duplicate Run (push) Failing after 5s
Test CI / Check Duplicate Run (push) Failing after 6s
E2E CI / Test Web App (push) Has been skipped
Test CI / Test Packages (push) Has been skipped
Test CI / Test App (shard 1/3) (push) Has been skipped
Test CI / Test App (shard 2/3) (push) Has been skipped
Test CI / Test App (shard 3/3) (push) Has been skipped
Test CI / Test Desktop App (push) Has been skipped
🔄 Branch Synchronization / sync-branches (push) Failing after 11s
Test CI / Test Database (push) Has been skipped
Test CI / Merge and Upload App Coverage (push) Has been skipped
Database Schema Visualization CI / build (push) Failing after 4m14s
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Enterprise Gateway — LobeChat Plugin Manifest
|
||||
|
||||
This directory holds **two** flavours of a [LobeChat plugin manifest](https://lobehub.com/docs/usage/plugins/development):
|
||||
|
||||
1. **Static** `manifest.json` — a hard-coded four-tool view. Good as a fallback / first
|
||||
look, but does **not** reflect the caller's real gateway capabilities.
|
||||
2. **Dynamic** (recommended) — served by the gateway at
|
||||
`GET http://gateway:3001/api/lobechat/manifest`. The `api[]` list is computed
|
||||
from `/api/capabilities` for the caller (identity via `X-Dev-User` or future
|
||||
Casdoor session), so different users see different tools.
|
||||
|
||||
Both flavours funnel tool calls to
|
||||
`POST http://gateway:3001/api/lobechat/tool-gateway` which preserves the gateway's
|
||||
RBAC / identity-map / data-scope / field-masking / audit pipeline.
|
||||
|
||||
## Dynamic manifest details
|
||||
|
||||
- `api[i].name` uses `__` as the separator because LobeChat's plugin spec rejects
|
||||
dots in `name` (e.g. `kb__search`, `gongdan__search_tickets`). The gateway
|
||||
translates this back to its real tool key.
|
||||
- Calls go to `POST /api/lobechat/tool-gateway` with body
|
||||
`{"name":"kb__search","arguments":{...}}` (OpenAI-plugin shape) or the simpler
|
||||
`{"tool":"kb.search","params":{...}}`. Both are accepted.
|
||||
- A 403 response means the caller is not authorized for that tool; agents should
|
||||
not retry.
|
||||
|
||||
## What it exposes
|
||||
|
||||
All four entries call `POST http://gateway:3001/api/tools/call` with a `{ tool, params }` body:
|
||||
|
||||
| Manifest `name` | Gateway `tool` key |
|
||||
| -------------------------- | ------------------------------- |
|
||||
| `kb_search` | `kb.search` |
|
||||
| `ai_search_web` | `ai_search.web` |
|
||||
| `gongdan_create_ticket` | `gongdan.create_ticket` |
|
||||
| `xiaoshou_search_customers`| `xiaoshou.search_customers` |
|
||||
|
||||
> This is a minimum-viable bridge. The Gateway enforces RBAC, identity-map, data-scope, and field-masking — this manifest does *not* relax any of that. A real plugin build will also need to translate the manifest `name` → gateway `tool` key, inject the caller's identity header (`X-Dev-User` in dev, Casdoor JWT in prod), and stream results back to LobeChat's tool-call channel. Today the gateway URL is reachable only from inside the compose network.
|
||||
|
||||
## How to register it in LobeChat
|
||||
|
||||
1. Start the stack: `docker compose up -d`.
|
||||
2. Open http://localhost:3010 and sign in.
|
||||
3. Settings → Plugins → Custom Plugin → Install from URL.
|
||||
4. Paste one of:
|
||||
- **Dynamic (recommended)**: `http://gateway:3001/api/lobechat/manifest`
|
||||
— served per-user, so the tool list always matches the caller's real
|
||||
grants. LobeChat must send `X-Dev-User: <username>` on the manifest
|
||||
fetch (configure via the plugin's custom-headers field) or be behind a
|
||||
gateway-side proxy that injects the Casdoor identity.
|
||||
- **Static**: paste the contents of `manifest.json`.
|
||||
5. Enable the plugin for an agent.
|
||||
|
||||
### Server-mode auto-registration
|
||||
|
||||
LobeChat's server-mode stores installed plugins in its own DB. We do **not**
|
||||
seed a row there from this repo because the LobeChat server-mode schema is
|
||||
owned by the `lobehub/lobe-chat-database` image (we pull it as a released
|
||||
container and do not control its migrations). Registration is manual (step 4
|
||||
above). If/when we self-host the LobeChat server image we can add a seed
|
||||
migration that pre-registers `http://gateway:3001/api/lobechat/manifest` for
|
||||
all users.
|
||||
|
||||
## Known limitations
|
||||
|
||||
- No auth header is injected yet — the gateway is running in `AUTH_MODE=dev`, so calls without `X-Dev-User` get 401. Replace this with a server-side proxy that adds the authenticated user's identity before forwarding.
|
||||
- Only 4 tools out of the full gateway catalog (`/api/capabilities`) are mirrored here. Extend `manifest.json` as needed.
|
||||
- The `url` uses the internal Docker hostname `gateway`. If LobeChat fetches the plugin from outside the compose network, change it to `http://localhost:3001` and adjust CORS (`GATEWAY_CORS_ORIGINS`).
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"$schema": "https://chat-plugins.lobehub.com/schema/plugin.json",
|
||||
"api": [
|
||||
{
|
||||
"url": "http://gateway:3001/api/tools/call",
|
||||
"name": "kb_search",
|
||||
"description": "Search the enterprise knowledge base. Returns ranked document snippets scoped by the caller's data-scope and masked per role.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"required": ["query"],
|
||||
"properties": {
|
||||
"query": { "type": "string", "description": "Natural-language query" },
|
||||
"top_k": { "type": "integer", "default": 5 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"url": "http://gateway:3001/api/tools/call",
|
||||
"name": "ai_search_web",
|
||||
"description": "Perform an external web search through the enterprise AI search adapter.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"required": ["query"],
|
||||
"properties": {
|
||||
"query": { "type": "string" },
|
||||
"num": { "type": "integer", "default": 10 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"url": "http://gateway:3001/api/tools/call",
|
||||
"name": "gongdan_create_ticket",
|
||||
"description": "Create a support/工单 ticket on behalf of the caller. Subject to role and identity-map enforcement.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"required": ["title", "description"],
|
||||
"properties": {
|
||||
"title": { "type": "string" },
|
||||
"description": { "type": "string" },
|
||||
"priority": { "type": "string", "enum": ["low", "normal", "high", "urgent"] },
|
||||
"customer_id": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"url": "http://gateway:3001/api/tools/call",
|
||||
"name": "xiaoshou_search_customers",
|
||||
"description": "Search sales (xiaoshou) customer records. Results are filtered to the caller's data scope (e.g. internal_sales sees only their own accounts).",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"keyword": { "type": "string" },
|
||||
"limit": { "type": "integer", "default": 20 }
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"identifier": "enterprise-gateway",
|
||||
"meta": {
|
||||
"avatar": "🏢",
|
||||
"tags": ["enterprise", "gateway", "tickets", "knowledge-base", "crm"],
|
||||
"title": "Enterprise Gateway",
|
||||
"description": "Bridge to the internal Enterprise Gateway. Exposes permission-enforced, data-scoped, field-masked tools for the knowledge base, AI search, ticketing (工单), and sales CRM."
|
||||
},
|
||||
"version": "1",
|
||||
"systemRole": "Before calling any enterprise-gateway tool, prefer kb_search for internal knowledge questions and gongdan_create_ticket for reporting user-facing problems. These calls go through a permission gateway that will return 403 if the user is not authorized."
|
||||
}
|
||||
Reference in New Issue
Block a user