【优化】优化 ai chat 主框架布局

This commit is contained in:
cherishsince 2024-05-09 22:13:23 +08:00
parent 760bab7d29
commit 5525bc2257

View File

@ -1,16 +1,18 @@
<template> <template>
<el-container> <el-container class="ai-layout">
<!-- 左侧会话列表 --> <!-- 左侧会话列表 -->
<el-aside width="260px" class="conversation-container"> <el-aside width="260px" class="conversation-container">
<div>
<!-- 左顶部新建对话 --> <!-- 左顶部新建对话 -->
<el-button class="w-1/1" type="primary"> <el-button class="w-1/1 btn-new-conversation" type="primary">
<Icon icon="ep:plus" class="mr-5px" /> <Icon icon="ep:plus" class="mr-5px" />
新建对话 新建对话
</el-button> </el-button>
<!-- 左顶部搜索对话 --> <!-- 左顶部搜索对话 -->
<el-input <el-input
v-model="searchName" v-model="searchName"
class="mt-10px" size="large"
class="mt-10px search-input"
placeholder="搜索历史记录" placeholder="搜索历史记录"
@keyup="searchConversation" @keyup="searchConversation"
> >
@ -19,36 +21,52 @@
</template> </template>
</el-input> </el-input>
<!-- 左中间对话列表 --> <!-- 左中间对话列表 -->
<div class="conversation-list" :style="{ height: leftHeight + 'px' }"> <div class="conversation-list" >
<!-- TODO @芋艿置顶聊天记录一星期钱30天前前端对数据重新做一下分组或者后端接口改一下 -->
<div>
<el-text class="mx-1" size="small" tag="b">置顶</el-text>
</div>
<el-row v-for="conversation in conversationList" :key="conversation.id"> <el-row v-for="conversation in conversationList" :key="conversation.id">
<div <div
:class="conversation.id === conversationId ? 'conversation active' : 'conversation'" :class="conversation.id === conversationId ? 'conversation active' : 'conversation'"
@click="changeConversation(conversation)" @click="changeConversation(conversation)"
> >
<el-image :src="conversation.avatar" class="avatar" /> <div class="title-wrapper">
<img class="avatar" :src="conversation.avatar" />
<span class="title">{{ conversation.title }}</span> <span class="title">{{ conversation.title }}</span>
<span class="button"> </div>
<!-- TODO 芋艿缺置顶按钮 --> <div class="button-wrapper">
<el-icon title="编辑" @click="updateConversationTitle(conversation)"> <el-icon title="编辑" @click="updateConversationTitle(conversation)">
<Icon icon="ep:edit" /> <Icon icon="ep:edit" />
</el-icon> </el-icon>
<el-icon title="删除会话" @click="deleteConversationTitle(conversation)"> <el-icon title="删除会话" @click="deleteConversationTitle(conversation)">
<Icon icon="ep:delete" /> <Icon icon="ep:delete" />
</el-icon> </el-icon>
</span> </div>
</div> </div>
</el-row> </el-row>
</div> </div>
<!-- 左底部工具栏 TODO 芋艿50% 不太对 --> </div>
<!-- 左底部工具栏 -->
<div class="tool-box"> <div class="tool-box">
<sapn class="w-1/2"> <Icon icon="ep:user" /> 角色仓库 </sapn> <div>
<sapn class="w-1/2"> <Icon icon="ep:delete" />清空未置顶对话</sapn> <Icon icon="ep:user" />
<el-text size="small">角色仓库</el-text>
</div>
<div>
<Icon icon="ep:delete" />
<el-text size="small" >清空未置顶对话</el-text>
</div>
</div> </div>
</el-aside> </el-aside>
<!-- 右侧会话详情 --> <!-- 右侧会话详情 -->
<el-container class="detail-container"> <el-container class="detail-container">
<!-- 右顶部 TODO 芋艿右对齐 --> <!-- 右顶部 TODO 芋艿右对齐 -->
<el-header class="header"> <el-header class="header">
<div class="title">
标题......
</div>
<div>
<el-button>3.5-turbo-0125 <Icon icon="ep:setting" /></el-button> <el-button>3.5-turbo-0125 <Icon icon="ep:setting" /></el-button>
<el-button> <el-button>
<Icon icon="ep:user" /> <Icon icon="ep:user" />
@ -59,9 +77,16 @@
<el-button> <el-button>
<Icon icon="ep:arrow-up" /> <Icon icon="ep:arrow-up" />
</el-button> </el-button>
</div>
</el-header> </el-header>
<el-main>对话列表</el-main> <el-main>对话列表</el-main>
<el-footer>发送消息框</el-footer> <el-footer>
<el-input
class="prompt-input"
type="textarea"
placeholder="请输入提示词..."
/>
</el-footer>
</el-container> </el-container>
</el-container> </el-container>
</template> </template>
@ -105,21 +130,60 @@ const searchConversation = () => {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.ai-layout {
// TODO @ height 100%
position: absolute;
flex: 1;
top: 0;
left: 0;
height: 100%;
width: 100%;
//padding: 15px 15px;
}
.conversation-container { .conversation-container {
position: relative;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 0 10px;
padding-top: 10px;
.btn-new-conversation {
padding: 18px 0;
}
.search-input {
margin-top: 20px;
}
.conversation-list { .conversation-list {
margin-top: 20px;
.conversation { .conversation {
display: flex; display: flex;
justify-content: flex-start; flex-direction: row;
width: 100%; justify-content: space-between;
padding: 5px 5px 0 0; flex: 1;
padding: 0 5px;
margin-top: 10px;
cursor: pointer; cursor: pointer;
border-radius: 5px;
align-items: center;
line-height: 30px;
&.active { &.active {
// TODO background-color: #e6e6e6;
background-color: #343540;
.button { .button {
display: inline; display: inline-block;
} }
} }
.title-wrapper {
display: flex;
flex-direction: row;
align-items: center;
}
.title { .title {
padding: 5px 10px; padding: 5px 10px;
max-width: 220px; max-width: 220px;
@ -131,36 +195,64 @@ const searchConversation = () => {
.avatar { .avatar {
width: 28px; width: 28px;
height: 28px; height: 28px;
border-radius: 50%; display: flex;
flex-direction: row;
justify-items: center;
} }
.button { //
position: absolute; .button-wrapper {
right: 2px; right: 2px;
top: 16px; display: flex;
flex-direction: row;
justify-items: center;
color: #606266;
.el-icon { .el-icon {
margin-right: 5px; margin-right: 5px;
} }
} }
} }
}
//
.tool-box { .tool-box {
line-height: 35px;
display: flex; display: flex;
justify-content: flex-start; justify-content: space-between;
padding: 0 20px 10px 20px; align-items: center;
border-top: 1px solid black; color: var(--el-text-color);
> div {
display: flex;
align-items: center;
color: #606266;
padding: 0;
margin: 0;
> span {
margin-left: 5px;
}
} }
} }
} }
.detail-container { .detail-container {
background: #ffffff;
.header { .header {
width: 100%;
height: 30px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: space-between;
padding-top: 10px; background: #fbfbfb;
.title {
font-size: 23px;
font-weight: bold;
}
}
.prompt-input {
} }
} }
</style> </style>