算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
dify【设计与创意】Use when building LLM applications with visual workflow — RAG knowledge bases, AI agents, chatbots with drag-and-drop orchestration. Dify: open-source LLM app platform supporting 30+ models (OpenAI, Claude, DeepSeek, Ollama, Qwen, GLM) with Docker deployment.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: dify description: "Use when building LLM applications with visual workflow — RAG knowledge bases, AI agents, chatbots with drag-and-drop orchestration. Dify: open-source LLM app platform supporting 30+ models (OpenAI, Claude, DeepSeek, Ollama, Qwen, GLM) with Docker deployment." tags:
项目地址: https://github.com/langgenius/dify
官网: https://dify.ai/
官方文档: https://docs.dify.ai/
许可证: Dify Open Source License(基于 Apache-2.0 + 附加条款) 最新版本: 参见 GitHub Releases
Dify 提供:
git clone https://github.com/langgenius/dify
cd dify/docker
cp .env.example .env
# 编辑 .env:SECRET_KEY、INIT_PASSWORD 等
docker compose up -d
# Web UI: http://localhost
数据持久化在 ./volumes/。生产环境建议使用外部 PostgreSQL + Redis + 对象存储 + 向量库(Weaviate/Qdrant/PGVector/Milvus)。
helm repo add dify https://langgenius.github.io/dify-helm
helm install dify dify/dify -n dify --create-namespace
进入 「设置 → 模型供应商」:
http://host.docker.internal:11434| 类型 | 用途 |
|---|---|
| Chatbot | 多轮对话,自动会话上下文 |
| Agent | 工具调用 + 推理(ReAct/FunctionCall) |
| Text Generator | 单次生成(写作/翻译/总结) |
| Workflow | 复杂业务流程(节点编排) |
| Chatflow | Chatbot + Workflow(可拖拽对话流程) |
| 节点 | 功能 |
|---|---|
| Start | 输入参数 |
| LLM | 模型推理 |
| Knowledge Retrieval | 知识库检索 |
| Question Classifier | 问题分类 |
| HTTP Request | 调用外部 API |
| Code | 运行 Python/JavaScript |
| Tool | 内置/自定义工具 |
| If/Else | 条件分支 |
| Iteration | 迭代列表 |
| Variable Aggregator | 合并变量 |
| Template Transform | Jinja2 字符串模板 |
| Parameter Extractor | 从文本抽参数 |
| End | 输出 |
支持引用上游变量:{{#node1.text#}}。
openapi: 3.0.0
info: { title: Weather, version: '1.0' }
paths:
/weather:
get:
operationId: getWeather
parameters:
- name: city
in: query
required: true
schema: { type: string }
responses:
'200': { description: ok }
「工具 → 自定义工具」上传后,Agent / Workflow 可直接调用。
每个应用自带 API 端点:
curl -X POST 'https://your-dify/v1/chat-messages' \
-H 'Authorization: Bearer app-xxxxx' \
-H 'Content-Type: application/json' \
-d '{
"inputs": {},
"query": "北京今天天气",
"user": "user-001",
"conversation_id": "",
"response_mode": "streaming"
}'
response_mode:blocking(同步)/ streaming(SSE)。
工作流调用:POST /v1/workflows/run。
/embed)与 SDK(Python / Node.js)# 整体步骤
1. 准备知识库文档(PDF/Markdown/网页)
2. 知识库 → 上传文档 → 选择嵌入模型(bge-m3)→ 启用混合检索 + Rerank
3. 创建 Chatbot 应用 → 绑定知识库
4. 配置系统提示词:"你是企业内部助手,仅基于知识库回答..."
5. 配置模型(GPT-4o-mini 或 DeepSeek-V3)
6. 测试 → 发布 → 获取 API Key
7. 通过 iframe 嵌入官网或对接飞书/钉钉/企微
# API 调用示例
curl -X POST 'https://dify.example.com/v1/chat-messages' \
-H 'Authorization: Bearer app-xxxxx' \
-H 'Content-Type: application/json' \
-d '{
"inputs": {},
"query": "公司年假政策是什么?",
"user": "employee-001",
"response_mode": "streaming"
}'
# Workflow 节点编排
Start → 用户提交申请
→ Question Classifier(判断申请类型:请假/报销/采购)
→ IF/ELSE 分支
→ 请假分支:
→ Code 节点(Python 计算剩余年假)
→ HTTP Request(调 HR 系统校验)
→ LLM 节点(生成审批意见)
→ 报销分支:
→ Parameter Extractor(抽取金额/事由)
→ Knowledge Retrieval(查报销政策)
→ LLM 节点(合规判断)
→ Variable Aggregator(汇总分支结果)
→ Template Transform(生成审批通知)
→ End(返回审批结果 + 通知)
{{#节点名.字段#}} 语法容易写错,复制节点 ID 粘贴response_mode: streaming),否则长回复体验差| 场景 | 推荐方案 |
|---|---|
| 简单 FAQ 问答 | Chatbot + 知识库 |
| 需要查数据库/调 API | Agent + 自定义工具 |
| 多步骤审批/数据流转 | Workflow |
| 对话式多步骤 | Chatflow |
| 纯文本生成(无对话) | Text Generator |
| 问题 | 解决 |
|---|---|
| 上传文档失败 | 检查 STORAGE_* 配置(本地 / S3)与权限 |
| 嵌入失败 | 嵌入模型未配置 / 余额不足;切换其它供应商 |
| 私有 Ollama 不通 | Docker 网络:host.docker.internal 或自定义网络 |
| 响应慢 | 启用 streaming;缩短 prompt;减少检索 topK |
| 中文检索差 | 使用 bge-m3 / text2vec 等中文嵌入 + jieba 关键词 |