Skip to content

Commit 7f4c6e5

Browse files
committed
Merge branch 'main' of https://github.com/dataease/SQLBot
2 parents d1448f6 + 069db60 commit 7f4c6e5

File tree

6 files changed

+183
-70
lines changed

6 files changed

+183
-70
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: build-base-and-push
2+
3+
run-name: 构建镜像并推送仓库 ${{ github.event.inputs.dockerImageTag }} (${{ github.event.inputs.registry }}) (${{ github.event.inputs.architecture }})
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
dockerImageTag:
9+
description: 'Image Tag'
10+
default: 'v0.9.0'
11+
required: true
12+
dockerImageTagWithLatest:
13+
description: '是否发布latest tag(正式发版时选择,测试版本切勿选择)'
14+
default: false
15+
required: true
16+
type: boolean
17+
architecture:
18+
description: 'Architecture'
19+
required: true
20+
default: 'linux/amd64'
21+
type: choice
22+
options:
23+
- linux/amd64
24+
- linux/arm64
25+
- linux/amd64,linux/arm64
26+
registry:
27+
description: 'Push To Registry'
28+
required: true
29+
default: 'aliyun-registry'
30+
type: choice
31+
options:
32+
- aliyun-registry
33+
- dockerhub
34+
- dockerhub, aliyun-registry
35+
36+
jobs:
37+
build-and-push-to-aliyun-registry:
38+
if: ${{ contains(github.event.inputs.registry, 'aliyun') }}
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
with:
44+
ref: ${{ github.ref_name }}
45+
- name: Prepare
46+
id: prepare
47+
run: |
48+
DOCKER_IMAGE=${{ secrets.ALIYUN_REGISTRY_HOST }}/dataease/sqlbot-python-pg
49+
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
50+
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
51+
TAG_NAME_WITH_LATEST=${{ github.event.inputs.dockerImageTagWithLatest }}
52+
if [[ ${TAG_NAME_WITH_LATEST} == 'true' ]]; then
53+
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:${TAG_NAME%%.*} --tag ${DOCKER_IMAGE}:latest"
54+
else
55+
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}"
56+
fi
57+
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --memory-swap -1 \
58+
--build-arg DOCKER_IMAGE_TAG=${{ github.event.inputs.dockerImageTag }} --build-arg BUILD_AT=$(TZ=Asia/Shanghai date +'%Y-%m-%dT%H:%M') --build-arg GITHUB_COMMIT=`git rev-parse --short HEAD` --no-cache \
59+
${DOCKER_IMAGE_TAGS} .
60+
- name: Set up Docker Buildx
61+
uses: crazy-max/ghaction-docker-buildx@v3
62+
- name: Login to Aliyun Registry
63+
uses: docker/login-action@v2
64+
with:
65+
registry: ${{ secrets.ALIYUN_REGISTRY_HOST }}
66+
username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
67+
password: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
68+
- name: Docker Buildx (build-and-push)
69+
run: |
70+
docker buildx build -f Dockerfile-base --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
71+
72+
build-and-push-to-dockerhub:
73+
if: ${{ contains(github.event.inputs.registry, 'dockerhub') }}
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v4
78+
with:
79+
ref: ${{ github.ref_name }}
80+
- name: Prepare
81+
id: prepare
82+
run: |
83+
DOCKER_IMAGE=dataease/sqlbot-python-pg
84+
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
85+
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
86+
TAG_NAME_WITH_LATEST=${{ github.event.inputs.dockerImageTagWithLatest }}
87+
if [[ ${TAG_NAME_WITH_LATEST} == 'true' ]]; then
88+
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:${TAG_NAME%%.*} --tag ${DOCKER_IMAGE}:latest"
89+
else
90+
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}"
91+
fi
92+
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --memory-swap -1 \
93+
--build-arg DOCKER_IMAGE_TAG=${{ github.event.inputs.dockerImageTag }} --build-arg BUILD_AT=$(TZ=Asia/Shanghai date +'%Y-%m-%dT%H:%M') --build-arg GITHUB_COMMIT=`git rev-parse --short HEAD` --no-cache \
94+
${DOCKER_IMAGE_TAGS} .
95+
- name: Set up Docker Buildx
96+
uses: crazy-max/ghaction-docker-buildx@v3
97+
- name: Login to Docker Hub
98+
uses: docker/login-action@v3
99+
with:
100+
username: ${{ secrets.DOCKERHUB_USERNAME }}
101+
password: ${{ secrets.DOCKERHUB_TOKEN }}
102+
- name: Docker Buildx (build-and-push)
103+
run: |
104+
docker buildx build -f Dockerfile-base --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}

Dockerfile

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build sqlbot
22
FROM ghcr.io/1panel-dev/maxkb-vector-model:v1.0.1 AS vector-model
3-
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS sqlbot-builder
3+
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-python-pg:latest AS sqlbot-builder
44

55
# Set build environment variables
66
ENV PYTHONUNBUFFERED=1
@@ -36,7 +36,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
3636
uv sync --extra cpu
3737

3838
# Build g2-ssr
39-
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS ssr-builder
39+
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-python-pg:latest AS ssr-builder
4040

4141
WORKDIR /app
4242

@@ -45,44 +45,8 @@ COPY g2-ssr/charts/* /app/charts/
4545

4646
RUN npm install
4747

48-
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS python-builder
4948
# Runtime stage
50-
# FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest
51-
FROM registry.cn-qingdao.aliyuncs.com/dataease/postgres:17.6
52-
53-
# python environment
54-
COPY --from=python-builder /usr/local /usr/local
55-
56-
RUN python --version && pip --version
57-
58-
# Install uv tool
59-
COPY --from=ghcr.io/astral-sh/uv:0.7.8 /uv /uvx /bin/
60-
61-
ARG DEPENDENCIES=" \
62-
wait-for-it \
63-
build-essential \
64-
curl \
65-
gnupg \
66-
gcc \
67-
g++ \
68-
libcairo2-dev \
69-
libpango1.0-dev \
70-
libjpeg-dev \
71-
libgif-dev \
72-
librsvg2-dev"
73-
74-
RUN apt-get update && apt-get install -y --no-install-recommends $DEPENDENCIES \
75-
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
76-
&& apt-get install -y nodejs \
77-
&& rm -rf /var/lib/apt/lists/* \
78-
&& chmod g-xr /usr/local/bin/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/17/bin/* \
79-
&& chmod g+xr /usr/bin/ld.so \
80-
&& chmod g+x /usr/local/bin/python*
81-
82-
# ENV PGDATA=/var/lib/postgresql/data \
83-
# POSTGRES_USER=root \
84-
# POSTGRES_PASSWORD=Password123@pg \
85-
# POSTGRES_DB=sqlbot
49+
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-python-pg:latest
8650

8751
# Set runtime environment variables
8852
ENV PYTHONUNBUFFERED=1

Dockerfile-base

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM python:3.11-slim-bookworm AS python-builder
2+
FROM registry.cn-qingdao.aliyuncs.com/dataease/postgres:17.6
3+
4+
# python environment
5+
COPY --from=python-builder /usr/local /usr/local
6+
7+
RUN python --version && pip --version
8+
9+
# Install uv tool
10+
COPY --from=ghcr.io/astral-sh/uv:0.7.8 /uv /uvx /bin/
11+
12+
RUN apt-get update && apt-get install -y --no-install-recommends \
13+
wait-for-it \
14+
build-essential \
15+
curl \
16+
gnupg \
17+
gcc \
18+
g++ \
19+
libcairo2-dev \
20+
libpango1.0-dev \
21+
libjpeg-dev \
22+
libgif-dev \
23+
librsvg2-dev \
24+
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
25+
&& apt-get install -y nodejs \
26+
&& curl -L --connect-timeout 60 -m 1800 https://fit2cloud-support.oss-cn-beijing.aliyuncs.com/xpack-license/get-validator-linux | sh \
27+
&& rm -rf /var/lib/apt/lists/* \
28+
&& chmod g+xr /usr/bin/ld.so \
29+
&& chmod g+x /usr/local/bin/python*

frontend/src/views/chat/chat-block/ChartBlock.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ const dataObject = computed<{
6363
const assistantStore = useAssistantStore()
6464
const isCompletePage = computed(() => !assistantStore.getAssistant || assistantStore.getEmbedded)
6565
66+
const isAssistant = computed(() => assistantStore.getAssistant)
67+
6668
const chartId = computed(() => props.message?.record?.id + (props.enlarge ? '-fullscreen' : ''))
6769
6870
const data = computed(() => {
@@ -395,7 +397,7 @@ watch(
395397
</div>
396398
</el-popover>
397399
</div>
398-
<div v-if="message?.record?.chart && isCompletePage">
400+
<div v-if="message?.record?.chart && !isAssistant">
399401
<el-tooltip effect="dark" :content="t('chat.add_to_dashboard')" placement="top">
400402
<el-button class="tool-btn" text @click="addToDashboard">
401403
<el-icon size="16">

frontend/src/views/dashboard/canvas/CanvasCore.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
864864
865865
html2canvas(clonedSlot).then((canvas) => {
866866
img.src = canvas.toDataURL()
867-
infoBox.value.cloneItem.appendChild(img)
867+
infoBox.value.cloneItem?.appendChild(img)
868868
})
869869
870870
if (containerRef.value) {
@@ -994,6 +994,12 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
994994
if (infoBox.value.resizeItem) {
995995
delete infoBox.value.resizeItem.isPlayer
996996
props.resizeEnd(e, infoBox.value.resizeItem, infoBox.value.resizeItem._dragId)
997+
998+
if (infoBox.value.resizeItem.component === 'SQTab') {
999+
const refTabInstance =
1000+
currentInstance.refs['shape_component_' + infoBox.value.resizeItem.id][0]
1001+
refTabInstance.outResizeEnd()
1002+
}
9971003
}
9981004
if (infoBox.value.moveItem) {
9991005
props.dragEnd(e, infoBox.value.moveItem, infoBox.value.moveItem._dragId)

frontend/src/views/dashboard/components/sq-tab/index.vue

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ const beforeHandleCommand = (item: any, param: any) => {
119119
}
120120
}
121121
const isEditMode = computed(() => props.showPosition === 'canvas')
122-
122+
const outResizeEnd = () => {
123+
state.tabShow = false
124+
nextTick(() => {
125+
state.tabShow = true
126+
})
127+
}
123128
const addTabItem = (item: CanvasItem) => {
124129
// do addTabItem
125130
const index = configItem.value.propValue.findIndex(
@@ -168,6 +173,7 @@ onMounted(() => {
168173
169174
defineExpose({
170175
addTabItem,
176+
outResizeEnd,
171177
})
172178
</script>
173179

@@ -224,35 +230,37 @@ defineExpose({
224230
</template>
225231
</el-tab-pane>
226232
</template>
227-
<div
228-
v-for="(tabItem, index) in configItem.propValue"
229-
:key="tabItem.name + '-content'"
230-
class="tab-content-custom"
231-
:class="{ 'switch-hidden': configItem.activeTabName !== tabItem.name }"
232-
>
233-
<SQPreview
234-
v-if="showPosition === 'preview'"
235-
:ref="'tabPreviewRef_' + index"
236-
class="tab-dashboard-preview"
237-
:component-data="tabItem.componentData"
238-
:canvas-view-info="canvasViewInfo"
239-
:base-matrix-count="tabBaseMatrixCount"
240-
:canvas-id="tabItem.name"
241-
></SQPreview>
242-
<DashboardEditor
243-
v-else
244-
:ref="'tabEditorRef_' + index"
245-
class="tab-dashboard-editor-main"
246-
:canvas-component-data="tabItem.componentData"
247-
:canvas-view-info="canvasViewInfo"
248-
:move-in-active="configItem.moveInActive"
249-
:base-matrix-count="tabBaseMatrixCount"
250-
:canvas-id="tabItem.name"
251-
:parent-config-item="configItem"
252-
@parent-add-item-box="(item) => emits('parentAddItemBox', item)"
233+
<template v-if="state.tabShow">
234+
<div
235+
v-for="(tabItem, index) in configItem.propValue"
236+
:key="tabItem.name + '-content'"
237+
class="tab-content-custom"
238+
:class="{ 'switch-hidden': configItem.activeTabName !== tabItem.name }"
253239
>
254-
</DashboardEditor>
255-
</div>
240+
<SQPreview
241+
v-if="showPosition === 'preview'"
242+
:ref="'tabPreviewRef_' + index"
243+
class="tab-dashboard-preview"
244+
:component-data="tabItem.componentData"
245+
:canvas-view-info="canvasViewInfo"
246+
:base-matrix-count="tabBaseMatrixCount"
247+
:canvas-id="tabItem.name"
248+
></SQPreview>
249+
<DashboardEditor
250+
v-else
251+
:ref="'tabEditorRef_' + index"
252+
class="tab-dashboard-editor-main"
253+
:canvas-component-data="tabItem.componentData"
254+
:canvas-view-info="canvasViewInfo"
255+
:move-in-active="configItem.moveInActive"
256+
:base-matrix-count="tabBaseMatrixCount"
257+
:canvas-id="tabItem.name"
258+
:parent-config-item="configItem"
259+
@parent-add-item-box="(item) => emits('parentAddItemBox', item)"
260+
>
261+
</DashboardEditor>
262+
</div>
263+
</template>
256264
</custom-tab>
257265
<el-dialog
258266
v-model="state.dialogVisible"

0 commit comments

Comments
 (0)