Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

dify-knowledge-base-upload修改知识库上传

Agent Skill

用于搭建或维护带检索增强的 RAG 工作流,适合让 Agent 处理知识库问答、向量检索、来源引用和事实核查。它可以辅助整理数据接入、Embedding、向量库、召回参数和回答生成流程。使用时需要确认数据来源、更新频率、召回阈值和引用展示方式,避免把未命中的资料或过期内容包装成确定事实。

总安装

499

周安装

20

GitHub Stars

6

下载量

162
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dify-knowledge-base-upload(修改知识库上传)
来源仓库:https://github.com/tiangong-ai/skills
仓库路径:skills/dify-knowledge-base-upload
安装命令:
npx skills add https://github.com/tiangong-ai/skills --skill dify-knowledge-base-upload
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/tiangong-ai/skills --skill dify-knowledge-base-upload

简介

dify-knowledge-base-upload 解决 UI 上传成功但实际未创建 chunk 的问题。

  • 支持本地文件上传与元数据二次编辑,适配某些发布式数据源的接入限制。
  • 纯文本建议保存为 .txt 或 .md 格式后上传,便于后续分块处理与索引构建。
  • 需正确设置 DIFY_* 系列环境变量,并确保目标数据集处于可写状态。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Dify Knowledge Base Upload

Use this skill when

  • The target Dify knowledge base is backed by a published pipeline datasource.
  • UI uploads succeed but document/create-by-file or create-by-text yields completed with 0 chunks.
  • You need to upload one local file and optionally write existing metadata fields afterward.

Prepare caller-side inputs

  • Provide a local file path to upload.
  • For pure text, save it as .txt or .md first and upload that file.
  • Set caller env values:

- DIFY_API_BASE_URL - DIFY_DATASET_ID - DIFY_API_KEY

  • Optionally provide pipeline inputs JSON if the published pipeline exposes user input variables.
  • Optionally provide metadata JSON:

- a flat object mapping existing Dify metadata field names to values, or - a list of {"name":..., "value":...} / {"id":..., "value":...} items. - The skill does not hardcode your metadata schema. Pass the current field names or ids in the JSON you provide at runtime.

  • Read references/env.md only if you need env or debug details.

Run workflow

  • Use scripts/upload_to_dataset.py to:

- discover the published datasource plugin from ${DIFY_API_BASE_URL}/datasets/${DIFY_DATASET_ID}/pipeline/datasource-plugins?is_published=true - upload the file to ${DIFY_API_BASE_URL}/datasets/pipeline/file-upload - run the published pipeline through ${DIFY_API_BASE_URL}/datasets/${DIFY_DATASET_ID}/pipeline/run - poll ${DIFY_API_BASE_URL}/datasets/${DIFY_DATASET_ID}/documents/{batch}/indexing-status - fetch ${DIFY_API_BASE_URL}/datasets/${DIFY_DATASET_ID}/documents/{document_id}?metadata=without - optionally resolve metadata field names through ${DIFY_API_BASE_URL}/datasets/${DIFY_DATASET_ID}/metadata - optionally update metadata through ${DIFY_API_BASE_URL}/datasets/${DIFY_DATASET_ID}/documents/metadata

  • Upload without metadata:
python3 scripts/upload_to_dataset.py \
  --file /path/to/document.pdf
  • Upload with pipeline inputs:
python3 scripts/upload_to_dataset.py \
  --file /path/to/document.pdf \
  --inputs-json assets/example-pipeline-inputs.json
  • Upload and then apply metadata:
python3 scripts/upload_to_dataset.py \
  --file /path/to/document.pdf \
  --metadata-json assets/example-metadata.json

Interpret response

  • Success prints JSON with batch, document_id, file_upload_response, pipeline_run_response, indexing_status_response, document_response, optional metadata_response, and validation.
  • validation.ok is only true when:

- indexing_status = "completed" - total_segments > 0 - segment_count > 0

  • If tokens is returned by the document detail API, it should also be greater than 0. Some pipeline deployments leave tokens = null; the script reports that as a warning instead of a hard failure.
  • The script exits non-zero if the required checks fail.
  • If --metadata-json is omitted, the script uploads the file only and skips metadata API calls.
  • Metadata keys must already exist in the target dataset. Unknown names fail fast before the metadata write request.
  • assets/example-metadata.json is only a template. Replace its keys with your own existing Dify metadata field names before live use.
  • Use --dry-run to validate local files and request shape without calling Dify.

Troubleshoot quickly

  • If auth fails, verify DIFY_API_KEY and Authorization header format.
  • If datasource discovery fails, verify the dataset has a published pipeline datasource and the key belongs to that dataset.
  • If the pipeline run fails with missing input errors, inspect user_input_variables from discovery_response and pass the missing keys in --inputs-json.
  • If the published datasource is not local_file, this skill is not the right uploader.
  • If metadata resolution fails, rename keys in the metadata JSON to the exact field names defined in Dify.
  • If you only have raw text, save it to .txt or .md and upload that file.
  • In the current tested deployment, .md uploaded successfully while .txt hit a Dify-side indexing 400. If plain text fails as .txt, retry as .md.

References

  • references/env.md
  • references/request-response.md
  • references/testing.md

Assets

  • assets/example-pipeline-inputs.json
  • assets/example-metadata.json

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.72%
按下载量换算61

Claude

28.9%
按下载量换算47

Cursor

17.03%
按下载量换算28

Gemini CLI

10.08%
按下载量换算16

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills