DialogWrap.vue 42 KB

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