开发者文档 SDK

知识库

检索并体检项目的 OKF 知识库——概念、断链、孤儿与重复一目了然。

Python

hits = okf.search("refund policy")
for h in hits:
    print(h["title"], "-", h.get("description", ""))

issues = okf.lint()
# 两者都接受 workspace_id=<知识库工作区 UUID> 以指定具体知识库

TypeScript

import { AllyBuildClient, OkfApi, ALLYBUILD_API_URL, TASK_JWT, PROJECT_ID } from "@allybuild/sdk";

const client = new AllyBuildClient(ALLYBUILD_API_URL, TASK_JWT, PROJECT_ID);
const okf = new OkfApi(client);

const hits = await okf.search("refund policy");
const issues = await okf.lint();

// 两个方法都接受可选的知识库工作区:search(query, workspaceId) / lint(workspaceId)