Skip to content

Commit

Permalink
fix: workflow name cannot repeat and optimize chat quick question
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdan-fit2cloud committed Dec 27, 2024
1 parent c92c8f9 commit de97de6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
27 changes: 24 additions & 3 deletions ui/src/components/ai-chat/component/chat-input-operate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,19 @@ import Recorder from 'recorder-core'
import applicationApi from '@/api/application'
import { MsgAlert } from '@/utils/message'
import { type chatType } from '@/api/type/application'
import { useRoute } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import { getImgUrl } from '@/utils/utils'
import 'recorder-core/src/engine/mp3'
import 'recorder-core/src/engine/mp3-engine'
import { MsgWarning } from '@/utils/message'
import useStore from '@/stores'
const router = useRouter()
const route = useRoute()
const { application } = useStore()
const {
query: { mode, question }
query: { mode, question },
params: { accessToken }
} = route as any
const quickInputRef = ref()
const props = withDefaults(
Expand Down Expand Up @@ -533,6 +536,24 @@ onMounted(() => {
if (question) {
inputValue.value = decodeURIComponent(question.trim())
sendChatHandle()
setTimeout(() => {
// 获取当前路由信息
const route = router.currentRoute.value
// 复制query对象
const query = { ...route.query }
// 删除特定的参数
delete query.question
const newRoute =
Object.entries(query)?.length > 0
? route.path +
'?' +
Object.entries(query)
.map(([key, value]) => `${key}=${value}`)
.join('&')
: route.path
history.pushState(null, '', '/ui' + newRoute)
}, 100)
}
setTimeout(() => {
if (quickInputRef.value && mode === 'embed') {
Expand Down
12 changes: 11 additions & 1 deletion ui/src/workflow/common/app-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ class AppNode extends HtmlResize.view {
} else {
const filterNodes = props.graphModel.nodes.filter((v: any) => v.type === props.model.type)
if (filterNodes.length - 1 > 0) {
props.model.properties.stepName = props.model.properties.stepName + (filterNodes.length - 1)
getNodesName(filterNodes.length - 1)
}
}
function getNodesName(num: number) {
let number = num
const name = props.model.properties.stepName + number
if (!props.graphModel.nodes?.some((node: any) => node.properties.stepName === name.trim())) {
props.model.properties.stepName = name
} else {
number += 1
getNodesName(number)
}
}
props.model.properties.config = nodeDict[props.model.type].properties.config
Expand Down

0 comments on commit de97de6

Please sign in to comment.