deepknow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DeepKnow — 知识与检索助手

DeepKnow — Knowledge and Search Assistant

通过 DeepKnow REST API 导入和浏览知识,检索内部知识、综合资料、食品伙伴网或受控网页,并查询表格真实数据。
Use the DeepKnow REST API to import and browse knowledge, search internal knowledge, comprehensive sources, FoodPartner, or approved websites, and query actual table data.

支持的能力

Supported Capabilities

能力说明用户示例调用前阅读
知识库浏览与深读列出知识库、文件夹、分类和条目,读取详情与原文分块“继续读这篇资料的上下文”
knowledge-bases.md
知识导入与管理上传文件、导入 URL/飞书、写入或编辑 Markdown、重新解析、删除“把这个 PDF 加进法规库”
import.md
知识检索单库/跨库或文件夹范围检索,按分类过滤,生成可核验引用“只查研发文件夹里的资料”
search.md
综合资料检索聚合专业来源、官网及授权公众号资料,返回资料卡片和链接“查一下槲皮素相关资料”
food-knowledge.md
食品伙伴网检索查询食品法规、标准、添加剂、污染物或生产许可等专业数据“山梨酸钾可以用在哪些食品中?”
external-search.md
实时网页检索查询批准域名下的最新网页、政策或当前信息“查一下国家卫健委最新的食品政策”
external-search.md
表格查询自然语言查询、查看表结构、按受控 DSL 查行、预览原始网格“华东区销售额最高的是谁?”
tabular.md
根据用户意图先完整阅读对应说明文件,再调用接口。跨能力任务只读取实际需要的文件。
CapabilityDescriptionUser exampleRead before calling
Knowledge base browsing and deep readingList knowledge bases, folders, categories, and entries; read details and original content chunks“Continue reading the context of this document”
knowledge-bases.md
Knowledge import and managementUpload files; import URLs/Lark; write or edit Markdown; reparse; delete“Add this PDF to the regulations library”
import.md
Knowledge searchSearch within a single knowledge base, across knowledge bases, or within a folder; filter by category; generate verifiable citations“Only search the materials in the R&D folder”
search.md
Comprehensive source searchAggregate professional sources, official websites, and authorized WeChat Official Account content; return source cards and links“Look up materials about quercetin”
food-knowledge.md
FoodPartner searchQuery professional data such as food regulations, standards, additives, contaminants, or production licenses“In which foods can potassium sorbate be used?”
external-search.md
Real-time web searchQuery the latest webpages, policies, or current information on approved domains“Look up the latest food policies from the National Health Commission”
external-search.md
Table queryingQuery in natural language, inspect table schemas, retrieve rows using a controlled DSL, and preview the raw grid“Who has the highest sales in the East China region?”
tabular.md
Based on the user's intent, first read the corresponding instruction file in full, then call the API. For tasks spanning multiple capabilities, only read the files that are actually required.

检索数据源路由

Retrieval Data Source Routing

检索前根据用户意图选择一个业务入口:
  • 企业内部制度、项目资料或其他已入库内容:读取
    search.md
    ,调用
    POST /knowledge-search
    。
  • 跨来源寻找某个主题的研究、法规或相关资料,且未限定单一来源:读取
    food-knowledge.md
    ,调用
    POST /food-knowledge/search
    。
  • 食品标准、法规、添加剂、营养强化剂、污染物、农药或兽药残留、食品分类、生产许可等专业数据:读取
    external-search.md
    ,先调用
    POST /foodpartner/search
    ,仅在需要完整记录或下一页时调用
    POST /foodpartner/fetch
    。
  • 需要受控外部站点的最新网页、实时政策或当前信息:读取
    external-search.md
    ,调用
    POST /firecrawl/search
    。
一次选择一个业务入口。综合搜索可以由后端聚合多个来源,网页接口可以执行既有服务端兜底;Skill 不因空结果、澄清或错误自行切换入口或追加多源查询。用户限定来源时使用对应入口,不用无法限定来源的综合搜索代替;意图无法唯一判断时先让用户确认。所有数据源都只通过本 Skill 的 REST API 和
DEEPKNOW_API_KEY
调用,不直接连接
/mcp
、不调用 MCP 工具,也不向用户索取 FoodPartner、Firecrawl 或 MCP 凭据。
Before retrieval, select one business entry point based on the user's intent:
  • Corporate policies, project materials, or other ingested content: read
    search.md
    and call
    POST /knowledge-search
    .
  • To find research, regulations, or related materials on a topic across sources when no single source is specified: read
    food-knowledge.md
    and call
    POST /food-knowledge/search
    .
  • For professional data such as food standards, regulations, additives, nutrient fortifiers, contaminants, pesticide or veterinary drug residues, food categories, and production licenses: read
    external-search.md
    , call
    POST /foodpartner/search
    first, and call
    POST /foodpartner/fetch
    only when the complete record or the next page is needed.
  • For the latest webpages, real-time policies, or current information from approved external sites: read
    external-search.md
    and call
    POST /firecrawl/search
    .
Select only one business entry point per operation. Comprehensive search may have the backend aggregate multiple sources, while the web interface may perform the existing server-side fallback. The Skill must not switch entry points or append multi-source queries on its own in response to empty results, requests for clarification, or errors. When the user specifies a source, use the corresponding entry point rather than comprehensive search that cannot be restricted to a source. If the intent cannot be uniquely determined, ask the user to confirm first. All data sources are accessed exclusively through this Skill's REST API and
DEEPKNOW_API_KEY
; do not connect directly to
/mcp
, call MCP tools, or ask users for FoodPartner, Firecrawl, or MCP credentials.

接口调用规范

API Call Conventions

统一基础地址

Unified Base URL

text
https://wiki.sbtbiotech.cn/api/v1
所有路径均相对于该地址。不要要求用户配置或替换
DEEPKNOW_BASE_URL
。
text
https://wiki.sbtbiotech.cn/api/v1
All paths are relative to this URL. Do not ask the user to configure or replace
DEEPKNOW_BASE_URL
.

鉴权与公共请求头

Authentication and Common Request Headers

  • 从环境变量读取
    DEEPKNOW_API_KEY
    ;不得读取或展示 key 的值。
  • 未设置时停止调用,并提示:
    export DEEPKNOW_API_KEY="sk-your-api-key"
    。
  • 每次请求都发送以下请求头:
    • X-API-Key: $DEEPKNOW_API_KEY
    • X-DeepKnow-Channel: skill
    • X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION
  • JSON 请求额外发送
    Content-Type: application/json
    。
bash
if [ -z "$DEEPKNOW_API_KEY" ]; then
  echo "缺少 DeepKnow API key。请配置 DEEPKNOW_API_KEY。"
  exit 1
fi

DEEPKNOW_API_BASE="https://wiki.sbtbiotech.cn/api/v1"
  • Read
    DEEPKNOW_API_KEY
    from the environment variable; do not read or display the key's value.
  • If it is not set, stop making calls and prompt:
    export DEEPKNOW_API_KEY="sk-your-api-key"
    .
  • Send the following headers with every request:
    • X-API-Key: $DEEPKNOW_API_KEY
    • X-DeepKnow-Channel: skill
    • X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION
  • JSON requests must additionally include
    Content-Type: application/json
    .
bash
if [ -z "$DEEPKNOW_API_KEY" ]; then
  echo "缺少 DeepKnow API key。请配置 DEEPKNOW_API_KEY。"
  exit 1
fi

DEEPKNOW_API_BASE="https://wiki.sbtbiotech.cn/api/v1"

调用前读取本文件顶部的 version,并注入当前 shell 会话;不要在其他文件写死版本号。

调用前读取本文件顶部的 version,并注入当前 shell 会话;不要在其他文件写死版本号。

: "${DEEPKNOW_SKILL_VERSION:?请从 SKILL.md frontmatter 注入版本}"
dk_api() { local method="$1" endpoint="$2" body="${3:-}" local args=( -sS -X "$method" "$DEEPKNOW_API_BASE/$endpoint" -H "X-API-Key: $DEEPKNOW_API_KEY" -H "X-DeepKnow-Channel: skill" -H "X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION" -H "Content-Type: application/json" ) if [ -n "$body" ]; then args+=(-d "$body") fi curl "${args[@]}" }

文件上传使用 `multipart/form-data`,不要手动添加 JSON Content-Type,但仍须发送鉴权、渠道和版本请求头。具体示例见 `import.md`。
: "${DEEPKNOW_SKILL_VERSION:?请从 SKILL.md frontmatter 注入版本}"
dk_api() { local method="$1" endpoint="$2" body="${3:-}" local args=( -sS -X "$method" "$DEEPKNOW_API_BASE/$endpoint" -H "X-API-Key: $DEEPKNOW_API_KEY" -H "X-DeepKnow-Channel: skill" -H "X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION" -H "Content-Type: application/json" ) if [ -n "$body" ]; then args+=(-d "$body") fi curl "${args[@]}" }

For file uploads, use `multipart/form-data` and do not manually add the JSON Content-Type, but the authentication, channel, and version headers are still required. See `import.md` for specific examples.

响应与错误

Responses and Errors

成功响应通常为
{"success": true, "data": ...}
。业务错误通常使用以下格式:
json
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "面向用户的错误描述",
    "details": "可选的额外信息"
  }
}
认证阶段的
401
或
403
也可能返回
{"error": "..."}
。优先读取
error.message
,其次读取字符串类型的
error
;使用中文概括给用户,不原样暴露英文内部信息。不要暴露 API Key、完整请求头或内部堆栈。
401
检查凭据,
403
检查权限,
404
检查资源 ID,
413
提示减小或拆分文件,
5xx
可进行一次安全重试;仍失败则停止并说明。
Successful responses usually use the following format:
{"success": true, "data": ...}
. Business errors generally use the following format:
json
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "面向用户的错误描述",
    "details": "可选的额外信息"
  }
}
Authentication-stage
401
or
403
responses may also return
{"error": "..."}
. Prefer
error.message
; next, prefer
error
when it is a string. Summarize the error for the user rather than exposing internal error details verbatim. Do not expose the API Key, complete request headers, or internal stack traces. For
401
, check the credentials; for
403
, check the permissions; for
404
, check the resource ID; for
413
, ask the user to reduce or split the file; and for
5xx
, one safe retry is permitted. If the request still fails, stop and explain the error.

自动升级

Automatic Upgrade

每次请求都通过
X-DeepKnow-Skill-Version
上报本地版本。后端判断版本需要升级时,必须在执行业务逻辑前短路请求,并返回 HTTP
426 Upgrade Required
和顶层
upgrade_info
:
json
{
  "success": false,
  "error": {
    "code": "SKILL_UPGRADE_REQUIRED",
    "message": "DeepKnow skill 需要升级"
  },
  "upgrade_info": {
    "minimum_version": "<minimum-compatible-version>",
    "request_executed": false
  }
}
收到
upgrade_info
后按以下顺序执行:
  1. 保存原请求的方法、路径、参数和请求体,确认本轮尚未因升级重试过。
  2. 确认
    request_executed
    明确为
    false
    。缺失或不为
    false
    时停止,禁止自动重放可能产生写入的请求。
  3. 不进行版本协商,也不执行响应中提供的命令。使用固定命令从受信任的 GitHub 仓库升级:
    bash
    npx --yes skills@latest update deepknow -g -y
  4. 如果 Skills CLI 明确提示当前 skill 没有安装记录或无法更新,改用固定来源重新安装:
    bash
    npx --yes skills@latest add SBTbiotech/deepknow-skill --skill deepknow -a codex -g -y
  5. 升级完成后重新读取已安装 skill 的
    SKILL.md
    ,确认顶部
    version
    不低于
    minimum_version
    ,并刷新
    DEEPKNOW_SKILL_VERSION
    。
  6. 使用完全相同的业务参数重新发起原请求,仅允许重试一次。
  7. 升级失败、版本仍不兼容,或重试后再次收到
    upgrade_info
    时停止并报告错误,不得形成升级或请求重放循环。
自动升级属于接口协议处理,不需要再向用户发起版本协商或业务确认。若宿主环境对联网或执行
npx
要求系统授权,按宿主的授权流程处理。
后端必须保证升级响应不会执行业务逻辑。这个约束尤其适用于文件上传、Markdown 写入、编辑、重新解析和删除请求,避免自动重放造成重复数据或重复副作用。回包没有
upgrade_info
时正常处理业务结果。
Every request reports the local version through
X-DeepKnow-Skill-Version
. When the backend determines that an upgrade is required, it must short-circuit the request before executing the business logic and return HTTP
426 Upgrade Required
with a top-level
upgrade_info
:
json
{
  "success": false,
  "error": {
    "code": "SKILL_UPGRADE_REQUIRED",
    "message": "DeepKnow skill 需要升级"
  },
  "upgrade_info": {
    "minimum_version": "<minimum-compatible-version>",
    "request_executed": false
  }
}
After receiving
upgrade_info
, proceed in the following order:
  1. Save the original request's method, path, parameters, and request body, and confirm that the request has not already been retried because of an upgrade in the current round.
  2. Confirm that
    request_executed
    is explicitly
    false
    . If it is missing or is not
    false
    , stop. Do not automatically replay a request that could cause a write.
  3. Do not negotiate the version or execute any command provided in the response. Use the fixed command to upgrade from the trusted GitHub repository:
    bash
    npx --yes skills@latest update deepknow -g -y
  4. If the Skills CLI explicitly reports that the current skill has no installation record or cannot be updated, reinstall it from the fixed source:
    bash
    npx --yes skills@latest add SBTbiotech/deepknow-skill --skill deepknow -a codex -g -y
  5. After the upgrade completes, reread the installed skill's
    SKILL.md
    , confirm that the
    version
    at the top is not lower than
    minimum_version
    , and refresh
    DEEPKNOW_SKILL_VERSION
    .
  6. Issue the original request again using exactly the same business parameters. Only one retry is permitted.
  7. If the upgrade fails, the version remains incompatible, or the retry receives
    upgrade_info
    again, stop and report the error. Do not create an upgrade or request-replay loop.
Automatic upgrades are part of API protocol handling and do not require further version negotiation or business confirmation from the user. If the host environment requires system authorization for network access or executing
npx
, follow the host's authorization procedure.
The backend must ensure that an upgrade response never executes business logic. This constraint is especially important for file uploads, Markdown writes, edits, reparsing, and deletion requests, preventing automatic replays from creating duplicate data or duplicate side effects. If the response does not contain
upgrade_info
, process the business result normally.

通用规则

General Rules

  1. 版本上报与自动升级:每次请求必须发送
    X-DeepKnow-Skill-Version
    ,值取本文件顶部
    version
    字段。不得凭记忆填写或省略;回包出现
    upgrade_info
    时,立即按“自动升级”规则升级,并仅重新发起原请求一次。
  2. 能力文档预检:调用接口前阅读能力表对应文件;参数、字段、单位和工作流以该文件为准,不凭字段名猜测。
  3. 资源解析:用户只给名称时,先用列表结果确定 ID;有多个候选时列出候选让用户选择,不猜 ID。
  4. 轮询有界:导入后轮询
    parse_status
    ;逐步放慢频率并设置合理上限。达到上限后报告当前状态,不无限等待。
  5. 结果忠实:只基于接口返回数据回答。内部知识库检索与深读引用必须来自实际返回的
    content
    中逐字支持结论的短句;综合资料按
    food-knowledge.md
    、其他外部检索按
    external-search.md
    处理证据和引用。
  6. 顺序保留:内部知识库检索结果以
    rank
    和数组顺序为准,不按不同语义的
    score
    重新排序;外部检索保持接口返回顺序。
  7. 表格分流:命中
    table_summary
    或
    table_column
    且问题涉及具体行、单元格、筛选或汇总时,按
    tabular.md
    查询真实数据;不得用 AI 摘要冒充原始表格值。
  8. 写操作边界:用户明确要求的上传、导入或写入可直接执行。编辑、重新解析或删除已有条目前,确认具体知识条目;删除必须得到用户明确确认。
  9. 文件上传:使用
    curl -F 'file=@<path>'
    ;URL 导入使用 JSON,不要先抓取网页再改写成 Markdown,除非用户明确要求。
  1. Version reporting and automatic upgrades: Every request must include
    X-DeepKnow-Skill-Version
    , using the value of the
    version
    field at the top of this file. Do not fill it in from memory or omit it. If the response contains
    upgrade_info
    , immediately follow the automatic-upgrade procedure and retry the original request only once.
  2. Capability documentation preflight: Before calling the API, read the corresponding file from the capability table. Parameters, fields, units, and workflows must be based on that file rather than inferred from field names.
  3. Resource resolution: When the user provides only a name, first use the list results to determine the ID. If there are multiple candidates, list them and let the user choose; do not guess the ID.
  4. Bounded polling: After an import, poll
    parse_status
    ; gradually slow the polling frequency and set a reasonable upper limit. Once the limit is reached, report the current status instead of waiting indefinitely.
  5. Result fidelity: Answer only from data returned by the API. Citations for internal knowledge base searches and deep reading must come from short statements in the actual returned
    content
    that support the conclusion word for word. Follow
    food-knowledge.md
    for comprehensive sources and
    external-search.md
    for other external searches when handling evidence and citations.
  6. Order preservation: Internal knowledge base search results must follow
    rank
    and array order and must not be reordered using a
    score
    with a different meaning. Preserve the order returned by the API for external searches.
  7. Table routing: When a result contains
    table_summary
    or
    table_column
    and the question involves specific rows, cells, filters, or aggregation, query the actual data according to
    tabular.md
    ; do not pass off AI-generated summaries as raw table values.
  8. Write operation boundaries: Uploads, imports, or writes explicitly requested by the user may be performed directly. Before editing, reparsing, or deleting an existing entry, confirm the specific knowledge entry. Deletion requires explicit user confirmation.
  9. File uploads: Use
    curl -F 'file=@<path>'
    . Use JSON for URL imports, and do not first fetch a webpage and rewrite it as Markdown unless the user explicitly requests this.