From 97716ed8acb63c2d378eebe7216e6722d722bc0d Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 8 Jul 2024 18:18:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20D?= =?UTF-8?q?ataEase=20Copilot=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/api/dataset.ts | 22 + .../src/assets/svg/active-btn_copilot.svg | 14 + .../src/assets/svg/btn_copilot.svg | 4 + core/core-frontend/src/assets/svg/copilot.svg | 92 ++++ .../src/layout/components/Copilot.vue | 89 ++++ .../src/layout/components/Header.vue | 31 +- core/core-frontend/src/router/index.ts | 16 + .../src/views/copilot/DialogueChart.vue | 112 +++++ .../core-frontend/src/views/copilot/index.vue | 450 ++++++++++++++++++ 9 files changed, 829 insertions(+), 1 deletion(-) create mode 100644 core/core-frontend/src/assets/svg/active-btn_copilot.svg create mode 100644 core/core-frontend/src/assets/svg/btn_copilot.svg create mode 100644 core/core-frontend/src/assets/svg/copilot.svg create mode 100644 core/core-frontend/src/layout/components/Copilot.vue create mode 100644 core/core-frontend/src/views/copilot/DialogueChart.vue create mode 100644 core/core-frontend/src/views/copilot/index.vue diff --git a/core/core-frontend/src/api/dataset.ts b/core/core-frontend/src/api/dataset.ts index df843b335b..7d3c6daf5b 100644 --- a/core/core-frontend/src/api/dataset.ts +++ b/core/core-frontend/src/api/dataset.ts @@ -202,6 +202,10 @@ export const listFieldsWithPermissions = (datasetId: number) => { return request.get({ url: '/datasetField/listWithPermissions/' + datasetId }) } +export const copilotFields = (datasetId: number) => { + return request.post({ url: '/datasetField/copilotFields/' + datasetId }) +} + export const saveRowPermission = (data = {}) => { return request.post({ url: '/dataset/rowPermissions/save', data }) } @@ -299,3 +303,21 @@ export const getFieldTree = async (data): Promise => { return res?.data }) } + +export const copilotChat = async (data): Promise => { + return request.post({ url: '/copilot/chat', data }).then(res => { + return res?.data + }) +} + +export const getListCopilot = async (data): Promise => { + return request.post({ url: '/copilot/getList/' + data }).then(res => { + return res?.data + }) +} + +export const clearAllCopilot = async (data): Promise => { + return request.post({ url: '/copilot/clearAll/' + data }).then(res => { + return res?.data + }) +} diff --git a/core/core-frontend/src/assets/svg/active-btn_copilot.svg b/core/core-frontend/src/assets/svg/active-btn_copilot.svg new file mode 100644 index 0000000000..4cc82f4754 --- /dev/null +++ b/core/core-frontend/src/assets/svg/active-btn_copilot.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/core/core-frontend/src/assets/svg/btn_copilot.svg b/core/core-frontend/src/assets/svg/btn_copilot.svg new file mode 100644 index 0000000000..56b3df88ba --- /dev/null +++ b/core/core-frontend/src/assets/svg/btn_copilot.svg @@ -0,0 +1,4 @@ + + + + diff --git a/core/core-frontend/src/assets/svg/copilot.svg b/core/core-frontend/src/assets/svg/copilot.svg new file mode 100644 index 0000000000..9752905519 --- /dev/null +++ b/core/core-frontend/src/assets/svg/copilot.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/core-frontend/src/layout/components/Copilot.vue b/core/core-frontend/src/layout/components/Copilot.vue new file mode 100644 index 0000000000..14bba2251d --- /dev/null +++ b/core/core-frontend/src/layout/components/Copilot.vue @@ -0,0 +1,89 @@ + + + + diff --git a/core/core-frontend/src/layout/components/Header.vue b/core/core-frontend/src/layout/components/Header.vue index 5d2ff4bbf3..1e4ead91b0 100644 --- a/core/core-frontend/src/layout/components/Header.vue +++ b/core/core-frontend/src/layout/components/Header.vue @@ -19,6 +19,7 @@ import AiComponent from '@/layout/components/AiComponent.vue' import { findBaseParams } from '@/api/aiComponent' import ExportExcel from '@/views/visualized/data/dataset/ExportExcel.vue' import AiTips from '@/layout/components/AiTips.vue' +import Copilot from '@/layout/components/Copilot.vue' const appearanceStore = useAppearanceStoreWithOut() const { push } = useRouter() @@ -35,6 +36,10 @@ const handleAiClick = () => { useEmitt().emitter.emit('aiComponentChange') } +const handleCopilotClick = () => { + push('/copilot/index') +} + const desktop = isDesktop() const activeIndex = computed(() => { if (route.path.includes('system')) { @@ -52,6 +57,7 @@ const routers: any[] = formatRoute(permissionStore.getRoutersNotHidden as AppCus const showSystem = ref(false) const showToolbox = ref(false) const showOverlay = ref(true) +const showOverlayCopilot = ref(true) const handleSelect = (index: string) => { // 自定义事件 if (isExternal(index)) { @@ -84,14 +90,30 @@ const initAiBase = async () => { }) } +const initCopilotBase = async () => { + const aiCopilotCheck = wsCache.get('DE-COPILOT-TIPS-CHECK') + if (aiCopilotCheck === 'CHECKED') { + showOverlayCopilot.value = false + } else { + showOverlayCopilot.value = true + } +} + const aiTipsConfirm = () => { wsCache.set('DE-AI-TIPS-CHECK', 'CHECKED') showOverlay.value = false } + +const copilotConfirm = () => { + wsCache.set('DE-COPILOT-TIPS-CHECK', 'CHECKED') + showOverlayCopilot.value = false +} + onMounted(() => { initShowSystem() initShowToolbox() initAiBase() + initCopilotBase() useEmitt({ name: 'data-export-center', callback: function (params) { @@ -122,6 +144,11 @@ onMounted(() => {
+ + + + + { :base-url="aiBaseUrl" >
+
@@ -284,7 +312,8 @@ onMounted(() => { font-size: 24px !important; } -.ai-icon-tips { +.ai-icon-tips, +.copilot-icon-tips { font-size: 24px !important; z-index: 10001; } diff --git a/core/core-frontend/src/router/index.ts b/core/core-frontend/src/router/index.ts index 006703bae7..fa4b46f162 100644 --- a/core/core-frontend/src/router/index.ts +++ b/core/core-frontend/src/router/index.ts @@ -20,6 +20,22 @@ export const routes: AppRouteRecordRaw[] = [ } ] }, + { + path: '/copilot', + name: 'copilot', + component: () => import('@/layout/index.vue'), + hidden: true, + meta: {}, + children: [ + { + path: 'index', + name: 'cpt', + hidden: true, + component: () => import('@/views/copilot/index.vue'), + meta: { hidden: true } + } + ] + }, { path: '/notSupport', name: 'notSupport', diff --git a/core/core-frontend/src/views/copilot/DialogueChart.vue b/core/core-frontend/src/views/copilot/DialogueChart.vue new file mode 100644 index 0000000000..e133c863f4 --- /dev/null +++ b/core/core-frontend/src/views/copilot/DialogueChart.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/core/core-frontend/src/views/copilot/index.vue b/core/core-frontend/src/views/copilot/index.vue new file mode 100644 index 0000000000..983c3e2077 --- /dev/null +++ b/core/core-frontend/src/views/copilot/index.vue @@ -0,0 +1,450 @@ + + + + +