Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 76 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,37 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- type: "ai"
name: "qiniu-ai"
label_en: "Qiniu AI"
label_zh: "七牛云 AI"
keep_models: true
keep_tools: false
- type: "kodo"
name: "qiniu-tools"
label_en: "Qiniu Storage"
label_zh: "七牛云存储"
keep_models: false
keep_tools: true
- type: "all"
name: "qiniu"
label_en: "Qiniu Cloud"
label_zh: "七牛云"
keep_models: true
keep_tools: true

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install yq for YAML processing
run: |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq

- name: Download Dify Plugin CLI
run: |
mkdir -p /tmp/dify-cli
Expand All @@ -22,13 +48,60 @@ jobs:
run: |
mkdir -p /tmp/plugin-build
# 复制需要的文件,排除 .git、.github 等不需要的目录
rsync -av --exclude='.git' --exclude='.github' . /tmp/plugin-build/
rsync -av --exclude='.git' --exclude='.github' --exclude='build.sh' --exclude='__pycache__' . /tmp/plugin-build/

- name: Configure plugin for ${{ matrix.type }}
run: |
cd /tmp/plugin-build

# 更新 manifest.yaml
yq eval '.name = "${{ matrix.name }}"' -i manifest.yaml
yq eval '.label.en_US = "${{ matrix.label_en }}"' -i manifest.yaml
yq eval '.label.zh_Hans = "${{ matrix.label_zh }}"' -i manifest.yaml

# 根据类型删除不需要的文件和配置
if [ "${{ matrix.keep_models }}" = "false" ]; then
echo "🗑️ 删除模型相关文件..."
rm -rf models/
rm -f provider/qiniu_ai.py provider/qiniu_ai.yaml
yq eval 'del(.plugins.models)' -i manifest.yaml
yq eval '.resource.permission = {"tool": {"enabled": true}}' -i manifest.yaml
fi

if [ "${{ matrix.keep_tools }}" = "false" ]; then
echo "🗑️ 删除工具相关文件..."
rm -rf tools/
rm -f provider/qiniu_tools.py provider/qiniu_tools.yaml
yq eval 'del(.plugins.tools)' -i manifest.yaml
yq eval '.resource.permission = {"model": {"llm": true, "rerank": false, "enabled": true, "moderation": false, "speech2text": false, "text_embedding": false, "tts": false}}' -i manifest.yaml
fi

# 确保 plugins 配置与实际文件一致
if [ "${{ matrix.keep_models }}" = "true" ] && [ "${{ matrix.keep_tools }}" = "false" ]; then
echo "📝 配置仅模型插件..."
yq eval '.plugins = {"models": ["provider/qiniu_ai.yaml"]}' -i manifest.yaml
elif [ "${{ matrix.keep_models }}" = "false" ] && [ "${{ matrix.keep_tools }}" = "true" ]; then
echo "📝 配置仅工具插件..."
yq eval '.plugins = {"tools": ["provider/qiniu_tools.yaml"]}' -i manifest.yaml
elif [ "${{ matrix.keep_models }}" = "true" ] && [ "${{ matrix.keep_tools }}" = "true" ]; then
echo "📝 配置完整插件..."
yq eval '.plugins = {"models": ["provider/qiniu_ai.yaml"], "tools": ["provider/qiniu_tools.yaml"]}' -i manifest.yaml
fi

# 清理空的 provider 目录
if [ -d provider ] && [ -z "$(ls -A provider)" ]; then
rm -rf provider/
fi

# 清理 __pycache__ 文件
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true

- name: Extract version from manifest
id: get_version
run: |
VERSION=$(grep '^version:' /tmp/plugin-build/manifest.yaml | sed 's/version: //')
PACKAGE_NAME="qiniu-${VERSION}.difypkg"
VERSION=$(yq eval '.version' /tmp/plugin-build/manifest.yaml)
PACKAGE_NAME="${{ matrix.name }}-${VERSION}.difypkg"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
Expand Down
81 changes: 80 additions & 1 deletion .github/workflows/runnable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ jobs:
strategy:
matrix:
python-version: ["3.11", "3.12"]
package-type:
- type: "ai"
name: "qiniu-ai"
label_en: "Qiniu AI"
label_zh: "七牛云 AI"
keep_models: true
keep_tools: false
- type: "kodo"
name: "qiniu-tools"
label_en: "Qiniu Storage Tools"
label_zh: "七牛云存储工具"
keep_models: false
keep_tools: true
- type: "all"
name: "qiniu"
label_en: "Qiniu Cloud"
label_zh: "七牛云"
keep_models: true
keep_tools: true

steps:
- uses: actions/checkout@v4
Expand All @@ -21,11 +40,71 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install yq for YAML processing
run: |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Test plugin runs without errors
- name: Prepare test environment for ${{ matrix.package-type.type }} package
run: |
# 创建测试目录
mkdir -p /tmp/test-plugin
# 复制文件,排除不需要的目录
rsync -av --exclude='.git' --exclude='.github' --exclude='build.sh' --exclude='__pycache__' . /tmp/test-plugin/

cd /tmp/test-plugin

# 更新 manifest.yaml
yq eval '.name = "${{ matrix.package-type.name }}"' -i manifest.yaml
yq eval '.label.en_US = "${{ matrix.package-type.label_en }}"' -i manifest.yaml
yq eval '.label.zh_Hans = "${{ matrix.package-type.label_zh }}"' -i manifest.yaml

# 根据类型删除不需要的文件和配置
if [ "${{ matrix.package-type.keep_models }}" = "false" ]; then
echo "🗑️ 删除模型相关文件..."
rm -rf models/
rm -f provider/qiniu_ai.py provider/qiniu_ai.yaml
yq eval 'del(.plugins.models)' -i manifest.yaml
yq eval '.resource.permission = {"tool": {"enabled": true}}' -i manifest.yaml
fi

if [ "${{ matrix.package-type.keep_tools }}" = "false" ]; then
echo "🗑️ 删除工具相关文件..."
rm -rf tools/
rm -f provider/qiniu_tools.py provider/qiniu_tools.yaml
yq eval 'del(.plugins.tools)' -i manifest.yaml
yq eval '.resource.permission = {"model": {"llm": true, "rerank": false, "enabled": true, "moderation": false, "speech2text": false, "text_embedding": false, "tts": false}}' -i manifest.yaml
fi

# 确保 plugins 配置与实际文件一致
if [ "${{ matrix.package-type.keep_models }}" = "true" ] && [ "${{ matrix.package-type.keep_tools }}" = "false" ]; then
echo "📝 配置仅模型插件..."
yq eval '.plugins = {"models": ["provider/qiniu_ai.yaml"]}' -i manifest.yaml
elif [ "${{ matrix.package-type.keep_models }}" = "false" ] && [ "${{ matrix.package-type.keep_tools }}" = "true" ]; then
echo "📝 配置仅工具插件..."
yq eval '.plugins = {"tools": ["provider/qiniu_tools.yaml"]}' -i manifest.yaml
elif [ "${{ matrix.package-type.keep_models }}" = "true" ] && [ "${{ matrix.package-type.keep_tools }}" = "true" ]; then
echo "📝 配置完整插件..."
yq eval '.plugins = {"models": ["provider/qiniu_ai.yaml"], "tools": ["provider/qiniu_tools.yaml"]}' -i manifest.yaml
fi

# 清理空的 provider 目录
if [ -d provider ] && [ -z "$(ls -A provider)" ]; then
rm -rf provider/
fi

# 清理 __pycache__ 文件
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true

- name: Test ${{ matrix.package-type.type }} package runs without errors
run: |
cd /tmp/test-plugin
echo "🧪 Testing ${{ matrix.package-type.name }} package..."
timeout 10s python -m main || [ $? -eq 124 ]
echo "✅ ${{ matrix.package-type.name }} package runs successfully"
2 changes: 1 addition & 1 deletion manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ meta:
version: 0.0.1
plugins:
models:
- provider/qiniu.yaml
- provider/qiniu_ai.yaml
tools:
- provider/qiniu_tools.yaml
resource:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions provider/qiniu.yaml → provider/qiniu_ai.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
provider: qiniu
label:
en_US: Qiniu Cloud
zh_Hans: 七牛云
zh_Hans: 七牛云 AI

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While changing the label to 七牛云 AI is correct for the AI-only package, the description on lines 6-7 is now inconsistent. It still mentions 'cloud storage management' and related features. To align with the multi-package structure, please update the description to only include AI inference services.

For example:

  • en_US: Official Qiniu Cloud Dify plugin providing comprehensive AI inference services. Supports multiple LLM models including GPT-OSS、deepseek、GLM、Kimi、Qwen series.
  • zh_Hans: 七牛云官方 Dify 插件,提供全面的 AI 推理服务。支持 GPT-OSS、deepseek、GLM、Kimi、Qwen 系列等多种大语言模型。

description:
en_US: Official Qiniu Cloud Dify plugin providing comprehensive AI inference services and cloud storage management. Supports multiple LLM models including GPT-OSS、deepseek、GLM、Kimi、Qwen series, and offers complete file management capabilities such as file upload, bucket operations, and content retrieval.
zh_Hans: 七牛云官方 Dify 插件,提供全面的 AI 推理服务和云存储管理功能。支持 GPT-OSS、deepseek、GLM、Kimi、Qwen 系列等多种大语言模型,并提供完整的文件管理能力,包括文件上传、存储空间操作和内容获取等功能。
Expand Down Expand Up @@ -50,4 +50,4 @@ extra:
python:
model_sources:
- models/llm/llm.py
provider_source: provider/qiniu.py
provider_source: provider/qiniu_ai.py
2 changes: 1 addition & 1 deletion provider/qiniu_tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ identity:
name: qiniu
label:
en_US: Qiniu Cloud
zh_Hans: 七牛云
zh_Hans: 七牛云存储

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The new label 七牛云存储 is appropriate for the tools-only package. However, the description on lines 8-9 should be updated. It currently includes 'AI inference services', which is not part of this package. Please revise the description to focus solely on cloud storage management capabilities.

For example:

  • en_US: Official Qiniu Cloud Dify plugin providing cloud storage management. Offers complete file management capabilities such as file upload, bucket operations, and content retrieval.
  • zh_Hans: 七牛云官方 Dify 插件,提供云存储管理功能。提供完整的文件管理能力,包括文件上传、存储空间操作和内容获取等功能。

description:
en_US: Official Qiniu Cloud Dify plugin providing comprehensive AI inference services and cloud storage management. Supports multiple LLM models including GPT-OSS、deepseek、GLM、Kimi、Qwen series, and offers complete file management capabilities such as file upload, bucket operations, and content retrieval.
zh_Hans: 七牛云官方 Dify 插件,提供全面的 AI 推理服务和云存储管理功能。支持 GPT-OSS、deepseek、GLM、Kimi、Qwen 系列等多种大语言模型,并提供完整的文件管理能力,包括文件上传、存储空间操作和内容获取等功能。
Expand Down