Skip to content

Commit 7907751

Browse files
perf: Assistant embed
1 parent 0050dfd commit 7907751

File tree

9 files changed

+383
-88
lines changed

9 files changed

+383
-88
lines changed

frontend/assistant.html

Lines changed: 0 additions & 19 deletions
This file was deleted.

frontend/public/assistant.js

Lines changed: 369 additions & 0 deletions
Large diffs are not rendered by default.

frontend/src/main_assistant.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

frontend/src/router/assistant.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

frontend/src/router/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import DashboardEditor from '@/views/dashboard/editor/index.vue'
1010
import DashboardPreview from '@//views/dashboard/preview/SQPreviewSingle.vue'
1111
import Dashboard from '@/views/dashboard/index.vue'
1212
import Model from '@/views/system/model/Model.vue'
13+
import assistant from '@/views/embedded/assistant.vue'
1314
// import User from "@/views/system/user/index.vue";
1415
import { watchRouter } from './watch'
1516
const router = createRouter({
@@ -128,6 +129,11 @@ const router = createRouter({
128129
},
129130
],
130131
},
132+
{
133+
path: '/assistant',
134+
name: 'assistant',
135+
component: assistant,
136+
},
131137
],
132138
})
133139
watchRouter(router)

frontend/src/router/watch.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ import { request } from '@/utils/request'
55
const userStore = useUserStore()
66
const { wsCache } = useCache()
77
const whiteList = ['/login']
8+
const assistantWhiteList = ['/assistant']
89
export const watchRouter = (router: any) => {
910
router.beforeEach(async (to: any, from: any, next: any) => {
1011
await loadXpackStatic()
12+
if (assistantWhiteList.includes(to.path)) {
13+
next()
14+
return
15+
}
1116
const token = wsCache.get('user.token')
1217
if (whiteList.includes(to.path)) {
1318
next()

frontend/src/router/watch_assistant.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

frontend/src/views/embedded/assistant.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ const validator = ref({
9595
})
9696
const loading = ref(true)
9797
onBeforeMount(async () => {
98-
const assistantId = route.params.id
98+
const assistantId = route.query.id
99+
const online = route.query.online
100+
console.log(online)
99101
const now = Date.now()
100102
assistantStore.setFlag(now)
101103
const id = `${assistantId}-${assistantStore.getFlag}`

frontend/vite.config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ export default defineConfig(({ mode }) => {
3939
build: {
4040
chunkSizeWarningLimit: 2000,
4141
rollupOptions: {
42-
input: {
43-
main: path.resolve(__dirname, 'index.html'),
44-
assistant: path.resolve(__dirname, 'assistant.html'),
45-
},
4642
output: {
4743
manualChunks: {
4844
'element-plus-secondary': ['element-plus-secondary'],

0 commit comments

Comments
 (0)