DialogWrap.vue 45 KB

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