From 932dd36abf4129da6cf1005393bfd9a6a70179d6 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Mon, 23 Mar 2026 21:23:53 +0800 Subject: [PATCH] docs(plugin): restore list_pipeline_knowledge_bases in Request API section (zh/en/ja) --- en/plugin/dev/apis/common.mdx | 23 +++++++++++++++++++++++ ja/plugin/dev/apis/common.mdx | 23 +++++++++++++++++++++++ zh/plugin/dev/apis/common.mdx | 23 +++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/en/plugin/dev/apis/common.mdx b/en/plugin/dev/apis/common.mdx index a3df17cdd..2a04140c8 100644 --- a/en/plugin/dev/apis/common.mdx +++ b/en/plugin/dev/apis/common.mdx @@ -82,6 +82,29 @@ async def get_query_vars(self) -> dict[str, Any]: query_vars = await event_context.get_query_vars() ``` +### List Pipeline Knowledge Bases + +Get the list of knowledge bases configured for the pipeline used by the current request. + +```python +async def list_pipeline_knowledge_bases(self) -> list[dict[str, Any]]: + """List knowledge bases configured for the current pipeline""" + +# Usage example +knowledge_bases = await event_context.list_pipeline_knowledge_bases() + +# Return example +[ + { + "uuid": "kb_uuid", + "name": "Product Docs", + "description": "Internal product documentation", + } +] +``` + +Only returns knowledge bases bound in the `Local Agent` configuration of the pipeline corresponding to the current request. If the current pipeline has no knowledge bases configured, or does not use `Local Agent`, an empty list is returned. + ## LangBot API These APIs can be called in any plugin component. Access methods: diff --git a/ja/plugin/dev/apis/common.mdx b/ja/plugin/dev/apis/common.mdx index af01ddd75..499b1a0e8 100644 --- a/ja/plugin/dev/apis/common.mdx +++ b/ja/plugin/dev/apis/common.mdx @@ -82,6 +82,29 @@ async def get_query_vars(self) -> dict[str, Any]: query_vars = await event_context.get_query_vars() ``` +### 現在のパイプラインに設定されたナレッジベース一覧の取得 + +現在のリクエストが使用するパイプラインに設定されたナレッジベースの一覧を取得します。 + +```python +async def list_pipeline_knowledge_bases(self) -> list[dict[str, Any]]: + """List knowledge bases configured for the current pipeline""" + +# 使用例 +knowledge_bases = await event_context.list_pipeline_knowledge_bases() + +# 返り値の例 +[ + { + "uuid": "kb_uuid", + "name": "Product Docs", + "description": "社内製品ドキュメント", + } +] +``` + +現在のリクエストに対応するパイプラインの `Local Agent` 設定にバインドされたナレッジベースのみを返します。現在のパイプラインにナレッジベースが設定されていない場合、または `Local Agent` を使用していない場合は、空のリストが返されます。 + ## LangBot API これらのAPIは、任意のプラグインコンポーネントで呼び出すことができます。アクセス方法: diff --git a/zh/plugin/dev/apis/common.mdx b/zh/plugin/dev/apis/common.mdx index d21f7d905..6dfdd1489 100644 --- a/zh/plugin/dev/apis/common.mdx +++ b/zh/plugin/dev/apis/common.mdx @@ -82,6 +82,29 @@ async def get_query_vars(self) -> dict[str, Any]: query_vars = await event_context.get_query_vars() ``` +### 获取当前流水线配置的知识库列表 + +获取当前请求所使用流水线中配置的知识库列表。 + +```python +async def list_pipeline_knowledge_bases(self) -> list[dict[str, Any]]: + """List knowledge bases configured for the current pipeline""" + +# 调用示例 +knowledge_bases = await event_context.list_pipeline_knowledge_bases() + +# 返回示例 +[ + { + "uuid": "kb_uuid", + "name": "Product Docs", + "description": "内部产品文档", + } +] +``` + +仅返回当前请求对应流水线在 `Local Agent` 配置中绑定的知识库。若当前流水线未配置知识库,或未使用 `Local Agent`,则返回空列表。 + ## LangBot API 这些 API 可在插件任何组件中调用。访问方式如下: