2024-05-07 21:59:47 +08:00
|
|
|
|
<template>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<el-container class="ai-layout">
|
2024-05-07 21:59:47 +08:00
|
|
|
|
<!-- 左侧:会话列表 -->
|
|
|
|
|
<el-aside width="260px" class="conversation-container">
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<div>
|
|
|
|
|
<!-- 左顶部:新建对话 -->
|
|
|
|
|
<el-button class="w-1/1 btn-new-conversation" type="primary">
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:plus" class="mr-5px"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
新建对话
|
|
|
|
|
</el-button>
|
|
|
|
|
<!-- 左顶部:搜索对话 -->
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="searchName"
|
|
|
|
|
size="large"
|
|
|
|
|
class="mt-10px search-input"
|
|
|
|
|
placeholder="搜索历史记录"
|
|
|
|
|
@keyup="searchConversation"
|
|
|
|
|
>
|
|
|
|
|
<template #prefix>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:search"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
<!-- 左中间:对话列表 -->
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<div class="conversation-list">
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<!-- TODO @芋艿,置顶、聊天记录、一星期钱、30天前,前端对数据重新做一下分组,或者后端接口改一下 -->
|
|
|
|
|
<div>
|
|
|
|
|
<el-text class="mx-1" size="small" tag="b">置顶</el-text>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</div>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<el-row v-for="conversation in conversationList" :key="conversation.id">
|
|
|
|
|
<div
|
|
|
|
|
:class="conversation.id === conversationId ? 'conversation active' : 'conversation'"
|
|
|
|
|
@click="changeConversation(conversation)"
|
|
|
|
|
>
|
|
|
|
|
<div class="title-wrapper">
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<img class="avatar" :src="conversation.avatar"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<span class="title">{{ conversation.title }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="button-wrapper">
|
|
|
|
|
<el-icon title="编辑" @click="updateConversationTitle(conversation)">
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:edit"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-icon>
|
|
|
|
|
<el-icon title="删除会话" @click="deleteConversationTitle(conversation)">
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:delete"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-icon>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-row>
|
|
|
|
|
</div>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</div>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<!-- 左底部:工具栏 -->
|
2024-05-07 21:59:47 +08:00
|
|
|
|
<div class="tool-box">
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<div>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:user"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<el-text size="small">角色仓库</el-text>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:delete"/>
|
|
|
|
|
<el-text size="small">清空未置顶对话</el-text>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</div>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</div>
|
|
|
|
|
</el-aside>
|
|
|
|
|
<!-- 右侧:会话详情 -->
|
|
|
|
|
<el-container class="detail-container">
|
|
|
|
|
<!-- 右顶部 TODO 芋艿:右对齐 -->
|
|
|
|
|
<el-header class="header">
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<div class="title">
|
|
|
|
|
标题......
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<el-button>3.5-turbo-0125
|
|
|
|
|
<Icon icon="ep:setting"/>
|
|
|
|
|
</el-button>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<el-button>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:user"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
<el-button>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:download"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
<el-button>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<Icon icon="ep:arrow-up"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</el-header>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-12 14:28:27 +08:00
|
|
|
|
<!-- main -->
|
|
|
|
|
<el-main class="main-container">
|
|
|
|
|
<MessageList />
|
2024-05-10 23:35:47 +08:00
|
|
|
|
</el-main>
|
|
|
|
|
<el-footer class="footer-container">
|
|
|
|
|
<textarea placeholder="问我任何问题...(Shift+Enter 换行,按下 Enter 发送)"
|
|
|
|
|
class="prompt-input">
|
|
|
|
|
</textarea>
|
|
|
|
|
<div class="prompt-btns">
|
|
|
|
|
<el-switch/>
|
|
|
|
|
<el-button type="primary" size="default">发送</el-button>
|
|
|
|
|
</div>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-footer>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</el-container>
|
|
|
|
|
</el-container>
|
|
|
|
|
</template>
|
2024-05-12 14:28:27 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
<script setup lang="ts">
|
2024-05-12 14:28:27 +08:00
|
|
|
|
import MessageList from './components/MessageList.vue'
|
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
const conversationList = [
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
title: '测试标题',
|
|
|
|
|
avatar:
|
|
|
|
|
'http://test.yudao.iocoder.cn/96c787a2ce88bf6d0ce3cd8b6cf5314e80e7703cd41bf4af8cd2e2909dbd6b6d.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 2,
|
|
|
|
|
title: '测试对话',
|
|
|
|
|
avatar:
|
|
|
|
|
'http://test.yudao.iocoder.cn/96c787a2ce88bf6d0ce3cd8b6cf5314e80e7703cd41bf4af8cd2e2909dbd6b6d.png'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
const conversationId = ref(1)
|
|
|
|
|
const searchName = ref('')
|
|
|
|
|
const leftHeight = window.innerHeight - 240 // TODO 芋艿:这里还不太对
|
|
|
|
|
|
|
|
|
|
const changeConversation = (conversation) => {
|
|
|
|
|
console.log(conversation)
|
|
|
|
|
conversationId.value = conversation.id
|
|
|
|
|
// TODO 芋艿:待实现
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const updateConversationTitle = (conversation) => {
|
|
|
|
|
console.log(conversation)
|
|
|
|
|
// TODO 芋艿:待实现
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const deleteConversationTitle = (conversation) => {
|
|
|
|
|
console.log(conversation)
|
|
|
|
|
// TODO 芋艿:待实现
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const searchConversation = () => {
|
|
|
|
|
// TODO 芋艿:待实现
|
|
|
|
|
}
|
2024-05-12 14:28:27 +08:00
|
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
})
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
|
|
|
|
|
.ai-layout {
|
|
|
|
|
// TODO @范 这里height不能 100% 先这样临时处理
|
|
|
|
|
position: absolute;
|
|
|
|
|
flex: 1;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
//padding: 15px 15px;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.conversation-container {
|
2024-05-09 22:13:23 +08:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.conversation-list {
|
2024-05-09 22:13:23 +08:00
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.conversation {
|
|
|
|
|
display: flex;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
flex-direction: row;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
flex: 1;
|
|
|
|
|
padding: 0 5px;
|
|
|
|
|
margin-top: 10px;
|
2024-05-07 21:59:47 +08:00
|
|
|
|
cursor: pointer;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
border-radius: 5px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
line-height: 30px;
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
&.active {
|
2024-05-09 22:13:23 +08:00
|
|
|
|
background-color: #e6e6e6;
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.button {
|
2024-05-09 22:13:23 +08:00
|
|
|
|
display: inline-block;
|
2024-05-07 21:59:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-09 22:13:23 +08:00
|
|
|
|
|
|
|
|
|
.title-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.title {
|
|
|
|
|
padding: 5px 10px;
|
|
|
|
|
max-width: 220px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
}
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.avatar {
|
|
|
|
|
width: 28px;
|
|
|
|
|
height: 28px;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
justify-items: center;
|
2024-05-07 21:59:47 +08:00
|
|
|
|
}
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-09 22:13:23 +08:00
|
|
|
|
// 对话编辑、删除
|
|
|
|
|
.button-wrapper {
|
2024-05-07 21:59:47 +08:00
|
|
|
|
right: 2px;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
justify-items: center;
|
|
|
|
|
color: #606266;
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.el-icon {
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-09 22:13:23 +08:00
|
|
|
|
}
|
2024-05-07 21:59:47 +08:00
|
|
|
|
|
2024-05-09 22:13:23 +08:00
|
|
|
|
// 角色仓库、清空未设置对话
|
|
|
|
|
.tool-box {
|
|
|
|
|
line-height: 35px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
color: var(--el-text-color);
|
|
|
|
|
|
|
|
|
|
> div {
|
2024-05-07 21:59:47 +08:00
|
|
|
|
display: flex;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
color: #606266;
|
|
|
|
|
padding: 0;
|
|
|
|
|
margin: 0;
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-09 22:13:23 +08:00
|
|
|
|
> span {
|
|
|
|
|
margin-left: 5px;
|
|
|
|
|
}
|
2024-05-07 21:59:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 23:35:47 +08:00
|
|
|
|
// 头部
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.detail-container {
|
2024-05-09 22:13:23 +08:00
|
|
|
|
background: #ffffff;
|
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
.header {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
align-items: center;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
justify-content: space-between;
|
|
|
|
|
background: #fbfbfb;
|
2024-05-10 23:35:47 +08:00
|
|
|
|
box-shadow: 0 0 0 0 #dcdfe6;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
|
|
|
|
|
.title {
|
2024-05-10 23:35:47 +08:00
|
|
|
|
font-size: 18px;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-10 23:35:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-12 14:28:27 +08:00
|
|
|
|
// main 容器
|
|
|
|
|
.main-container {
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
position: relative;
|
2024-05-10 23:35:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 底部
|
|
|
|
|
.footer-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
height: auto;
|
|
|
|
|
border: 1px solid #e3e3e3;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
margin: 20px 20px;
|
|
|
|
|
padding: 9px 10px;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
|
|
|
|
|
.prompt-input {
|
2024-05-10 23:35:47 +08:00
|
|
|
|
height: 80px;
|
|
|
|
|
//box-shadow: none;
|
|
|
|
|
border: none;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
resize: none;
|
|
|
|
|
padding: 0px 2px;
|
|
|
|
|
//padding: 5px 5px;
|
2024-05-09 22:13:23 +08:00
|
|
|
|
|
2024-05-10 23:35:47 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.prompt-input:focus {
|
|
|
|
|
outline: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.prompt-btns {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
padding-bottom: 0px;
|
|
|
|
|
padding-top: 5px;
|
2024-05-07 21:59:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|