From 834f163fce18fc7cb52c9419650163218c044715 Mon Sep 17 00:00:00 2001 From: lzp Date: Fri, 27 Feb 2026 16:47:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/agent.ts | 19 +++- .../Canvas/FlowCanvas/flow-canvas.vue | 10 +- src/components/Canvas/FlowCanvas/index.vue | 7 +- src/router/index.ts | 2 +- src/views/home/index.vue | 4 +- src/views/home/left-nav.vue | 101 +++++++++++------- src/views/home/test.vue | 6 +- 7 files changed, 99 insertions(+), 50 deletions(-) diff --git a/src/api/agent.ts b/src/api/agent.ts index 4d77954..4858085 100644 --- a/src/api/agent.ts +++ b/src/api/agent.ts @@ -13,7 +13,7 @@ export const fetchAgentReply = (data: AgentParamsType): Promise = 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', }) -} \ No newline at end of file +} + +/** + * 获取项目版本列表 + * @param params 获取项目版本列表参数 + * @param params.page 页码 + * @param params.size 每页数量 + * @returns 获取项目版本列表 +*/ +export const getProjectList = (params) => { + return request({ + url: `/api/project/list`, + method: 'get', + params + }) +} diff --git a/src/components/Canvas/FlowCanvas/flow-canvas.vue b/src/components/Canvas/FlowCanvas/flow-canvas.vue index 15fec53..79f4024 100644 --- a/src/components/Canvas/FlowCanvas/flow-canvas.vue +++ b/src/components/Canvas/FlowCanvas/flow-canvas.vue @@ -48,6 +48,13 @@ import { FlowManager } from './manager/FlowManager' import { NodeManager } from './manager/NodeManager' + const props = defineProps({ + config: { + type: Object, + default: () => ({}) + } + }) + const vueFlow = ref() 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 } } }) diff --git a/src/components/Canvas/FlowCanvas/index.vue b/src/components/Canvas/FlowCanvas/index.vue index 1644e90..be86005 100644 --- a/src/components/Canvas/FlowCanvas/index.vue +++ b/src/components/Canvas/FlowCanvas/index.vue @@ -1,6 +1,6 @@ @@ -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 diff --git a/src/router/index.ts b/src/router/index.ts index ad76b18..de58ff9 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -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') } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 72a467b..86287fc 100644 --- a/src/views/home/index.vue +++ b/src/views/home/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(() => { diff --git a/src/views/home/left-nav.vue b/src/views/home/left-nav.vue index f7db48f..f5c2474 100644 --- a/src/views/home/left-nav.vue +++ b/src/views/home/left-nav.vue @@ -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()