MBE 开发者文档
版本: 3.0.0 | 更新日期: 2026-02-01
欢迎使用 MBE (Mises Behavior Engine) 开发者文档。本文档帮助您快速集成 MBE API 和使用设计系统。
快速导航
快速入门
1. 获取 API Key
- 访问 MBE 开发者门户
- 注册/登录账号
- 在控制台创建应用
- 获取 API Key
2. 发送第一个请求
curl -X POST https://mbe.hi-maker.com/api/expert/ask \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "什么是合同违约?",
"expert_id": "civil_lawyer"
}'
3. 响应示例
{
"answer": "合同违约是指合同一方或双方不履行或不完全履行合同规定的义务...",
"confidence": 0.92,
"expert_id": "civil_lawyer",
"expert_name": "中国民事律师",
"response_time_ms": 1250
}
API 概览
基础 URL
| 环境 |
URL |
| 生产环境 |
https://mbe.hi-maker.com |
| 开发环境 |
https://dev.hi-maker.com |
| 本地开发 |
http://localhost:8001 |
认证
所有 API 请求需要在 Header 中包含 API Key:
Authorization: Bearer YOUR_API_KEY
主要端点
| 端点 |
方法 |
描述 |
/api/expert/list |
GET |
获取专家列表 |
/api/expert/ask |
POST |
向专家提问 |
/api/expert/{id} |
GET |
获取专家详情 |
/api/knowledge/list |
GET |
获取知识库列表 |
/api/knowledge/search |
POST |
搜索知识库 |
/health |
GET |
健康检查 |
设计系统集成
安装
pnpm add @mbe/design-tokens @mbe/ui @mbe/tailwind-config
配置
// tailwind.config.ts
import mbeConfig from '@mbe/tailwind-config';
export default {
presets: [mbeConfig],
content: [
'./app/**/*.{js,ts,jsx,tsx}',
'./node_modules/@mbe/ui/**/*.{js,ts,jsx,tsx}',
],
};
使用组件
import { GlassCard, Button, Badge } from '@mbe/ui';
export function ExpertCard({ expert }) {
return (
<GlassCard hover glow className="p-6">
<div className="flex justify-between items-center mb-4">
<h3 className="text-lg font-semibold">{expert.name}</h3>
<Badge variant="success">在线</Badge>
</div>
<p className="text-gray-400 mb-4">{expert.description}</p>
<Button variant="primary">开始咨询</Button>
</GlassCard>
);
}
SDK
Python SDK
from mbe import MBEClient
client = MBEClient(api_key="YOUR_API_KEY")
# 获取专家列表
experts = client.experts.list()
# 向专家提问
response = client.experts.ask(
query="什么是合同违约?",
expert_id="civil_lawyer"
)
print(response.answer)
JavaScript/TypeScript SDK
import { MBEClient } from '@mbe/sdk';
const client = new MBEClient({ apiKey: 'YOUR_API_KEY' });
// 获取专家列表
const experts = await client.experts.list();
// 向专家提问
const response = await client.experts.ask({
query: '什么是合同违约?',
expertId: 'civil_lawyer',
});
console.log(response.answer);
错误处理
错误响应格式
{
"error": {
"code": "INVALID_API_KEY",
"message": "API Key 无效或已过期",
"details": {}
}
}
常见错误码
| 错误码 |
HTTP 状态 |
描述 |
INVALID_API_KEY |
401 |
API Key 无效 |
RATE_LIMIT_EXCEEDED |
429 |
超出速率限制 |
EXPERT_NOT_FOUND |
404 |
专家不存在 |
INVALID_REQUEST |
400 |
请求参数错误 |
INTERNAL_ERROR |
500 |
服务器内部错误 |
速率限制
| 套餐 |
请求限制 |
Token 限制 |
| 免费版 |
100次/天 |
10K/天 |
| 个人版 |
1000次/天 |
100K/天 |
| 团队版 |
10000次/天 |
1M/天 |
| 企业版 |
无限制 |
无限制 |
Webhook
配置 Webhook
curl -X POST https://mbe.hi-maker.com/api/webhooks \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"url": "https://your-server.com/webhook",
"events": ["expert.response", "payment.completed"]
}'
事件类型
| 事件 |
描述 |
expert.response |
专家响应完成 |
payment.completed |
支付完成 |
knowledge.updated |
知识库更新 |
本地开发
启动本地环境
# 使用 Docker
.\scripts\deploy_complete_development.ps1
# 或手动启动
docker compose -f docker-compose.complete.yml --env-file .env.development up -d
本地 API 地址
- API:
http://localhost:8001
- API 文档:
http://localhost:8001/docs
相关文档
支持
开发者文档 | MBE v3.0.0 | 2026-02-01