index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. <template>
  2. <el-container class="ai-layout">
  3. <!-- 左侧:对话列表 -->
  4. <Conversation :active-id="activeConversationId"
  5. ref="conversationRef"
  6. @onConversationCreate="handleConversationCreate"
  7. @onConversationClick="handleConversationClick"
  8. @onConversationClear="handlerConversationClear"
  9. @onConversationDelete="handlerConversationDelete"
  10. />
  11. <!-- 右侧:对话详情 -->
  12. <el-container class="detail-container">
  13. <el-header class="header">
  14. <div class="title">
  15. {{ activeConversation?.title ? activeConversation?.title : '对话' }}
  16. <span v-if="list.length">({{list.length}})</span>
  17. </div>
  18. <div class="btns" v-if="activeConversation">
  19. <el-button type="primary" bg plain size="small" @click="openChatConversationUpdateForm">
  20. <span v-html="activeConversation?.modelName"></span>
  21. <Icon icon="ep:setting" style="margin-left: 10px"/>
  22. </el-button>
  23. <el-button size="small" class="btn" @click="handlerMessageClear">
  24. <!-- TODO @fan:style 部分,可以考虑用 unocss 替代 -->
  25. <img src="@/assets/ai/clear.svg" style="height: 14px;" />
  26. </el-button>
  27. <!-- TODO @fan:下面两个 icon,可以使用类似 <Icon icon="ep:question-filled" /> 替代哈 -->
  28. <el-button size="small" :icon="Download" class="btn" />
  29. <el-button size="small" :icon="Top" class="btn" @click="handlerGoTop" />
  30. </div>
  31. </el-header>
  32. <!-- main:消息列表 -->
  33. <el-main class="main-container" >
  34. <div >
  35. <div class="message-container" >
  36. <MessageLoading v-if="listLoading" />
  37. <MessageNewChat v-if="!activeConversation" @on-new-chat="handlerNewChat" />
  38. <ChatEmpty v-if="!listLoading && messageList.length === 0 && activeConversation" @on-prompt="doSend"/>
  39. <Message v-if="!listLoading && messageList.length > 0"
  40. ref="messageRef"
  41. :conversation="activeConversation"
  42. :list="messageList"
  43. @on-delete-success="handlerMessageDelete"
  44. @on-edit="handlerMessageEdit"
  45. @on-refresh="handlerMessageRefresh"/>
  46. </div>
  47. </div>
  48. </el-main>
  49. <!-- 底部 -->
  50. <el-footer class="footer-container">
  51. <form class="prompt-from">
  52. <textarea
  53. class="prompt-input"
  54. v-model="prompt"
  55. @keydown="onSend"
  56. @input="onPromptInput"
  57. @compositionstart="onCompositionstart"
  58. @compositionend="onCompositionend"
  59. placeholder="问我任何问题...(Shift+Enter 换行,按下 Enter 发送)"
  60. ></textarea>
  61. <div class="prompt-btns">
  62. <div>
  63. <el-switch v-model="enableContext" /> <span style="font-size: 14px; color: #8f8f8f;">上下文</span>
  64. </div>
  65. <el-button
  66. type="primary"
  67. size="default"
  68. @click="onSendBtn"
  69. :loading="conversationInProgress"
  70. v-if="conversationInProgress == false"
  71. >
  72. {{ conversationInProgress ? '进行中' : '发送' }}
  73. </el-button>
  74. <el-button
  75. type="danger"
  76. size="default"
  77. @click="stopStream()"
  78. v-if="conversationInProgress == true"
  79. >
  80. 停止
  81. </el-button>
  82. </div>
  83. </form>
  84. </el-footer>
  85. </el-container>
  86. <!-- ========= 额外组件 ========== -->
  87. <!-- 更新对话 Form -->
  88. <ChatConversationUpdateForm
  89. ref="chatConversationUpdateFormRef"
  90. @success="handlerTitleSuccess"
  91. />
  92. </el-container>
  93. </template>
  94. <script setup lang="ts">
  95. // TODO @fan:是不是把 index.vue 相关的,在这里新建一个 index 目录,然后挪进去哈。因为 /ai/chat 还会有其它功能。例如说,现在的 /ai/chat/manager 管理
  96. import Conversation from './Conversation.vue'
  97. import Message from './Message.vue'
  98. import ChatEmpty from './ChatEmpty.vue'
  99. import MessageLoading from './MessageLoading.vue'
  100. import MessageNewChat from './MessageNewChat.vue'
  101. import {ChatMessageApi, ChatMessageVO} from '@/api/ai/chat/message'
  102. import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversation'
  103. import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
  104. import ChatConversationUpdateForm from "@/views/ai/chat/components/ChatConversationUpdateForm.vue";
  105. import {Download, Top} from "@element-plus/icons-vue";
  106. const route = useRoute() // 路由
  107. const message = useMessage() // 消息弹窗
  108. // ref 属性定义
  109. const activeConversationId = ref<string | null>(null) // 选中的对话编号
  110. const activeConversation = ref<ChatConversationVO | null>(null) // 选中的 Conversation
  111. const conversationInProgress = ref(false) // 对话进行中
  112. const conversationInAbortController = ref<any>() // 对话进行中 abort 控制器(控制 stream 对话)
  113. const inputTimeout = ref<any>() // 处理输入中回车的定时器
  114. const prompt = ref<string>() // prompt
  115. const userInfo = ref<ProfileVO>() // 用户信息
  116. const enableContext = ref<boolean>(true) // 是否开启上下文
  117. // TODO @fan:这几个变量,可以注释在补下哈;另外,fullText 可以明确是生成中的消息 Text,这样更容易理解哈;
  118. const fullText = ref('');
  119. const displayedText = ref('');
  120. const textSpeed = ref<number>(50); // Typing speed in milliseconds
  121. const textRoleRunning = ref<boolean>(false); // Typing speed in milliseconds
  122. // chat message 列表
  123. // TODO @fan:list、listLoading、listLoadingTime 不能体现出来是消息列表,是不是可以变量再优化下
  124. const list = ref<ChatMessageVO[]>([]) // 列表的数据
  125. const listLoading = ref<boolean>(false) // 是否加载中
  126. const listLoadingTime = ref<any>() // time 定时器,如果加载速度很快,就不进入加载中
  127. // 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方)
  128. const messageRef = ref()
  129. const conversationRef = ref()
  130. const isComposing = ref(false) // 判断用户是否在输入
  131. // 默认 role 头像
  132. const defaultRoleAvatar = 'http://test.yudao.iocoder.cn/eaef5f41acb911dd718429a0702dcc3c61160d16e57ba1d543132fab58934f9f.png'
  133. // =========== 自提滚动效果
  134. // TODO @fan:这个方法,要不加个方法注释
  135. const textRoll = async () => {
  136. let index = 0;
  137. try {
  138. // 只能执行一次
  139. if (textRoleRunning.value) {
  140. return
  141. }
  142. // 设置状态
  143. textRoleRunning.value = true
  144. displayedText.value = ''
  145. const task = async () => {
  146. // 调整速度
  147. const diff = (fullText.value.length - displayedText.value.length) / 10
  148. if (diff > 5) {
  149. textSpeed.value = 10
  150. } else if (diff > 2) {
  151. textSpeed.value = 30
  152. } else if (diff > 1.5) {
  153. textSpeed.value = 50
  154. } else {
  155. textSpeed.value = 100
  156. }
  157. // 对话结束,就按 30 的速度
  158. if (!conversationInProgress.value) {
  159. textSpeed.value = 10
  160. }
  161. // console.log('index < fullText.value.length', index < fullText.value.length, conversationInProgress.value)
  162. if (index < fullText.value.length) {
  163. displayedText.value += fullText.value[index];
  164. index++;
  165. // 更新 message
  166. const lastMessage = list.value[list.value.length - 1]
  167. lastMessage.content = displayedText.value
  168. // TODO @fan:ist.value?,还是 ist.value.length 哈?
  169. list.value[list.value - 1] = lastMessage
  170. // 滚动到住下面
  171. await scrollToBottom()
  172. // 重新设置任务
  173. timer = setTimeout(task, textSpeed.value);
  174. } else {
  175. // 不是对话中可以结束
  176. if (!conversationInProgress.value) {
  177. textRoleRunning.value = false
  178. clearTimeout(timer);
  179. console.log("字体滚动退出!")
  180. } else {
  181. // 重新设置任务
  182. timer = setTimeout(task, textSpeed.value);
  183. }
  184. }
  185. }
  186. let timer = setTimeout(task, textSpeed.value);
  187. } finally {
  188. }
  189. };
  190. // ============ 处理对话滚动 ==============
  191. function scrollToBottom(isIgnore?: boolean) {
  192. // isIgnore = isIgnore !== null ? isIgnore : false
  193. nextTick(() => {
  194. if (messageRef.value) {
  195. messageRef.value.scrollToBottom(isIgnore)
  196. }
  197. })
  198. }
  199. // ============= 处理聊天输入回车发送 =============
  200. // TODO @fan:是不是可以通过 @keydown.enter、@keydown.shift.enter 来实现,回车发送、shift+回车换行;主要看看,是不是可以简化 isComposing 相关的逻辑
  201. const onCompositionstart = () => {
  202. isComposing.value = true
  203. }
  204. const onCompositionend = () => {
  205. // console.log('输入结束...')
  206. setTimeout(() => {
  207. isComposing.value = false
  208. }, 200)
  209. }
  210. const onPromptInput = (event) => {
  211. // 非输入法 输入设置为 true
  212. if (!isComposing.value) {
  213. // 回车 event data 是 null
  214. if (event.data == null) {
  215. return
  216. }
  217. isComposing.value = true
  218. }
  219. // 清理定时器
  220. if (inputTimeout.value) {
  221. clearTimeout(inputTimeout.value)
  222. }
  223. // 重置定时器
  224. inputTimeout.value = setTimeout(() => {
  225. isComposing.value = false
  226. }, 400)
  227. }
  228. // ============== 对话消息相关 =================
  229. /**
  230. * 发送消息
  231. */
  232. const onSend = async (event) => {
  233. // 判断用户是否在输入
  234. if (isComposing.value) {
  235. return
  236. }
  237. // 进行中不允许发送
  238. if (conversationInProgress.value) {
  239. return
  240. }
  241. const content = prompt.value?.trim() as string
  242. if (event.key === 'Enter') {
  243. if (event.shiftKey) {
  244. // 插入换行
  245. prompt.value += '\r\n';
  246. event.preventDefault(); // 防止默认的换行行为
  247. } else {
  248. // 发送消息
  249. await doSend(content)
  250. event.preventDefault(); // 防止默认的提交行为
  251. }
  252. }
  253. }
  254. const onSendBtn = async () => {
  255. await doSend(prompt.value?.trim() as string)
  256. }
  257. const doSend = async (content: string) => {
  258. if (content.length < 2) {
  259. // TODO @fan:这个 message.error(`上传文件大小不能超过${props.fileSize}MB!`) 可以替代,这种形式
  260. ElMessage({
  261. message: '请输入内容!',
  262. type: 'error'
  263. })
  264. return
  265. }
  266. // TODO @fan:这个 message.error(`上传文件大小不能超过${props.fileSize}MB!`) 可以替代,这种形式
  267. if (activeConversationId.value == null) {
  268. ElMessage({
  269. message: '还没创建对话,不能发送!',
  270. type: 'error'
  271. })
  272. return
  273. }
  274. // 清空输入框
  275. prompt.value = ''
  276. // TODO @fan:idea 这里会报类型错误,是不是可以解决下哈
  277. const userMessage = {
  278. conversationId: activeConversationId.value,
  279. content: content
  280. } as ChatMessageVO
  281. // stream
  282. await doSendStream(userMessage)
  283. }
  284. const doSendStream = async (userMessage: ChatMessageVO) => {
  285. // 创建AbortController实例,以便中止请求
  286. conversationInAbortController.value = new AbortController()
  287. // 标记对话进行中
  288. conversationInProgress.value = true
  289. // 设置为空
  290. fullText.value = ''
  291. try {
  292. // 先添加两个假数据,等 stream 返回再替换
  293. // TODO @fan:idea 这里会报类型错误,是不是可以解决下哈
  294. list.value.push({
  295. id: -1,
  296. conversationId: activeConversationId.value,
  297. type: 'user',
  298. content: userMessage.content,
  299. userAvatar: userInfo.value?.avatar,
  300. createTime: new Date()
  301. } as ChatMessageVO)
  302. list.value.push({
  303. id: -2,
  304. conversationId: activeConversationId.value,
  305. type: 'system',
  306. content: '思考中...',
  307. roleAvatar: (activeConversation.value as ChatConversationVO).roleAvatar,
  308. createTime: new Date()
  309. } as ChatMessageVO)
  310. // 滚动到最下面
  311. // TODO @fan:可以 await nextTick();然后同步调用 scrollToBottom()
  312. nextTick(async () => {
  313. await scrollToBottom()
  314. })
  315. // 开始滚动
  316. textRoll()
  317. // 发送 event stream
  318. let isFirstMessage = true // TODO @fan:isFirstChunk 会更精准
  319. ChatMessageApi.sendStream(
  320. userMessage.conversationId, // TODO 芋艿:这里可能要在优化;
  321. userMessage.content,
  322. conversationInAbortController.value,
  323. enableContext.value,
  324. async (res) => {
  325. console.log('res', res)
  326. const { code, data, msg } = JSON.parse(res.data)
  327. if (code !== 0) {
  328. message.alert(`对话异常! ${msg}`)
  329. return
  330. }
  331. // 如果内容为空,就不处理。
  332. if (data.receive.content === '') {
  333. return
  334. }
  335. // 首次返回需要添加一个 message 到页面,后面的都是更新
  336. if (isFirstMessage) {
  337. isFirstMessage = false
  338. // 弹出两个 假数据
  339. list.value.pop()
  340. list.value.pop()
  341. // 更新返回的数据
  342. list.value.push(data.send)
  343. list.value.push(data.receive)
  344. }
  345. // debugger
  346. fullText.value = fullText.value + data.receive.content
  347. // 滚动到最下面
  348. await scrollToBottom()
  349. },
  350. (error) => {
  351. message.alert(`对话异常! ${error}`)
  352. // TODO @fan:是不是可以复用 stopStream 方法
  353. // 标记对话结束
  354. conversationInProgress.value = false
  355. // 结束 stream 对话
  356. conversationInAbortController.value.abort()
  357. },
  358. () => {
  359. // TODO @fan:是不是可以复用 stopStream 方法
  360. // 标记对话结束
  361. conversationInProgress.value = false
  362. // 结束 stream 对话
  363. conversationInAbortController.value.abort()
  364. }
  365. )
  366. } finally {
  367. }
  368. }
  369. const stopStream = async () => {
  370. console.log('stopStream...')
  371. // tip:如果 stream 进行中的 message,就需要调用 controller 结束
  372. if (conversationInAbortController.value) {
  373. conversationInAbortController.value.abort()
  374. }
  375. // 设置为 false
  376. conversationInProgress.value = false
  377. }
  378. // ============== message 数据 =================
  379. /** 消息列表 */
  380. const messageList = computed(() => {
  381. if (list.value.length > 0) {
  382. return list.value
  383. }
  384. // 没有消息时,如果有 systemMessage 则展示它
  385. // TODO add by 芋艿:这个消息下面,不能有复制、删除按钮
  386. if (activeConversation.value?.systemMessage) {
  387. return [{
  388. id: 0,
  389. type: 'system',
  390. content: activeConversation.value.systemMessage
  391. }]
  392. }
  393. return []
  394. })
  395. // TODO @fan:一般情况下,项目方法注释用 /** */,啊哈,主要保持风格统一,= = 少占点行哈,
  396. /**
  397. * 获取 - message 列表
  398. */
  399. const getMessageList = async () => {
  400. try {
  401. // time 定时器,如果加载速度很快,就不进入加载中
  402. listLoadingTime.value = setTimeout(() => {
  403. listLoading.value = true
  404. }, 60)
  405. if (activeConversationId.value === null) {
  406. return
  407. }
  408. // 获取列表数据
  409. const messageListRes = await ChatMessageApi.messageList(activeConversationId.value)
  410. // 设置用户头像
  411. messageListRes.map(item => {
  412. // 设置 role 默认头像
  413. item.roleAvatar = item.roleAvatar ? item.roleAvatar : defaultRoleAvatar
  414. })
  415. list.value = messageListRes
  416. // 滚动到最下面
  417. await nextTick(() => {
  418. // 滚动到最后
  419. scrollToBottom()
  420. })
  421. } finally {
  422. // time 定时器,如果加载速度很快,就不进入加载中
  423. if (listLoadingTime.value) {
  424. clearTimeout(listLoadingTime.value)
  425. }
  426. // 加载结束
  427. listLoading.value = false
  428. }
  429. }
  430. /** 修改聊天对话 */
  431. const chatConversationUpdateFormRef = ref()
  432. const openChatConversationUpdateForm = async () => {
  433. chatConversationUpdateFormRef.value.open(activeConversationId.value)
  434. }
  435. /**
  436. * 对话 - 标题修改成功
  437. */
  438. const handlerTitleSuccess = async () => {
  439. // TODO 需要刷新 对话列表
  440. await getConversation(activeConversationId.value)
  441. }
  442. /**
  443. * 对话 - 创建
  444. */
  445. const handleConversationCreate = async () => {
  446. // 创建新的对话,清空输入框
  447. prompt.value = ''
  448. }
  449. /**
  450. * 对话 - 点击
  451. */
  452. const handleConversationClick = async (conversation: ChatConversationVO) => {
  453. // 对话进行中,不允许切换
  454. if (conversationInProgress.value) {
  455. await message.alert("对话中,不允许切换!")
  456. return false
  457. }
  458. // 更新选中的对话 id
  459. activeConversationId.value = conversation.id
  460. activeConversation.value = conversation
  461. // 处理进行中的对话
  462. if (conversationInProgress.value) {
  463. await stopStream()
  464. }
  465. // 刷新 message 列表
  466. await getMessageList()
  467. // 滚动底部
  468. scrollToBottom(true)
  469. // 清空输入框
  470. prompt.value = ''
  471. return true
  472. }
  473. /**
  474. * 对话 - 清理全部对话
  475. */
  476. const handlerConversationClear = async ()=> {
  477. // TODO @fan:需要加一个 对话进行中,不允许切换
  478. activeConversationId.value = null
  479. activeConversation.value = null
  480. list.value = []
  481. }
  482. /**
  483. * 对话 - 删除
  484. */
  485. const handlerConversationDelete = async (delConversation: ChatConversationVO) => {
  486. // 删除的对话如果是当前选中的,那么就重置
  487. if (activeConversationId.value === delConversation.id) {
  488. await handlerConversationClear()
  489. }
  490. }
  491. /**
  492. * 对话 - 获取
  493. */
  494. const getConversation = async (id: string | null) => {
  495. if (!id) {
  496. return
  497. }
  498. const conversation: ChatConversationVO = await ChatConversationApi.getChatConversationMy(id)
  499. if (conversation) {
  500. activeConversation.value = conversation
  501. activeConversationId.value = conversation.id
  502. }
  503. }
  504. /**
  505. * 对话 - 新建
  506. */
  507. // TODO @fan:应该是 handleXXX,handler 是名词哈
  508. const handlerNewChat = async () => {
  509. // 创建对话
  510. await conversationRef.value.createConversation()
  511. }
  512. // ============ message ===========
  513. /**
  514. * 删除 message
  515. */
  516. const handlerMessageDelete = async () => {
  517. if (conversationInProgress.value) {
  518. message.alert('回答中,不能删除!')
  519. return
  520. }
  521. // 刷新 message
  522. await getMessageList()
  523. }
  524. /**
  525. * 编辑 message:设置为 prompt,可以再次编辑
  526. */
  527. const handlerMessageEdit = async (message: ChatMessageVO) => {
  528. prompt.value = message.content
  529. }
  530. /**
  531. * 刷新 message:基于指定消息,再次发起对话
  532. */
  533. const handlerMessageRefresh = async (message: ChatMessageVO) => {
  534. await doSend(message.content)
  535. }
  536. /**
  537. * 回到顶部
  538. */
  539. const handlerGoTop = async () => {
  540. await messageRef.value.handlerGoTop()
  541. }
  542. /**
  543. * message 清除
  544. */
  545. const handlerMessageClear = async () => {
  546. if (!activeConversationId.value) {
  547. return
  548. }
  549. // TODO @fan:需要 try catch 下,不然点击取消会报异常
  550. // 确认提示
  551. await message.delConfirm("确认清空对话消息?")
  552. // 清空对话
  553. await ChatMessageApi.deleteByConversationId(activeConversationId.value as string)
  554. // TODO @fan:是不是直接置空就好啦;
  555. // 刷新 message 列表
  556. await getMessageList()
  557. }
  558. /** 初始化 **/
  559. onMounted(async () => {
  560. // 设置当前对话 TODO 角色仓库过来的,自带 conversationId 需要选中
  561. if (route.query.conversationId) {
  562. const id = route.query.conversationId as string
  563. activeConversationId.value = id
  564. await getConversation(id)
  565. }
  566. // 获取列表数据
  567. listLoading.value = true
  568. await getMessageList()
  569. // 获取用户信息
  570. userInfo.value = await getUserProfile()
  571. })
  572. </script>
  573. <style lang="scss" scoped>
  574. .ai-layout {
  575. // TODO @范 这里height不能 100% 先这样临时处理
  576. position: absolute;
  577. flex: 1;
  578. top: 0;
  579. left: 0;
  580. height: 100%;
  581. width: 100%;
  582. }
  583. .conversation-container {
  584. position: relative;
  585. display: flex;
  586. flex-direction: column;
  587. justify-content: space-between;
  588. padding: 0 10px;
  589. padding-top: 10px;
  590. .btn-new-conversation {
  591. padding: 18px 0;
  592. }
  593. .search-input {
  594. margin-top: 20px;
  595. }
  596. .conversation-list {
  597. margin-top: 20px;
  598. .conversation {
  599. display: flex;
  600. flex-direction: row;
  601. justify-content: space-between;
  602. flex: 1;
  603. padding: 0 5px;
  604. margin-top: 10px;
  605. cursor: pointer;
  606. border-radius: 5px;
  607. align-items: center;
  608. line-height: 30px;
  609. &.active {
  610. background-color: #e6e6e6;
  611. .button {
  612. display: inline-block;
  613. }
  614. }
  615. .title-wrapper {
  616. display: flex;
  617. flex-direction: row;
  618. align-items: center;
  619. }
  620. .title {
  621. padding: 5px 10px;
  622. max-width: 220px;
  623. font-size: 14px;
  624. overflow: hidden;
  625. white-space: nowrap;
  626. text-overflow: ellipsis;
  627. }
  628. .avatar {
  629. width: 28px;
  630. height: 28px;
  631. display: flex;
  632. flex-direction: row;
  633. justify-items: center;
  634. }
  635. // 对话编辑、删除
  636. .button-wrapper {
  637. right: 2px;
  638. display: flex;
  639. flex-direction: row;
  640. justify-items: center;
  641. color: #606266;
  642. .el-icon {
  643. margin-right: 5px;
  644. }
  645. }
  646. }
  647. }
  648. // 角色仓库、清空未设置对话
  649. .tool-box {
  650. line-height: 35px;
  651. display: flex;
  652. justify-content: space-between;
  653. align-items: center;
  654. color: var(--el-text-color);
  655. > div {
  656. display: flex;
  657. align-items: center;
  658. color: #606266;
  659. padding: 0;
  660. margin: 0;
  661. cursor: pointer;
  662. > span {
  663. margin-left: 5px;
  664. }
  665. }
  666. }
  667. }
  668. // 头部
  669. .detail-container {
  670. background: #ffffff;
  671. .header {
  672. display: flex;
  673. flex-direction: row;
  674. align-items: center;
  675. justify-content: space-between;
  676. background: #fbfbfb;
  677. box-shadow: 0 0 0 0 #dcdfe6;
  678. .title {
  679. font-size: 18px;
  680. font-weight: bold;
  681. }
  682. .btns {
  683. display: flex;
  684. width: 300px;
  685. flex-direction: row;
  686. justify-content: flex-end;
  687. //justify-content: space-between;
  688. .btn {
  689. padding: 10px;
  690. }
  691. }
  692. }
  693. }
  694. // main 容器
  695. .main-container {
  696. margin: 0;
  697. padding: 0;
  698. position: relative;
  699. height: 100%;
  700. width: 100%;
  701. .message-container {
  702. position: absolute;
  703. top: 0;
  704. bottom: 0;
  705. left: 0;
  706. right: 0;
  707. //width: 100%;
  708. //height: 100%;
  709. overflow-y: hidden;
  710. padding: 0;
  711. margin: 0;
  712. }
  713. }
  714. // 底部
  715. .footer-container {
  716. display: flex;
  717. flex-direction: column;
  718. height: auto;
  719. margin: 0;
  720. padding: 0;
  721. .prompt-from {
  722. display: flex;
  723. flex-direction: column;
  724. height: auto;
  725. border: 1px solid #e3e3e3;
  726. border-radius: 10px;
  727. margin: 10px 20px 20px 20px;
  728. padding: 9px 10px;
  729. }
  730. .prompt-input {
  731. height: 80px;
  732. //box-shadow: none;
  733. border: none;
  734. box-sizing: border-box;
  735. resize: none;
  736. padding: 0px 2px;
  737. //padding: 5px 5px;
  738. overflow: auto;
  739. }
  740. .prompt-input:focus {
  741. outline: none;
  742. }
  743. .prompt-btns {
  744. display: flex;
  745. justify-content: space-between;
  746. padding-bottom: 0px;
  747. padding-top: 5px;
  748. }
  749. }
  750. </style>