perf(agent): 为历史对话项添加 key 属性

- 在 history-item 组件中添加 :key="index",以优化渲染性能
This commit is contained in:
林志军
2025-08-04 17:53:02 +08:00
parent 8268e77f9b
commit a653ea0c26

View File

@ -42,12 +42,18 @@
{{ item.title }}
</div>
<div class="trigger-container">
<a-trigger mouse-leave-delay="200" position="top" trigger="hover" :auto-fit-position="false" :unmount-on-close="true ">
<a-trigger
mouse-leave-delay="200"
position="top"
trigger="hover"
:auto-fit-position="false"
:unmount-on-close="true"
>
<SvgIcon size="12" name="svg-more" class="icon-more" />
<template #content>
<div class="">
<div class="history-item-dropdown">
<div class="dropdown-item ">
<div class="dropdown-item">
<SvgIcon size="12" name="svg-pin" class="icon color-#6D4CFE" />
<div @click="(event) => handleTop(item.id, item.sort, event)" class="text">
{{ item.sort > 0 ? '取消置顶' : '置顶' }}
@ -90,7 +96,11 @@
</div>
<div class="res h-full">
<a-spin v-if="loading" class="spin-center" tip="生成中。。。" />
<div class="markdown-container" v-if="workFlowRes.output != '' && loading === false" v-html="renderedMarkdown"></div>
<div
class="markdown-container"
v-if="workFlowRes.output != '' && loading === false"
v-html="renderedMarkdown"
></div>
<NoData v-if="workFlowRes.output == '' && loading === false" />
</div>
</div>
@ -156,9 +166,11 @@ const cozeInfo = reactive({
description: '',
icon_url: '',
workflow_id: '',
id: 0,
});
const getData = async () => {
const { code, data } = await getWorkFlowInfo(query.id);
console.log(data.info,'data.info')
Object.assign(cozeInfo, data.info);
formFields.value = data.form_config;
history.value = data.history;
@ -189,11 +201,7 @@ const historyForm = reactive({
title: '',
});
const editTitle = async (item) => {
historyForm.id = item.id;
historyForm.title = item.title;
editHistoryVisible.value = true;
};
const handleTop = async (id, sort, event) => {
if (sort > 0) {
@ -233,7 +241,8 @@ const getWorkflowHistoryList = async () => {
// 提交表单
const handleSubmit = async (formData) => {
try {
const param = { form_data: formData, workflow_id: cozeInfo.workflow_id, bot_id: formFields.value.bot_id };
const param = { form_data: formData, id: cozeInfo.id };
console.log(param,'param')
workFlowRes.output = '';
loading.value = true;
const { code, data } = await executeWorkFlow(param);
@ -298,5 +307,4 @@ onMounted(() => {
<style scoped lang="scss">
@import './style.scss';
</style>