Skip to content

Commit d8daf6f

Browse files
committed
reactor:【AI 大模型】chat/message 简化成 unocss
1 parent 2617e56 commit d8daf6f

File tree

2 files changed

+49
-254
lines changed

2 files changed

+49
-254
lines changed

src/views/ai/chat/index/components/conversation/ConversationList.vue

Lines changed: 37 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<el-aside width="260px" class="conversation-container h-100%">
44
<!-- 左顶部:对话 -->
55
<div class="h-100%">
6-
<el-button class="w-1/1 btn-new-conversation" type="primary" @click="createConversation">
6+
<el-button class="w-1/1 py-4.5" type="primary" @click="createConversation">
77
<Icon icon="ep:plus" class="mr-5px" />
88
新建对话
99
</el-button>
@@ -12,7 +12,7 @@
1212
<el-input
1313
v-model="searchName"
1414
size="large"
15-
class="mt-10px search-input"
15+
class="mt-5"
1616
placeholder="搜索历史记录"
1717
@keyup="searchConversation"
1818
>
@@ -27,16 +27,13 @@
2727
<el-empty v-if="loading" description="." :v-loading="loading" />
2828
<!-- 情况二:按照 group 分组,展示聊天会话 list 列表 -->
2929
<div v-for="conversationKey in Object.keys(conversationMap)" :key="conversationKey">
30-
<div
31-
class="conversation-item classify-title"
32-
v-if="conversationMap[conversationKey].length"
33-
>
30+
<div class="mt-1.25 pt-2.5" v-if="conversationMap[conversationKey].length">
3431
<el-text class="mx-1" size="small" tag="b">
3532
{{ conversationKey }}
3633
</el-text>
3734
</div>
3835
<div
39-
class="conversation-item"
36+
class="mt-1.25"
4037
v-for="conversation in conversationMap[conversationKey]"
4138
:key="conversation.id"
4239
@click="handleConversationClick(conversation.id)"
@@ -48,21 +45,28 @@
4845
conversation.id === activeConversationId ? 'conversation active' : 'conversation'
4946
"
5047
>
51-
<div class="title-wrapper">
52-
<img class="avatar" :src="conversation.roleAvatar || roleAvatarDefaultImg" />
48+
<div class="flex flex-row items-center">
49+
<img
50+
class="w-6.25 h-6.25 rounded-1.25 flex flex-row justify-center"
51+
:src="conversation.roleAvatar || roleAvatarDefaultImg"
52+
/>
5353
<span class="title">{{ conversation.title }}</span>
5454
</div>
55-
<div class="button-wrapper" v-show="hoverConversationId === conversation.id">
56-
<el-button class="btn" link @click.stop="handleTop(conversation)">
55+
<div
56+
class="right-0.5 flex flex-row justify-center"
57+
style="color: var(--el-text-color-regular)"
58+
v-show="hoverConversationId === conversation.id"
59+
>
60+
<el-button class="m-0" link @click.stop="handleTop(conversation)">
5761
<el-icon title="置顶" v-if="!conversation.pinned"><Top /></el-icon>
5862
<el-icon title="置顶" v-if="conversation.pinned"><Bottom /></el-icon>
5963
</el-button>
60-
<el-button class="btn" link @click.stop="updateConversationTitle(conversation)">
64+
<el-button class="m-0" link @click.stop="updateConversationTitle(conversation)">
6165
<el-icon title="编辑">
6266
<Icon icon="ep:edit" />
6367
</el-icon>
6468
</el-button>
65-
<el-button class="btn" link @click.stop="deleteChatConversation(conversation)">
69+
<el-button class="m-0" link @click.stop="deleteChatConversation(conversation)">
6670
<el-icon title="删除对话">
6771
<Icon icon="ep:delete" />
6872
</el-icon>
@@ -77,14 +81,29 @@
7781
</div>
7882

7983
<!-- 左底部:工具栏 -->
80-
<div class="tool-box">
81-
<div @click="handleRoleRepository">
84+
<div
85+
class="absolute bottom-0 left-0 right-0 px-5 leading-8.75 flex justify-between items-center"
86+
style="
87+
background-color: var(--el-fill-color-extra-light);
88+
box-shadow: 0 0 1px 1px var(--el-border-color-lighter);
89+
color: var(--el-text-color);
90+
"
91+
>
92+
<div
93+
class="flex items-center p-0 m-0 cursor-pointer"
94+
style="color: var(--el-text-color-regular)"
95+
@click="handleRoleRepository"
96+
>
8297
<Icon icon="ep:user" />
83-
<el-text size="small">角色仓库</el-text>
98+
<el-text class="ml-1.25" size="small">角色仓库</el-text>
8499
</div>
85-
<div @click="handleClearConversation">
100+
<div
101+
class="flex items-center p-0 m-0 cursor-pointer"
102+
style="color: var(--el-text-color-regular)"
103+
@click="handleClearConversation"
104+
>
86105
<Icon icon="ep:delete" />
87-
<el-text size="small">清空未置顶对话</el-text>
106+
<el-text class="ml-1.25" size="small">清空未置顶对话</el-text>
88107
</div>
89108
</div>
90109

@@ -361,26 +380,10 @@ onMounted(async () => {
361380
padding: 10px 10px 0;
362381
overflow: hidden;
363382
364-
.btn-new-conversation {
365-
padding: 18px 0;
366-
}
367-
368-
.search-input {
369-
margin-top: 20px;
370-
}
371-
372383
.conversation-list {
373384
overflow: auto;
374385
height: 100%;
375386
376-
.classify-title {
377-
padding-top: 10px;
378-
}
379-
380-
.conversation-item {
381-
margin-top: 5px;
382-
}
383-
384387
.conversation {
385388
display: flex;
386389
flex-direction: row;
@@ -401,12 +404,6 @@ onMounted(async () => {
401404
}
402405
}
403406
404-
.title-wrapper {
405-
display: flex;
406-
flex-direction: row;
407-
align-items: center;
408-
}
409-
410407
.title {
411408
padding: 2px 10px;
412409
max-width: 220px;
@@ -417,58 +414,6 @@ onMounted(async () => {
417414
white-space: nowrap;
418415
text-overflow: ellipsis;
419416
}
420-
421-
.avatar {
422-
width: 25px;
423-
height: 25px;
424-
border-radius: 5px;
425-
display: flex;
426-
flex-direction: row;
427-
justify-items: center;
428-
}
429-
430-
// 对话编辑、删除
431-
.button-wrapper {
432-
right: 2px;
433-
display: flex;
434-
flex-direction: row;
435-
justify-items: center;
436-
color: var(--el-text-color-regular);
437-
438-
.btn {
439-
margin: 0;
440-
}
441-
}
442-
}
443-
}
444-
445-
// 角色仓库、清空未设置对话
446-
.tool-box {
447-
position: absolute;
448-
bottom: 0;
449-
left: 0;
450-
right: 0;
451-
//width: 100%;
452-
padding: 0 20px;
453-
background-color: var(--el-fill-color-extra-light);
454-
box-shadow: 0 0 1px 1px var(--el-border-color-lighter);
455-
line-height: 35px;
456-
display: flex;
457-
justify-content: space-between;
458-
align-items: center;
459-
color: var(--el-text-color);
460-
461-
> div {
462-
display: flex;
463-
align-items: center;
464-
color: var(--el-text-color-regular);
465-
padding: 0;
466-
margin: 0;
467-
cursor: pointer;
468-
469-
> span {
470-
margin-left: 5px;
471-
}
472417
}
473418
}
474419
}

0 commit comments

Comments
 (0)