dify-for-dsl

repository·main·Indexed 26 days ago

https://github.com/wwwzhouhui/dify-for-dsl

A collection of pre-configured DSL workflow scripts for the Dify open-source platform. The repository includes tools for story video generation, an MCP server for Volcengine models (doubao_mcp_ai_server2.py), an Intelligent Invoice Application System (fapiaosqd), BeArt AI Face Swap, and a LaTeX to Word conversion tool.

Tokens
21.9K
Snippets
63
Records
140
Agent score
87%

What's inside dify-for-dsl

  1. Use the Invoice Application Information Extraction Expert (LangGPT)

    main

    The 发票申请单信息提取专家_LangGPT is a specialized AI persona designed to extract key information from invoice application data for subsequent automated invoicing. It processes basic information, invoicing party details, payer details, itemized product lists, and tax calculations.

    Workflow

    1. Basic Info Identification: Extracts header information.
    2. Invoicing Party Extraction: Retrieves company invoicing details.
    3. Payer Info Extraction: Retrieves full payer unit information.
    4. Itemized Detail Parsing: Extracts product names, specifications, quantities, unit prices, and tax data line-by-line.
    5. Total Verification: Calculates and verifies total amounts and tax sums.
    6. Data Completion: If multiple application forms are provided, missing payer information in subsequent forms is automatically filled from the first complete form.
    7. Formatted Output: Organizes all extracted data into a standardized JSON format.
  2. Use the Junior High Chemistry Periodic Table HTML Generator Prompt

    main

    This prompt defines a specialized role for an AI agent to act as a Junior High Chemistry Periodic Table HTML Page Generation Expert. It is designed to generate interactive, responsive, and pedagogically sound HTML/CSS/JS code for periodic tables tailored to junior high school curriculum requirements.

    Capabilities

    • Curriculum Alignment: Focuses only on elements required by junior high syllabi (typically the first 18-20 elements).
    • Technical Stack: Generates semantic HTML5, responsive CSS3, and interactive JavaScript.
    • Educational Design: Incorporates visual aids like color-coding for metals/non-metals/noble gases and accessibility features for color-blind students.
    • Output: Provides a complete, single-file or modular solution including structure, styling, interaction logic, and documentation.

    How to Use

    To get the best results, provide the agent with specific requirements covering three categories:

    1. Basic Information

    • Target Grade: (e.g., Grade 7, 8, or 9)
    • Element Range: (e.g., first 18 elements, first 20 elements, or custom)
    • Primary Function: (e.g., basic display, interactive query, or practice testing)
    • Device Support: (e.g., PC, Mobile, Tablet, or Cross-platform)
    • Special Requirements: (e.g., print-friendly, offline use, specific color themes)

    2. Technical Preferences

    • Complexity: (e.g., simple static page, medium interaction, or advanced features)
    • Framework: (e.g., Vanilla HTML, Bootstrap, etc.)
    • Compatibility: (e.g., modern browsers, mobile-first, or IE compatibility)

    3. Pedagogical/Teaching Requirements

    • Data to Display: (e.g., symbol, name, atomic number, atomic mass, electron configuration)
    • Classification: (e.g., color-coding for metals, non-metals, and noble gases)
    • Interaction: (e.g., click for details, search functionality, memory training/quizzes)
    • Accessibility: (e.g., text-to-speech, magnifying glass, high-contrast mode)
  3. Convert LaTeX to Word via Web Interface

    main

    Once the Gradio application is running, follow these steps to convert your documents:

    1. Input: Paste your LaTeX code into the LaTeX源代码框 (LaTeX source code box) on the left side of the interface.
    2. Execute: Click the 🔄 转换为Word (Convert to Word) button.
    3. Wait: Monitor the status in the output area until conversion is complete.
    4. Download: Use the provided download link to save the generated Word document locally.

    Additional Interface Controls:

    • 📄 加载示例 (Load Example): Populates the input box with preset LaTeX code.
    • 🗑️ 清空 (Clear): Clears all input content.
  4. Create a Custom Tool in Dify using OpenAPI-Swagger

    main

    To create a custom tool in Dify, you must provide an OpenAPI-Swagger specification (JSON) that describes your API. Dify uses this schema to understand the available endpoints, required parameters, and data structures.

    Steps to create a tool:

    1. Ensure your external API (e.g., a FastAPI service) is publicly accessible.
    2. Generate an OpenAPI 3.1.0 JSON schema. You can use LLMs like GPT to convert curl commands into the required schema.
    3. In Dify, navigate to the Custom Tool creation section and paste your JSON schema.
    4. Test the interface within Dify to verify that the returned values match your API's expected output.
    {
      "openapi": "3.1.0",
      "info": {
        "title": "Generate Image API",
        "description": "API to generate an image based on a given prompt.",
        "version": "v1.0.0"
      },
      "servers": [
        {
          "url": "http://YOUR_API_ENDPOINT"
        }
      ],
      "paths": {
        "/generate_image/": {
          "post": {
            "summary": "Generate an image based on a prompt",
            "operationId": "generateImage",
            "requestBody": {
              "required": true,
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/GenerateImageRequest"
                  }
                }
              }
            },
            "responses": {}
          }
        }
      },
      "components": {
        "schemas": {
          "GenerateImageRequest": {
            "type": "object",
            "properties": {
              "prompt": {
                "type": "string",
                "description": "The prompt describing the image to be generated."
              }
            },
            "required": [
              "prompt"
            ]
          }
        }
      }
    }
  5. Configure Dify Workflow for ComfyUI BizyAir

    main

    To integrate the ComfyUI BizyAir API into a Dify workflow, follow these steps:

    1. Start Node: Define two input variables:

      • prompt: Text variable.
      • workflowfile: File type variable (custom file format).
    2. HTTP Request Node:

      • Method: POST
      • URL: http://192.168.1.13:8082/comfyui_bizyairapi/
      • Body Type: form-data
      • Body Parameters:
        • prompt: Map from Start Node prompt.
        • seed: Hardcoded integer (e.g., 1).
        • idx: Hardcoded integer (e.g., 1).
        • workflowfile: Map from Start Node workflowfile.
    3. Code Execution Node: Use the following Python code to convert the API response into a Markdown image link:

    def main(arg1: str) -> str:
        import json
        data = json.loads(arg1)
        filename = data['filename']
        url = data['etag']
        markdown_result = f"![{filename}]({url})"
        return {"result": markdown_result}
    1. Direct Reply Node: Output the result from the Code Execution node.
    def main(arg1: str) -> str:
        import json
        data = json.loads(arg1)
        filename=data['filename']
        url=data['etag']
        markdown_result = f"![{filename}]({url})"
        return {"result": markdown_result}
  6. Deploy comfyui_bizyair using Docker

    main

    You can deploy comfyui_bizyair using Docker on any supported operating system (Windows, Linux, Mac). This allows you to run ComfyUI locally without requiring a dedicated GPU by leveraging SiliconFlow's Bizyair service.

    First, pull the latest image from Docker Hub:

    docker pull wwwzhouhui569/comfyui_bizyair:v0.4.0

    Then, run the container with volume mapping to persist models, inputs, and outputs. Replace D:/tmp/20250118 with your preferred local directory path to manage generated images easily.

    docker run -d -p 8188:8188 -v "D:/tmp/20250118/models:/app/models" -v "D:/tmp/20250118/input:/app/input" -v "D:/tmp/20250118/temp:/app/output/temp" -v "D:/tmp/20250118/output:/app/output" -v "D:/tmp/20250118/user:/app/user"  --name comfyui-container2 wwwzhouhui569/comfyui_bizyair:v0.4.0
  7. Configure Stress Testing for Extreme Market Conditions

    main

    Simulate high-pressure environments to ensure model stability during extreme market volatility. Monitor response times, memory usage, and calculation accuracy.

    Simulation Configuration:

    • Data Source Latency: Random delay between 300-800ms.
    • Market Volatility: Set intraday amplitude to ±20%.
    • Concurrency: 50+ queries per second.

    Monitoring Metrics:

    • P99 Response Time: < 2s
    • Memory Leak: < 50MB/hour
    • Calculation Deviation Rate: < 0.5%
  8. Install the LaTeX to Word Gradio Tool

    main

    To use the LaTeX to Word converter, you must install Python 3.8+, the Pandoc engine, and the required Python dependencies.

    System Dependencies

    1. Python 3.8+
    2. Pandoc: Required as the LaTeX conversion engine.
      • Windows: Download from pandoc.org or use choco install pandoc.
      • Ensure Pandoc is added to your system PATH.

    Python Dependencies

    Install the required packages using pip:

    pip install -r requirements.txt

    Key dependencies include gradio, fastapi, cos-python-sdk-v5, and requests.

    pip install -r requirements.txt