Skip to content

Commit

Permalink
Merge commit '7f3282ec04d87cfb8fcff892e824c96094b92636'
Browse files Browse the repository at this point in the history
* commit '7f3282ec04d87cfb8fcff892e824c96094b92636': (105 commits)
  Update version to 0.8.3 in packaging and docker-compose files (langgenius#8590)
  chore: fix webpack dependencies order (langgenius#8542)
  ComfyUI tool use the new internal enumeration class "VariableKey" (langgenius#8533)
  Fix: update qwen model and model config (langgenius#8584)
  fix: fix qwen series model type (langgenius#8580)
  feat: add hunyuan-vision (langgenius#8529)
  chore: improve delimiter (langgenius#8552)
  add storage error log (langgenius#8556)
  feat: sync Qwen API with Aliyun Bailian (langgenius#8538)
  fix: thread_pool submit count in parallel workflow not releasing (langgenius#8549)
  fix: ci issues(missing duckduckgo-search==6.2.11, ruff lint issue) (langgenius#8543)
  feat: add format util unit and add pre-commit unit check (langgenius#8427)
  validate user permission before enter app detail page (langgenius#8527)
  refactor: rename task_type to task for jina embeddings v3 (langgenius#8488)
  chore: Deprecate gpt-3.5-turbo-0613 and gpt-3.5-turbo-16k-0613 models (langgenius#8500)
  feat: Add ComfyUI tool for Stable Diffusion (langgenius#8160)
  chore: update the .gitignore file to include opensearch,pgvector,and myscale (langgenius#8470)
  feat: Add base URL settings and secure_ascii options to the Brave search tool (langgenius#8463)
  feat: add flux dev of siliconflow image-gen tool (langgenius#8450)
  chore: workflow BRANCH, PARALLEL i18n (langgenius#8452)
  ...

# Conflicts:
#	api/core/file/file_obj.py
#	api/core/file/message_file_parser.py
#	api/core/helper/code_executor/code_executor.py
#	api/core/workflow/nodes/code/code_node.py
#	api/core/workflow/nodes/tool/tool_node.py
  • Loading branch information
Scorpion1221 committed Sep 21, 2024
2 parents d030e36 + 7f3282e commit 854084e
Show file tree
Hide file tree
Showing 1,059 changed files with 32,329 additions and 25,647 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ docker-legacy/volumes/etcd/*
docker-legacy/volumes/minio/*
docker-legacy/volumes/milvus/*
docker-legacy/volumes/chroma/*
docker-legacy/volumes/opensearch/data/*
docker-legacy/volumes/pgvectors/data/*
docker-legacy/volumes/pgvector/data/*

docker/volumes/app/storage/*
docker/volumes/certbot/*
Expand All @@ -164,6 +167,12 @@ docker/volumes/etcd/*
docker/volumes/minio/*
docker/volumes/milvus/*
docker/volumes/chroma/*
docker/volumes/opensearch/data/*
docker/volumes/myscale/data/*
docker/volumes/myscale/log/*
docker/volumes/unstructured/*
docker/volumes/pgvector/data/*
docker/volumes/pgvecto_rs/data/*

docker/nginx/conf.d/default.conf
docker/middleware.env
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
| 被团队成员标记为高优先级的功能 | 高优先级 |
|[community feedback board](https://github.com/langgenius/dify/discussions/categories/feedbacks) 内反馈的常见功能请求 | 中等优先级 |
| 非核心功能和小幅改进 | 低优先级 |
| 有价值当不紧急 | 未来功能 |
| 有价值但不紧急 | 未来功能 |

### 其他任何事情(例如 bug 报告、性能优化、拼写错误更正):
* 立即开始编码。
Expand Down Expand Up @@ -138,7 +138,7 @@ Dify 的后端使用 Python 编写,使用 [Flask](https://flask.palletsproject
├── models // 描述数据模型和 API 响应的形状
├── public // 如 favicon 等元资源
├── service // 定义 API 操作的形状
├── test
├── test
├── types // 函数参数和返回值的描述
└── utils // 共享的实用函数
```
Expand Down
2 changes: 1 addition & 1 deletion api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def initialize_extensions(app):
@login_manager.request_loader
def load_user_from_request(request_from_flask_login):
"""Load user based on the request."""
if request.blueprint not in ["console", "inner_api"]:
if request.blueprint not in {"console", "inner_api"}:
return None
# Check if the user_id contains a dot, indicating the old format
auth_header = request.headers.get("Authorization", "")
Expand Down
16 changes: 8 additions & 8 deletions api/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def reset_email(email, new_email, email_confirm):
)
@click.confirmation_option(
prompt=click.style(
"Are you sure you want to reset encrypt key pair?" " this operation cannot be rolled back!", fg="red"
"Are you sure you want to reset encrypt key pair? this operation cannot be rolled back!", fg="red"
)
)
def reset_encrypt_key_pair():
Expand All @@ -131,7 +131,7 @@ def reset_encrypt_key_pair():

click.echo(
click.style(
"Congratulations! " "the asymmetric key pair of workspace {} has been reset.".format(tenant.id),
"Congratulations! The asymmetric key pair of workspace {} has been reset.".format(tenant.id),
fg="green",
)
)
Expand All @@ -140,9 +140,9 @@ def reset_encrypt_key_pair():
@click.command("vdb-migrate", help="migrate vector db.")
@click.option("--scope", default="all", prompt=False, help="The scope of vector database to migrate, Default is All.")
def vdb_migrate(scope: str):
if scope in ["knowledge", "all"]:
if scope in {"knowledge", "all"}:
migrate_knowledge_vector_database()
if scope in ["annotation", "all"]:
if scope in {"annotation", "all"}:
migrate_annotation_vector_database()


Expand Down Expand Up @@ -275,8 +275,7 @@ def migrate_knowledge_vector_database():
for dataset in datasets:
total_count = total_count + 1
click.echo(
f"Processing the {total_count} dataset {dataset.id}. "
+ f"{create_count} created, {skipped_count} skipped."
f"Processing the {total_count} dataset {dataset.id}. {create_count} created, {skipped_count} skipped."
)
try:
click.echo("Create dataset vdb index: {}".format(dataset.id))
Expand Down Expand Up @@ -411,7 +410,8 @@ def migrate_knowledge_vector_database():
try:
click.echo(
click.style(
f"Start to created vector index with {len(documents)} documents of {segments_count} segments for dataset {dataset.id}.",
f"Start to created vector index with {len(documents)} documents of {segments_count}"
f" segments for dataset {dataset.id}.",
fg="green",
)
)
Expand Down Expand Up @@ -593,7 +593,7 @@ def create_tenant(email: str, language: Optional[str] = None, name: Optional[str

click.echo(
click.style(
"Congratulations! Account and tenant created.\n" "Account: {}\nPassword: {}".format(email, new_password),
"Congratulations! Account and tenant created.\nAccount: {}\nPassword: {}".format(email, new_password),
fg="green",
)
)
Expand Down
6 changes: 3 additions & 3 deletions api/configs/feature/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ class EndpointConfig(BaseSettings):
)

SERVICE_API_URL: str = Field(
description="Service API Url prefix." "used to display Service API Base Url to the front-end.",
description="Service API Url prefix. used to display Service API Base Url to the front-end.",
default="",
)

APP_WEB_URL: str = Field(
description="WebApp Url prefix." "used to display WebAPP API Base Url to the front-end.",
description="WebApp Url prefix. used to display WebAPP API Base Url to the front-end.",
default="",
)

Expand Down Expand Up @@ -272,7 +272,7 @@ class LoggingConfig(BaseSettings):
"""

LOG_LEVEL: str = Field(
description="Log output level, default to INFO." "It is recommended to set it to ERROR for production.",
description="Log output level, default to INFO. It is recommended to set it to ERROR for production.",
default="INFO",
)

Expand Down
2 changes: 1 addition & 1 deletion api/configs/packaging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PackagingInfo(BaseSettings):

CURRENT_VERSION: str = Field(
description="Dify version",
default="0.8.0",
default="0.8.3",
)

COMMIT_SHA: str = Field(
Expand Down
24 changes: 8 additions & 16 deletions api/controllers/console/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,15 @@ def post(self):

site = app.site
if not site:
desc = args["desc"] if args["desc"] else ""
copy_right = args["copyright"] if args["copyright"] else ""
privacy_policy = args["privacy_policy"] if args["privacy_policy"] else ""
custom_disclaimer = args["custom_disclaimer"] if args["custom_disclaimer"] else ""
desc = args["desc"] or ""
copy_right = args["copyright"] or ""
privacy_policy = args["privacy_policy"] or ""
custom_disclaimer = args["custom_disclaimer"] or ""
else:
desc = site.description if site.description else args["desc"] if args["desc"] else ""
copy_right = site.copyright if site.copyright else args["copyright"] if args["copyright"] else ""
privacy_policy = (
site.privacy_policy if site.privacy_policy else args["privacy_policy"] if args["privacy_policy"] else ""
)
custom_disclaimer = (
site.custom_disclaimer
if site.custom_disclaimer
else args["custom_disclaimer"]
if args["custom_disclaimer"]
else ""
)
desc = site.description or args["desc"] or ""
copy_right = site.copyright or args["copyright"] or ""
privacy_policy = site.privacy_policy or args["privacy_policy"] or ""
custom_disclaimer = site.custom_disclaimer or args["custom_disclaimer"] or ""

recommended_app = RecommendedApp.query.filter(RecommendedApp.app_id == args["app_id"]).first()

Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get(self, resource_id):
def post(self, resource_id):
resource_id = str(resource_id)
_get_resource(resource_id, current_user.current_tenant_id, self.resource_model)
if not current_user.is_admin_or_owner:
if not current_user.is_editor:
raise Forbidden()

current_key_count = (
Expand Down
10 changes: 3 additions & 7 deletions api/controllers/console/app/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,15 @@ def post(self, app_model):
message_id = args.get("message_id", None)
text = args.get("text", None)
if (
app_model.mode in [AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value]
app_model.mode in {AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value}
and app_model.workflow
and app_model.workflow.features_dict
):
text_to_speech = app_model.workflow.features_dict.get("text_to_speech")
voice = args.get("voice") if args.get("voice") else text_to_speech.get("voice")
voice = args.get("voice") or text_to_speech.get("voice")
else:
try:
voice = (
args.get("voice")
if args.get("voice")
else app_model.app_model_config.text_to_speech_dict.get("voice")
)
voice = args.get("voice") or app_model.app_model_config.text_to_speech_dict.get("voice")
except Exception:
voice = None
response = AudioService.transcript_tts(app_model=app_model, text=text, message_id=message_id, voice=voice)
Expand Down
10 changes: 5 additions & 5 deletions api/controllers/console/app/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
conversation_pagination_fields,
conversation_with_summary_pagination_fields,
)
from libs.helper import datetime_string
from libs.helper import DatetimeString
from libs.login import login_required
from models.model import AppMode, Conversation, EndUser, Message, MessageAnnotation

Expand All @@ -36,8 +36,8 @@ def get(self, app_model):
raise Forbidden()
parser = reqparse.RequestParser()
parser.add_argument("keyword", type=str, location="args")
parser.add_argument("start", type=datetime_string("%Y-%m-%d %H:%M"), location="args")
parser.add_argument("end", type=datetime_string("%Y-%m-%d %H:%M"), location="args")
parser.add_argument("start", type=DatetimeString("%Y-%m-%d %H:%M"), location="args")
parser.add_argument("end", type=DatetimeString("%Y-%m-%d %H:%M"), location="args")
parser.add_argument(
"annotation_status", type=str, choices=["annotated", "not_annotated", "all"], default="all", location="args"
)
Expand Down Expand Up @@ -143,8 +143,8 @@ def get(self, app_model):
raise Forbidden()
parser = reqparse.RequestParser()
parser.add_argument("keyword", type=str, location="args")
parser.add_argument("start", type=datetime_string("%Y-%m-%d %H:%M"), location="args")
parser.add_argument("end", type=datetime_string("%Y-%m-%d %H:%M"), location="args")
parser.add_argument("start", type=DatetimeString("%Y-%m-%d %H:%M"), location="args")
parser.add_argument("end", type=DatetimeString("%Y-%m-%d %H:%M"), location="args")
parser.add_argument(
"annotation_status", type=str, choices=["annotated", "not_annotated", "all"], default="all", location="args"
)
Expand Down
Loading

0 comments on commit 854084e

Please sign in to comment.