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
|
|
|
|
<!-- 左侧:会话列表 -->
|
2024-05-16 23:21:31 +08:00
|
|
|
|
<Conversation :active-id="activeConversationId"
|
2024-05-22 17:08:13 +08:00
|
|
|
|
ref="conversationRef"
|
2024-05-24 10:35:11 +08:00
|
|
|
|
@onConversationCreate="handleConversationCreate"
|
2024-05-16 23:21:31 +08:00
|
|
|
|
@onConversationClick="handleConversationClick"
|
|
|
|
|
@onConversationClear="handlerConversationClear"
|
|
|
|
|
@onConversationDelete="handlerConversationDelete"
|
|
|
|
|
/>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
<!-- 右侧:会话详情 -->
|
|
|
|
|
<el-container class="detail-container">
|
|
|
|
|
<!-- 右顶部 TODO 芋艿:右对齐 -->
|
|
|
|
|
<el-header class="header">
|
2024-05-09 22:13:23 +08:00
|
|
|
|
<div class="title">
|
2024-05-22 17:08:13 +08:00
|
|
|
|
{{ activeConversation?.title ? activeConversation?.title : '对话' }}
|
2024-05-22 17:17:43 +08:00
|
|
|
|
<span v-if="list.length">({{list.length}})</span>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</div>
|
2024-05-22 17:08:13 +08:00
|
|
|
|
<div class="btns" v-if="activeConversation">
|
2024-05-15 13:00:31 +08:00
|
|
|
|
<!-- TODO @fan:样式改下;这里我已经改成点击后,弹出了 -->
|
2024-05-21 17:52:21 +08:00
|
|
|
|
<el-button type="primary" bg text="plain" size="small" @click="openChatConversationUpdateForm">
|
|
|
|
|
<span v-html="activeConversation?.modelName"></span>
|
|
|
|
|
<Icon icon="ep:setting" style="margin-left: 10px"/>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-button>
|
2024-05-22 09:57:46 +08:00
|
|
|
|
<el-button size="small" class="btn" @click="handlerMessageClear">
|
|
|
|
|
<img src="@/assets/ai/clear.svg" style="height: 14px;" />
|
|
|
|
|
</el-button>
|
2024-05-21 17:52:21 +08:00
|
|
|
|
<el-button size="small" :icon="Download" class="btn" />
|
|
|
|
|
<el-button size="small" :icon="Top" class="btn" @click="handlerGoTop" />
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</div>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</el-header>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
|
2024-05-17 17:07:57 +08:00
|
|
|
|
<!-- main -->
|
2024-05-17 23:57:59 +08:00
|
|
|
|
<el-main class="main-container" >
|
|
|
|
|
<div >
|
|
|
|
|
<div class="message-container" >
|
2024-05-21 13:56:11 +08:00
|
|
|
|
<MessageLoading v-if="listLoading" />
|
2024-05-22 17:08:13 +08:00
|
|
|
|
<MessageNewChat v-if="!activeConversation" @on-new-chat="handlerNewChat" />
|
2024-05-24 20:58:31 +08:00
|
|
|
|
<ChatEmpty v-if="!listLoading && messageList.length === 0 && activeConversation" @on-prompt="doSend"/>
|
|
|
|
|
<Message v-if="!listLoading && messageList.length > 0"
|
2024-05-21 16:09:33 +08:00
|
|
|
|
ref="messageRef"
|
2024-05-24 20:58:31 +08:00
|
|
|
|
:conversation="activeConversation"
|
|
|
|
|
:list="messageList"
|
2024-05-24 10:32:08 +08:00
|
|
|
|
@on-delete-success="handlerMessageDelete"
|
|
|
|
|
@on-edit="handlerMessageEdit"
|
|
|
|
|
@on-refresh="handlerMessageRefresh"/>
|
2024-05-17 23:57:59 +08:00
|
|
|
|
</div>
|
2024-05-12 19:02:45 +08:00
|
|
|
|
</div>
|
2024-05-10 23:35:47 +08:00
|
|
|
|
</el-main>
|
2024-05-17 17:07:57 +08:00
|
|
|
|
|
|
|
|
|
<!-- 底部 -->
|
2024-05-10 23:35:47 +08:00
|
|
|
|
<el-footer class="footer-container">
|
2024-05-21 22:05:56 +08:00
|
|
|
|
<form class="prompt-from">
|
2024-05-14 23:55:23 +08:00
|
|
|
|
<textarea
|
|
|
|
|
class="prompt-input"
|
|
|
|
|
v-model="prompt"
|
2024-05-21 22:05:56 +08:00
|
|
|
|
@keydown="onSend"
|
2024-05-14 23:55:23 +08:00
|
|
|
|
@input="onPromptInput"
|
|
|
|
|
@compositionstart="onCompositionstart"
|
|
|
|
|
@compositionend="onCompositionend"
|
|
|
|
|
placeholder="问我任何问题...(Shift+Enter 换行,按下 Enter 发送)"
|
|
|
|
|
></textarea>
|
2024-05-12 22:22:34 +08:00
|
|
|
|
<div class="prompt-btns">
|
2024-05-22 15:14:17 +08:00
|
|
|
|
<div>
|
|
|
|
|
<el-switch v-model="enableContext" /> <span style="font-size: 14px; color: #8f8f8f;">上下文</span>
|
|
|
|
|
</div>
|
2024-05-14 23:55:23 +08:00
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="default"
|
2024-05-21 22:18:03 +08:00
|
|
|
|
@click="onSendBtn"
|
2024-05-14 23:55:23 +08:00
|
|
|
|
:loading="conversationInProgress"
|
|
|
|
|
v-if="conversationInProgress == false"
|
|
|
|
|
>
|
2024-05-13 23:22:42 +08:00
|
|
|
|
{{ conversationInProgress ? '进行中' : '发送' }}
|
2024-05-13 17:49:18 +08:00
|
|
|
|
</el-button>
|
2024-05-14 23:55:23 +08:00
|
|
|
|
<el-button
|
|
|
|
|
type="danger"
|
|
|
|
|
size="default"
|
|
|
|
|
@click="stopStream()"
|
|
|
|
|
v-if="conversationInProgress == true"
|
|
|
|
|
>
|
2024-05-13 17:49:18 +08:00
|
|
|
|
停止
|
|
|
|
|
</el-button>
|
2024-05-12 22:22:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2024-05-09 22:13:23 +08:00
|
|
|
|
</el-footer>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</el-container>
|
2024-05-15 13:00:31 +08:00
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
<!-- ========= 额外组件 ========== -->
|
|
|
|
|
<!-- 更新对话 form -->
|
|
|
|
|
<ChatConversationUpdateForm
|
|
|
|
|
ref="chatConversationUpdateFormRef"
|
|
|
|
|
@success="handlerTitleSuccess"
|
|
|
|
|
/>
|
|
|
|
|
</el-container>
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</template>
|
2024-05-12 14:28:27 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
<script setup lang="ts">
|
2024-05-16 18:29:42 +08:00
|
|
|
|
import Conversation from './Conversation.vue'
|
2024-05-16 23:21:31 +08:00
|
|
|
|
import Message from './Message.vue'
|
2024-05-17 17:07:57 +08:00
|
|
|
|
import ChatEmpty from './ChatEmpty.vue'
|
2024-05-21 13:56:11 +08:00
|
|
|
|
import MessageLoading from './MessageLoading.vue'
|
2024-05-22 17:08:13 +08:00
|
|
|
|
import MessageNewChat from './MessageNewChat.vue'
|
2024-05-16 11:28:31 +08:00
|
|
|
|
import {ChatMessageApi, ChatMessageVO} from '@/api/ai/chat/message'
|
2024-05-16 23:21:31 +08:00
|
|
|
|
import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversation'
|
2024-05-24 20:58:31 +08:00
|
|
|
|
import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
|
2024-05-16 11:28:31 +08:00
|
|
|
|
import {useClipboard} from '@vueuse/core'
|
2024-05-16 18:29:42 +08:00
|
|
|
|
import ChatConversationUpdateForm from "@/views/ai/chat/components/ChatConversationUpdateForm.vue";
|
2024-05-22 09:57:46 +08:00
|
|
|
|
import {Download, Top} from "@element-plus/icons-vue";
|
2024-05-16 11:28:31 +08:00
|
|
|
|
|
2024-05-16 00:18:29 +08:00
|
|
|
|
const route = useRoute() // 路由
|
2024-05-15 08:59:30 +08:00
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
// ref 属性定义
|
2024-05-16 23:21:31 +08:00
|
|
|
|
const activeConversationId = ref<string | null>(null) // 选中的对话编号
|
2024-05-16 18:29:42 +08:00
|
|
|
|
const activeConversation = ref<ChatConversationVO | null>(null) // 选中的 Conversation
|
2024-05-15 20:32:58 +08:00
|
|
|
|
const conversationInProgress = ref(false) // 对话进行中
|
2024-05-12 22:22:34 +08:00
|
|
|
|
const conversationInAbortController = ref<any>() // 对话进行中 abort 控制器(控制 stream 对话)
|
2024-05-16 18:29:42 +08:00
|
|
|
|
const inputTimeout = ref<any>() // 处理输入中回车的定时器
|
2024-05-12 19:02:45 +08:00
|
|
|
|
const prompt = ref<string>() // prompt
|
2024-05-22 10:58:54 +08:00
|
|
|
|
const userInfo = ref<ProfileVO>() // 用户信息
|
2024-05-22 15:14:17 +08:00
|
|
|
|
const enableContext = ref<boolean>(true) // 是否开启上下文
|
2024-05-12 22:22:34 +08:00
|
|
|
|
|
2024-05-17 18:01:06 +08:00
|
|
|
|
const fullText = ref('');
|
|
|
|
|
const displayedText = ref('');
|
|
|
|
|
const textSpeed = ref<number>(50); // Typing speed in milliseconds
|
|
|
|
|
const textRoleRunning = ref<boolean>(false); // Typing speed in milliseconds
|
|
|
|
|
|
2024-05-21 13:56:11 +08:00
|
|
|
|
// chat message 列表
|
|
|
|
|
const list = ref<ChatMessageVO[]>([]) // 列表的数据
|
|
|
|
|
const listLoading = ref<boolean>(false) // 是否加载中
|
|
|
|
|
const listLoadingTime = ref<any>() // time定时器,如果加载速度很快,就不进入加载中
|
|
|
|
|
|
2024-05-12 22:22:34 +08:00
|
|
|
|
// 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方)
|
2024-05-16 23:21:31 +08:00
|
|
|
|
const messageRef = ref()
|
2024-05-22 17:08:13 +08:00
|
|
|
|
const conversationRef = ref()
|
2024-05-14 17:17:26 +08:00
|
|
|
|
const isComposing = ref(false) // 判断用户是否在输入
|
2024-05-12 22:22:34 +08:00
|
|
|
|
|
2024-05-22 10:58:54 +08:00
|
|
|
|
// 默认 role 头像
|
|
|
|
|
const defaultRoleAvatar = 'http://test.yudao.iocoder.cn/eaef5f41acb911dd718429a0702dcc3c61160d16e57ba1d543132fab58934f9f.png'
|
|
|
|
|
|
2024-05-17 18:01:06 +08:00
|
|
|
|
// =========== 自提滚动效果
|
|
|
|
|
|
|
|
|
|
const textRoll = async () => {
|
|
|
|
|
let index = 0;
|
|
|
|
|
try {
|
|
|
|
|
// 只能执行一次
|
|
|
|
|
if (textRoleRunning.value) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-17 18:07:54 +08:00
|
|
|
|
// 设置状态
|
2024-05-17 18:01:06 +08:00
|
|
|
|
textRoleRunning.value = true
|
2024-05-17 18:07:54 +08:00
|
|
|
|
displayedText.value = ''
|
2024-05-17 18:01:06 +08:00
|
|
|
|
const task = async () => {
|
|
|
|
|
// 调整速度
|
|
|
|
|
const diff = (fullText.value.length - displayedText.value.length) / 10
|
|
|
|
|
if (diff > 5) {
|
|
|
|
|
textSpeed.value = 10
|
|
|
|
|
} else if (diff > 2) {
|
|
|
|
|
textSpeed.value = 30
|
|
|
|
|
} else if (diff > 1.5) {
|
|
|
|
|
textSpeed.value = 50
|
|
|
|
|
} else {
|
|
|
|
|
textSpeed.value = 100
|
|
|
|
|
}
|
2024-05-17 18:07:54 +08:00
|
|
|
|
// 对话结束,就按30的速度
|
|
|
|
|
if (!conversationInProgress.value) {
|
2024-05-17 18:08:57 +08:00
|
|
|
|
textSpeed.value = 10
|
2024-05-17 18:07:54 +08:00
|
|
|
|
}
|
2024-05-17 18:01:06 +08:00
|
|
|
|
|
|
|
|
|
// console.log('index < fullText.value.length', index < fullText.value.length, conversationInProgress.value)
|
|
|
|
|
|
|
|
|
|
if (index < fullText.value.length) {
|
|
|
|
|
displayedText.value += fullText.value[index];
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
// 更新 message
|
|
|
|
|
const lastMessage = list.value[list.value.length - 1]
|
|
|
|
|
lastMessage.content = displayedText.value
|
|
|
|
|
list.value[list.value - 1] = lastMessage
|
|
|
|
|
// 滚动到住下面
|
|
|
|
|
await scrollToBottom()
|
|
|
|
|
// 重新设置任务
|
|
|
|
|
timer = setTimeout(task, textSpeed.value);
|
|
|
|
|
} else {
|
|
|
|
|
// 不是对话中可以结束
|
|
|
|
|
if (!conversationInProgress.value) {
|
|
|
|
|
textRoleRunning.value = false
|
|
|
|
|
clearTimeout(timer);
|
|
|
|
|
console.log("字体滚动退出!")
|
|
|
|
|
} else {
|
|
|
|
|
// 重新设置任务
|
|
|
|
|
timer = setTimeout(task, textSpeed.value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let timer = setTimeout(task, textSpeed.value);
|
|
|
|
|
} finally {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-15 00:00:03 +08:00
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
// ============ 处理对话滚动 ==============
|
2024-05-07 21:59:47 +08:00
|
|
|
|
|
2024-05-16 23:39:31 +08:00
|
|
|
|
function scrollToBottom(isIgnore?: boolean) {
|
2024-05-21 16:21:14 +08:00
|
|
|
|
// isIgnore = isIgnore !== null ? isIgnore : false
|
2024-05-16 23:39:31 +08:00
|
|
|
|
nextTick(() => {
|
2024-05-21 16:21:14 +08:00
|
|
|
|
if (messageRef.value) {
|
|
|
|
|
messageRef.value.scrollToBottom(isIgnore)
|
|
|
|
|
}
|
2024-05-16 23:39:31 +08:00
|
|
|
|
})
|
2024-05-07 21:59:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
// ============= 处理聊天输入回车发送 =============
|
|
|
|
|
|
|
|
|
|
const onCompositionstart = () => {
|
|
|
|
|
isComposing.value = true
|
2024-05-07 21:59:47 +08:00
|
|
|
|
}
|
2024-05-12 14:28:27 +08:00
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
const onCompositionend = () => {
|
|
|
|
|
// console.log('输入结束...')
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
isComposing.value = false
|
|
|
|
|
}, 200)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const onPromptInput = (event) => {
|
|
|
|
|
// 非输入法 输入设置为 true
|
|
|
|
|
if (!isComposing.value) {
|
|
|
|
|
// 回车 event data 是 null
|
|
|
|
|
if (event.data == null) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
isComposing.value = true
|
|
|
|
|
}
|
|
|
|
|
// 清理定时器
|
|
|
|
|
if (inputTimeout.value) {
|
|
|
|
|
clearTimeout(inputTimeout.value)
|
|
|
|
|
}
|
|
|
|
|
// 重置定时器
|
|
|
|
|
inputTimeout.value = setTimeout(() => {
|
|
|
|
|
isComposing.value = false
|
|
|
|
|
}, 400)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ============== 对话消息相关 =================
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发送消息
|
|
|
|
|
*/
|
2024-05-21 22:05:56 +08:00
|
|
|
|
const onSend = async (event) => {
|
2024-05-14 17:17:26 +08:00
|
|
|
|
// 判断用户是否在输入
|
|
|
|
|
if (isComposing.value) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-13 17:49:18 +08:00
|
|
|
|
// 进行中不允许发送
|
|
|
|
|
if (conversationInProgress.value) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-17 17:21:30 +08:00
|
|
|
|
const content = prompt.value?.trim() as string
|
2024-05-21 22:05:56 +08:00
|
|
|
|
if (event.key === 'Enter') {
|
|
|
|
|
if (event.shiftKey) {
|
|
|
|
|
// 插入换行
|
|
|
|
|
prompt.value += '\r\n';
|
|
|
|
|
event.preventDefault(); // 防止默认的换行行为
|
|
|
|
|
} else {
|
|
|
|
|
// 发送消息
|
|
|
|
|
await doSend(content)
|
|
|
|
|
event.preventDefault(); // 防止默认的提交行为
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-17 17:21:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-21 22:18:03 +08:00
|
|
|
|
const onSendBtn = async () => {
|
|
|
|
|
await doSend(prompt.value?.trim() as string)
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-17 17:21:30 +08:00
|
|
|
|
const doSend = async (content: string) => {
|
2024-05-15 23:06:27 +08:00
|
|
|
|
if (content.length < 2) {
|
2024-05-14 17:17:26 +08:00
|
|
|
|
ElMessage({
|
|
|
|
|
message: '请输入内容!',
|
2024-05-14 23:55:23 +08:00
|
|
|
|
type: 'error'
|
2024-05-14 17:17:26 +08:00
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-17 17:11:23 +08:00
|
|
|
|
if (activeConversationId.value == null) {
|
2024-05-17 17:21:30 +08:00
|
|
|
|
ElMessage({
|
|
|
|
|
message: '还没创建对话,不能发送!',
|
|
|
|
|
type: 'error'
|
|
|
|
|
})
|
2024-05-17 17:11:23 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-15 23:06:27 +08:00
|
|
|
|
// TODO 芋艿:这块交互要在优化;应该是先插入到 UI 界面,里面会有当前的消息,和正在思考中;之后发起请求;
|
2024-05-12 22:22:34 +08:00
|
|
|
|
// 清空输入框
|
|
|
|
|
prompt.value = ''
|
2024-05-15 23:06:27 +08:00
|
|
|
|
const userMessage = {
|
2024-05-16 18:29:42 +08:00
|
|
|
|
conversationId: activeConversationId.value,
|
2024-05-14 23:55:23 +08:00
|
|
|
|
content: content
|
2024-05-16 00:18:29 +08:00
|
|
|
|
} as ChatMessageVO
|
2024-05-12 22:22:34 +08:00
|
|
|
|
// stream
|
2024-05-12 19:02:45 +08:00
|
|
|
|
await doSendStream(userMessage)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const doSendStream = async (userMessage: ChatMessageVO) => {
|
|
|
|
|
// 创建AbortController实例,以便中止请求
|
2024-05-12 22:22:34 +08:00
|
|
|
|
conversationInAbortController.value = new AbortController()
|
|
|
|
|
// 标记对话进行中
|
|
|
|
|
conversationInProgress.value = true
|
2024-05-17 18:01:06 +08:00
|
|
|
|
// 设置为空
|
|
|
|
|
fullText.value = ''
|
2024-05-12 22:22:34 +08:00
|
|
|
|
try {
|
2024-05-17 23:27:13 +08:00
|
|
|
|
// 先添加两个假数据,等 stream 返回再替换
|
|
|
|
|
list.value.push({
|
|
|
|
|
id: -1,
|
|
|
|
|
conversationId: activeConversationId.value,
|
|
|
|
|
type: 'user',
|
|
|
|
|
content: userMessage.content,
|
2024-05-22 10:58:54 +08:00
|
|
|
|
userAvatar: userInfo.value?.avatar,
|
2024-05-17 23:27:13 +08:00
|
|
|
|
createTime: new Date()
|
|
|
|
|
} as ChatMessageVO)
|
|
|
|
|
list.value.push({
|
|
|
|
|
id: -2,
|
|
|
|
|
conversationId: activeConversationId.value,
|
|
|
|
|
type: 'system',
|
|
|
|
|
content: '思考中...',
|
2024-05-22 11:08:22 +08:00
|
|
|
|
roleAvatar: (activeConversation.value as ChatConversationVO).roleAvatar,
|
2024-05-17 23:27:13 +08:00
|
|
|
|
createTime: new Date()
|
|
|
|
|
} as ChatMessageVO)
|
2024-05-21 22:18:03 +08:00
|
|
|
|
// 滚动到最下面
|
|
|
|
|
nextTick(async () => {
|
|
|
|
|
await scrollToBottom()
|
|
|
|
|
})
|
2024-05-17 18:01:06 +08:00
|
|
|
|
// 开始滚动
|
|
|
|
|
textRoll()
|
2024-05-12 22:22:34 +08:00
|
|
|
|
// 发送 event stream
|
|
|
|
|
let isFirstMessage = true
|
2024-05-14 23:55:23 +08:00
|
|
|
|
ChatMessageApi.sendStream(
|
2024-05-15 23:06:27 +08:00
|
|
|
|
userMessage.conversationId, // TODO 芋艿:这里可能要在优化;
|
|
|
|
|
userMessage.content,
|
2024-05-14 23:55:23 +08:00
|
|
|
|
conversationInAbortController.value,
|
2024-05-22 15:14:17 +08:00
|
|
|
|
enableContext.value,
|
2024-05-24 16:11:16 +08:00
|
|
|
|
async (res) => {
|
|
|
|
|
console.log('res', res)
|
|
|
|
|
const { code, data, msg } = JSON.parse(res.data)
|
|
|
|
|
if (code !== 0) {
|
|
|
|
|
message.alert(`对话异常! ${msg}`)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-21 16:40:38 +08:00
|
|
|
|
// 如果内容为空,就不处理。
|
2024-05-15 23:06:27 +08:00
|
|
|
|
if (data.receive.content === '') {
|
2024-05-17 23:27:13 +08:00
|
|
|
|
return
|
2024-05-14 23:55:23 +08:00
|
|
|
|
}
|
|
|
|
|
// 首次返回需要添加一个 message 到页面,后面的都是更新
|
|
|
|
|
if (isFirstMessage) {
|
|
|
|
|
isFirstMessage = false
|
2024-05-17 23:27:13 +08:00
|
|
|
|
// 弹出两个 假数据
|
|
|
|
|
list.value.pop()
|
|
|
|
|
list.value.pop()
|
|
|
|
|
// 更新返回的数据
|
2024-05-15 23:06:27 +08:00
|
|
|
|
list.value.push(data.send)
|
|
|
|
|
list.value.push(data.receive)
|
2024-05-14 23:55:23 +08:00
|
|
|
|
}
|
2024-05-17 23:27:13 +08:00
|
|
|
|
// debugger
|
|
|
|
|
fullText.value = fullText.value + data.receive.content
|
2024-05-14 23:55:23 +08:00
|
|
|
|
// 滚动到最下面
|
2024-05-16 23:39:31 +08:00
|
|
|
|
await scrollToBottom()
|
2024-05-14 23:55:23 +08:00
|
|
|
|
},
|
|
|
|
|
(error) => {
|
2024-05-24 16:11:16 +08:00
|
|
|
|
message.alert(`对话异常! ${error}`)
|
2024-05-12 22:22:34 +08:00
|
|
|
|
// 标记对话结束
|
2024-05-14 23:55:23 +08:00
|
|
|
|
conversationInProgress.value = false
|
|
|
|
|
// 结束 stream 对话
|
|
|
|
|
conversationInAbortController.value.abort()
|
|
|
|
|
},
|
|
|
|
|
() => {
|
|
|
|
|
// 标记对话结束
|
|
|
|
|
conversationInProgress.value = false
|
2024-05-12 22:22:34 +08:00
|
|
|
|
// 结束 stream 对话
|
|
|
|
|
conversationInAbortController.value.abort()
|
|
|
|
|
}
|
2024-05-14 23:55:23 +08:00
|
|
|
|
)
|
2024-05-12 22:22:34 +08:00
|
|
|
|
} finally {
|
|
|
|
|
}
|
2024-05-12 19:02:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
const stopStream = async () => {
|
2024-05-21 22:44:37 +08:00
|
|
|
|
console.log('stopStream...')
|
2024-05-16 18:29:42 +08:00
|
|
|
|
// tip:如果 stream 进行中的 message,就需要调用 controller 结束
|
|
|
|
|
if (conversationInAbortController.value) {
|
|
|
|
|
conversationInAbortController.value.abort()
|
|
|
|
|
}
|
|
|
|
|
// 设置为 false
|
|
|
|
|
conversationInProgress.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ============== message 数据 =================
|
|
|
|
|
|
2024-05-24 20:58:31 +08:00
|
|
|
|
/** 消息列表 */
|
|
|
|
|
const messageList = computed(() => {
|
|
|
|
|
if (list.value.length > 0) {
|
|
|
|
|
return list.value
|
|
|
|
|
}
|
|
|
|
|
// 没有消息时,如果有 systemMessage 则展示它
|
|
|
|
|
// TODO add by 芋艿:这个消息下面,不能有复制、删除按钮
|
|
|
|
|
if (activeConversation.value?.systemMessage) {
|
|
|
|
|
return [{
|
|
|
|
|
id: 0,
|
|
|
|
|
type: 'system',
|
|
|
|
|
content: activeConversation.value.systemMessage
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
return []
|
|
|
|
|
})
|
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取 - message 列表
|
|
|
|
|
*/
|
|
|
|
|
const getMessageList = async () => {
|
2024-05-12 19:02:45 +08:00
|
|
|
|
try {
|
2024-05-21 13:56:11 +08:00
|
|
|
|
// time 定时器,如果加载速度很快,就不进入加载中
|
|
|
|
|
listLoadingTime.value = setTimeout(() => {
|
|
|
|
|
listLoading.value = true
|
|
|
|
|
}, 60)
|
2024-05-16 18:29:42 +08:00
|
|
|
|
if (activeConversationId.value === null) {
|
2024-05-16 00:18:29 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-12 19:02:45 +08:00
|
|
|
|
// 获取列表数据
|
2024-05-22 10:30:00 +08:00
|
|
|
|
const messageListRes = await ChatMessageApi.messageList(activeConversationId.value)
|
|
|
|
|
// 设置用户头像
|
|
|
|
|
messageListRes.map(item => {
|
2024-05-22 10:58:54 +08:00
|
|
|
|
// 设置 role 默认头像
|
|
|
|
|
item.roleAvatar = item.roleAvatar ? item.roleAvatar : defaultRoleAvatar
|
2024-05-22 10:30:00 +08:00
|
|
|
|
})
|
|
|
|
|
list.value = messageListRes
|
2024-05-12 19:02:45 +08:00
|
|
|
|
// 滚动到最下面
|
2024-05-16 18:29:42 +08:00
|
|
|
|
await nextTick(() => {
|
2024-05-16 23:21:31 +08:00
|
|
|
|
// 滚动到最后
|
2024-05-16 23:39:31 +08:00
|
|
|
|
scrollToBottom()
|
2024-05-16 18:29:42 +08:00
|
|
|
|
})
|
2024-05-12 19:02:45 +08:00
|
|
|
|
} finally {
|
2024-05-21 13:56:11 +08:00
|
|
|
|
// time 定时器,如果加载速度很快,就不进入加载中
|
|
|
|
|
if (listLoadingTime.value) {
|
|
|
|
|
clearTimeout(listLoadingTime.value)
|
|
|
|
|
}
|
|
|
|
|
// 加载结束
|
|
|
|
|
listLoading.value = false
|
2024-05-12 19:02:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-12 22:22:34 +08:00
|
|
|
|
|
2024-05-15 13:00:31 +08:00
|
|
|
|
/** 修改聊天会话 */
|
|
|
|
|
const chatConversationUpdateFormRef = ref()
|
2024-05-15 19:45:19 +08:00
|
|
|
|
const openChatConversationUpdateForm = async () => {
|
2024-05-16 18:29:42 +08:00
|
|
|
|
chatConversationUpdateFormRef.value.open(activeConversationId.value)
|
2024-05-14 13:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-14 17:17:26 +08:00
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
/**
|
|
|
|
|
* 对话 - 标题修改成功
|
|
|
|
|
*/
|
|
|
|
|
const handlerTitleSuccess = async () => {
|
|
|
|
|
// TODO 需要刷新 对话列表
|
2024-05-21 11:46:30 +08:00
|
|
|
|
await getConversation(activeConversationId.value)
|
2024-05-14 17:17:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-24 10:35:11 +08:00
|
|
|
|
/**
|
|
|
|
|
* 对话 - 创建
|
|
|
|
|
*/
|
|
|
|
|
const handleConversationCreate = async () => {
|
|
|
|
|
// 创建新的对话,清空输入框
|
|
|
|
|
prompt.value = ''
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
/**
|
|
|
|
|
* 对话 - 点击
|
|
|
|
|
*/
|
|
|
|
|
const handleConversationClick = async (conversation: ChatConversationVO) => {
|
2024-05-21 22:44:37 +08:00
|
|
|
|
// 对话进行中,不允许切换
|
|
|
|
|
if (conversationInProgress.value) {
|
|
|
|
|
await message.alert("对话中,不允许切换!")
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
// 更新选中的对话 id
|
|
|
|
|
activeConversationId.value = conversation.id
|
2024-05-16 19:43:51 +08:00
|
|
|
|
activeConversation.value = conversation
|
2024-05-21 22:44:37 +08:00
|
|
|
|
// 处理进行中的对话
|
|
|
|
|
if (conversationInProgress.value) {
|
|
|
|
|
await stopStream()
|
|
|
|
|
}
|
2024-05-16 18:29:42 +08:00
|
|
|
|
// 刷新 message 列表
|
|
|
|
|
await getMessageList()
|
2024-05-16 23:39:31 +08:00
|
|
|
|
// 滚动底部
|
|
|
|
|
scrollToBottom(true)
|
2024-05-24 16:50:55 +08:00
|
|
|
|
// 清空输入框
|
|
|
|
|
prompt.value = ''
|
2024-05-21 22:44:37 +08:00
|
|
|
|
return true
|
2024-05-16 09:34:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 18:29:42 +08:00
|
|
|
|
/**
|
|
|
|
|
* 对话 - 清理全部对话
|
|
|
|
|
*/
|
|
|
|
|
const handlerConversationClear = async ()=> {
|
|
|
|
|
activeConversationId.value = null
|
|
|
|
|
activeConversation.value = null
|
|
|
|
|
list.value = []
|
2024-05-16 12:09:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 23:21:31 +08:00
|
|
|
|
/**
|
|
|
|
|
* 对话 - 删除
|
|
|
|
|
*/
|
|
|
|
|
const handlerConversationDelete = async (delConversation: ChatConversationVO) => {
|
|
|
|
|
// 删除的对话如果是当前选中的,那么久重置
|
|
|
|
|
if (activeConversationId.value === delConversation.id) {
|
|
|
|
|
await handlerConversationClear()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 对话 - 获取
|
|
|
|
|
*/
|
2024-05-21 11:46:30 +08:00
|
|
|
|
const getConversation = async (id: string | null) => {
|
|
|
|
|
if (!id) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-16 23:21:31 +08:00
|
|
|
|
const conversation: ChatConversationVO = await ChatConversationApi.getChatConversationMy(id)
|
2024-05-21 16:21:14 +08:00
|
|
|
|
if (conversation) {
|
|
|
|
|
activeConversation.value = conversation
|
|
|
|
|
activeConversationId.value = conversation.id
|
|
|
|
|
}
|
2024-05-16 23:21:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-22 17:08:13 +08:00
|
|
|
|
/**
|
|
|
|
|
* 对话 - 新建
|
|
|
|
|
*/
|
|
|
|
|
const handlerNewChat = async () => {
|
|
|
|
|
// 创建对话
|
|
|
|
|
await conversationRef.value.createConversation()
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 23:39:31 +08:00
|
|
|
|
// ============ message ===========
|
|
|
|
|
|
2024-05-21 16:09:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* 删除 message
|
|
|
|
|
*/
|
2024-05-16 23:39:31 +08:00
|
|
|
|
const handlerMessageDelete = async () => {
|
2024-05-24 16:11:16 +08:00
|
|
|
|
if (conversationInProgress.value) {
|
|
|
|
|
message.alert('回答中,不能删除!')
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-05-16 23:39:31 +08:00
|
|
|
|
// 刷新 message
|
|
|
|
|
await getMessageList()
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-24 10:32:08 +08:00
|
|
|
|
/**
|
|
|
|
|
* 编辑 message
|
|
|
|
|
*/
|
|
|
|
|
const handlerMessageEdit = async (message: ChatMessageVO) => {
|
|
|
|
|
prompt.value = message.content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑 message
|
|
|
|
|
*/
|
|
|
|
|
const handlerMessageRefresh = async (message: ChatMessageVO) => {
|
|
|
|
|
await doSend(message.content)
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-21 16:09:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* 回到顶部
|
|
|
|
|
*/
|
|
|
|
|
const handlerGoTop = async () => {
|
|
|
|
|
await messageRef.value.handlerGoTop()
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-22 09:57:46 +08:00
|
|
|
|
/**
|
|
|
|
|
* message 清除
|
|
|
|
|
*/
|
|
|
|
|
const handlerMessageClear = async () => {
|
|
|
|
|
if (!activeConversationId.value) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 确认提示
|
|
|
|
|
await message.delConfirm("确认清空对话消息?")
|
|
|
|
|
// 清空对话
|
|
|
|
|
await ChatMessageApi.deleteByConversationId(activeConversationId.value as string)
|
|
|
|
|
// 刷新 message 列表
|
|
|
|
|
await getMessageList()
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-12 14:28:27 +08:00
|
|
|
|
/** 初始化 **/
|
2024-05-12 19:02:45 +08:00
|
|
|
|
onMounted(async () => {
|
2024-05-16 18:29:42 +08:00
|
|
|
|
// 设置当前对话 TODO 角色仓库过来的,自带 conversationId 需要选中
|
2024-05-16 23:21:31 +08:00
|
|
|
|
if (route.query.conversationId) {
|
|
|
|
|
const id = route.query.conversationId as string
|
2024-05-21 22:21:45 +08:00
|
|
|
|
activeConversationId.value = id
|
2024-05-21 11:46:30 +08:00
|
|
|
|
await getConversation(id)
|
2024-05-16 23:21:31 +08:00
|
|
|
|
}
|
2024-05-12 19:02:45 +08:00
|
|
|
|
// 获取列表数据
|
2024-05-21 22:21:45 +08:00
|
|
|
|
listLoading.value = true
|
2024-05-16 18:29:42 +08:00
|
|
|
|
await getMessageList()
|
2024-05-22 10:58:54 +08:00
|
|
|
|
// 获取用户信息
|
|
|
|
|
userInfo.value = await getUserProfile()
|
2024-05-12 14:28:27 +08:00
|
|
|
|
})
|
2024-05-07 21:59:47 +08:00
|
|
|
|
</script>
|
2024-05-16 18:29:42 +08:00
|
|
|
|
|
2024-05-07 21:59:47 +08:00
|
|
|
|
<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%;
|
|
|
|
|
}
|
|
|
|
|
|
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-16 09:34:53 +08:00
|
|
|
|
cursor: pointer;
|
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-17 23:57:59 +08:00
|
|
|
|
|
|
|
|
|
.btns {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 300px;
|
2024-05-21 17:52:21 +08:00
|
|
|
|
flex-direction: row;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
//justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
padding: 10px;
|
|
|
|
|
}
|
2024-05-17 23:57:59 +08:00
|
|
|
|
}
|
2024-05-09 22:13:23 +08:00
|
|
|
|
}
|
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-17 23:57:59 +08:00
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
2024-05-12 19:02:45 +08:00
|
|
|
|
|
2024-05-16 23:39:31 +08:00
|
|
|
|
.message-container {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
//width: 100%;
|
|
|
|
|
//height: 100%;
|
2024-05-17 23:57:59 +08:00
|
|
|
|
overflow-y: hidden;
|
|
|
|
|
padding: 0;
|
|
|
|
|
margin: 0;
|
2024-05-12 19:02:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 23:35:47 +08:00
|
|
|
|
// 底部
|
|
|
|
|
.footer-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
height: auto;
|
2024-05-12 22:22:34 +08:00
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
|
|
|
|
.prompt-from {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
height: auto;
|
|
|
|
|
border: 1px solid #e3e3e3;
|
|
|
|
|
border-radius: 10px;
|
2024-05-21 17:30:48 +08:00
|
|
|
|
margin: 10px 20px 20px 20px;
|
2024-05-12 22:22:34 +08:00
|
|
|
|
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-17 18:12:01 +08:00
|
|
|
|
overflow: auto;
|
2024-05-10 23:35:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.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>
|