Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: save site setting not work (#14700)

非法操作4125e575af6b
diff --git a/api/controllers/console/app/site.py b/api/controllers/console/app/site.py
index c5a9c4d76e3..f15f9d4dae0 100644
--- a/api/controllers/console/app/site.py
+++ b/api/controllers/console/app/site.py
@@ -2,7 +2,6 @@ from datetime import UTC, datetime
from flask_login import current_user # type: ignore
from flask_restful import Resource, marshal_with, reqparse # type: ignore
-from sqlalchemy.orm import Session
from werkzeug.exceptions import Forbidden, NotFound
from constants.languages import supported_language
@@ -51,37 +50,35 @@ class AppSite(Resource):
if not current_user.is_editor:
raise Forbidden()
- with Session(db.engine) as session:
- site = session.query(Site).filter(Site.app_id == app_model.id).first()
-
- if not site:
- raise NotFound
-
- for attr_name in [
- "title",
- "icon_type",
- "icon",
- "icon_background",
- "description",
- "default_language",
- "chat_color_theme",
- "chat_color_theme_inverted",
- "customize_domain",
- "copyright",
- "privacy_policy",
- "custom_disclaimer",
- "customize_token_strategy",
- "prompt_public",
- "show_workflow_steps",
- "use_icon_as_answer_icon",
- ]:
- value = args.get(attr_name)
- if value is not None:
- setattr(site, attr_name, value)
-
- site.updated_by = current_user.id
- site.updated_at = datetime.now(UTC).replace(tzinfo=None)
- session.commit()
+ site = db.session.query(Site).filter(Site.app_id == app_model.id).first()
+ if not site:
+ raise NotFound
+
+ for attr_name in [
+ "title",
+ "icon_type",
+ "icon",
+ "icon_background",
+ "description",
+ "default_language",
+ "chat_color_theme",
+ "chat_color_theme_inverted",
+ "customize_domain",
+ "copyright",
+ "privacy_policy",
+ "custom_disclaimer",
+ "customize_token_strategy",
+ "prompt_public",
+ "show_workflow_steps",
+ "use_icon_as_answer_icon",
+ ]:
+ value = args.get(attr_name)
+ if value is not None:
+ setattr(site, attr_name, value)
+
+ site.updated_by = current_user.id
+ site.updated_at = datetime.now(UTC).replace(tzinfo=None)
+ db.session.commit()
return site