index.vue 22 KB

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