From 5f3f1dd2cac4938846e7ca0e98c1a7256f2972c6 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:52:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=98=BE=E7=A4=BA=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serializers/application_serializers.py | 19 +- apps/application/template/embed.js | 40 +--- apps/common/models/db_model_manage.py | 35 +++ apps/common/models/handle/base_handle.py | 15 ++ .../handle/impl/default_base_model_handle.py | 14 ++ apps/smartdoc/wsgi.py | 2 + ui/src/api/application-xpack.ts | 53 +++++ ui/src/components/ai-chat/index.vue | 14 +- ui/src/components/layout-container/index.vue | 2 +- .../components/top-bar/avatar/AboutDialog.vue | 25 +- .../lang/en_US/views/application-overview.ts | 205 +++++++++-------- .../lang/zh_CN/views/application-overview.ts | 204 +++++++++-------- ui/src/stores/modules/application.ts | 56 ++++- ui/src/stores/modules/user.ts | 11 +- .../component/DisplaySettingDialog.vue | 213 ++++++++++++++++++ .../component/LimitDialog.vue | 8 +- ui/src/views/application-overview/index.vue | 52 +++-- ui/src/views/authentication/index.vue | 12 +- ui/src/views/chat/base/index.vue | 7 +- ui/src/views/chat/embed/index.vue | 17 +- ui/src/views/chat/index.vue | 28 ++- ui/src/views/chat/pc/index.vue | 12 +- ui/src/views/login/index.vue | 2 +- ui/src/views/theme/index.vue | 6 +- 24 files changed, 747 insertions(+), 305 deletions(-) create mode 100644 apps/common/models/db_model_manage.py create mode 100644 apps/common/models/handle/base_handle.py create mode 100644 apps/common/models/handle/impl/default_base_model_handle.py create mode 100644 ui/src/api/application-xpack.ts create mode 100644 ui/src/views/application-overview/component/DisplaySettingDialog.vue diff --git a/apps/application/serializers/application_serializers.py b/apps/application/serializers/application_serializers.py index 7e85ffc4a..692a17843 100644 --- a/apps/application/serializers/application_serializers.py +++ b/apps/application/serializers/application_serializers.py @@ -32,6 +32,7 @@ from common.db.search import get_dynamics_model, native_search, native_page_sear from common.db.sql_execute import select_list from common.exception.app_exception import AppApiException, NotFound404, AppUnauthorizedFailed from common.field.common import UploadedImageField +from common.models.db_model_manage import DBModelManage from common.util.common import valid_license from common.util.field_message import ErrMessage from common.util.file_util import get_file_content @@ -194,10 +195,19 @@ class ApplicationSerializer(serializers.Serializer): file.close() application_access_token = QuerySet(ApplicationAccessToken).filter( access_token=self.data.get('token')).first() + is_draggable = 'false' + show_guide = 'true' + float_icon = f"{self.data.get('protocol')}://{self.data.get('host')}/ui/favicon.ico" + application_setting_model = DBModelManage.get_model('application_setting') + if application_setting_model is not None: + application_setting = QuerySet(application_setting_model).filter( + application_id=application_access_token.application_id).first() + if application_setting is not None: + is_draggable = 'true' if application_setting.is_draggable else 'false' + float_icon = f"{self.data.get('protocol')}://{self.data.get('host')}{application_setting.float_icon}" + show_guide = 'true' if application_setting else 'false' is_auth = 'true' if application_access_token is not None and application_access_token.is_active else 'false' - application_access_token = QuerySet(ApplicationAccessToken).filter( - access_token=self.data.get('token')).first() t = Template(content) s = t.render( Context( @@ -205,7 +215,10 @@ class ApplicationSerializer(serializers.Serializer): 'token': self.data.get('token'), 'white_list_str': ",".join( application_access_token.white_list), - 'white_active': 'true' if application_access_token.white_active else 'false'})) + 'white_active': 'true' if application_access_token.white_active else 'false', + 'is_draggable': is_draggable, + 'float_icon': float_icon, + 'show_guide': show_guide})) response = HttpResponse(s, status=200, headers={'Content-Type': 'text/javascript'}) return response diff --git a/apps/application/template/embed.js b/apps/application/template/embed.js index ec4e6b9f2..7006984dd 100644 --- a/apps/application/template/embed.js +++ b/apps/application/template/embed.js @@ -19,34 +19,8 @@ const guideHtml=` ` const chatButtonHtml= -`