所有操作都抽象为"意图",通过单一的 /api/v1/beg 接口处理所有需求。
POST /api/v1/beg
{
"user_intent": "用户的自然语言意图描述",
"intent_type": "意图类型/模块",
"action": "操作类型",
"data": { "业务数据" },
"filters": { "查询筛选" },
"budget": "预算(可选)",
"platform": "分发平台(可选)"
}goods- 丐物(商品需求)codes- 丐码(数字资产)knowledge- 丐知(知识悬赏)companions- 丐伴(AI伴侣)prompts- 丐咒(Prompt市场)console- 丐帮(控制台)copy- 纯文案生成(默认)
list- 查询列表get- 获取详情create- 创建update- 更新delete- 删除join- 加入(goods专用)rent- 租用(codes专用)claim- 认领(knowledge专用)solve- 解决(knowledge专用)purchase- 购买(prompts专用)generate- 生成文案(copy专用,默认)
curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想买个便宜的iPhone",
"intent_type": "copy",
"action": "generate",
"budget": "2000元"
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想查看所有商品需求",
"intent_type": "goods",
"action": "list",
"filters": {"status": "GATHERING"}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想发起一个iPhone团购需求",
"intent_type": "goods",
"action": "create",
"data": {
"item_name": "iPhone 15 Pro",
"market_price": 7999,
"target_price": 6500,
"target_users": 1000
}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我要加入这个需求",
"intent_type": "goods",
"action": "join",
"data": {"id": 1}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想看看有什么数字资产可以租",
"intent_type": "codes",
"action": "list"
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我要租用Netflix账号",
"intent_type": "codes",
"action": "rent",
"data": {"id": 1}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想看看有什么悬赏可以接",
"intent_type": "knowledge",
"action": "list",
"filters": {"search": "Rust"}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想发布一个技术问题悬赏",
"intent_type": "knowledge",
"action": "create",
"data": {
"title": "如何在 Rust 中优化 WebAssembly?",
"description": "处理大文件时内存占用过高",
"reward_amount": 200.0
}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想找一些Midjourney的Prompt",
"intent_type": "prompts",
"action": "list",
"filters": {"search": "Midjourney"}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我要购买这个Prompt",
"intent_type": "prompts",
"action": "purchase",
"data": {"id": 1}
}'curl -X POST http://127.0.0.1:8001/api/v1/beg \
-H "Content-Type: application/json" \
-d '{
"user_intent": "我想查看系统统计",
"intent_type": "console",
"action": "stats"
}'{
"success": true,
"intent_type": "goods",
"action": "list",
"data": [ ... ],
"copy": { ... }, // 仅当 intent_type="copy" 时存在
"error": null,
"message": "找到 10 个需求",
"timestamp": "2026-01-27T16:30:00"
}- 统一接口 - 所有操作都通过一个接口
- 意图驱动 - 自然语言描述 + 结构化参数
- 易于扩展 - 新增模块只需添加路由处理器
- 类型安全 - 使用 Pydantic 进行数据验证
- 灵活查询 - 支持筛选和搜索
- 当前使用内存存储,重启后数据会丢失(生产环境应使用数据库)
user_intent字段主要用于日志和AI处理,业务逻辑主要依赖intent_type和action- 所有操作都是异步的,支持高并发