DialogWrap.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624
  1. <template>
  2. <div class="dialog-flex-wrap" :data-chat="dialogId">
  3. <div class="dialog-flex" ref="dialogScroll">
  4. <div class="section-open" v-if="open">
  5. <header class="dialog-header">
  6. <a-avatar shape="circle" :size="28">
  7. <img alt="avatar" src="/src/assets/slider/logo.jpg" />
  8. </a-avatar>
  9. </header>
  10. <footer class="dialog-footer">
  11. <p>{{ open }}</p>
  12. </footer>
  13. </div>
  14. <Suggestion :suggestions="suggestions" :readonly="readonly"/>
  15. <div class="dialog-list" v-if="dialogList.length > 0">
  16. <div
  17. :class="['dialog-item', isSetting ? '' : 'dialog-absolute', 'dialog-item-' + key]"
  18. v-for="(item, key) in dialogList"
  19. :key="item.client_gen_id"
  20. :data-item-index="key"
  21. :data-item-key="item.client_gen_id"
  22. >
  23. <div class="dialog-header" v-if="item?.question">
  24. <!-- <div class="user-name" style="background-color: rgb(255, 110, 110)">
  25. {{ userName.slice(0, 1) }}
  26. </div> -->
  27. <ClientUserAvatar />
  28. </div>
  29. <div class="dialog-footer" v-if="item?.question">
  30. <Question
  31. v-once
  32. :question="item.question"
  33. :index="key"
  34. :chat_id="dialogId"
  35. :chat_type="type"
  36. :agentId="agentId"
  37. />
  38. </div>
  39. <!-- 如果是代码则不显示头像 -->
  40. <div class="dialog-header" v-if="item?.capacity">
  41. <img alt="avatar" src="/src/assets/slider/logo.jpg" width="28" />
  42. </div>
  43. <!-- 没有处理答案则渲染代码和sql -->
  44. <div class="dialog-code-footer" v-if="item.code || item.sql">
  45. <div v-if="item.code">
  46. <p class="dialog-code-footer-title" v-if="item.code">Python:</p>
  47. <span v-html="item.code"></span>
  48. </div>
  49. <div v-if="item.sql">
  50. <p class="dialog-code-footer-title" v-if="item.sql">SQL:</p>
  51. <span v-html="item.sql"></span>
  52. </div>
  53. </div>
  54. <div class="dialog-footer" v-else-if="item?.capacity"
  55. :style="{ display: dialogConfig.type === 'paper' ? 'inline-block' : 'block' }">
  56. <div v-if="type === 'knowledge'" @click="openCapacity(key)"
  57. :class="[readonly || item.capacity.status === 'loading' ? 'disabled' : '']">
  58. <a-spin :size="18" v-if="item.capacity.status === 'loading'" />
  59. <icon-check-circle-fill :size="18" v-else />
  60. <span>{{ item.capacity.status === "loading" ? "小数正在检索" : "查看检索信息" }}</span>
  61. <!-- <b>{{ item.capacity.text }}</b> -->
  62. <icon-caret-right size="18" v-if="item.capacity.status === 'loaded' && !menuList[key]?.open" />
  63. <icon-caret-down size="18" v-if="item.capacity.status === 'loaded' && menuList[key]?.open" />
  64. </div>
  65. <div v-else v-show="item.capacity.status === 'loading'"
  66. :class="[readonly || item.capacity.status === 'loading' ? 'disabled' : '']">
  67. <a-spin :size="18" />
  68. <span>{{ type === 'excel' ? '正在为您合并...' : '正在为您搜索答案...' }}</span>
  69. </div>
  70. <section v-if="type === 'knowledge' && item.capacity.status === 'loaded'" v-show="menuList[key].open">
  71. <div v-if="item.capacity.data.list">
  72. <p v-for="(item, key) in item.capacity.data.list" :key="key">
  73. <a-typography-paragraph :ellipsis="{ rows: 1, css: true }" :style="{ flex: 1, margin: '0' }">
  74. {{ item }}
  75. </a-typography-paragraph>
  76. </p>
  77. </div>
  78. <div v-if="item.capacity.data.documents">
  79. <div v-for="(document, documentKey) in item.capacity.data.documents" :key="documentKey">
  80. <div @click="openDocument(key, documentKey)" :class="[readonly ? 'disabled' : '']">
  81. <span>{{ document.type }}</span>
  82. <a-typography-paragraph :ellipsis="{ rows: 1, css: true }" :style="{ flex: 1, margin: '0' }">
  83. <span>{{ document.title }}</span>
  84. </a-typography-paragraph>
  85. <span>
  86. <em v-for="(item, documentIndex) in document.list" :key="documentIndex">{{
  87. item.title
  88. }}</em>
  89. </span>
  90. <icon-caret-down size="12" v-if="documentKey === menuList[key].documentOpenIndex" />
  91. <icon-caret-right size="12" v-else />
  92. </div>
  93. <div v-show="documentKey === menuList[key].documentOpenIndex">
  94. <p v-for="(item, index) in document.list" :key="index">
  95. <span>{{ item.title }}</span>
  96. <a-typography-paragraph :ellipsis="{ rows: 3, css: true }" :style="{ flex: 1, margin: '0' }">
  97. <span style="color: rgba(153, 153, 153, 1); font-size: 12px">{{
  98. item.content
  99. }}</span>
  100. </a-typography-paragraph>
  101. </p>
  102. </div>
  103. </div>
  104. </div>
  105. </section>
  106. <p v-if="type === 'knowledge' && item.answer" style="margin-top: 10px; font-size: 18px; font-weight: bold">
  107. 答案生成结果
  108. </p>
  109. <p v-if="item.answer" :style="{ 'margin-top': type === 'knowledge' ? '12px' : '0' }">
  110. <span v-if="type === 'paper'" class="paper-wrap">
  111. <img src="@/assets/question/word.svg" />
  112. <span>
  113. <b>黄冈试卷考试题</b>
  114. <em>DOCX,13.19KB</em>
  115. </span>
  116. </span>
  117. <Answer v-else
  118. :answer="item.answer"
  119. :index="key"
  120. :chat_id="dialogId"
  121. :chat_type="type"
  122. :agentId="agentId"
  123. :special_4_refference="item.fullRefference"
  124. :special_4_image="item.fullImageUrls"
  125. />
  126. </p>
  127. </div>
  128. <div class="dialog-footer" v-else>
  129. <Answer
  130. :answer="item.answer"
  131. :index="key"
  132. :chat_id="dialogId"
  133. :chat_type="type"
  134. :agentId="agentId"
  135. :special_4_refference="item.fullRefference"
  136. :special_4_image="item.fullImageUrls"
  137. />
  138. </div>
  139. <!-- 处理来源 -->
  140. <div v-if="(type === 'knowledge' || type === 'knowledgeQuiz') && item.reference && item.reference.length > 0"
  141. class="knowledge-wrap">
  142. <header>
  143. <p>来源</p>
  144. <!-- TODO详情暂时注释 -->
  145. <!-- <p @click="goKnowledge">查看全部关联 ></p> -->
  146. </header>
  147. <section>
  148. <DocRefItem
  149. v-for="(knowledge, knowledgeIndex) in item.reference"
  150. :key="knowledgeIndex"
  151. :knowledge="knowledge"
  152. :knowledgeIndex="knowledgeIndex"
  153. />
  154. <!-- <div v-for="(knowledge, knowledgeIndex) in item.reference" :key="knowledgeIndex">
  155. <a-popover :title="knowledge.doc_name" position="left">
  156. <div @click="openDocuementPage(knowledge)">
  157. <span>{{ knowledgeIndex + 1 }}</span>
  158. <span>{{ knowledge.doc_name }}</span>
  159. </div>
  160. <template #content>
  161. <div class="knowledge-detail">
  162. <div class="knowledge-content">
  163. {{ knowledge.content_ltks }}
  164. </div>
  165. <div class="knowledge-footer">
  166. <p>检索片段</p>
  167. <p>
  168. <span v-for="(content, contentIndex) in knowledge.content_ltks" :key="contentIndex"
  169. :class="{ active: knowledge.page === contentIndex }" @click="() => {
  170. knowledge.page = contentIndex;
  171. }
  172. ">{{ contentIndex + 1 }}</span>
  173. </p>
  174. </div>
  175. </div>
  176. </template>
  177. </a-popover>
  178. </div> -->
  179. </section>
  180. </div>
  181. <!-- 如果有图片 -->
  182. <div v-if="item?.image_url" style="margin-left: 50px;">
  183. <a-image width="500" :src="item?.image_url" />
  184. </div>
  185. <div v-if="item.file" class="paper-wrap" @click="downloadFile(item.file.file_url)">
  186. <img v-if="item.file.file_type === 'excel'" src="@/assets/question/excel.svg" />
  187. <img v-if="item.file.file_type === 'word'" src="@/assets/question/word.svg" />
  188. <span>
  189. <b>{{ item.file.file_name }}</b>
  190. </span>
  191. <icon-download style="margin-right: 24px;font-size: 32px;" />
  192. </div>
  193. <div class="dialog-other" v-if="item?.other">
  194. <p v-if="isSetting">
  195. <img src="@/assets/icons/check.png" width="16" />
  196. <span>{{ item.other.token }}</span>
  197. </p>
  198. <p v-else></p>
  199. <div v-if="show_info_btns">
  200. <a-tooltip content="重新生成">
  201. <p @click="reQuestion(item.question)" :class="[readonly ? 'disabled' : '']">
  202. <img src="@/assets/icons/refresh.png" width="15" />
  203. </p>
  204. </a-tooltip>
  205. <a-tooltip content="复制">
  206. <p @click="copyAnswer(item.answer)" :class="[readonly ? 'disabled' : '']">
  207. <img src="@/assets/icons/copy.png" width="15" />
  208. </p>
  209. </a-tooltip>
  210. <a-tooltip content="收藏">
  211. <p @click="saveAnswer(key)" :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  212. <img src="@/assets/icons/star-full.png" width="15" v-if="menuList[key].save" />
  213. <img src="@/assets/icons/star.png" width="15" v-else />
  214. </p>
  215. </a-tooltip>
  216. <a-tooltip content="点赞">
  217. <p :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  218. <img src="@/assets/icons/thumb-up.png" width="15" />
  219. </p>
  220. </a-tooltip>
  221. <a-tooltip content="反馈">
  222. <p @click="feedbackAnswer" :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  223. <img src="@/assets/icons/thumb-down.png" width="15" />
  224. </p>
  225. </a-tooltip>
  226. <a-tooltip content="分享">
  227. <p :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  228. <img src="@/assets/icons/share.png" width="15" />
  229. </p>
  230. </a-tooltip>
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <!-- <div v-show="readonly" @click="stopWriting" class="dialog-writing-button">
  237. <icon-record-stop :size="20" style="margin-right: 4px" />停止生成
  238. </div> -->
  239. <dialog-feedback :showFeedback="showFeedback" @handleCancel="handleCancel" @handleOk="handleOk" v-if="!isSetting" />
  240. </div>
  241. </template>
  242. <script>
  243. import DialogFeedback from "./DialogFeedback.vue";
  244. import { defineComponent, ref, onBeforeUnmount, onMounted, reactive, nextTick, inject } from "vue";
  245. import formatAnwserString from './answer-effect/format-anwser-string';
  246. import initTempHistory, {getChatIdFromUrl} from './answer-effect/temp-history';
  247. // import { getDocumentUrl } from '../ajax/document';
  248. import Question from './dialog-wrap/Question.vue';
  249. import Suggestion from './dialog-wrap/Suggestion.vue';
  250. import ClientUserAvatar from './dialog-wrap/ClientUserAvatar.vue';
  251. import Answer from './dialog-wrap/Answer.vue';
  252. import {huituSetTempImageIndex} from './dialog-wrap/temp-image'
  253. import generateClientUniqueId from './dialog-wrap/generate-client-unique-id';
  254. import formatDialogItem from './dialog-wrap/format-dialog-item';
  255. import DocRefItem from './dialog-wrap/DocRefItem.vue';
  256. import {useImageUploadStatus} from '../store/index';
  257. export default defineComponent({
  258. components: {
  259. DialogFeedback,
  260. Suggestion,
  261. ClientUserAvatar,
  262. Question,
  263. Answer,
  264. DocRefItem
  265. },
  266. props: [
  267. "open",
  268. "suggestions",
  269. "isSetting",
  270. "readonly",
  271. "type",
  272. "list",
  273. "agentId",
  274. "dialogId",
  275. 'reference'
  276. ],
  277. setup(props, { emit }) {
  278. // 图片上传的状态
  279. const imageUploadStatus = useImageUploadStatus();
  280. const knowledgeList = ref([[{}]]);
  281. const DOCUMENT_RESULT = {};
  282. const getHTML = (string) => {
  283. return formatAnwserString(string);
  284. };
  285. const replaceCode = (text, index) => {
  286. const icon = ` <span class="circle" data-list-index="${index || 0}"></span>`
  287. return text.replace(/##\d\$\$/g, icon);
  288. }
  289. const { helper, ajax } = inject("$global");
  290. // const userName = ref(helper.read("userName") || "");
  291. /**
  292. * 此数据定义,仅用于暂时隐藏 重新生成、复制、收藏、点赞、反馈、分享 按钮
  293. * 如果这些按钮需要显示,则可将此定义移除,同时移除 对应的 v-if
  294. */
  295. const show_info_btns = ref(false);
  296. /**
  297. * 初始化临时历史记录
  298. * 在对话过程中,消息记录是一条一条的呈现
  299. * 而在历史记录面板中,一个对话框中可能有多条对话,一次性直接加载
  300. */
  301. const tempHistory = initTempHistory();
  302. const list = props.list.map((item, index) => {
  303. // const client_id = generateClientUniqueId(JSON.stringify(item));
  304. return formatDialogItem(item, index);
  305. // return {
  306. // /**
  307. // * 客户端生成的ID
  308. // * 此数据作为列表唯一的key
  309. // */
  310. // client_gen_id: client_id,
  311. // answer: item.answer && replaceCode(item.answer, index),
  312. // question: item.question,
  313. // // 如果有引用
  314. // reference: (item.reference && item.reference.chunks && item.reference.doc_aggs) ? item.reference.doc_aggs.map(reference => {
  315. // return {
  316. // id: reference.doc_id,
  317. // doc_name: reference.doc_name,
  318. // page: 0,
  319. // content_ltks: [item.reference.chunks.find(chunk => chunk.doc_id == reference.doc_id).content_ltks]
  320. // }
  321. // }) : [],
  322. // // 完整的引用数据: pdf文档引用效果需要使用此数据
  323. // fullRefference: item.reference,
  324. // // 合法可用的图片地址
  325. // fullImageUrls: (() => {
  326. // if(item.images){
  327. // return item.images;
  328. // }else{
  329. // return [];
  330. // }
  331. // })(),
  332. // // 如果有文件处理完拿第一个,后续有变动再改
  333. // file: (item.files && item.files.length > 0) ? item.files.map(item => {
  334. // const port = window.location.port ? `:${window.location.port}` : '';
  335. // return {
  336. // file_type: 'word',
  337. // file_name: item.file_name,
  338. // file_url: `http://${window.location.hostname}${port}${item.file_url}`,
  339. // }
  340. // })[0] : null,
  341. // }
  342. });
  343. const dialogList = reactive(list || []);
  344. const randomKey = ref(0);
  345. const showFeedback = ref(false);
  346. const menuList = reactive([]);
  347. let dialogIndex = dialogList.length;
  348. const dialogScroll = ref("");
  349. const dialogConfig = ref({});
  350. const scrollToEnd = async () => {
  351. await nextTick();
  352. if (dialogScroll.value) {
  353. dialogScroll.value.scrollTop = dialogScroll.value.scrollHeight;
  354. }
  355. };
  356. let answerInterval = null;
  357. const stopWriting = () => {
  358. window.clearInterval(answerInterval);
  359. emit("set-readonly", false);
  360. if (dialogList[dialogIndex]) {
  361. dialogList[dialogIndex].other = {
  362. token: "4.0s | Tokens"
  363. };
  364. }
  365. scrollToEnd();
  366. dialogIndex += 1;
  367. };
  368. const addData = (data) => {
  369. dialogList.splice(dialogIndex, 1, data);
  370. randomKey.value = Math.random();
  371. scrollToEnd();
  372. };
  373. const saveAnswer = (index) => {
  374. if (!props.readonly) {
  375. menuList[index].save = !menuList[index].save;
  376. }
  377. };
  378. const openCapacity = (index) => {
  379. if (!props.readonly) {
  380. menuList[index].open = !menuList[index].open;
  381. }
  382. };
  383. const feedbackAnswer = () => {
  384. if (!props.readonly) {
  385. showFeedback.value = true;
  386. }
  387. };
  388. const handleOk = () => {
  389. showFeedback.value = false;
  390. };
  391. const handleCancel = () => {
  392. showFeedback.value = false;
  393. };
  394. // const selectSuggestion = (text) => {
  395. // if (!props.readonly) {
  396. // }
  397. // };
  398. const copyAnswer = (text) => {
  399. if (!props.readonly) {
  400. helper.copyText(text, "复制成功");
  401. }
  402. };
  403. const reQuestion = (text) => {
  404. if (!props.readonly) {
  405. setTimeout(() => {
  406. helper.$bus.emit("send-message", text);
  407. }, 200);
  408. }
  409. };
  410. const openDocument = (index, documentIndex) => {
  411. if (menuList[index].documentOpenIndex === documentIndex) {
  412. menuList[index].documentOpenIndex = -1;
  413. } else {
  414. menuList[index].documentOpenIndex = documentIndex;
  415. }
  416. };
  417. const goKnowledge = () => {
  418. // emit("go-document");
  419. };
  420. // // 点击文档,打开新页面
  421. // const openDocuementPage = (knowledge) => {
  422. // const doc_name = knowledge.doc_name;
  423. // const doc_id = knowledge.id;
  424. // // const pdf_url = `http://192.168.20.119:11080/v1/document/get/${doc_id}`;
  425. // const pdf_url = getDocumentUrl(doc_id);
  426. // window.open(pdf_url);
  427. // }
  428. const addLoading = (data) => {
  429. const mockData = DOCUMENT_RESULT;
  430. data.capacity = {
  431. type: mockData.type,
  432. text: mockData.text,
  433. status: "loading",
  434. data: null
  435. };
  436. menuList[dialogIndex] = {
  437. save: false,
  438. open: false,
  439. documentOpenIndex: -1
  440. };
  441. addData(data);
  442. return data;
  443. };
  444. const loadingData = ref(null);
  445. const isLoaded = ref(false);
  446. const answerData = ref("");
  447. const answerReference = ref([]);
  448. const fullRefference = reactive({
  449. full_ref: {}
  450. });
  451. const fullImageUrls = reactive({
  452. url: []
  453. });
  454. const imageUrl = ref(undefined);
  455. const answerFile = ref(undefined);
  456. const answerCode = ref(undefined);
  457. const answerSql = ref(undefined);
  458. const addQuestion = (question, file = null) => {
  459. let result = {
  460. question,
  461. capacity: null,
  462. answer: "",
  463. other: null,
  464. file: null,
  465. };
  466. addData(result);
  467. return result;
  468. };
  469. const addAnswer = (data) => {
  470. data.answer = answerData.value;
  471. data.reference = answerReference.value;
  472. data.fullRefference = fullRefference.full_ref; // 完整的引用数据
  473. data.fullImageUrls = fullImageUrls.url; // 图片地址数据
  474. data.image_url = imageUrl.value;
  475. data.code = answerCode.value;
  476. data.file = answerFile.value;
  477. data.sql = answerSql.value;
  478. // 客户端生成的唯一的key
  479. data.client_gen_id = generateClientUniqueId(JSON.stringify(data));
  480. addData(data);
  481. };
  482. const answerLoaded = () => {
  483. isLoaded.value = true;
  484. emit("set-readonly", true);
  485. loadingData.value.capacity = DOCUMENT_RESULT;
  486. addAnswer(loadingData.value);
  487. };
  488. const downloadFile = (url) => {
  489. window.open(url, "_blank");
  490. };
  491. onBeforeUnmount(() => {
  492. helper.$bus.off("send-message");
  493. helper.$bus.off("clear-message");
  494. helper.$bus.off("stop-writing");
  495. helper.webSocket?.close();
  496. });
  497. onMounted(() => {
  498. scrollToEnd();
  499. /**
  500. * 应用引用效果
  501. * 答案中 引用图标(感叹号)点击时,浮层显示引用内容
  502. */
  503. // applyRefferencePopover(props.list);
  504. // applyImageDisplay(props.list);
  505. /**
  506. * TODO: 只允许保存一条消息,避免出现多条消息同时发送的情况
  507. * 当网络状况不佳,用户发送第一条数据时,socket还未连接成功,紧接着又发送第二条数据,第三条数据....
  508. * 此时,消息队列里将会有多条数据等待发送
  509. * 当socket连接成功后,遍历消息队列里的数据,会将这多条数据一同发送,此时就会出现异常情况。
  510. */
  511. let msg_list = [];
  512. function createSocket() {
  513. const token = helper.read("token");
  514. const p_type = props.type;
  515. // 如果是智能数据,则拿缓存里的数据开启对话
  516. if (helper.read("sendData") && helper.read("sendData").agent_id == 'basic_excel_talk') {
  517. const data = helper.read("sendData");
  518. helper.webSocket = ajax.message.create(token, data.agent_id, data.chat_id, p_type);
  519. // 创建对话之后清空缓存
  520. helper.write('sendData', {});
  521. } else {
  522. helper.webSocket = ajax.message.create(token, props.agentId, props.dialogId, p_type);
  523. }
  524. // 监听socket开启事件
  525. // 当socket开启后,遍历消息,并发送
  526. helper.webSocket.onopen = function (event) {
  527. msg_list.forEach(item => {
  528. helper.webSocket.send(item);
  529. });
  530. // 所有消息发送完成后,清空消息队列
  531. msg_list = [];
  532. }
  533. }
  534. // 发送socket数据
  535. function sendSocketMsg(dt) {
  536. // 判断socket是否开启
  537. // 如果开启,则直接发送,如果没有开启,则将数据推入消息队列
  538. if (helper.webSocket.readyState === 0) {
  539. msg_list.push(dt);
  540. }
  541. if (helper.webSocket.readyState === 1) {
  542. helper.webSocket.send(dt);
  543. }
  544. if (helper.webSocket.readyState === 2) {
  545. // 正在关闭
  546. console.log('web socket正在关闭');
  547. }
  548. if (helper.webSocket.readyState === 3) {
  549. msg_list.push(dt);
  550. // 已关闭: 重新开启socket
  551. createSocket();
  552. }
  553. }
  554. // 创建socket链接
  555. createSocket();
  556. /**
  557. * 处理socket数据
  558. */
  559. function handleSocketMessage(evt_dt, cur_chat_id){
  560. let res_data = null;
  561. try{
  562. res_data = JSON.parse(evt_dt);
  563. }catch(err){
  564. console.log(err);
  565. }
  566. if(!res_data){
  567. return;
  568. }
  569. const { type, reference, step_message, files } = res_data;
  570. const msg_type = type; // 返回的消息类型
  571. const chat_type = props.type; // 对话的类型
  572. let { message } = res_data;
  573. if (!loadingData.value) return;
  574. if (msg_type === "stream") {
  575. // 没解析完就一直loading
  576. if (step_message == '文件上传完成,开始解析') {
  577. emit("changeParse", true);
  578. }
  579. if (step_message == '文件解析完成') {
  580. emit("changeParse", false);
  581. }
  582. if (files && files.length > 0) {
  583. loadingData.value.file = {
  584. file_name: files[0].file_name,
  585. file_url: files[0].file_url,
  586. };
  587. answerFile.value = {
  588. file_name: files[0].file_name,
  589. file_url: files[0].file_url,
  590. };
  591. addData(loadingData.value);
  592. } else {
  593. answerData.value += step_message ? getHTML(step_message) + "</br>" : message
  594. if (answerData.value && !isLoaded.value) {
  595. answerLoaded();
  596. }
  597. addAnswer(loadingData.value);
  598. }
  599. }
  600. if (msg_type === "message") {
  601. // 获取此时的聊天临时聊天记录中的序号
  602. const cur_index = tempHistory.getChatIndex(cur_chat_id);
  603. message = replaceCode(message, cur_index);
  604. answerData.value = getHTML(message);
  605. answerReference.value = [];
  606. fullRefference.full_ref = reference; // 完整引用数据
  607. // 如有文档引用处理接收到的新消息和引用
  608. if (reference && reference.doc_aggs && reference.doc_aggs.length > 0) {
  609. answerReference.value = reference.doc_aggs.map(item => {
  610. return {
  611. id: item.doc_id,
  612. doc_name: item.doc_name,
  613. page: 0,
  614. content_ltks: [reference.chunks.find(chunk => chunk.doc_id == item.doc_id).content_ltks]
  615. }
  616. });
  617. }
  618. // 智能数据
  619. if (chat_type == 'smartData') {
  620. answerData.value = '正在处理中...'
  621. // 以下是智能数据对话的变量
  622. const { image_url, excel_url, excel_name, code, sql } = JSON.parse(evt_dt);
  623. const port = window.location.port ? `:${window.location.port}` : '';
  624. // 如果有图片或excel,则更新图片或excel地址
  625. if (image_url) {
  626. imageUrl.value = `http://${window.location.hostname}${port}${image_url}`
  627. }
  628. if (excel_url) {
  629. const file = {
  630. file_type: 'excel',
  631. file_url: `http://${window.location.hostname}${port}${excel_url}`,
  632. file_name: `${excel_name}.xlsx` || '点击下载',
  633. }
  634. answerFile.value = file
  635. }
  636. if (code) answerCode.value = getHTML(code);
  637. if (sql) answerSql.value = getHTML(sql);
  638. }
  639. // 出题
  640. if (chat_type == 'question') {
  641. const { file_url, file_name } = JSON.parse(evt_dt);
  642. const port = window.location.port ? `:${window.location.port}` : '';
  643. if (file_url) {
  644. const file = {
  645. file_type: 'word',
  646. file_url: `http://${window.location.hostname}${port}${file_url}`,
  647. file_name: `${file_name}.docx` || '点击下载',
  648. }
  649. answerFile.value = file
  650. }
  651. }
  652. if (answerData.value && !isLoaded.value) {
  653. answerLoaded();
  654. }
  655. addAnswer(loadingData.value);
  656. }
  657. if (msg_type === "close") {
  658. /**
  659. * 在小数绘图对话结束时
  660. * 存在一个字段数据
  661. */
  662. if(chat_type === 'huitu'){
  663. // 获取此时的聊天临时聊天记录中的序号
  664. const cur_index = tempHistory.getChatIndex(cur_chat_id);
  665. message = replaceCode(message, cur_index);
  666. answerData.value = getHTML(message);
  667. // 小数绘图
  668. if(res_data.message_files){
  669. const arr = [];
  670. if(Array.isArray(res_data.message_files)){
  671. res_data.message_files.forEach((item, index) => {
  672. arr.push(item);
  673. });
  674. fullImageUrls.url = arr;
  675. }else{
  676. fullImageUrls.url = arr;
  677. }
  678. }
  679. answerLoaded();
  680. stopWriting();
  681. answerData.value = "";
  682. isLoaded.value = false;
  683. } else if(chat_type === 'excel'){
  684. // 报表合并
  685. answerLoaded();
  686. answerData.value = getHTML(message);
  687. addAnswer(loadingData.value);
  688. answerData.value = getHTML(message);
  689. stopWriting();
  690. } else{
  691. if (!answerData.value) {
  692. answerLoaded();
  693. answerData.value = getHTML(message);
  694. addAnswer(loadingData.value);
  695. }
  696. stopWriting();
  697. answerData.value = "";
  698. isLoaded.value = false;
  699. }
  700. }
  701. }
  702. helper.webSocket.onmessage = (event) => {
  703. const evt_dt = event.data;
  704. /**
  705. * 例如:ws://localhost/api/chat/ws/42e4fcdc9bea11efac300242ac160006/765f672c700f49b79a473fc906fe388c?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyIiwidXNlcl9pZCI6MjEsImV4cCI6MTczMjQzNzkzNH0.7SPOZpnaTUu2KPzWIJrhhkRehjePeuL8TABo7rNgnCY
  706. */
  707. const socket_url = event.target.url; // socket连接地址
  708. const cur_chat_id = getChatIdFromUrl(socket_url);
  709. // setTempHistory(event);
  710. tempHistory.setHistory(event);
  711. // 处理socket数据
  712. handleSocketMessage(evt_dt, cur_chat_id);
  713. };
  714. /**
  715. * 所有数据的发送,统一走到这里
  716. * 通过websocket进行发送
  717. */
  718. helper.$bus.on("send-message", (value) => {
  719. dialogConfig.value = helper.dialogConfig;
  720. const chat_type = props.type; // 对话的类型
  721. const question = chat_type === "report" ? value.inputs.report_name : value;
  722. const data = addQuestion(question);
  723. loadingData.value = addLoading(data);
  724. let sendData = {
  725. message: value
  726. }
  727. if(chat_type === "report"){
  728. sendData = value;
  729. }
  730. if(chat_type === "excel"){
  731. sendData = value;
  732. }
  733. if (chat_type === 'doc') {
  734. sendData.doc_ids = [helper.read('docId')];
  735. }
  736. // 小数绘图
  737. if(chat_type === 'huitu'){
  738. const img_file = helper.read('sendData');
  739. if(img_file){
  740. const upload_file_id = img_file.upload_file_id;
  741. if(upload_file_id){
  742. sendData = {
  743. message: value,
  744. upload_file_id: upload_file_id
  745. }
  746. setTimeout(() => {
  747. // 文字消息上传成功
  748. imageUploadStatus.messageFinish();
  749. // 记录此时页面中的问题记录
  750. huituSetTempImageIndex(dialogList.length);
  751. helper.write('sendData', {});
  752. });
  753. }
  754. }else{
  755. sendData = {
  756. message: value
  757. };
  758. }
  759. }
  760. const dt = JSON.stringify(sendData);
  761. // 发送socket数据
  762. sendSocketMsg(dt)
  763. });
  764. helper.$bus.on("clear-message", () => {
  765. dialogList.splice(0);
  766. });
  767. helper.$bus.on("stop-writing", () => {
  768. stopWriting();
  769. });
  770. });
  771. return {
  772. dialogId: props.dialogId,
  773. goKnowledge,
  774. randomKey,
  775. showFeedback,
  776. copyAnswer,
  777. dialogList,
  778. getHTML,
  779. // selectSuggestion,
  780. dialogScroll,
  781. reQuestion,
  782. menuList,
  783. saveAnswer,
  784. openCapacity,
  785. feedbackAnswer,
  786. handleOk,
  787. handleCancel,
  788. stopWriting,
  789. knowledgeList,
  790. dialogConfig,
  791. // userName,
  792. downloadFile,
  793. openDocument,
  794. // openDocuementPage,
  795. show_info_btns
  796. };
  797. }
  798. });
  799. </script>
  800. <style>
  801. .dialog-header {
  802. display: flex;
  803. align-items: center;
  804. .dialog-span {
  805. color: rgba(51, 51, 51, 1);
  806. font-size: 14px;
  807. font-weight: bold;
  808. }
  809. }
  810. </style>
  811. <style scoped>
  812. /* .user-name {
  813. width: 28px;
  814. height: 28px;
  815. border-radius: 14px;
  816. display: flex;
  817. align-items: center;
  818. justify-content: center;
  819. color: #fff;
  820. } */
  821. .paper-download {
  822. padding-left: 50px;
  823. >span {
  824. width: 26px;
  825. height: 26px;
  826. border-radius: 3px;
  827. cursor: pointer;
  828. display: flex;
  829. align-items: center;
  830. justify-content: center;
  831. &:hover {
  832. background: rgba(150, 171, 185, 0.2);
  833. }
  834. }
  835. }
  836. .paper-wrap {
  837. display: flex;
  838. align-items: center;
  839. margin-bottom: 10px;
  840. cursor: pointer;
  841. background-color: #F5F7FE;
  842. border-radius: 16px;
  843. padding: 6px;
  844. margin-left: 50px;
  845. >img {
  846. width: 50px;
  847. margin: 8px 6px;
  848. }
  849. >span {
  850. flex: 1;
  851. white-space: nowrap;
  852. overflow: hidden;
  853. text-overflow: ellipsis;
  854. >b {
  855. white-space: nowrap;
  856. overflow: hidden;
  857. text-overflow: ellipsis;
  858. display: block;
  859. width: 100%;
  860. }
  861. >em {
  862. font-style: normal;
  863. }
  864. }
  865. }
  866. .knowledge-detail {
  867. width: 320px;
  868. padding-top: 20px;
  869. .knowledge-content {
  870. height: 300px;
  871. overflow-y: auto;
  872. line-height: 30px;
  873. }
  874. .knowledge-footer {
  875. border-top: 1px solid rgba(229, 229, 229, 1);
  876. margin-top: 20px;
  877. padding-top: 20px;
  878. display: flex;
  879. justify-content: space-between;
  880. align-items: center;
  881. p {
  882. &:nth-child(1) {
  883. opacity: 0.8;
  884. }
  885. &:nth-child(2) {
  886. flex: 1;
  887. display: flex;
  888. justify-content: left;
  889. margin: 0 30px;
  890. >span {
  891. margin: 0 5px;
  892. cursor: pointer;
  893. &:hover,
  894. &.active {
  895. color: #00aea3;
  896. }
  897. }
  898. }
  899. &:nth-child(3) {
  900. font-weight: bold;
  901. cursor: pointer;
  902. &:hover {
  903. color: #00aea3;
  904. }
  905. }
  906. }
  907. }
  908. }
  909. .knowledge-wrap {
  910. padding: 10px 0 20px 50px;
  911. >header {
  912. display: flex;
  913. justify-content: space-between;
  914. >p {
  915. &:nth-child(1) {
  916. color: #7f7f7f;
  917. font-weight: bold;
  918. }
  919. &:nth-child(2) {
  920. cursor: pointer;
  921. &:hover {
  922. color: #00aea3;
  923. }
  924. }
  925. }
  926. }
  927. >section {
  928. >div {
  929. >div {
  930. height: 40px;
  931. display: inline-flex;
  932. align-items: center;
  933. >span {
  934. &:nth-child(1) {
  935. display: inline-block;
  936. background-color: rgba(0, 174, 163, 0.2);
  937. color: #00aea3;
  938. padding: 1px 5px;
  939. border-radius: 2px;
  940. margin-right: 5px;
  941. font-size: 12px;
  942. }
  943. &:nth-child(2) {
  944. cursor: pointer;
  945. &:hover {
  946. color: #00aea3;
  947. }
  948. }
  949. }
  950. }
  951. }
  952. }
  953. }
  954. .dialog-absolute {
  955. .dialog-header {
  956. position: absolute;
  957. &:nth-child(1) {
  958. transform: translateY(10px);
  959. }
  960. &:nth-child(3) {
  961. transform: translateY(16px);
  962. }
  963. }
  964. .dialog-footer {
  965. margin-left: 50px;
  966. &:nth-child(2) {
  967. margin-left: 50px;
  968. padding-left: 0;
  969. }
  970. }
  971. .dialog-code-footer {
  972. border-radius: 12px;
  973. font-size: 14px;
  974. background-color: #32333c;
  975. color: #BCBDC3;
  976. margin: 16px 0;
  977. margin-left: 50px;
  978. .dialog-code-footer-title {
  979. font-size: 16px;
  980. font-weight: 500;
  981. margin: 12px 0;
  982. width: 100%;
  983. padding: 4px 8px;
  984. background-color: #3D3F3F;
  985. color: #BCBDC3;
  986. }
  987. &:nth-child(2) {
  988. background-color: rgba(0, 0, 0, 0);
  989. margin: 0;
  990. }
  991. >p {
  992. font-size: 14px;
  993. }
  994. >div {
  995. font-size: 14px;
  996. padding: 4px 8px;
  997. border-radius: 4px;
  998. align-items: center;
  999. cursor: pointer;
  1000. &.disabled {
  1001. cursor: not-allowed;
  1002. }
  1003. >b {
  1004. margin-right: 8px;
  1005. }
  1006. }
  1007. >section {
  1008. padding: 0 16px;
  1009. background-color: #ffffff;
  1010. border-radius: 12px;
  1011. margin-top: 16px;
  1012. >p {
  1013. display: inline-block;
  1014. color: rgba(16, 16, 16, 1);
  1015. font-size: 12px;
  1016. margin-top: 16px;
  1017. width: 100%;
  1018. }
  1019. >div {
  1020. margin-top: 4px;
  1021. overflow: hidden;
  1022. margin-bottom: 16px;
  1023. display: inline-block;
  1024. width: 100%;
  1025. >div {
  1026. margin-top: 8px;
  1027. >div {
  1028. &:nth-child(1) {
  1029. border-radius: 4px;
  1030. color: rgba(16, 16, 16, 1);
  1031. font-size: 12px;
  1032. height: 24px;
  1033. border: 1px solid rgba(229, 229, 229, 1);
  1034. display: flex;
  1035. justify-content: center;
  1036. align-items: center;
  1037. padding-right: 8px;
  1038. cursor: pointer;
  1039. &.disabled {
  1040. cursor: not-allowed;
  1041. }
  1042. &:hover {
  1043. background: rgba(229, 229, 229, 0.2);
  1044. }
  1045. >span {
  1046. &:nth-child(1) {
  1047. background-color: rgba(0, 174, 163, 0.2);
  1048. color: #00aea3;
  1049. font-size: 12px;
  1050. border: 1px solid rgba(64, 95, 234, 0.13);
  1051. padding: 0 4px;
  1052. margin: 0 4px 0 0;
  1053. }
  1054. &:nth-child(3) {
  1055. color: #00aea3;
  1056. font-size: 12px;
  1057. em {
  1058. padding: 0 4px;
  1059. font-style: normal;
  1060. border-left: 1px solid rgba(64, 95, 234, 1);
  1061. font-weight: bold;
  1062. &:nth-child(1) {
  1063. border: none;
  1064. }
  1065. }
  1066. }
  1067. }
  1068. }
  1069. &:nth-child(2) {
  1070. >p {
  1071. margin: 8px 0;
  1072. display: flex;
  1073. >span {
  1074. transform: translateY(2px);
  1075. color: #00aea3;
  1076. font-weight: bold;
  1077. font-size: 12px;
  1078. margin-right: 8px;
  1079. }
  1080. }
  1081. }
  1082. }
  1083. }
  1084. >p {
  1085. float: left;
  1086. width: 48%;
  1087. border-radius: 4px;
  1088. background-color: rgba(245, 247, 254, 1);
  1089. color: rgba(16, 16, 16, 1);
  1090. font-size: 12px;
  1091. margin-top: 8px;
  1092. height: 36px;
  1093. line-height: 36px;
  1094. padding: 0 8px;
  1095. display: flex;
  1096. align-items: center;
  1097. &:nth-child(odd) {
  1098. margin-right: 4%;
  1099. }
  1100. }
  1101. }
  1102. }
  1103. }
  1104. }
  1105. .dialog-flex-wrap {
  1106. position: relative;
  1107. flex: 1;
  1108. margin-top: 16px;
  1109. height: 100%;
  1110. }
  1111. .dialog-flex {
  1112. position: absolute;
  1113. left: 0;
  1114. top: 0;
  1115. right: 0;
  1116. bottom: 0;
  1117. overflow-y: auto;
  1118. overflow-x: hidden;
  1119. padding-right: 32px;
  1120. }
  1121. .section-open {
  1122. margin-top: 12px;
  1123. }
  1124. .dialog-file {
  1125. width: 421px;
  1126. height: 48px;
  1127. border-radius: 12px;
  1128. background-color: rgba(255, 255, 255, 1);
  1129. color: rgba(16, 16, 16, 1);
  1130. font-size: 14px;
  1131. border: 1px solid rgba(229, 229, 229, 1);
  1132. display: flex;
  1133. align-items: center;
  1134. margin-bottom: 16px;
  1135. padding: 0 8px;
  1136. }
  1137. .dialog-footer {
  1138. border-radius: 12px;
  1139. background-color: rgba(245, 247, 254, 1);
  1140. padding: 12px 16px;
  1141. margin: 16px 0;
  1142. &:nth-child(2) {
  1143. background-color: rgba(0, 0, 0, 0);
  1144. margin: 0;
  1145. }
  1146. >p {
  1147. color: rgba(16, 16, 16, 1);
  1148. font-size: 14px;
  1149. }
  1150. >div {
  1151. border: 1px solid rgba(64, 95, 234, 0.42);
  1152. background-color: rgba(255, 255, 255, 1);
  1153. color: rgba(16, 16, 16, 1);
  1154. font-size: 14px;
  1155. display: inline-flex;
  1156. padding: 4px 8px;
  1157. border-radius: 4px;
  1158. align-items: center;
  1159. cursor: pointer;
  1160. height: 30px;
  1161. &.disabled {
  1162. cursor: not-allowed;
  1163. }
  1164. &:hover {
  1165. background: rgb(245, 247, 254, 0.4);
  1166. }
  1167. >span {
  1168. margin: 0 8px;
  1169. }
  1170. >b {
  1171. margin-right: 8px;
  1172. }
  1173. }
  1174. >section {
  1175. padding: 0 16px;
  1176. background-color: #ffffff;
  1177. border-radius: 12px;
  1178. margin-top: 16px;
  1179. >p {
  1180. display: inline-block;
  1181. color: rgba(16, 16, 16, 1);
  1182. font-size: 12px;
  1183. margin-top: 16px;
  1184. width: 100%;
  1185. }
  1186. >div {
  1187. margin-top: 4px;
  1188. overflow: hidden;
  1189. margin-bottom: 16px;
  1190. display: inline-block;
  1191. width: 100%;
  1192. >div {
  1193. margin-top: 8px;
  1194. >div {
  1195. &:nth-child(1) {
  1196. border-radius: 4px;
  1197. color: rgba(16, 16, 16, 1);
  1198. font-size: 12px;
  1199. height: 24px;
  1200. border: 1px solid rgba(229, 229, 229, 1);
  1201. display: flex;
  1202. justify-content: center;
  1203. align-items: center;
  1204. padding-right: 8px;
  1205. cursor: pointer;
  1206. &.disabled {
  1207. cursor: not-allowed;
  1208. }
  1209. &:hover {
  1210. background: rgba(229, 229, 229, 0.2);
  1211. }
  1212. >span {
  1213. &:nth-child(1) {
  1214. background-color: rgba(0, 174, 163, 0.2);
  1215. color: #00aea3;
  1216. font-size: 12px;
  1217. border: 1px solid rgba(64, 95, 234, 0.13);
  1218. padding: 0 4px;
  1219. margin: 0 4px 0 0;
  1220. }
  1221. &:nth-child(3) {
  1222. color: #00aea3;
  1223. font-size: 12px;
  1224. em {
  1225. padding: 0 4px;
  1226. font-style: normal;
  1227. border-left: 1px solid rgba(64, 95, 234, 1);
  1228. font-weight: bold;
  1229. &:nth-child(1) {
  1230. border: none;
  1231. }
  1232. }
  1233. }
  1234. }
  1235. }
  1236. &:nth-child(2) {
  1237. >p {
  1238. margin: 8px 0;
  1239. display: flex;
  1240. >span {
  1241. transform: translateY(2px);
  1242. color: #00aea3;
  1243. font-weight: bold;
  1244. font-size: 12px;
  1245. margin-right: 8px;
  1246. }
  1247. }
  1248. }
  1249. }
  1250. }
  1251. >p {
  1252. float: left;
  1253. width: 48%;
  1254. border-radius: 4px;
  1255. background-color: rgba(245, 247, 254, 1);
  1256. color: rgba(16, 16, 16, 1);
  1257. font-size: 12px;
  1258. margin-top: 8px;
  1259. height: 36px;
  1260. line-height: 36px;
  1261. padding: 0 8px;
  1262. display: flex;
  1263. align-items: center;
  1264. &:nth-child(odd) {
  1265. margin-right: 4%;
  1266. }
  1267. }
  1268. }
  1269. }
  1270. }
  1271. /**
  1272. .section-suggestions {
  1273. margin: 12px 0 20px;
  1274. .section-suggestion {
  1275. width: 380px;
  1276. height: 40px;
  1277. line-height: 40px;
  1278. border: 1px solid #e5e5e5;
  1279. border-radius: 12px;
  1280. padding: 0 8px;
  1281. display: flex;
  1282. align-items: center;
  1283. justify-content: space-between;
  1284. cursor: pointer;
  1285. margin-top: 8px;
  1286. &.disabled {
  1287. cursor: not-allowed;
  1288. }
  1289. &:hover {
  1290. background: rgb(245, 247, 254);
  1291. }
  1292. }
  1293. }
  1294. */
  1295. .dialog-other {
  1296. margin-bottom: 16px;
  1297. display: flex;
  1298. align-items: center;
  1299. justify-content: space-between;
  1300. >p {
  1301. display: flex;
  1302. align-items: center;
  1303. span {
  1304. margin-left: 8px;
  1305. color: rgba(16, 16, 16, 1);
  1306. font-size: 12px;
  1307. }
  1308. }
  1309. >div {
  1310. display: flex;
  1311. p {
  1312. display: flex;
  1313. align-items: center;
  1314. justify-content: center;
  1315. width: 30px;
  1316. height: 30px;
  1317. border-radius: 15px;
  1318. border: 1px solid rgba(229, 229, 229, 1);
  1319. margin-left: 8px;
  1320. cursor: pointer;
  1321. &.disabled {
  1322. cursor: not-allowed;
  1323. }
  1324. &:hover {
  1325. background-color: rgba(245, 247, 254, 1);
  1326. }
  1327. }
  1328. }
  1329. }
  1330. .feedback-title {
  1331. color: rgba(102, 102, 102, 1);
  1332. font-size: 12px;
  1333. margin: 0 0 8px 4px;
  1334. }
  1335. .feedback-content {
  1336. margin-bottom: 16px;
  1337. }
  1338. .dialog-writing-button {
  1339. position: absolute;
  1340. bottom: -30px;
  1341. left: 50%;
  1342. transform: translateX(-50%);
  1343. text-align: center;
  1344. width: 106px;
  1345. height: 34px;
  1346. line-height: 34px;
  1347. border-radius: 4px;
  1348. background-color: rgba(255, 255, 255, 1);
  1349. color: rgba(16, 16, 16, 1);
  1350. font-size: 14px;
  1351. border: 1px solid rgba(229, 229, 229, 1);
  1352. display: flex;
  1353. align-items: center;
  1354. justify-content: center;
  1355. cursor: pointer;
  1356. z-index: 10;
  1357. &:hover {
  1358. background: rgb(245, 247, 254);
  1359. }
  1360. }
  1361. </style>
  1362. <style>
  1363. .circle {
  1364. width: 13px;
  1365. height: 13px;
  1366. margin-left: 4px;
  1367. border-radius: 50%;
  1368. cursor: pointer;
  1369. display: inline-block;
  1370. border: 1px solid #888;
  1371. }
  1372. .circle::before {
  1373. content: "!";
  1374. font-size: 12px;
  1375. color: #000;
  1376. line-height: 12px;
  1377. text-align: center;
  1378. display: block;
  1379. }
  1380. </style>