mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
feat: rename title in site both rename name in app (#857)
This commit is contained in:
parent
bf45f08e78
commit
e8c14bb732
|
@ -397,29 +397,6 @@ class AppApiStatus(Resource):
|
||||||
return app
|
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):
|
class AppCopy(Resource):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_app_copy(app):
|
def create_app_copy(app):
|
||||||
|
@ -482,16 +459,6 @@ class AppCopy(Resource):
|
||||||
return copy_app, 201
|
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(AppListApi, '/apps')
|
||||||
api.add_resource(AppTemplateApi, '/app-templates')
|
api.add_resource(AppTemplateApi, '/app-templates')
|
||||||
api.add_resource(AppApi, '/apps/<uuid:app_id>')
|
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(AppIconApi, '/apps/<uuid:app_id>/icon')
|
||||||
api.add_resource(AppSiteStatus, '/apps/<uuid:app_id>/site-enable')
|
api.add_resource(AppSiteStatus, '/apps/<uuid:app_id>/site-enable')
|
||||||
api.add_resource(AppApiStatus, '/apps/<uuid:app_id>/api-enable')
|
api.add_resource(AppApiStatus, '/apps/<uuid:app_id>/api-enable')
|
||||||
api.add_resource(AppRateLimit, '/apps/<uuid:app_id>/rate-limit')
|
|
||||||
|
|
|
@ -80,6 +80,13 @@ class AppSite(Resource):
|
||||||
if value is not None:
|
if value is not None:
|
||||||
setattr(site, attr_name, value)
|
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()
|
db.session.commit()
|
||||||
|
|
||||||
return site
|
return site
|
||||||
|
|
|
@ -10,7 +10,7 @@ from langchain.schema import AgentAction, AgentFinish, OutputParserException
|
||||||
class StructuredChatOutputParser(LCStructuredChatOutputParser):
|
class StructuredChatOutputParser(LCStructuredChatOutputParser):
|
||||||
def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
|
def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
|
||||||
try:
|
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:
|
if action_match is not None:
|
||||||
response = json.loads(action_match.group(2).strip(), strict=False)
|
response = json.loads(action_match.group(2).strip(), strict=False)
|
||||||
if isinstance(response, list):
|
if isinstance(response, list):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user