From 12e988dce7bada37c6aeb1c8cf47bb04a99c5d86 Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:17:38 +0800 Subject: [PATCH 0001/1234] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ad8c35b6..819fdd599 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ SQLBot 是一款基于大模型和 RAG 的智能问数系统。SQLBot 的优势包括: - **开箱即用**: 只需配置大模型和数据源即可开启问数之旅,通过大模型和 RAG 的结合来实现高质量的 text2sql; -- **易于集成**: 支持快速嵌入到第三方业务系统,也支持被 n8n、MaxKB、Dify 、Coze 等 AI 应用开发平台集成调用,让各类应用快速拥有智能问数能力; +- **易于集成**: 支持快速嵌入到第三方业务系统,也支持被 n8n、MaxKB、Dify、Coze 等 AI 应用开发平台集成调用,让各类应用快速拥有智能问数能力; - **安全可控**: 提供基于工作空间的资源隔离机制,能够实现细粒度的数据权限控制。 ## 快速开始 From ad8064596395248ffd03b05a190aa2aeecad686b Mon Sep 17 00:00:00 2001 From: zhangliqiang Date: Thu, 7 Aug 2025 11:17:27 +0800 Subject: [PATCH 0002/1234] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 819fdd599..eadda3542 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ docker compose up -d - [DataEase](https://github.com/dataease/dataease/) - 人人可用的开源 BI 工具 - [1Panel](https://github.com/1panel-dev/1panel/) - 现代化、开源的 Linux 服务器运维管理面板 -- [MaxKB](https://github.com/1panel-dev/MaxKB/) - 基于 LLM 大语言模型的开源知识库问答系统 +- [MaxKB](https://github.com/1panel-dev/MaxKB/) - 强大易用的企业级智能体平台 - [JumpServer](https://github.com/jumpserver/jumpserver/) - 广受欢迎的开源堡垒机 - [Halo](https://github.com/halo-dev/halo/) - 强大易用的开源建站工具 - [MeterSphere](https://github.com/metersphere/metersphere/) - 新一代的开源持续测试工具 From 30bdecf7eb581f4ae2eb755bbc2843527a25b71e Mon Sep 17 00:00:00 2001 From: lan-yonghui Date: Thu, 7 Aug 2025 11:39:00 +0800 Subject: [PATCH 0003/1234] refactor: improve code --- frontend/src/components/layout/Workspace.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/layout/Workspace.vue b/frontend/src/components/layout/Workspace.vue index 112559471..63d2335a4 100644 --- a/frontend/src/components/layout/Workspace.vue +++ b/frontend/src/components/layout/Workspace.vue @@ -1,5 +1,5 @@ + + diff --git a/frontend/src/stores/appearance.ts b/frontend/src/stores/appearance.ts new file mode 100644 index 000000000..6697264eb --- /dev/null +++ b/frontend/src/stores/appearance.ts @@ -0,0 +1,354 @@ +import { defineStore } from 'pinia' +import { store } from '@/stores/index' +// import { defaultFont, list } from '@/api/font' +// import { uiLoadApi } from '@/api/login' +import colorFunctions from 'less/lib/less/functions/color.js' +import colorTree from 'less/lib/less/tree/color.js' +import { setTitle } from '@/utils/utils' + +const basePath = import.meta.env.VITE_API_BASEPATH +const baseUrl = basePath + '/appearance/image/' +import { isBtnShow } from '@/utils/utils' +import type { LinkHTMLAttributes } from 'vue' +interface AppearanceState { + themeColor?: string + customColor?: string + navigateBg?: string + navigate?: string + mobileLogin?: string + mobileLoginBg?: string + help?: string + showAi?: string + showCopilot?: string + showDoc?: string + showAbout?: string + bg?: string + login?: string + slogan?: string + web?: string + name?: string + foot?: string + footContent?: string + loaded: boolean + showDemoTips?: boolean + demoTipsContent?: string + community: boolean + fontList?: Array<{ name: string; id: string; isDefault: boolean }> +} + +interface KeyValue { + pkey: string + pval: string +} +// const { wsCache } = useCache() +export const useAppearanceStore = defineStore('appearanceStore', { + state: (): AppearanceState => { + return { + themeColor: '', + customColor: '', + navigateBg: '', + navigate: '', + mobileLogin: '', + mobileLoginBg: '', + help: '', + showDoc: '0', + showAi: '0', + showCopilot: '0', + showAbout: '0', + bg: '', + login: '', + slogan: '', + web: '', + name: '', + foot: 'false', + footContent: '', + loaded: false, + showDemoTips: false, + demoTipsContent: '', + community: true, + fontList: [], + } + }, + getters: { + getNavigate(): string { + if (this.navigate) { + return baseUrl + this.navigate + } + return null! + }, + getMobileLogin(): string { + if (this.mobileLogin) { + return baseUrl + this.mobileLogin + } + return null! + }, + getMobileLoginBg(): string { + if (this.mobileLoginBg) { + return baseUrl + this.mobileLoginBg + } + return null! + }, + getHelp(): string { + return this.help! + }, + getThemeColor(): string { + return this.themeColor! + }, + getCustomColor(): string { + return this.customColor! + }, + getNavigateBg(): string { + return this.navigateBg! + }, + getBg(): string { + if (this.bg) { + return baseUrl + this.bg + } + return null! + }, + getLogin(): string { + if (this.login) { + return baseUrl + this.login + } + return null! + }, + getSlogan(): string { + return this.slogan! + }, + getWeb(): string { + if (this.web) { + return baseUrl + this.web + } + return null! + }, + getName(): string { + return this.name! + }, + getLoaded(): boolean { + return this.loaded + }, + getFoot(): string { + return this.foot! + }, + getFootContent(): string { + return this.footContent! + }, + getShowDemoTips(): boolean { + return this.showDemoTips! + }, + getDemoTipsContent(): string { + return this.demoTipsContent! + }, + getCommunity(): boolean { + return this.community + }, + getShowAi(): boolean { + return isBtnShow(this.showAi!) + }, + getShowCopilot(): boolean { + return isBtnShow(this.showCopilot!) + }, + getShowDoc(): boolean { + return isBtnShow(this.showDoc!) + }, + getShowAbout(): boolean { + return isBtnShow(this.showAbout!) + }, + }, + actions: { + setNavigate(data: string) { + this.navigate = data + }, + setMobileLogin(data: string) { + this.mobileLogin = data + }, + // async setFontList() { + // const res = await list() + // this.fontList = res || [] + // }, + // setCurrentFont(name) { + // const currentFont = this.fontList.find(ele => ele.name === name) + // if (currentFont) { + // let fontStyleElement = document.querySelector(`#de-custom_font${name}`) + // if (!fontStyleElement) { + // fontStyleElement = document.createElement('style') + // fontStyleElement.setAttribute('id', `de-custom_font${name}`) + // document.querySelector('head').appendChild(fontStyleElement) + // } + // fontStyleElement.innerHTML = `@font-face { + // font-family: '${name}'; + // src: url(${ + // embeddedStore.baseUrl + // ? (embeddedStore.baseUrl + basePath).replace('/./', '/') + // : basePath + // }/typeface/download/${currentFont.fileTransName}); + // font-weight: normal; + // font-style: normal; + // }` + // } + // }, + setMobileLoginBg(data: string) { + this.mobileLoginBg = data + }, + setHelp(data: string) { + this.help = data + }, + setNavigateBg(data: string) { + this.navigateBg = data + }, + setThemeColor(data: string) { + this.themeColor = data + }, + setCustomColor(data: string) { + this.customColor = data + }, + setLoaded(data: boolean) { + this.loaded = data + }, + async setAppearance(isDataEaseBi?: boolean) { + // const desktop = wsCache.get('app.desktop') + // if (desktop) { + // this.loaded = true + // this.community = true + // } + if (this.loaded) { + return + } + // defaultFont().then(res => { + // const [font] = res || [] + // setDefaultFont( + // `${ + // embeddedStore.baseUrl + // ? (embeddedStore.baseUrl + basePath).replace('/./', '/') + // : basePath + // }/typeface/download/${font?.fileTransName}`, + // font?.name, + // font?.fileTransName + // ) + // function setDefaultFont(url, name, fileTransName) { + // let fontStyleElement = document.querySelector('#de-custom_font') + // if (!fontStyleElement) { + // fontStyleElement = document.createElement('style') + // fontStyleElement.setAttribute('id', 'de-custom_font') + // document.querySelector('head').appendChild(fontStyleElement) + // } + // fontStyleElement.innerHTML = + // name && fileTransName + // ? `@font-face { + // font-family: '${name}'; + // src: url(${url}); + // font-weight: normal; + // font-style: normal; + // }` + // : '' + // document.documentElement.style.setProperty('--de-custom_font', `${name}`) + // document.documentElement.style.setProperty('--van-base-font', `${name}`) + // } + // }) + // if (!isDataEaseBi) { + // document.title = '' + // } + // const res = await uiLoadApi() + const res = { data: [] } + this.loaded = true + const resData = res.data + // if (!resData?.length) { + // if (!isDataEaseBi) { + // document.title = 'SQLBot' + // setLinkIcon() + // } + // return + // } + const data: AppearanceState = { loaded: false, community: true } + let isCommunity = false + resData.forEach((item: KeyValue) => { + ;( + data as { + [key: string]: any + } + )[item.pkey] = item.pval + if (item.pkey === 'community') { + isCommunity = true + } + }) + data.community = isCommunity + this.community = data.community + if (this.community) { + this.showDemoTips = data.showDemoTips + this.demoTipsContent = data.demoTipsContent + this.loaded = true + setLinkIcon() + return + } + this.navigate = data.navigate + this.mobileLogin = data.mobileLogin + this.mobileLoginBg = data.mobileLoginBg + this.help = data.help + this.showAi = data.showAi + this.showCopilot = data.showCopilot + this.showDoc = data.showDoc + this.showAbout = data.showAbout + this.navigateBg = data.navigateBg + this.themeColor = data.themeColor + this.customColor = data.customColor + const currentColor = + this.themeColor === 'custom' && this.customColor ? this.customColor : '#1CBA90' + document.documentElement.style.setProperty('--ed-color-primary', currentColor) + document.documentElement.style.setProperty('--van-blue', currentColor) + document.documentElement.style.setProperty( + '--ed-color-primary-light-5', + colorFunctions + .mix(new colorTree('ffffff'), new colorTree(currentColor.substr(1)), { value: 40 }) + .toRGB() + ) + document.documentElement.style.setProperty( + '--ed-color-primary-light-3', + colorFunctions + .mix(new colorTree('ffffff'), new colorTree(currentColor.substr(1)), { value: 15 }) + .toRGB() + ) + document.documentElement.style.setProperty('--ed-color-primary-1a', `${currentColor}1a`) + document.documentElement.style.setProperty('--ed-color-primary-14', `${currentColor}14`) + document.documentElement.style.setProperty('--ed-color-primary-33', `${currentColor}33`) + document.documentElement.style.setProperty('--ed-color-primary-99', `${currentColor}99`) + document.documentElement.style.setProperty( + '--ed-color-primary-dark-2', + colorFunctions + .mix(new colorTree('000000'), new colorTree(currentColor.substr(1)), { value: 15 }) + .toRGB() + ) + + this.bg = data.bg + this.login = data.login + this.slogan = data.slogan + this.web = data.web + this.name = data.name + this.foot = data.foot + this.footContent = data.footContent + if (isDataEaseBi) return + if (this.name) { + document.title = this.name + setTitle(this.name) + } else { + document.title = 'SQLBot' + setTitle('SQLBot') + } + setLinkIcon(this.web) + }, + }, +}) + +const setLinkIcon = (linkWeb?: string) => { + const link = document.querySelector('link[rel="icon"]') as LinkHTMLAttributes + if (link) { + if (linkWeb) { + link['href'] = baseUrl + linkWeb + } else { + link['href'] = '/LOGO-fold.svg' + } + } +} + +export const useAppearanceStoreWithOut = () => { + return useAppearanceStore(store) +} diff --git a/frontend/src/utils/url.ts b/frontend/src/utils/url.ts new file mode 100644 index 000000000..ed03dd389 --- /dev/null +++ b/frontend/src/utils/url.ts @@ -0,0 +1,3 @@ +export const formatDataEaseBi = (url: string) => { + return url +} diff --git a/frontend/src/views/system/appearance/LoginPreview.vue b/frontend/src/views/system/appearance/LoginPreview.vue new file mode 100644 index 000000000..ccf89755d --- /dev/null +++ b/frontend/src/views/system/appearance/LoginPreview.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/frontend/src/views/system/appearance/Person.vue b/frontend/src/views/system/appearance/Person.vue new file mode 100644 index 000000000..ac6557b9d --- /dev/null +++ b/frontend/src/views/system/appearance/Person.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/frontend/src/views/system/appearance/index.vue b/frontend/src/views/system/appearance/index.vue new file mode 100644 index 000000000..382971229 --- /dev/null +++ b/frontend/src/views/system/appearance/index.vue @@ -0,0 +1,1007 @@ + + + + + From 5fd3606f6b1d5af61bda42428492a27d38ad8334 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 7 Aug 2025 17:56:22 +0800 Subject: [PATCH 0019/1234] feat(appearance): appearance set --- frontend/src/views/system/appearance/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/views/system/appearance/index.vue b/frontend/src/views/system/appearance/index.vue index 382971229..ab0de18c0 100644 --- a/frontend/src/views/system/appearance/index.vue +++ b/frontend/src/views/system/appearance/index.vue @@ -231,6 +231,7 @@ interface ConfigItem { } const showAbout = ref(true) const showDoc = ref(true) +const input = ref('') const COLOR_PANEL = [ '#FF4500', '#FF8C00', From c0eb5822af3cccc7eaf19a21248f5ed8906e1e80 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 7 Aug 2025 18:01:54 +0800 Subject: [PATCH 0020/1234] feat(appearance): appearance set --- .../src/views/system/appearance/index.vue | 110 ------------------ 1 file changed, 110 deletions(-) diff --git a/frontend/src/views/system/appearance/index.vue b/frontend/src/views/system/appearance/index.vue index ab0de18c0..ca85959b2 100644 --- a/frontend/src/views/system/appearance/index.vue +++ b/frontend/src/views/system/appearance/index.vue @@ -810,116 +810,6 @@ onUnmounted(() => { } } } - .mobile-fake { - display: flex; - align-items: center; - justify-content: center; - background: #ffffff; - border-radius: 6px; - padding-top: 24px; - .mobile-canvas { - transform: scale(0.6); - transform-origin: top; - border-radius: 30px; - width: 419px; - height: 852px; - overflow: hidden; - background-size: 100% 100% !important; - position: relative; - background-image: url(@/assets/img/mobile-bg-pc.png); - padding: 0 22px; - - .mobile-header { - margin-top: 20px; - height: 43px; - display: flex; - img { - height: 100%; - width: 100%; - } - } - - .config-panel-title { - height: 44px; - display: flex; - align-items: center; - justify-content: center; - background: #fff; - position: relative; - border-top-right-radius: 4px; - border-top-left-radius: 4px; - } - - .config-panel-content { - width: 100%; - height: calc(100% - 127px); - border-bottom-left-radius: 45px; - border-bottom-right-radius: 45px; - overflow: hidden; - - .login-mobile_color { - width: 100%; - height: 100%; - position: relative; - .mobile-login-content { - background: linear-gradient( - 180deg, - rgba(255, 255, 255, 0.94) 0%, - #ffffff 58.86% - ); - position: absolute; - bottom: 0; - left: 0; - border-top-right-radius: 20px; - border-top-left-radius: 20px; - overflow: hidden; - width: 100%; - height: 70%; - padding: 24px 16px; - z-index: 10; - - .mobile-login-welcome { - font-size: 22px; - font-weight: 500; - line-height: 30px; - margin-top: 10px; - } - - .login-input_fake { - position: relative; - width: 100%; - height: 48px; - border: 1px solid #bbbfc4; - border-radius: 6px; - margin: 16px 0; - padding: 12px 16px; - border-color: rgb(187, 191, 196); - } - } - } - - &.with-bg { - background-size: contain; - background-repeat: no-repeat; - background-image: url(@/assets/img/bg-mobile.png); - } - - .mobile-login_bg { - width: 100%; - height: 100%; - position: relative; - z-index: 1; - } - } - } - } - .tips-page { - font-size: 14px; - font-weight: 400; - line-height: 22px; - color: #8f959e; - margin-top: 6px; - } } .config-list { From 553faa5faba929dbfc7d77814140e4894ec69624 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 7 Aug 2025 18:10:50 +0800 Subject: [PATCH 0021/1234] perf: Frontend router --- frontend/src/router/watch.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/router/watch.ts b/frontend/src/router/watch.ts index a8c9ea10f..f6f2c622d 100644 --- a/frontend/src/router/watch.ts +++ b/frontend/src/router/watch.ts @@ -14,6 +14,10 @@ export const watchRouter = (router: any) => { await loadXpackStatic() await appearanceStore.setAppearance() LicenseGenerator.generateRouters(router) + if (to.path.startsWith('/login') && userStore.getUid) { + next('/') + return + } if (assistantWhiteList.includes(to.path)) { next() return From fc13d41755f80939468be8ad454074f3f0c0de77 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 8 Aug 2025 10:04:53 +0800 Subject: [PATCH 0022/1234] feat(assistant): Added a new assistant debugging page --- frontend/embedded.html | 13 +++++++++++++ frontend/src/embedded.ts | 17 +++++++++++++++++ frontend/src/router/index.ts | 7 +++++++ frontend/src/views/system/embedded/Test.vue | 9 +++++++++ 4 files changed, 46 insertions(+) create mode 100644 frontend/embedded.html create mode 100644 frontend/src/embedded.ts create mode 100644 frontend/src/views/system/embedded/Test.vue diff --git a/frontend/embedded.html b/frontend/embedded.html new file mode 100644 index 000000000..12c49178f --- /dev/null +++ b/frontend/embedded.html @@ -0,0 +1,13 @@ + + + + + + + SQLBot + + +
+ + + diff --git a/frontend/src/embedded.ts b/frontend/src/embedded.ts new file mode 100644 index 000000000..f81e9fcbe --- /dev/null +++ b/frontend/src/embedded.ts @@ -0,0 +1,17 @@ +import { createApp } from 'vue' +import { createPinia } from 'pinia' +import './style.less' +import App from './App.vue' +import router from './router' +import { i18n } from './i18n' +import VueDOMPurifyHTML from 'vue-dompurify-html' + +// import 'element-plus/dist/index.css' +const app = createApp(App) +const pinia = createPinia() + +app.use(pinia) +app.use(router) +app.use(i18n) +app.use(VueDOMPurifyHTML) +app.mount('#app') diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 3b9b0d7f6..638cd5450 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -11,6 +11,7 @@ import DashboardPreview from '@//views/dashboard/preview/SQPreviewSingle.vue' import Dashboard from '@/views/dashboard/index.vue' import Model from '@/views/system/model/Model.vue' import Embedded from '@/views/system/embedded/index.vue' +import assistantTest from '@/views/system/embedded/Test.vue' import assistant from '@/views/embedded/index.vue' import Member from '@/views/system/member/index.vue' import Appearance from '@/views/system/appearance/index.vue' @@ -180,6 +181,12 @@ export const routes = [ name: 'assistant', component: assistant, }, + + { + path: '/assistantTest', + name: 'assistantTest', + component: assistantTest, + }, ] const router = createRouter({ history: createWebHashHistory(), diff --git a/frontend/src/views/system/embedded/Test.vue b/frontend/src/views/system/embedded/Test.vue new file mode 100644 index 000000000..ae70a0d8f --- /dev/null +++ b/frontend/src/views/system/embedded/Test.vue @@ -0,0 +1,9 @@ + From a4d2543bba5229a2384ba87dba5ceb0c2b530a79 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 8 Aug 2025 10:16:20 +0800 Subject: [PATCH 0023/1234] fix(Embedded): The assistant modifies the prompt information from full screen to enlarged --- frontend/src/views/chat/chat-block/ChartBlock.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue index 13cdaf11b..2d27e1aaa 100644 --- a/frontend/src/views/chat/chat-block/ChartBlock.vue +++ b/frontend/src/views/chat/chat-block/ChartBlock.vue @@ -395,7 +395,11 @@ watch( -->
- + @@ -404,7 +408,11 @@ watch(
- + From 7a28587e6618bfa83827cd534dc8969e25f71e2a Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 8 Aug 2025 10:17:22 +0800 Subject: [PATCH 0024/1234] fix(Embedded): correct Assistant-Basic Application-Basic Information Application name, prompts and other information --- .../src/assets/svg/icon_admin_outlined.svg | 6 +++--- frontend/src/i18n/en.json | 3 +++ frontend/src/i18n/zh-CN.json | 7 +++++-- frontend/src/views/system/embedded/index.vue | 6 ++---- frontend/src/views/system/model/Card.vue | 20 ++++++++++++++++--- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/frontend/src/assets/svg/icon_admin_outlined.svg b/frontend/src/assets/svg/icon_admin_outlined.svg index 08447d7f5..f74a759ba 100644 --- a/frontend/src/assets/svg/icon_admin_outlined.svg +++ b/frontend/src/assets/svg/icon_admin_outlined.svg @@ -1,4 +1,4 @@ - - - + + + diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index b9a86a053..ce90511c9 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -6,6 +6,9 @@ "AI Model Configuration": "AI Model Configuration" }, "common": { + "zoom_in": "Zoom in", + "zoom_out": "Zoom out", + "the_default_model": "Already the default model", "as_default_model": "Set as Default Model", "no_model_yet": "No model yet", "intelligent_questioning_platform": "Welcome to the SQLBot Intelligent Questioning Platform", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 100aa5140..8235df5cd 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -6,6 +6,9 @@ "AI Model Configuration": "模型配置" }, "common": { + "zoom_in": "放大", + "zoom_out": "缩小", + "the_default_model": "已是默认模型", "as_default_model": "设为默认模型", "no_model_yet": "暂无模型", "intelligent_questioning_platform": "欢迎使用 SQLBot 智能问数平台", @@ -567,7 +570,7 @@ "license": { "error_tips": "是否刷新页面?", "offline_tips": "服务已经下线,请联系管理员重启服务!" - }, + }, "system": { "system_settings": "系统设置", "appearance_settings": "外观设置", @@ -599,4 +602,4 @@ "setting_successfully": "设置成功", "customize_theme_color": "自定义主题色" } -} +} \ No newline at end of file diff --git a/frontend/src/views/system/embedded/index.vue b/frontend/src/views/system/embedded/index.vue index 2fb0f13aa..9e36821b8 100644 --- a/frontend/src/views/system/embedded/index.vue +++ b/frontend/src/views/system/embedded/index.vue @@ -617,13 +617,11 @@ const saveHandler = () => { class="form-content_error" @submit.prevent > - + import delIcon from '@/assets/svg/icon_delete.svg' -import icon_embedded_outlined from '@/assets/svg/icon-setting.svg' +import icon_admin_outlined from '@/assets/svg/icon_admin_outlined.svg' import edit from '@/assets/svg/icon_edit_outlined.svg' import { get_supplier } from '@/entity/supplier' import { computed, ref } from 'vue' @@ -76,9 +76,23 @@ defineExpose({ showErrorMask }) {{ baseModel }}
- + + + + + + {{ $t('common.as_default_model') }} + + + + - + {{ $t('common.as_default_model') }} From a23f2839c6de47784dfa396f7fa9d5013b73174d Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 8 Aug 2025 10:32:46 +0800 Subject: [PATCH 0025/1234] fix: fix excel upload path error --- backend/apps/datasource/api/datasource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/datasource/api/datasource.py b/backend/apps/datasource/api/datasource.py index f89b052bd..1b181a92e 100644 --- a/backend/apps/datasource/api/datasource.py +++ b/backend/apps/datasource/api/datasource.py @@ -273,7 +273,7 @@ def inner(): for sheet_name in sheet_names: tableName = f"{sheet_name}_{hashlib.sha256(uuid.uuid4().bytes).hexdigest()[:10]}" sheets.append({"tableName": tableName, "tableComment": ""}) - df_temp = pd.read_excel(path, nrows=5) + df_temp = pd.read_excel(save_path, nrows=5) non_empty_cols = df_temp.columns[df_temp.notna().any()].tolist() df = pd.read_excel(save_path, sheet_name=sheet_name, engine='calamine', usecols=non_empty_cols) insert_pg(df, tableName, engine) From 3f0c4632741da950fdf5a594ad85e02b6cad53ae Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 8 Aug 2025 11:19:24 +0800 Subject: [PATCH 0026/1234] refactor: read excel faster --- backend/apps/datasource/api/datasource.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/apps/datasource/api/datasource.py b/backend/apps/datasource/api/datasource.py index 1b181a92e..0eeba6dea 100644 --- a/backend/apps/datasource/api/datasource.py +++ b/backend/apps/datasource/api/datasource.py @@ -273,9 +273,9 @@ def inner(): for sheet_name in sheet_names: tableName = f"{sheet_name}_{hashlib.sha256(uuid.uuid4().bytes).hexdigest()[:10]}" sheets.append({"tableName": tableName, "tableComment": ""}) - df_temp = pd.read_excel(save_path, nrows=5) - non_empty_cols = df_temp.columns[df_temp.notna().any()].tolist() - df = pd.read_excel(save_path, sheet_name=sheet_name, engine='calamine', usecols=non_empty_cols) + # df_temp = pd.read_excel(save_path, nrows=5) + # non_empty_cols = df_temp.columns[df_temp.notna().any()].tolist() + df = pd.read_excel(save_path, sheet_name=sheet_name, engine='calamine') insert_pg(df, tableName, engine) # os.remove(save_path) From dead2f1a857786954645996e3e6b3193d8e46383 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 8 Aug 2025 11:38:28 +0800 Subject: [PATCH 0027/1234] feat: Maintain the order of table fields --- backend/alembic/versions/034_field_sort.py | 29 ++++++++++++++++++++ backend/apps/datasource/crud/datasource.py | 5 ++-- backend/apps/datasource/crud/field.py | 2 +- backend/apps/datasource/models/datasource.py | 1 + 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 backend/alembic/versions/034_field_sort.py diff --git a/backend/alembic/versions/034_field_sort.py b/backend/alembic/versions/034_field_sort.py new file mode 100644 index 000000000..de98161e1 --- /dev/null +++ b/backend/alembic/versions/034_field_sort.py @@ -0,0 +1,29 @@ +"""034_field_sort + +Revision ID: e8b470d2b150 +Revises: 3cb5d6a54f2e +Create Date: 2025-08-08 11:33:33.227564 + +""" +from alembic import op +import sqlalchemy as sa +import sqlmodel.sql.sqltypes +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = 'e8b470d2b150' +down_revision = '3cb5d6a54f2e' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('core_field', sa.Column('field_index', sa.BigInteger(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('core_field', 'field_index') + # ### end Alembic commands ### diff --git a/backend/apps/datasource/crud/datasource.py b/backend/apps/datasource/crud/datasource.py index 3d6dc7352..6293bca32 100644 --- a/backend/apps/datasource/crud/datasource.py +++ b/backend/apps/datasource/crud/datasource.py @@ -204,7 +204,7 @@ def sync_table(session: SessionDep, ds: CoreDatasource, tables: List[CoreTable]) def sync_fields(session: SessionDep, ds: CoreDatasource, table: CoreTable, fields: List[ColumnSchema]): id_list = [] - for item in fields: + for index, item in enumerate(fields): statement = select(CoreField).where( and_(CoreField.table_id == table.id, CoreField.field_name == item.fieldName)) record = session.exec(statement).first() @@ -213,12 +213,13 @@ def sync_fields(session: SessionDep, ds: CoreDatasource, table: CoreTable, field id_list.append(record.id) record.field_comment = item.fieldComment + record.field_index = index session.add(record) session.commit() else: field = CoreField(ds_id=ds.id, table_id=table.id, checked=True, field_name=item.fieldName, field_type=item.fieldType, field_comment=item.fieldComment, - custom_comment=item.fieldComment) + custom_comment=item.fieldComment, field_index=index) session.add(field) session.flush() session.refresh(field) diff --git a/backend/apps/datasource/crud/field.py b/backend/apps/datasource/crud/field.py index 2b478ff53..d7a2de7c6 100644 --- a/backend/apps/datasource/crud/field.py +++ b/backend/apps/datasource/crud/field.py @@ -8,7 +8,7 @@ def delete_field_by_ds_id(session: SessionDep, id: int): def get_fields_by_table_id(session: SessionDep, id: int): - return session.query(CoreField).filter(CoreField.table_id == id).all() + return session.query(CoreField).filter(CoreField.table_id == id).order_by(CoreField.field_index.asc()).all() def update_field(session: SessionDep, item: CoreField): diff --git a/backend/apps/datasource/models/datasource.py b/backend/apps/datasource/models/datasource.py index 1f810e9ec..6496a857d 100644 --- a/backend/apps/datasource/models/datasource.py +++ b/backend/apps/datasource/models/datasource.py @@ -41,6 +41,7 @@ class CoreField(SQLModel, table=True): field_type: str = Field(max_length=128, nullable=True) field_comment: str = Field(sa_column=Column(Text)) custom_comment: str = Field(sa_column=Column(Text)) + field_index: int = Field(sa_column=Column(BigInteger())) # datasource create obj From e5b63d941ab98ec9a39183f6280f955ab1fc20cb Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 8 Aug 2025 14:52:19 +0800 Subject: [PATCH 0028/1234] (permission): Settings - Permission Configuration Error Style Fix When no data source is selected, the data table style is disabled --- frontend/src/views/system/permission/index.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/system/permission/index.vue b/frontend/src/views/system/permission/index.vue index ea2255c1e..43aad3880 100644 --- a/frontend/src/views/system/permission/index.vue +++ b/frontend/src/views/system/permission/index.vue @@ -216,10 +216,14 @@ const handleColumnPermission = (row: any) => { const icon = (item: any) => { return (dsTypeWithImg.find((ele) => item.type === ele.type) || {}).img } - +let time: any const handleInitDsIdChange = (val: any) => { columnForm.ds_id = val.id columnForm.ds_name = val.name + time = setTimeout(() => { + clearTimeout(time) + columnFormRef.value.clearValidate('table_id') + }, 0) datasourceApi.tableList(val.id).then((res: any) => { tableListOptions.value = res || [] activeTable.value = null From 86b6415b672c2d87cfbd0d6d595b243243ead53e Mon Sep 17 00:00:00 2001 From: xuwei-fit2cloud Date: Fri, 8 Aug 2025 15:12:11 +0800 Subject: [PATCH 0029/1234] fix: fix the variable name errors in the installation script --- installer/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/install.sh b/installer/install.sh index dd73d8676..3f277c53a 100644 --- a/installer/install.sh +++ b/installer/install.sh @@ -32,7 +32,7 @@ function check_and_prepare_env_params() { # 获取已安装的 SQLBOT 的运行目录 SQLBOT_BASE=$(grep "^SQLBOT_BASE=" /usr/bin/sctl | cut -d'=' -f2) SQLBOT_BASE_OLD=${SQLBOT_BASE} - sed -i -e "s#SQLBOT_BASE=.*#SQLBOT_BASE_BASE=${SQLBOT_BASE}#g" sctl + sed -i -e "s#SQLBOT_BASE=.*#SQLBOT_BASE=${SQLBOT_BASE}#g" sctl \cp sctl /usr/local/bin && chmod +x /usr/local/bin/sctl log_content "停止 SQLBot 服务" From 538bbc4f2feb80d39f0163303d2c6a0cb8301438 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 8 Aug 2025 15:17:32 +0800 Subject: [PATCH 0030/1234] perf: Assistant header display name --- backend/pyproject.toml | 2 +- frontend/public/assistant.js | 4 ++-- frontend/src/views/embedded/index.vue | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 53680a0be..73db46975 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "sqlbot" -version = "1.0.0" +version = "1.0.1" description = "" requires-python = ">=3.10,<3.13" dependencies = [ diff --git a/frontend/public/assistant.js b/frontend/public/assistant.js index ef127fc5b..4b986199c 100644 --- a/frontend/public/assistant.js +++ b/frontend/public/assistant.js @@ -68,7 +68,7 @@ const getChatContainerHtml = (data) => { return `
- +
@@ -460,7 +460,7 @@ } const data = res.data const config_json = data.configuration - let tempData = Object.assign(defaultData, { id, domain_url }) + let tempData = Object.assign(defaultData, { id, domain_url, name: data.name }) if (config_json) { const config = JSON.parse(config_json) if (config) { diff --git a/frontend/src/views/embedded/index.vue b/frontend/src/views/embedded/index.vue index 7d1d5c370..3d9dca537 100644 --- a/frontend/src/views/embedded/index.vue +++ b/frontend/src/views/embedded/index.vue @@ -5,7 +5,7 @@ - {{ $t('embedded.intelligent_customer_service') }} + {{ assistantName || $t('embedded.intelligent_customer_service') }} @@ -31,7 +31,7 @@ import { useAssistantStore } from '@/stores/assistant' const assistantStore = useAssistantStore() const route = useRoute() - +const assistantName = ref('') const chatRef = ref() const createChat = () => { @@ -100,6 +100,11 @@ onBeforeMount(async () => { } const online = route.query.online setFormatOnline(online) + + let name = route.query.name + if (name) { + assistantName.value = decodeURIComponent(name.toString()) + } const now = Date.now() assistantStore.setFlag(now) assistantStore.setId(assistantId?.toString() || '') From f73388f0c312aabfbc302edfe1c5d5fa008647e0 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 8 Aug 2025 15:38:52 +0800 Subject: [PATCH 0031/1234] feat(X-Pack): Appearance menu --- backend/pyproject.toml | 2 +- frontend/src/router/index.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 73db46975..da17562a8 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -36,7 +36,7 @@ dependencies = [ "pyyaml (>=6.0.2,<7.0.0)", "fastapi-mcp (>=0.3.4,<0.4.0)", "tabulate>=0.9.0", - "sqlbot-xpack==0.0.3.13", + "sqlbot-xpack==0.0.3.14", "fastapi-cache2>=0.2.2", "sqlparse>=0.5.3", "redis>=6.2.0", diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 638cd5450..fee18b001 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -161,9 +161,10 @@ export const routes = [ }, }, { - path: 'set', + path: 'setting', meta: { title: t('system.system_settings'), iconActive: 'set', iconDeActive: 'noSet' }, - redirect: 'set/appearance', + redirect: 'system_/appearance', + name: 'setting', children: [ { path: 'appearance', From 1b34bb8a72d8798f1bf6d8816f7c0b579b64b093 Mon Sep 17 00:00:00 2001 From: ulleo Date: Fri, 8 Aug 2025 17:23:56 +0800 Subject: [PATCH 0032/1234] feat: add query data limit in chat --- backend/apps/chat/task/llm.py | 7 ++++- frontend/src/i18n/en.json | 3 +- frontend/src/i18n/zh-CN.json | 3 +- .../src/views/chat/chat-block/ChartBlock.vue | 29 +++++++++++++------ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/backend/apps/chat/task/llm.py b/backend/apps/chat/task/llm.py index 353df4ee1..95e92fe7b 100644 --- a/backend/apps/chat/task/llm.py +++ b/backend/apps/chat/task/llm.py @@ -744,9 +744,14 @@ def save_error(self, message: str): def save_sql_data(self, data_obj: Dict[str, Any]): try: data_result = data_obj.get('data') + limit = 1000 if data_result: data_result = prepare_for_orjson(data_result) - data_obj['data'] = data_result + if data_result and len(data_result) > limit: + data_obj['data'] = data_result[:limit] + data_obj['limit'] = limit + else: + data_obj['data'] = data_result return save_sql_exec_data(session=self.session, record_id=self.record.id, data=orjson.dumps(data_obj).decode()) except Exception as e: diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index ce90511c9..3be3aecac 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -541,6 +541,7 @@ "thinking": "Thinking", "data_analysis": "Data Analysis", "data_predict": "Data Prediction", + "data_over_limit": "The data is too large, only the first {0} entries are displayed.", "ds_is_invalid": "Datasource is invalid", "error": "Error", "no_data": "No Data", @@ -602,4 +603,4 @@ "setting_successfully": "Setting Successfully", "customize_theme_color": "Customize theme color" } -} \ No newline at end of file +} diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 8235df5cd..ccc2267cc 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -541,6 +541,7 @@ "thinking": "思考中", "data_analysis": "数据分析", "data_predict": "数据预测", + "data_over_limit": "数据量过大,仅展示前{0}条数据", "ds_is_invalid": "数据源无效", "error": "错误", "no_data": "暂无数据", @@ -602,4 +603,4 @@ "setting_successfully": "设置成功", "customize_theme_color": "自定义主题色" } -} \ No newline at end of file +} diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue index 2d27e1aaa..e961cf7b0 100644 --- a/frontend/src/views/chat/chat-block/ChartBlock.vue +++ b/frontend/src/views/chat/chat-block/ChartBlock.vue @@ -49,6 +49,7 @@ const emits = defineEmits(['exitFullScreen']) const dataObject = computed<{ fields: Array data: Array<{ [key: string]: any }> + limit: number | undefined }>(() => { if (props.message?.record?.data) { if (typeof props.message?.record?.data === 'string') { @@ -423,15 +424,20 @@ watch(
-
- -
+ Date: Fri, 8 Aug 2025 22:41:14 +0800 Subject: [PATCH 0033/1234] update .gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index efdba8764..ede858916 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ * text=auto *.sh text eol=lf +*.vue linguist-language=python From ab239ea36ad581e65f279c58a4cd70743b0eba10 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 11 Aug 2025 09:33:25 +0800 Subject: [PATCH 0034/1234] fix(chat): Repair the copy button function does not work in the case of http --- frontend/src/views/chat/chat-block/ChartBlock.vue | 2 +- frontend/src/views/system/embedded/index.vue | 2 +- frontend/src/views/system/user/User.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue index e961cf7b0..41693d4d3 100644 --- a/frontend/src/views/chat/chat-block/ChartBlock.vue +++ b/frontend/src/views/chat/chat-block/ChartBlock.vue @@ -40,7 +40,7 @@ const props = withDefaults( } ) -const { copy } = useClipboard() +const { copy } = useClipboard({ legacy: true }) const loading = ref(false) const { t } = useI18n() const addViewRef = ref(null) diff --git a/frontend/src/views/system/embedded/index.vue b/frontend/src/views/system/embedded/index.vue index 9e36821b8..ed5b332c4 100644 --- a/frontend/src/views/system/embedded/index.vue +++ b/frontend/src/views/system/embedded/index.vue @@ -20,7 +20,7 @@ import { useI18n } from 'vue-i18n' import { cloneDeep } from 'lodash-es' const { t } = useI18n() -const { copy } = useClipboard() +const { copy } = useClipboard({ legacy: true }) const keywords = ref('') const activeStep = ref(0) diff --git a/frontend/src/views/system/user/User.vue b/frontend/src/views/system/user/User.vue index dbbdfed76..bc9743f61 100644 --- a/frontend/src/views/system/user/User.vue +++ b/frontend/src/views/system/user/User.vue @@ -379,7 +379,7 @@ import { ClickOutside as vClickOutside } from 'element-plus-secondary' import icon_warning_filled from '@/assets/svg/icon_warning_filled.svg' import { useClipboard } from '@vueuse/core' -const { copy } = useClipboard() +const { copy } = useClipboard({ legacy: true }) const { t } = useI18n() const keyword = ref('') From e92a97e8b4f16ab3a79e86abad5c6a61d6df9058 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 11 Aug 2025 09:51:44 +0800 Subject: [PATCH 0035/1234] fix(Embedded Management): Change the title to a normal one, refer to AI model management configuration --- frontend/src/views/system/embedded/index.vue | 85 ++++++++++++------- .../system/permission/SelectPermission.vue | 11 ++- .../workspace/AuthorizedWorkspaceDialog.vue | 11 ++- 3 files changed, 73 insertions(+), 34 deletions(-) diff --git a/frontend/src/views/system/embedded/index.vue b/frontend/src/views/system/embedded/index.vue index ed5b332c4..9e17ea255 100644 --- a/frontend/src/views/system/embedded/index.vue +++ b/frontend/src/views/system/embedded/index.vue @@ -357,7 +357,7 @@ const saveEmbedded = () => { } }) } -const btnSelect = ref('d') +// const btnSelect = ref('d') const dialogVisible = ref(false) const scriptElement = ref('') @@ -453,14 +453,15 @@ const saveHandler = () => {