diff --git a/frontend/assistant.html b/frontend/assistant.html
new file mode 100644
index 00000000..c65334fd
--- /dev/null
+++ b/frontend/assistant.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ SQLBot
+
+
+
+
+
+
+
diff --git a/frontend/src/assets/img/assistant.gif b/frontend/src/assets/img/assistant.gif
new file mode 100644
index 00000000..055d49a6
Binary files /dev/null and b/frontend/src/assets/img/assistant.gif differ
diff --git a/frontend/src/assets/svg/chart/history.svg b/frontend/src/assets/svg/chart/history.svg
new file mode 100644
index 00000000..b10edcd9
--- /dev/null
+++ b/frontend/src/assets/svg/chart/history.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/frontend/src/main_assistant.ts b/frontend/src/main_assistant.ts
new file mode 100644
index 00000000..b458a6c6
--- /dev/null
+++ b/frontend/src/main_assistant.ts
@@ -0,0 +1,11 @@
+import { createApp } from 'vue'
+import './style.less'
+import App from './App.vue'
+import router from './router/assistant'
+import { i18n } from './i18n'
+
+const app = createApp(App)
+
+app.use(router)
+app.use(i18n)
+app.mount('#sqlbot_embedded_app')
diff --git a/frontend/src/router/assistant.ts b/frontend/src/router/assistant.ts
new file mode 100644
index 00000000..0bcbbf88
--- /dev/null
+++ b/frontend/src/router/assistant.ts
@@ -0,0 +1,21 @@
+import { createRouter, createWebHashHistory } from 'vue-router'
+
+import assistant from '@/views/embedded/assistant.vue'
+import { watchRouter } from './watch_assistant'
+const router = createRouter({
+ history: createWebHashHistory(),
+ routes: [
+ {
+ path: '/',
+ name: 'index',
+ component: assistant,
+ },
+ {
+ path: '/assistant',
+ name: 'assistant',
+ component: assistant,
+ },
+ ],
+})
+watchRouter(router)
+export default router
diff --git a/frontend/src/router/watch_assistant.ts b/frontend/src/router/watch_assistant.ts
new file mode 100644
index 00000000..1e0fcbcb
--- /dev/null
+++ b/frontend/src/router/watch_assistant.ts
@@ -0,0 +1,32 @@
+import { ElMessage } from 'element-plus-secondary'
+
+import { request } from '@/utils/request'
+
+export const watchRouter = (router: any) => {
+ router.beforeEach(async (to: any, from: any, next: any) => {
+ console.log(to, from)
+ await loadXpackStatic()
+ next()
+ })
+}
+const loadXpackStatic = () => {
+ if (document.getElementById('sqlbot_xpack_static')) {
+ return Promise.resolve()
+ }
+ const url = '/xpack_static/license-generator.umd.js'
+ return new Promise((resolve, reject) => {
+ request
+ .loadRemoteScript(url, 'sqlbot_xpack_static', () => {
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
+ LicenseGenerator?.init(import.meta.env.VITE_API_BASE_URL).then(() => {
+ resolve(true)
+ })
+ })
+ .catch((error) => {
+ console.error('Failed to load xpack_static script:', error)
+ ElMessage.error('Failed to load license generator script')
+ reject(error)
+ })
+ })
+}
diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue
index acbd890f..68c0c1a5 100644
--- a/frontend/src/views/chat/index.vue
+++ b/frontend/src/views/chat/index.vue
@@ -645,6 +645,20 @@ const handleCtrlEnter = (e: KeyboardEvent) => {
textarea.selectionStart = textarea.selectionEnd = start + 1
})
}
+
+const getHistoryList = () => {
+ return chatList.value
+}
+const getCurrentChatId = () => {
+ return currentChatId.value
+}
+defineExpose({
+ getHistoryList,
+ onClickHistory,
+ onChatDeleted,
+ onChatRenamed,
+ getCurrentChatId,
+})
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 89a1405a..8e88d435 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -39,6 +39,10 @@ export default defineConfig(({ mode }) => {
build: {
chunkSizeWarningLimit: 2000,
rollupOptions: {
+ input: {
+ main: path.resolve(__dirname, 'index.html'),
+ assistant: path.resolve(__dirname, 'assistant.html'),
+ },
output: {
manualChunks: {
'element-plus-secondary': ['element-plus-secondary'],
@@ -46,16 +50,6 @@ export default defineConfig(({ mode }) => {
},
},
},
- // server: {
- // proxy: {
- // '/api': {
- // target: 'https://sqlbot.fit2cloud.cn',
- // changeOrigin: true,
- // rewrite: path => path.replace(/^\/api/, 'api')
- // }
- // },
- // port: 8080
- // },
esbuild: {
jsxFactory: 'h',
jsxFragment: 'Fragment',