项目历史
This commit is contained in:
@@ -13,7 +13,7 @@ export const fetchAgentReply = (data: AgentParamsType): Promise<AgentResponse> =
|
||||
return request({
|
||||
url: '/api/ai-design/chat',
|
||||
method: 'get',
|
||||
data,
|
||||
data,
|
||||
meta: { responseAll: true }
|
||||
})
|
||||
}
|
||||
@@ -39,4 +39,19 @@ export const getProjectInfo = (data) => {
|
||||
url: `/api/project/${data.id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目版本列表
|
||||
* @param params 获取项目版本列表参数
|
||||
* @param params.page 页码
|
||||
* @param params.size 每页数量
|
||||
* @returns 获取项目版本列表
|
||||
*/
|
||||
export const getProjectList = (params) => {
|
||||
return request({
|
||||
url: `/api/project/list`,
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -48,6 +48,13 @@
|
||||
import { FlowManager } from './manager/FlowManager'
|
||||
import { NodeManager } from './manager/NodeManager'
|
||||
|
||||
const props = defineProps({
|
||||
config: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const vueFlow = ref<any>()
|
||||
const nodeTypes = ref([NODE_TYPE.INPUT, NODE_TYPE.SECONDARY, NODE_TYPE.OUTPUT])
|
||||
|
||||
@@ -98,11 +105,12 @@
|
||||
onMounted(() => {
|
||||
// window['vueFlow'] = vueFlow
|
||||
// window['nodes'] = nodes
|
||||
console.log(props.config)
|
||||
nodeManager.createResultNode({
|
||||
data: {
|
||||
isHeader: false,
|
||||
data: {
|
||||
url: 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__'
|
||||
url: props.config.url
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<fullscreen-dialog v-model="dialogVisible" hide-destroy>
|
||||
<flow-canvas />
|
||||
<flow-canvas :config="config" />
|
||||
</fullscreen-dialog>
|
||||
</template>
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
import flowCanvas from './flow-canvas.vue'
|
||||
import { ref } from 'vue'
|
||||
const dialogVisible = ref(false)
|
||||
const open = () => {
|
||||
console.log('open')
|
||||
const config = ref({})
|
||||
const open = (options) => {
|
||||
dialogVisible.value = true
|
||||
config.value = options || {}
|
||||
}
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
|
||||
@@ -62,7 +62,7 @@ const router = createRouter({
|
||||
component: () => import('../views/home/mainInput.vue')
|
||||
},
|
||||
{
|
||||
path: 'agent',
|
||||
path: 'agent/:id',
|
||||
name: 'agent',
|
||||
component: () => import('../views/home/agent/index.vue')
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
userInfoStore.getUserInfo()
|
||||
|
||||
const flowCanvasRef = ref(null)
|
||||
const openFlowCanvas = () => {
|
||||
flowCanvasRef.value.open()
|
||||
const openFlowCanvas = (config) => {
|
||||
flowCanvasRef.value.open(config)
|
||||
}
|
||||
myEvent.add('openFlowCanvas', openFlowCanvas)
|
||||
onUnmounted(() => {
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
import { computed, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getProjectList } from '@/api/agent'
|
||||
import { FormatDate } from '@/utils/tools'
|
||||
const { t: $t } = useI18n()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@@ -66,40 +68,36 @@
|
||||
globalStore.setHomeLeftNavCollapse(!isCollapse.value)
|
||||
}
|
||||
const showHistory = ref(true)
|
||||
const historyList = ref([
|
||||
{
|
||||
title: true,
|
||||
name: $t('Home.today')
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'Conversation Item 1'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Conversation Item 2'
|
||||
},
|
||||
{
|
||||
title: true,
|
||||
name: $t('Home.yesterday')
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Conversation Item 3'
|
||||
},
|
||||
{
|
||||
title: true,
|
||||
name: $t('Home.earlierChat')
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'Conversation Item 4'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'Conversation Item 5'
|
||||
|
||||
const todayList = ref([])
|
||||
const yesterdayList = ref([])
|
||||
const earlierChatList = ref([])
|
||||
const historyList = computed(() => {
|
||||
const list = []
|
||||
if (todayList.value.length > 0) {
|
||||
list.push({
|
||||
title: true,
|
||||
name: $t('Home.today')
|
||||
})
|
||||
list.push(...todayList.value)
|
||||
}
|
||||
])
|
||||
if (yesterdayList.value.length > 0) {
|
||||
list.push({
|
||||
title: true,
|
||||
name: $t('Home.yesterday')
|
||||
})
|
||||
list.push(...yesterdayList.value)
|
||||
}
|
||||
if (earlierChatList.value.length > 0) {
|
||||
list.push({
|
||||
title: true,
|
||||
name: $t('Home.earlierChat')
|
||||
})
|
||||
list.push(...earlierChatList.value)
|
||||
}
|
||||
return list
|
||||
})
|
||||
|
||||
const onCreateProject = () => {
|
||||
router.push({ name: 'mainInput' })
|
||||
}
|
||||
@@ -113,7 +111,7 @@
|
||||
}
|
||||
}
|
||||
const onClickHistoryItem = (item: any) => {
|
||||
router.push({ name: 'test', params: { id: item.id } })
|
||||
router.push({ name: 'agent', params: { id: item.id } })
|
||||
}
|
||||
const onRenameHistoryItem = (item: any) => {
|
||||
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
|
||||
@@ -121,12 +119,37 @@
|
||||
// }
|
||||
}
|
||||
const onDeleteHistoryItem = (item: any) => {
|
||||
console.log(item)
|
||||
const index = historyList.value.findIndex((i: any) => i.id == item.id)
|
||||
if (index != -1) {
|
||||
historyList.value.splice(index, 1)
|
||||
}
|
||||
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
|
||||
// if (index != -1) {
|
||||
// historyList.value.splice(index, 1)
|
||||
// }
|
||||
}
|
||||
|
||||
const GetProjectList = async () => {
|
||||
const res = await getProjectList({
|
||||
page: 1,
|
||||
size: 100
|
||||
})
|
||||
const str = 'yyyyMMdd'
|
||||
const today = FormatDate(Date.now(), str)
|
||||
const yesterday = FormatDate(Date.now() - 24 * 60 * 60 * 1000, str)
|
||||
todayList.value = []
|
||||
yesterdayList.value = []
|
||||
earlierChatList.value = []
|
||||
const list = res.records || []
|
||||
list.forEach((item: any) => {
|
||||
const obj = { ...item }
|
||||
const date = FormatDate(obj.createTime * 1000, str)
|
||||
if (date == today) {
|
||||
todayList.value.push(obj)
|
||||
} else if (date == yesterday) {
|
||||
yesterdayList.value.push(obj)
|
||||
} else {
|
||||
earlierChatList.value.push(obj)
|
||||
}
|
||||
})
|
||||
}
|
||||
GetProjectList()
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
const route = useRoute()
|
||||
const id = computed(() => route.params.id)
|
||||
const openCanvas = () => {
|
||||
myEvent.emit('openFlowCanvas')
|
||||
myEvent.emit('openFlowCanvas', {
|
||||
url: 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__'
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
openCanvas();
|
||||
openCanvas()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user