Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into feat/knowledge-admin-role
Browse files Browse the repository at this point in the history
* refs/heads/main: (45 commits)
  fix: do not remove (#5682)
  Feature/add qwen llm (#5659)
  Fix docker command (#5681)
  feature: Add presence_penalty and frequency_penalty parameters to the … (#5637)
  Feat/fix ops trace (#5672)
  feat: xxo enhancement. (#5671)
  chore: rearrange python dependencies in groups (#5603)
  chore: delete unused resource (#5667)
  fix: knowledge retrieval score threshold setting (#5658)
  feat: add jina new pre-defined rerankers, include: jina-reranker-v2 (#5657)
  fix: tool call message role according to credentials (#5625)
  fix: HTTP request header is overwritten when user set Content-Type (#5628)
  chore: apply flake8-comprehensions Ruff rules to improve collection comprehensions (#5652)
  fix(api): language list (#5649)
  fix(api/configs): Ignore empty environment variables when loading config. (#5647)
  fix: type error in config (#5643)
  fix: remove obsoleted 'version' elements in compose files (#5553)
  chore: add a secondary confirmation dialog when the user delete the tool (#5634)
  fix: ro-RO is not a valid language (#5635)
  FR: #4048 - Add color customization to the chatbot  (#4885)
  ...

# Conflicts:
#	api/config.py
#	web/app/components/datasets/settings/form/index.tsx
  • Loading branch information
ZhouhaoJiang committed Jun 28, 2024
2 parents 6313230 + d37ee49 commit 2ccb4e0
Show file tree
Hide file tree
Showing 376 changed files with 11,167 additions and 2,840 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/post_create_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cd web && npm install

echo 'alias start-api="cd /workspaces/dify/api && flask run --host 0.0.0.0 --port=5001 --debug"' >> ~/.bashrc
echo 'alias start-worker="cd /workspaces/dify/api && celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail"' >> ~/.bashrc
echo 'alias start-worker="cd /workspaces/dify/api && celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace"' >> ~/.bashrc
echo 'alias start-web="cd /workspaces/dify/web && npm run dev"' >> ~/.bashrc
echo 'alias start-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify up -d"' >> ~/.bashrc

Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ body:
required: true
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
required: true
- label: "请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
required: true
- label: "Please do not modify this template :) and fill in all the required fields."
required: true

Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/document_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ body:
required: true
- label: I confirm that I am using English to submit report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
required: true
- label: "请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
required: true
- label: "Please do not modify this template :) and fill in all the required fields."
required: true
- type: textarea
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ body:
required: true
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
required: true
- label: "请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
required: true
- label: "Please do not modify this template :) and fill in all the required fields."
required: true
- type: textarea
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/translation_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ body:
required: true
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
required: true
- label: "请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
required: true
- label: "Please do not modify this template :) and fill in all the required fields."
required: true
- type: input
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
docker/docker-compose.pgvecto-rs.yaml
docker/docker-compose.pgvector.yaml
docker/docker-compose.chroma.yaml
docker/docker-compose.oracle.yaml
services: |
weaviate
qdrant
Expand All @@ -87,7 +86,6 @@ jobs:
pgvecto-rs
pgvector
chroma
oracle
- name: Test Vector Stores
run: poetry run -C api bash dev/pytest/pytest_vdb.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ web/.vscode/settings.json
!.idea/icon.png
.ideaDataSources/
*.iml
api/.idea

api/.env
api/storage/*
Expand Down
14 changes: 13 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,19 @@
"FLASK_DEBUG": "1",
"GEVENT_SUPPORT": "True"
},
"args": ["-A", "app.celery", "worker", "-P", "gevent", "-c", "1", "--loglevel", "info", "-Q", "dataset,generation,mail"],
"args": [
"-A",
"app.celery",
"worker",
"-P",
"gevent",
"-c",
"1",
"--loglevel",
"info",
"-Q",
"dataset,generation,mail,ops_trace"
]
},
]
}
4 changes: 2 additions & 2 deletions api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ DB_DATABASE=dify

# Storage configuration
# use for store upload files, private keys...
# storage type: local, s3, azure-blob
# storage type: local, s3, azure-blob, google-storage
STORAGE_TYPE=local
STORAGE_LOCAL_PATH=storage
S3_USE_AWS_MANAGED_IAM=false
Expand All @@ -63,7 +63,7 @@ ALIYUN_OSS_REGION=your-region

# Google Storage configuration
GOOGLE_STORAGE_BUCKET_NAME=yout-bucket-name
GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON=your-google-service-account-json-base64-string
GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64=your-google-service-account-json-base64-string

# Tencent COS Storage configuration
TENCENT_COS_BUCKET_NAME=your-bucket-name
Expand Down
4 changes: 2 additions & 2 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

```bash
cd ../docker
docker-compose -f docker-compose.middleware.yaml -p dify up -d
docker compose -f docker-compose.middleware.yaml -p dify up -d
cd ../api
```

Expand Down Expand Up @@ -66,7 +66,7 @@
10. If you need to debug local async processing, please start the worker service.

```bash
poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail
poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace
```

The started celery app handles the async tasks, e.g. dataset importing and documents indexing.
Expand Down
14 changes: 11 additions & 3 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from werkzeug.exceptions import Unauthorized

from commands import register_commands
from config import Config

# DO NOT REMOVE BELOW
from events import event_handlers
Expand Down Expand Up @@ -82,8 +81,17 @@ def create_flask_app_with_configs() -> Flask:
with configs loaded from .env file
"""
dify_app = DifyApp(__name__)
dify_app.config.from_object(Config())
dify_app.config.from_mapping(DifyConfig().model_dump())

# populate configs into system environment variables
for key, value in dify_app.config.items():
if isinstance(value, str):
os.environ[key] = value
elif isinstance(value, int | float | bool):
os.environ[key] = str(value)
elif value is None:
os.environ[key] = ''

return dify_app


Expand Down Expand Up @@ -232,7 +240,7 @@ def register_blueprints(app):
app = create_app()
celery = app.extensions["celery"]

if app.config['TESTING']:
if app.config.get('TESTING'):
print("App is running in TESTING mode")


Expand Down
223 changes: 0 additions & 223 deletions api/config.py

This file was deleted.

1 change: 1 addition & 0 deletions api/configs/app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class DifyConfig(
# read from dotenv format config file
env_file='.env',
env_file_encoding='utf-8',
env_ignore_empty=True,

# ignore extra attributes
extra='ignore',
Expand Down
Loading

0 comments on commit 2ccb4e0

Please sign in to comment.