Jyong da4847c5a8 fix segment update issue (#1844) 1 年之前
..
.vscode db43ed6f41 feat: add api-based extension & external data tool & moderation backend (#1403) 1 年之前
constants 42a5b3ec17 feat: advanced prompt backend (#1301) 1 年之前
controllers 7b37e05dec feat: add billing switch. (#1789) 1 年之前
core 6b57e4e0ff Fix chitchat lost context (#1828) 1 年之前
docker 0c18cab111 feat: add queue to celery task (#688) 1 年之前
events a71f2863ac Annotation management (#1767) 1 年之前
extensions 6b499b9a16 remove stripe and anthropic. (#1746) 1 年之前
fields 185c2f86cd Compatible with the situation where there is no user information. (#1792) 1 年之前
libs 024250803a feat: move login_required wrapper outside (#1281) 1 年之前
migrations 5bb841935e feat: custom webapp logo (#1766) 1 年之前
models 185c2f86cd Compatible with the situation where there is no user information. (#1792) 1 年之前
services da4847c5a8 fix segment update issue (#1844) 1 年之前
tasks 1521ac5563 feat: add email template for invite new user in workspace (#1810) 1 年之前
templates 7083a05a25 fix: mail link color (#1812) 1 年之前
tests 451af66be0 feat: add jina embedding (#1647) 1 年之前
.dockerignore 220f7c81e9 build: fix .dockerignore file (#800) 1 年之前
.env.example 5e34f938c1 Feat/add unstructured support (#1780) 1 年之前
Dockerfile 3a5ae96e7b fix: TRANSFORMERS_OFFLINE orders in Dockerfile (#1144) 1 年之前
README.md 454577c6b1 Remove legacy docker startup docs in frontend (#1645) 1 年之前
app.py 6b499b9a16 remove stripe and anthropic. (#1746) 1 年之前
commands.py a71f2863ac Annotation management (#1767) 1 年之前
config.py 7b37e05dec feat: add billing switch. (#1789) 1 年之前
requirements.txt 163515c6e9 fix unstructured requirements (#1821) 1 年之前

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.

    openssl rand -base64 42
    

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

    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:

    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.