← 返回
未分类 Key

dify-flow-access

Query and interact with company knowledge bases or workflows using Dify API with multi-turn context and streaming response support.
使用 Dify API 查询并交互公司知识库或工作流,支持多轮上下文和流式响应
whswhs1128
未分类 clawhub v1.0.0 1 版本 99622.6 Key: 需要
★ 0
Stars
📥 264
下载
💾 0
安装
1
版本
#latest

概述

Dify Workflow - OpenClaw CLI for Dify API

Use OpenClaw to query company knowledge base or execute workflows via Dify API. Supports multi-turn conversation and streaming responses.

Trigger Conditions

When users need to access internal knowledge bases, documentation queries, Q&A systems, or execute specific workflows, this skill handles those requests such as "help me check the knowledge base" or "query Dify workflow".

Features

  • ✅ Call Dify Workflow API (workflow mode)
  • ✅ Call Dify ChatApp API (chat mode)
  • ✅ Multi-turn conversation context management
  • ✅ Streaming response support (show results incrementally)
  • ✅ Automatic timeout and error handling
  • ✅ Configurable request parameters

Quick Start

# Basic ChatApp mode query (recommended, no workflow ID needed)
/dify-workflow "如何部署项目?" --chat

# Workflow mode query (requires specifying workflow ID)
/dify-workflow "查询 AI 助手信息" --wf wf_123456abcdef

# Multi-turn conversation (use conversation_id from previous response)
/dify-workflow "那退款流程呢?" --conv conv_xyz789

# Streaming response (show results incrementally)
/dify-workflow "解释一下这个概念" --stream

# Combined usage
/dify-workflow "查询中电港 AI 助手相关信息" --chat

Configuration

Base URL: http://10.10.10.159/v1

API Key: app-jUhDcPj3lcnEG04JW4gRsfyy

Environment Variables (Optional Overrides)

You can override defaults via environment variables:

export DIFY_BASE_URL="http://your-dify-server/v1"
export DIFY_API_KEY="your-api-key-here"
export DEFAULT_TIMEOUT=120

Command Line Options

OptionDescriptionExample
------------------------------
--chatUse ChatApp mode (default for most apps)--chat
--wf IDSpecify workflow ID for Workflow mode--wf wf_xxx
--conv IDSpecify conversation ID for multi-turn--conv conv_xxx
--streamEnable streaming response mode--stream

API Endpoints

  • Workflow: POST /v1/workflows/run - Execute predefined workflows
  • ChatApp: POST /v1/chat-messages - Chat interface with knowledge base

Request Format Examples

ChatApp Mode

{
  "inputs": {},
  "query": "user query",
  "conversation_id": "conv_xxx",  // Optional for multi-turn
  "response_mode": "blocking",     // or "streaming"
  "user": "openclaw-user",
  "files": []
}

Workflow Mode

{
  "workflow_id": "wf_xxx",
  "inputs": {
    "query": "user query"
  },
  "response_mode": "blocking",
  "user": "openclaw-user"
}

Response Extraction

The script automatically extracts answers from different Dify response formats:

  • ChatApp: .data.answer
  • Workflow: .data.outputs.answer or .data.outputs.*
  • Advanced Chat: .answer (top-level)

Common Use Cases

1. Knowledge Base Query

/dify-workflow "员工手册中的报销政策是什么?" --chat

2. Multi-turn Conversation

# First query returns conversation_id: conv_abc123
/dify-workflow "那加班制度呢?" --conv conv_abc123

3. Execute Specific Workflow

/dify-workflow "生成月度报告" --wf wf_report_gen_xyz

4. Streaming Large Outputs

/dify-workflow "分析这个数据集" --stream

Troubleshooting

Common Errors and Solutions

  1. "not_workflow_app"
    • Cause: Using Workflow mode for a ChatApp
    • Solution: Use --chat flag: /dify-workflow "query" --chat
  1. "conversation_id_invalid"
    • Cause: Expired or incorrect conversation ID
    • Solution: Start fresh without --conv option
  1. "workflow_not_found"
    • Cause: Invalid workflow ID
    • Solution: Verify the workflow ID exists in your Dify app (should start with wf_)
  1. "query missing parameter"
    • Cause: Query parameter not included in payload
    • Solution: Ensure query is properly specified

Getting IDs from Dify Dashboard

ChatApp Mode:

  • No additional setup needed
  • Conversation IDs are automatically returned in responses

Workflow Mode:

  1. Open your Workflow app in Dify dashboard
  2. Go to "API Access" or check the URL
  3. Look for IDs starting with wf_

Technical Details

Unicode Support

  • Automatic decoding of Unicode escape sequences (e.g., \u4f60\u597d你好)
  • Supports Chinese and other multi-language responses

Error Handling

  • Clear error messages with actionable suggestions
  • Timeout protection (default 120 seconds)
  • Graceful fallback for missing dependencies

Dependencies

  • Python 3.x (for JSON parsing and Unicode decoding)
  • curl (for HTTP requests)
  • jq (optional, for advanced output formatting)

Version Information

  • Version: 1.0.0
  • Last Updated: 2026-05-20
  • Author: OpenClaw Team
  • License: Internal use only

Support

For issues or questions:

  1. Check the troubleshooting section above
  2. Verify your Dify API credentials and configuration
  3. Ensure network connectivity to Dify server at http://10.10.10.159/v1

Note: Default timeout is 120 seconds to accommodate complex workflow executions. Adjust via DEFAULT_TIMEOUT environment variable if needed.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-21 15:38 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,225 📥 267,597
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,078 📥 808,054
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,376 📥 320,101