Skip to content

Commit 7abfebe

Browse files
fix: url
1 parent 081ca69 commit 7abfebe

File tree

6 files changed

+56
-27
lines changed

6 files changed

+56
-27
lines changed

ui/src/layout/login-layout/LoginLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const loginImage = computed(() => {
7979
return `${fileURL.value}`
8080
} else {
8181
const imgName = getThemeImg(theme.themeInfo?.theme)
82-
const imgPath = `/ui/theme/${imgName}.jpg`
82+
const imgPath = `/theme/${imgName}.jpg`
8383
const imageUrl = new URL(imgPath, import.meta.url).href
8484
return imageUrl
8585
}

ui/src/layout/login-layout/UserLoginLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const loginImage = computed(() => {
4747
return `${fileURL.value}`
4848
} else {
4949
const imgName = getThemeImg(theme.themeInfo?.theme)
50-
const imgPath = `../../assets/theme/${imgName}.jpg`
50+
const imgPath = `/theme/${imgName}.jpg`
5151
const imageUrl = new URL(imgPath, import.meta.url).href
5252
return imageUrl
5353
}

ui/src/utils/application.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
export function isWorkFlow(type: string | undefined) {
22
return type === 'WORK_FLOW'
33
}
4+
5+
export function mapToUrlParams(map: any[]) {
6+
const params = new URLSearchParams()
7+
8+
map.forEach((item: any) => {
9+
params.append(encodeURIComponent(item.name), encodeURIComponent(item.value))
10+
})
11+
12+
return params.toString() // 返回 URL 查询字符串
13+
}

ui/src/views/application-overview/index.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ import { nowDate, beforeDay } from '@/utils/time'
225225
import { MsgSuccess, MsgConfirm } from '@/utils/message'
226226
import { copyClick } from '@/utils/clipboard'
227227
import { isAppIcon } from '@/utils/common'
228+
import { mapToUrlParams } from '@/utils/application'
228229
import useStore from '@/stores'
229230
import { t } from '@/locales'
230231
import { EditionConst } from '@/utils/permission/data'
@@ -459,16 +460,6 @@ function refreshIcon() {
459460
getDetail()
460461
}
461462
462-
function mapToUrlParams(map: any[]) {
463-
const params = new URLSearchParams()
464-
465-
map.forEach((item: any) => {
466-
params.append(encodeURIComponent(item.name), encodeURIComponent(item.value))
467-
})
468-
469-
return params.toString() // 返回 URL 查询字符串
470-
}
471-
472463
onMounted(() => {
473464
getDetail()
474465
getAccessToken()

ui/src/views/application-workflow/index.vue

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
</el-button>
4747
<template #dropdown>
4848
<el-dropdown-menu>
49+
<el-dropdown-item :href="shareUrl">
50+
<AppIcon iconName="app-create-chat" class="mr-4"></AppIcon>
51+
{{ $t('views.application.operation.toChat') }}
52+
</el-dropdown-item>
53+
4954
<el-dropdown-item @click="openHistory">
5055
<AppIcon iconName="app-history-outlined"></AppIcon>
5156
{{ $t('views.applicationWorkflow.setting.releaseHistory') }}
@@ -138,6 +143,7 @@ import applicationApi from '@/api/application/application'
138143
import { isAppIcon } from '@/utils/common'
139144
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
140145
import { datetimeFormat } from '@/utils/time'
146+
import { mapToUrlParams } from '@/utils/application'
141147
import useStore from '@/stores'
142148
import { WorkFlowInstance } from '@/workflow/common/validate'
143149
import { hasPermission } from '@/utils/permission'
@@ -170,6 +176,15 @@ const disablePublic = ref(false)
170176
const currentVersion = ref<any>({})
171177
const cloneWorkFlow = ref(null)
172178
179+
const apiInputParams = ref([])
180+
181+
const urlParams = computed(() =>
182+
mapToUrlParams(apiInputParams.value) ? '?' + mapToUrlParams(apiInputParams.value) : '',
183+
)
184+
const shareUrl = computed(
185+
() => `${window.location.origin}/chat/` + detail.value.access_token + urlParams.value,
186+
)
187+
173188
function back() {
174189
if (JSON.stringify(cloneWorkFlow.value) !== JSON.stringify(getGraphData())) {
175190
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.tip.saveMessage'), {
@@ -227,9 +242,9 @@ function renderGraphData(item: any) {
227242
228243
function closeHistory() {
229244
getDetail()
230-
// if (hasPermission(`APPLICATION:MANAGE:${id}`, 'AND') && isSave.value) {
231-
// initInterval()
232-
// }
245+
if (isSave.value) {
246+
initInterval()
247+
}
233248
showHistory.value = false
234249
disablePublic.value = false
235250
}
@@ -244,12 +259,10 @@ function changeSave(bool: boolean) {
244259
}
245260
246261
function clickNodes(item: any) {
247-
// workflowRef.value?.addNode(item)
248262
showPopover.value = false
249263
}
250264
251265
function onmousedown(item: any) {
252-
// workflowRef.value?.onmousedown(item)
253266
showPopover.value = false
254267
}
255268
@@ -328,12 +341,6 @@ const clickShowDebug = () => {
328341
}
329342
})
330343
}
331-
// function clickoutsideDebug(e: any) {
332-
// if (workflowMainRef.value && e && e.target && workflowMainRef.value.contains(e?.target)) {
333-
// showDebug.value = false
334-
// }
335-
// }
336-
337344
function getGraphData() {
338345
return workflowRef.value?.getGraphData()
339346
}
@@ -348,6 +355,27 @@ function getDetail() {
348355
detail.value.tts_model_id = res.data.tts_model
349356
detail.value.tts_type = res.data.tts_type
350357
saveTime.value = res.data?.update_time
358+
detail.value.work_flow?.nodes
359+
?.filter((v: any) => v.id === 'base-node')
360+
.map((v: any) => {
361+
apiInputParams.value = v.properties.api_input_field_list
362+
? v.properties.api_input_field_list.map((v: any) => {
363+
return {
364+
name: v.variable,
365+
value: v.default_value,
366+
}
367+
})
368+
: v.properties.input_field_list
369+
? v.properties.input_field_list
370+
.filter((v: any) => v.assignment_method === 'api_input')
371+
.map((v: any) => {
372+
return {
373+
name: v.variable,
374+
value: v.default_value,
375+
}
376+
})
377+
: []
378+
})
351379
application.asyncGetAccessToken(id, loading).then((res: any) => {
352380
detail.value = { ...detail.value, ...res.data }
353381
})
@@ -404,9 +432,9 @@ onMounted(() => {
404432
const workflowAutoSave = localStorage.getItem('workflowAutoSave')
405433
isSave.value = workflowAutoSave === 'true' ? true : false
406434
// 初始化定时任务
407-
// if (hasPermission(`APPLICATION:MANAGE:${id}`, 'AND') && isSave.value) {
408-
// initInterval()
409-
// }
435+
if (isSave.value) {
436+
initInterval()
437+
}
410438
})
411439
412440
onBeforeUnmount(() => {

ui/src/views/chat/user-login/components/LoginLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const loginImage = computed(() => {
7979
return `${fileURL.value}`
8080
} else {
8181
const imgName = getThemeImg(theme.themeInfo?.theme)
82-
const imgPath = `../../assets/theme/${imgName}.jpg`
82+
const imgPath = `/theme/${imgName}.jpg`
8383
const imageUrl = new URL(imgPath, import.meta.url).href
8484
return imageUrl
8585
}

0 commit comments

Comments
 (0)