OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  local-places:通过 Google Places API 搜索当地餐馆、咖啡馆等地点

local-places:通过 Google Places API 搜索当地餐馆、咖啡馆等地点

 
  sharding ·  2026-02-20 12:31:46 · 3 次点击  · 0 条评论  

名称: local-places
描述: 通过本地 Google Places API 代理搜索地点(餐厅、咖啡馆等)。
主页: https://github.com/Hyaxia/local_places
元数据: {"clawdbot":{"emoji":"📍","requires":{"bins":["uv"],"env":["GOOGLE_PLACES_API_KEY"]},"primaryEnv":"GOOGLE_PLACES_API_KEY"}}


📍 Local Places

快速发现周边地点

通过本地 Google Places API 代理搜索附近地点。采用两步流程:先解析位置,再进行搜索。

环境设置

cd {baseDir}
echo "GOOGLE_PLACES_API_KEY=your-key" > .env
uv venv && uv pip install -e ".[dev]"
uv run --env-file .env uvicorn local_places.main:app --host 127.0.0.1 --port 8000

需要在 .env 文件或环境变量中设置 GOOGLE_PLACES_API_KEY

快速开始

  1. 检查服务状态: curl http://127.0.0.1:8000/ping

  2. 解析位置:

curl -X POST http://127.0.0.1:8000/locations/resolve \
  -H "Content-Type: application/json" \
  -d '{"location_text": "Soho, London", "limit": 5}'
  1. 搜索地点:
curl -X POST http://127.0.0.1:8000/places/search \
  -H "Content-Type: application/json" \
  -d '{
    "query": "coffee shop",
    "location_bias": {"lat": 51.5137, "lng": -0.1366, "radius_m": 1000},
    "filters": {"open_now": true, "min_rating": 4.0},
    "limit": 10
  }'
  1. 获取详情:
curl http://127.0.0.1:8000/places/{place_id}

对话流程

  1. 如果用户提到“附近”或给出模糊位置 → 先解析位置。
  2. 如果解析出多个结果 → 显示编号列表,请用户选择。
  3. 询问偏好:类型、是否营业中、评分、价格水平。
  4. 使用选定位置的 location_bias 进行搜索。
  5. 展示结果,包含名称、评分、地址、营业状态。
  6. 提供获取详情或优化搜索的选项。

筛选条件约束

  • filters.types必须且只能指定一个类型(例如 "restaurant"、"cafe"、"gym")。
  • filters.price_levels:整数 0-4(0=免费,4=非常昂贵)。
  • filters.min_rating:0-5,以 0.5 为增量。
  • filters.open_now:布尔值。
  • limit:搜索时为 1-20,解析位置时为 1-10。
  • location_bias.radius_m:必须大于 0。

响应格式

{
  "results": [
    {
      "place_id": "ChIJ...",
      "name": "Coffee Shop",
      "address": "123 Main St",
      "location": {"lat": 51.5, "lng": -0.1},
      "rating": 4.6,
      "price_level": 2,
      "types": ["cafe", "food"],
      "open_now": true
    }
  ],
  "next_page_token": "..."
}

如需获取更多结果,可在下一次请求中将 next_page_token 作为 page_token 参数传入。

3 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor