You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
takatost 6cf0e0c242 Merge branch 'main' into feat/workflow 1 year ago
..
.vscode Model Runtime (#1858) 1 year ago
constants add completion app creation back 1 year ago
controllers Merge branch 'main' into feat/workflow 1 year ago
core Merge branch 'main' into feat/workflow 1 year ago
docker improvement: introduce Super-Linter actions to check style for shell script, dockerfile and yaml files (#1966) 1 year ago
events update workflow app bind datasets 1 year ago
extensions Add azure blob storage support (#2919) 1 year ago
fields optimize app list desc 1 year ago
libs Merge branch 'main' into feat/workflow 1 year ago
migrations add message error record 1 year ago
models add message error record 1 year ago
schedule Feat/dify rag (#2528) 1 year ago
services fix: tool sort 1 year ago
tasks optimize codes 1 year ago
templates fix: email template style (#1914) 1 year ago
tests optimize codes 1 year ago
.dockerignore build: fix .dockerignore file (#800) 2 years ago
.env.example Merge branch 'main' into feat/workflow 1 year ago
Dockerfile Add gmpy2 dependencies packages (#2216) 1 year ago
README.md debug/chat: increase notify error duration to 3000 (#2778) 1 year ago
app.py feat: support HTTP response compression in api server (#2680) 1 year ago
commands.py Merge branch 'main' into feat/workflow-backend 1 year ago
config.py Merge branch 'main' into feat/workflow 1 year ago
pyproject.toml fix: event handlers not registered globally (#2479) 1 year ago
requirements.txt fix: Upgrade duckduckgo-search to version 5.1.0 & update document segment api parameter error (#2938) 1 year ago

README.md

Dify Backend API

Usage

  1. Start the docker-compose stack

The backend require some middleware, including PostgreSQL, Redis, and Weaviate, which can be started together using docker-compose.

   cd ../docker
   docker-compose -f docker-compose.middleware.yaml -p dify up -d
   cd ../api
  1. Copy .env.example to .env
  2. Generate a SECRET_KEY in the .env file.
   sed -i "/^SECRET_KEY=/c\SECRET_KEY=$(openssl rand -base64 42)" .env

3.5 If you use annaconda, create a new environment and activate it

   conda create --name dify python=3.10
   conda activate dify
  1. Install dependencies bash pip install -r requirements.txt
  2. Run migrate

Before the first launch, migrate the database to the latest version.

   flask db upgrade

⚠️ If you encounter problems with jieba, for example

   > flask db upgrade
   Error: While importing 'app', an ImportError was raised:

Please run the following command instead.

   pip install -r requirements.txt --upgrade --force-reinstall
  1. Start backend: bash flask run --host 0.0.0.0 --port=5001 --debug
  2. Setup your application by visiting http://localhost:5001/console/api/setup or other apis…
  3. If you need to debug local async processing, you can run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail, celery can do dataset importing and other async tasks.