Skip to content

Commit 2617e56

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

File tree

3 files changed

+51
-66
lines changed

3 files changed

+51
-66
lines changed

src/views/ai/chat/index/components/message/MessageList.vue

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,30 @@
1010
<div>
1111
<el-text class="text-left leading-30px">{{ formatDate(item.createTime) }}</el-text>
1212
</div>
13-
<div class="relative flex flex-col break-words bg-[var(--el-fill-color-light)] shadow-[0_0_0_1px_var(--el-border-color-light)] rounded-10px pt-10px px-10px pb-5px" ref="markdownViewRef">
14-
<MarkdownView class="text-[var(--el-text-color-primary)] text-[0.95rem]" :content="item.content" />
13+
<div
14+
class="relative flex flex-col break-words bg-[var(--el-fill-color-light)] shadow-[0_0_0_1px_var(--el-border-color-light)] rounded-10px pt-10px px-10px pb-5px"
15+
ref="markdownViewRef"
16+
>
17+
<MarkdownView
18+
class="text-[var(--el-text-color-primary)] text-[0.95rem]"
19+
:content="item.content"
20+
/>
1521
<MessageKnowledge v-if="item.segments" :segments="item.segments" />
1622
</div>
1723
<div class="flex flex-row mt-8px">
18-
<el-button class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]" link @click="copyContent(item.content)">
24+
<el-button
25+
class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]"
26+
link
27+
@click="copyContent(item.content)"
28+
>
1929
<img class="h-20px" src="@/assets/ai/copy.svg" />
2030
</el-button>
21-
<el-button v-if="item.id > 0" class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]" link @click="onDelete(item.id)">
31+
<el-button
32+
v-if="item.id > 0"
33+
class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]"
34+
link
35+
@click="onDelete(item.id)"
36+
>
2237
<img class="h-17px" src="@/assets/ai/delete.svg" />
2338
</el-button>
2439
</div>
@@ -34,19 +49,38 @@
3449
<el-text class="text-left leading-30px">{{ formatDate(item.createTime) }}</el-text>
3550
</div>
3651
<div class="flex flex-row-reverse">
37-
<div class="text-[0.95rem] text-[var(--el-color-white)] inline bg-[var(--el-color-primary)] shadow-[0_0_0_1px_var(--el-color-primary)] rounded-10px p-10px w-auto break-words whitespace-pre-wrap">{{ item.content }}</div>
52+
<div
53+
class="text-[0.95rem] text-[var(--el-color-white)] inline bg-[var(--el-color-primary)] shadow-[0_0_0_1px_var(--el-color-primary)] rounded-10px p-10px w-auto break-words whitespace-pre-wrap"
54+
>{{ item.content }}</div
55+
>
3856
</div>
3957
<div class="flex flex-row-reverse mt-8px">
40-
<el-button class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]" link @click="copyContent(item.content)">
58+
<el-button
59+
class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]"
60+
link
61+
@click="copyContent(item.content)"
62+
>
4163
<img class="h-20px" src="@/assets/ai/copy.svg" />
4264
</el-button>
43-
<el-button class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]" link @click="onDelete(item.id)">
65+
<el-button
66+
class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]"
67+
link
68+
@click="onDelete(item.id)"
69+
>
4470
<img class="h-17px mr-12px" src="@/assets/ai/delete.svg" />
4571
</el-button>
46-
<el-button class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]" link @click="onRefresh(item)">
72+
<el-button
73+
class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]"
74+
link
75+
@click="onRefresh(item)"
76+
>
4777
<el-icon size="17"><RefreshRight /></el-icon>
4878
</el-button>
49-
<el-button class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]" link @click="onEdit(item)">
79+
<el-button
80+
class="flex bg-transparent items-center hover:cursor-pointer hover:bg-[var(--el-fill-color-lighter)]"
81+
link
82+
@click="onEdit(item)"
83+
>
5084
<el-icon size="17"><Edit /></el-icon>
5185
</el-button>
5286
</div>
@@ -171,5 +205,3 @@ onMounted(async () => {
171205
messageContainer.value.addEventListener('scroll', handleScroll)
172206
})
173207
</script>
174-
175-

src/views/ai/chat/index/components/message/MessageNewConversation.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ const handlerNewChat = () => {
1717
emits('onNewConversation')
1818
}
1919
</script>
20-

src/views/ai/chat/index/index.vue

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<el-container class="ai-layout">
2+
<el-container class="absolute flex-1 top-0 left-0 h-full w-full">
33
<!-- 左侧:对话列表 -->
44
<ConversationList
55
:active-id="activeConversationId"
@@ -67,18 +67,21 @@
6767
</el-main>
6868

6969
<!-- 底部 -->
70-
<el-footer class="footer-container">
71-
<form class="prompt-from">
70+
<el-footer class="flex flex-col !h-auto !p-0">
71+
<form
72+
class="mt-10px mx-20px mb-20px py-9px px-10px flex flex-col h-auto rounded-10px"
73+
style="border: 1px solid var(--el-border-color)"
74+
>
7275
<textarea
73-
class="prompt-input"
76+
class="h-80px border-none box-border resize-none py-0 px-2px overflow-auto focus:outline-none"
7477
v-model="prompt"
7578
@keydown="handleSendByKeydown"
7679
@input="handlePromptInput"
7780
@compositionstart="onCompositionstart"
7881
@compositionend="onCompositionend"
7982
placeholder="问我任何问题...(Shift+Enter 换行,按下 Enter 发送)"
8083
></textarea>
81-
<div class="prompt-btns">
84+
<div class="flex justify-between pb-0 pt-5px">
8285
<div>
8386
<el-switch v-model="enableContext" />
8487
<span class="ml-5px text-14px text-#8f8f8f">上下文</span>
@@ -576,15 +579,6 @@ onMounted(async () => {
576579
</script>
577580

578581
<style lang="scss" scoped>
579-
.ai-layout {
580-
position: absolute;
581-
flex: 1;
582-
top: 0;
583-
left: 0;
584-
height: 100%;
585-
width: 100%;
586-
}
587-
588582
.conversation-container {
589583
position: relative;
590584
display: flex;
@@ -735,44 +729,4 @@ onMounted(async () => {
735729
margin: 0;
736730
}
737731
}
738-
739-
// 底部
740-
.footer-container {
741-
display: flex;
742-
flex-direction: column;
743-
height: auto;
744-
margin: 0;
745-
padding: 0;
746-
747-
.prompt-from {
748-
display: flex;
749-
flex-direction: column;
750-
height: auto;
751-
border: 1px solid var(--el-border-color);
752-
border-radius: 10px;
753-
margin: 10px 20px 20px 20px;
754-
padding: 9px 10px;
755-
}
756-
757-
.prompt-input {
758-
height: 80px;
759-
//box-shadow: none;
760-
border: none;
761-
box-sizing: border-box;
762-
resize: none;
763-
padding: 0 2px;
764-
overflow: auto;
765-
}
766-
767-
.prompt-input:focus {
768-
outline: none;
769-
}
770-
771-
.prompt-btns {
772-
display: flex;
773-
justify-content: space-between;
774-
padding-bottom: 0;
775-
padding-top: 5px;
776-
}
777-
}
778732
</style>

0 commit comments

Comments
 (0)