Skip to content

Commit 6c950e1

Browse files
feat: 历史记录增加删除功能优化
feat: 历史记录增加删除功能优化
2 parents b90672f + 4a1a9c7 commit 6c950e1

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

ui/src/components/ai-chat/index.vue

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
ref="quickInputRef"
147147
v-model="inputValue"
148148
placeholder="请输入"
149-
:autosize="{ minRows: 1, maxRows: 4 }"
149+
:autosize="{ minRows: 1, maxRows: common.isMobile() ? 4 : 10 }"
150150
type="textarea"
151151
:maxlength="100000"
152152
@keydown.enter="sendChatHandle($event)"
@@ -173,7 +173,7 @@
173173
</div>
174174
</template>
175175
<script setup lang="ts">
176-
import { ref, nextTick, computed, watch, reactive } from 'vue'
176+
import { ref, nextTick, computed, watch, reactive, onMounted } from 'vue'
177177
import { useRoute } from 'vue-router'
178178
import LogOperationButton from './LogOperationButton.vue'
179179
import OperationButton from './OperationButton.vue'
@@ -215,7 +215,7 @@ const props = defineProps({
215215
216216
const emit = defineEmits(['refresh', 'scroll'])
217217
218-
const { application } = useStore()
218+
const { application, common } = useStore()
219219
220220
const ParagraphSourceDialogRef = ref()
221221
const aiChatRef = ref()
@@ -622,11 +622,7 @@ defineExpose({
622622
position: relative;
623623
color: var(--app-text-color);
624624
box-sizing: border-box;
625-
&.chart-log {
626-
.ai-chat__content {
627-
padding-bottom: 0;
628-
}
629-
}
625+
630626
&__content {
631627
padding-top: 0;
632628
box-sizing: border-box;

ui/src/components/common-list/index.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@click.prevent="clickHandle(item, index)"
77
:class="current === item[props.valueKey] ? 'active' : ''"
88
class="cursor"
9+
@mouseenter="mouseenter(item)"
10+
@mouseleave="mouseleave()"
911
>
1012
<slot :row="item" :index="index"> </slot>
1113
</li>
@@ -44,7 +46,14 @@ watch(
4446
{ immediate: true }
4547
)
4648
47-
const emit = defineEmits(['click'])
49+
const emit = defineEmits(['click', 'mouseenter', 'mouseleave'])
50+
51+
function mouseenter(row: any) {
52+
emit('mouseenter', row)
53+
}
54+
function mouseleave() {
55+
emit('mouseleave')
56+
}
4857
4958
function clickHandle(row: any, index: number) {
5059
current.value = row[props.valueKey]

ui/src/views/chat/embed/index.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@
4343
v-loading="left_loading"
4444
:defaultActive="currentChatId"
4545
@click="clickListHandle"
46+
@mouseenter="mouseenter"
47+
@mouseleave="mouseId = ''"
4648
>
4749
<template #default="{ row }">
4850
<div class="flex-between">
4951
<auto-tooltip :content="row.abstract">
5052
{{ row.abstract }}
5153
</auto-tooltip>
52-
<div @click.stop>
53-
<el-button text @click.stop="deleteLog(row)">
54+
<div @click.stop v-if="mouseId === row.id">
55+
<el-button style="padding: 0" link @click.stop="deleteLog(row)">
5456
<el-icon><Delete /></el-icon>
5557
</el-button>
5658
</div>
@@ -101,6 +103,11 @@ const paginationConfig = reactive({
101103
const currentRecordList = ref<any>([])
102104
const currentChatId = ref('new') // 当前历史记录Id 默认为'new'
103105
106+
const mouseId = ref('')
107+
108+
function mouseenter(row: any) {
109+
mouseId.value = row.id
110+
}
104111
function deleteLog(row: any) {
105112
log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => {
106113
if (currentChatId.value === row.id) {
@@ -247,9 +254,6 @@ onMounted(() => {
247254
overflow: hidden;
248255
}
249256
.new-chat-button {
250-
// position: absolute;
251-
// bottom: 80px;
252-
// left: 18px;
253257
z-index: 11;
254258
}
255259
// 历史对话弹出层
@@ -305,9 +309,6 @@ onMounted(() => {
305309
.ai-chat__operate {
306310
padding-top: 12px;
307311
}
308-
.ai-chat__content {
309-
padding-bottom: 104px;
310-
}
311312
}
312313
}
313314
</style>

ui/src/views/chat/pc/index.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,22 @@
2323
v-loading="left_loading"
2424
:defaultActive="currentChatId"
2525
@click="clickListHandle"
26+
@mouseenter="mouseenter"
27+
@mouseleave="mouseId = ''"
2628
>
2729
<template #default="{ row }">
2830
<div class="flex-between">
2931
<auto-tooltip :content="row.abstract">
3032
{{ row.abstract }}
3133
</auto-tooltip>
32-
<div @click.stop>
33-
<el-button text @click.stop="deleteLog(row)">
34+
<div @click.stop v-if="mouseId === row.id">
35+
<el-button style="padding: 0" link @click.stop="deleteLog(row)">
3436
<el-icon><Delete /></el-icon>
3537
</el-button>
3638
</div>
3739
</div>
3840
</template>
41+
3942
<template #empty>
4043
<div class="text-center">
4144
<el-text type="info">暂无历史记录</el-text>
@@ -150,7 +153,11 @@ const paginationConfig = ref({
150153
const currentRecordList = ref<any>([])
151154
const currentChatId = ref('new') // 当前历史记录Id 默认为'new'
152155
const currentChatName = ref('新建对话')
156+
const mouseId = ref('')
153157
158+
function mouseenter(row: any) {
159+
mouseId.value = row.id
160+
}
154161
function deleteLog(row: any) {
155162
log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => {
156163
if (currentChatId.value === row.id) {

0 commit comments

Comments
 (0)