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.

feat: rename title in site both rename name in app (#857)

takatoste8c14bb732c8
diff --git a/api/controllers/console/app/app.py b/api/controllers/console/app/app.py
index cb7738e17ef..6d589cded54 100644
--- a/api/controllers/console/app/app.py
+++ b/api/controllers/console/app/app.py
@@ -397,29 +397,6 @@ class AppApiStatus(Resource):
return app
-class AppRateLimit(Resource):
- @setup_required
- @login_required
- @account_initialization_required
- @marshal_with(app_detail_fields)
- def post(self, app_id):
- parser = reqparse.RequestParser()
- parser.add_argument('api_rpm', type=inputs.natural, required=False, location='json')
- parser.add_argument('api_rph', type=inputs.natural, required=False, location='json')
- args = parser.parse_args()
-
- app_id = str(app_id)
- app = _get_app(app_id, current_user.current_tenant_id)
-
- if args.get('api_rpm'):
- app.api_rpm = args.get('api_rpm')
- if args.get('api_rph'):
- app.api_rph = args.get('api_rph')
- app.updated_at = datetime.utcnow()
- db.session.commit()
- return app
-
-
class AppCopy(Resource):
@staticmethod
def create_app_copy(app):
@@ -482,16 +459,6 @@ class AppCopy(Resource):
return copy_app, 201
-class AppExport(Resource):
-
- @setup_required
- @login_required
- @account_initialization_required
- def post(self, app_id):
- # todo
- pass
-
-
api.add_resource(AppListApi, '/apps')
api.add_resource(AppTemplateApi, '/app-templates')
api.add_resource(AppApi, '/apps/<uuid:app_id>')
@@ -500,4 +467,3 @@ api.add_resource(AppNameApi, '/apps/<uuid:app_id>/name')
api.add_resource(AppIconApi, '/apps/<uuid:app_id>/icon')
api.add_resource(AppSiteStatus, '/apps/<uuid:app_id>/site-enable')
api.add_resource(AppApiStatus, '/apps/<uuid:app_id>/api-enable')
-api.add_resource(AppRateLimit, '/apps/<uuid:app_id>/rate-limit')
diff --git a/api/controllers/console/app/site.py b/api/controllers/console/app/site.py
index 2e0e00a8817..952bf45303f 100644
--- a/api/controllers/console/app/site.py
+++ b/api/controllers/console/app/site.py
@@ -80,6 +80,13 @@ class AppSite(Resource):
if value is not None:
setattr(site, attr_name, value)
+ if attr_name == 'title':
+ app_model.name = value
+ elif attr_name == 'icon':
+ app_model.icon = value
+ elif attr_name == 'icon_background':
+ app_model.icon_background = value
+
db.session.commit()
return site
diff --git a/api/core/agent/agent/output_parser/structured_chat.py b/api/core/agent/agent/output_parser/structured_chat.py
index a3c62ba605a..e2841b67204 100644
--- a/api/core/agent/agent/output_parser/structured_chat.py
+++ b/api/core/agent/agent/output_parser/structured_chat.py
@@ -10,7 +10,7 @@ from langchain.schema import AgentAction, AgentFinish, OutputParserException
class StructuredChatOutputParser(LCStructuredChatOutputParser):
def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
try:
- action_match = re.search(r"```(.*?)\n(.*?)```?", text, re.DOTALL)
+ action_match = re.search(r"```(.*?)\n?(.*?)```", text, re.DOTALL)
if action_match is not None:
response = json.loads(action_match.group(2).strip(), strict=False)
if isinstance(response, list):