Skip to content

快速开始

三步接入知识库。

1. 申请 API Key

向知识库服务方申请(每产品一个独立 Key),格式 atlas_live_<hex>。 服务方签发后明文只展示一次,库中只存哈希,可随时撤销。

bash
# 服务方操作(内容系统侧)
npx tsx apps/atlas-runtime/src/admin.ts create --product voice --plan free
# → 打印 id / 明文 Key(仅此一次)/ sha256

2. 验证连通

bash
# 健康检查(公开,无需 Key)
curl https://atlas.halfwaylab.cn/api/atlas/v1/ready

# 第一个查询(带 Key)
curl -X POST https://atlas.halfwaylab.cn/api/atlas/v1/search \
  -H "Authorization: Bearer <API_KEY>" -H "Content-Type: application/json" \
  -d '{"q":"安藤忠雄","limit":3}'

3. 用 SDK 调起来

bash
npm install @halfway/atlas-sdk
ts
import { createAtlasClient } from "@halfway/atlas-sdk";

const atlas = createAtlasClient({
  baseUrl: "https://atlas.halfwaylab.cn",
  apiKey: "atlas_live_...",
});

const hits = await atlas.search({ q: "清水混凝土", scope: ["work"], limit: 5 });
console.log(hits.hits.map((h) => h.displayName));

开发环境把 baseUrl 换成 http://localhost:4150;未开启鉴权时可省略 apiKey

设计图谱知识库 · Halfway Lab