Skip to content

Commit d2d418a

Browse files
committed
feat:Supports adding charts to the DataEase canvas.
1 parent f75d5d2 commit d2d418a

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

frontend/src/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@
622622
"excel": "Excel",
623623
"picture": "Image",
624624
"add_to_dashboard": "Add to Dashboard",
625-
"add_to_dataV_en": "Add to Canvas",
625+
"add_to_dataV": "Add to Canvas",
626626
"full_screen": "Full Screen",
627627
"exit_full_screen": "Exit Full Screen",
628628
"sql_generation": "Generate SQL",

frontend/src/i18n/ko-KR.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@
622622
"excel": "Excel",
623623
"picture": "이미지",
624624
"add_to_dashboard": "대시보드에 추가",
625-
"add_to_dataV_ko": "캔버스에 추가",
625+
"add_to_dataV": "캔버스에 추가",
626626
"full_screen": "전체 화면",
627627
"exit_full_screen": "전체 화면 종료",
628628
"sql_generation": "SQL 생성",

frontend/src/stores/assistant.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface AssistantState {
2020
certificate: string
2121
online: boolean
2222
pageEmbedded?: boolean
23+
platform: string
2324
history: boolean
2425
requestPromiseMap: Map<string, PendingRequest>
2526
}
@@ -35,6 +36,7 @@ export const AssistantStore = defineStore('assistant', {
3536
certificate: '',
3637
online: false,
3738
pageEmbedded: false,
39+
platform: '',
3840
history: true,
3941
requestPromiseMap: new Map<string, PendingRequest>(),
4042
}
@@ -49,6 +51,9 @@ export const AssistantStore = defineStore('assistant', {
4951
getToken(): string {
5052
return this.token
5153
},
54+
getPlatform(): string {
55+
return this.platform
56+
},
5257
getAssistant(): boolean {
5358
return this.assistant
5459
},
@@ -132,6 +137,9 @@ export const AssistantStore = defineStore('assistant', {
132137
setPageEmbedded(embedded?: boolean) {
133138
this.pageEmbedded = !!embedded
134139
},
140+
setPlatform(platform: string) {
141+
this.platform = platform
142+
},
135143
setOnline(online: boolean) {
136144
this.online = !!online
137145
},

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ const isCompletePage = computed(() => !assistantStore.getAssistant || assistantS
6565
6666
const isAssistant = computed(() => assistantStore.getAssistant)
6767
68+
const isDataEaseAssistant = computed(
69+
() => assistantStore.getAssistant && assistantStore.getPlatform === 'dataease'
70+
)
71+
6872
const chartId = computed(() => props.message?.record?.id + (props.enlarge ? '-fullscreen' : ''))
6973
7074
const data = computed(() => {
@@ -208,7 +212,6 @@ function showSql() {
208212
}
209213
210214
function addToResource() {
211-
// @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
212215
const readyData = {
213216
eventName: 'sqlbot_add_to_resource',
214217
busi: props.message?.record?.sql_prase,
@@ -434,7 +437,7 @@ watch(
434437
</div>
435438
</el-popover>
436439
</div>
437-
<div v-if="message?.record?.sql_prase">
440+
<div v-if="message?.record?.sql_prase && isDataEaseAssistant">
438441
<el-tooltip effect="dark" :content="t('chat.add_to_dataV')" placement="top">
439442
<el-button class="tool-btn" text @click="addToResource">
440443
<el-icon size="16">

frontend/src/views/embedded/index.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
:logo-assistant="logo"
2828
/>
2929
</div>
30-
<div class="drawer-assistant" @click="openHistory"></div>
30+
<div v-if="!isDataeaseAssistant" class="drawer-assistant" @click="openHistory"></div>
3131
</div>
3232
</template>
3333
<script setup lang="ts">
@@ -65,6 +65,7 @@ const validator = ref({
6565
const appName = ref('')
6666
const loading = ref(true)
6767
const eventName = 'sqlbot_assistant_event'
68+
const isDataeaseAssistant = ref(false)
6869
const communicationCb = async (event: any) => {
6970
if (event.data?.eventName === eventName) {
7071
if (event.data?.messageId !== route.query.id) {
@@ -139,6 +140,11 @@ onBeforeMount(async () => {
139140
ElMessage.error('Miss assistant id, please check assistant url')
140141
return
141142
}
143+
const platform = route.query.platform
144+
if (!platform) {
145+
assistantStore.setPlatform(platform?.toString() || '')
146+
isDataeaseAssistant.value = platform === 'dataease'
147+
}
142148
143149
const online = route.query.online
144150
setFormatOnline(online)

0 commit comments

Comments
 (0)