DialogWrap.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. <template>
  2. <div class="dialog-flex-wrap">
  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. <div class="section-suggestions">
  15. <div :class="['section-suggestion', readonly ? 'disabled' : '']"
  16. v-for="(suggestion, key) in suggestions" :key="key" @click="selectSuggestion(suggestion)">
  17. {{ suggestion }}<icon-arrow-right />
  18. </div>
  19. </div>
  20. <div class="dialog-list" v-if="dialogList.length > 0" :key="randomKey">
  21. <div :class="['dialog-item', isSetting ? '' : 'dialog-absolute']" v-for="(item, key) in dialogList"
  22. :key="item.key">
  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. <p style="margin-top: 0">{{ item.question }}</p>
  30. </div>
  31. <div class="dialog-header" v-if="item?.capacity">
  32. <img alt="avatar" src="/src/assets/slider/logo.jpg" width="28" />
  33. </div>
  34. <div class="dialog-footer" v-if="item.capacity"
  35. :style="{ display: dialogConfig.type === 'paper' ? 'inline-block' : 'block' }">
  36. <div v-if="type === 'knowledge'" @click="openCapacity(key)"
  37. :class="[readonly || item.capacity.status === 'loading' ? 'disabled' : '']">
  38. <a-spin :size="18" v-if="item.capacity.status === 'loading'" />
  39. <icon-check-circle-fill :size="18" v-else />
  40. <span>{{ item.capacity.status === "loading" ? "小数正在检索" : "查看检索信息" }}</span>
  41. <!-- <b>{{ item.capacity.text }}</b> -->
  42. <icon-caret-right size="18"
  43. v-if="item.capacity.status === 'loaded' && !menuList[key]?.open" />
  44. <icon-caret-down size="18"
  45. v-if="item.capacity.status === 'loaded' && menuList[key]?.open" />
  46. </div>
  47. <div v-else v-show="item.capacity.status === 'loading'"
  48. :class="[readonly || item.capacity.status === 'loading' ? 'disabled' : '']">
  49. <a-spin :size="18" />
  50. <span>{{ type === 'excel' ? '正在为您合并...' : '正在为您搜索答案...' }}</span>
  51. </div>
  52. <section v-if="type === 'knowledge' && item.capacity.status === 'loaded'"
  53. v-show="menuList[key].open">
  54. <div v-if="item.capacity.data.list">
  55. <p v-for="(item, key) in item.capacity.data.list" :key="key">
  56. <a-typography-paragraph :ellipsis="{ rows: 1, css: true }"
  57. :style="{ flex: 1, margin: '0' }">
  58. {{ item }}
  59. </a-typography-paragraph>
  60. </p>
  61. </div>
  62. <div v-if="item.capacity.data.documents">
  63. <div v-for="(document, documentKey) in item.capacity.data.documents" :key="documentKey">
  64. <div @click="openDocument(key, documentKey)" :class="[readonly ? 'disabled' : '']">
  65. <span>{{ document.type }}</span>
  66. <a-typography-paragraph :ellipsis="{ rows: 1, css: true }"
  67. :style="{ flex: 1, margin: '0' }">
  68. <span>{{ document.title }}</span>
  69. </a-typography-paragraph>
  70. <span>
  71. <em v-for="(item, documentIndex) in document.list" :key="documentIndex">{{
  72. item.title
  73. }}</em>
  74. </span>
  75. <icon-caret-down size="12"
  76. v-if="documentKey === menuList[key].documentOpenIndex" />
  77. <icon-caret-right size="12" v-else />
  78. </div>
  79. <div v-show="documentKey === menuList[key].documentOpenIndex">
  80. <p v-for="(item, index) in document.list" :key="index">
  81. <span>{{ item.title }}</span>
  82. <a-typography-paragraph :ellipsis="{ rows: 3, css: true }"
  83. :style="{ flex: 1, margin: '0' }">
  84. <span style="color: rgba(153, 153, 153, 1); font-size: 12px">{{
  85. item.content
  86. }}</span>
  87. </a-typography-paragraph>
  88. </p>
  89. </div>
  90. </div>
  91. </div>
  92. </section>
  93. <p v-if="type === 'knowledge' && item.answer"
  94. style="margin-top: 10px; font-size: 18px; font-weight: bold">
  95. 答案生成结果
  96. </p>
  97. <p v-if="item.answer" :style="{ 'margin-top': type === 'knowledge' ? '12px' : '0' }">
  98. <span v-if="type === 'paper'" class="paper-wrap">
  99. <img src="@/assets/question/word.svg" />
  100. <span>
  101. <b>黄冈试卷考试题</b>
  102. <em>DOCX,13.19KB</em>
  103. </span>
  104. </span>
  105. <span v-else v-html="item.answer"></span>
  106. </p>
  107. </div>
  108. <div class="dialog-footer" v-else>
  109. <p v-if="item.answer">
  110. {{ item.answer }}
  111. </p>
  112. </div>
  113. <div v-if="type === 'knowledge' && item.other" class="knowledge-wrap">
  114. <header>
  115. <p>来源</p>
  116. <p @click="goKnowledge">查看全部关联 ></p>
  117. </header>
  118. <section>
  119. <div v-for="(knowledge, knowledgeIndex) in knowledgeList" :key="knowledgeIndex">
  120. <a-popover :title="knowledge.name" position="left">
  121. <div>
  122. <span>{{ knowledgeIndex + 1 }}</span>
  123. <span>{{ knowledge.name }}</span>
  124. </div>
  125. <template #content>
  126. <div class="knowledge-detail">
  127. <div class="knowledge-content">
  128. {{ knowledge.contents[knowledge.page] }}
  129. </div>
  130. <div class="knowledge-footer">
  131. <p>检索片段</p>
  132. <p>
  133. <span v-for="(content, contentIndex) in knowledge.contents"
  134. :key="contentIndex"
  135. :class="{ active: knowledge.page === contentIndex }" @click="() => {
  136. knowledge.page = contentIndex;
  137. }
  138. ">{{ contentIndex + 1 }}</span>
  139. </p>
  140. <p @click="goKnowledge(knowledge.id)">查看详情></p>
  141. </div>
  142. </div>
  143. </template>
  144. </a-popover>
  145. </div>
  146. </section>
  147. </div>
  148. <div v-if="item.file" class="paper-wrap" @click="downloadFile(item.file.file_url)">
  149. <img src="@/assets/question/excel.svg" v-if="type === 'excel'" />
  150. <img src="@/assets/question/word.svg" v-else />
  151. <span>
  152. <b>{{ item.file.file_name }}</b>
  153. </span>
  154. </div>
  155. <div class="dialog-other" v-if="item?.other">
  156. <p v-if="isSetting">
  157. <img src="@/assets/icons/check.png" width="16" />
  158. <span>{{ item.other.token }}</span>
  159. </p>
  160. <p v-else></p>
  161. <div>
  162. <a-tooltip content="重新生成">
  163. <p @click="reQuestion(item.question)" :class="[readonly ? 'disabled' : '']">
  164. <img src="@/assets/icons/refresh.png" width="15" />
  165. </p>
  166. </a-tooltip>
  167. <a-tooltip content="复制">
  168. <p @click="copyAnswer(item.answer)" :class="[readonly ? 'disabled' : '']">
  169. <img src="@/assets/icons/copy.png" width="15" />
  170. </p>
  171. </a-tooltip>
  172. <a-tooltip content="收藏">
  173. <p @click="saveAnswer(key)" :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  174. <img src="@/assets/icons/star-full.png" width="15" v-if="menuList[key].save" />
  175. <img src="@/assets/icons/star.png" width="15" v-else />
  176. </p>
  177. </a-tooltip>
  178. <a-tooltip content="点赞">
  179. <p :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  180. <img src="@/assets/icons/thumb-up.png" width="15" />
  181. </p>
  182. </a-tooltip>
  183. <a-tooltip content="反馈">
  184. <p @click="feedbackAnswer" :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  185. <img src="@/assets/icons/thumb-down.png" width="15" />
  186. </p>
  187. </a-tooltip>
  188. <a-tooltip content="分享">
  189. <p :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
  190. <img src="@/assets/icons/share.png" width="15" />
  191. </p>
  192. </a-tooltip>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <!-- <div v-show="readonly" @click="stopWriting" class="dialog-writing-button">
  199. <icon-record-stop :size="20" style="margin-right: 4px" />停止生成
  200. </div> -->
  201. <dialog-feedback :showFeedback="showFeedback" @handleCancel="handleCancel" @handleOk="handleOk"
  202. v-if="!isSetting" />
  203. </div>
  204. </template>
  205. <script>
  206. import DialogFeedback from "./DialogFeedback.vue";
  207. import { defineComponent, ref, onBeforeUnmount, onMounted, reactive, nextTick, inject } from "vue";
  208. import { marked } from "marked";
  209. export default defineComponent({
  210. components: {
  211. DialogFeedback
  212. },
  213. props: ["open", "suggestions", "isSetting", "readonly", "type", "list", "agentId", "dialogId"],
  214. setup(props, { emit }) {
  215. const knowledgeList = ref([
  216. {
  217. id: "111",
  218. name: "十四届全国人大二次会议政府工作报告1.docx ",
  219. page: 0,
  220. contents: [
  221. `促进社会综合融资成本稳中有降。畅通货币政策传导机制,避免资金沉
  222. 淀空转。增强资本市场内在稳定性。保持人民币汇率在合理均衡水平上的基本
  223. 稳定。大力发展科技金融、绿色金融、普惠金融、养老金融、数字金融。优化
  224. 融资增信、风险分担、信息共享等配套措施,更好满足中小微企业融资需求。
  225. 增强宏观政策取向一致性。围绕发展大局,加强财政、货币、就业、产业、
  226. 区域、科技、环保等政策协调配合,把非经济性政策纳入宏观政策取向一致性
  227. 评估,强化政策统筹,确保同向发力、形成合力。各地区各部门制定政策要认`,
  228. `制定推动文化传承发展的政策举措。深入推进国家文化数字化战略。
  229. 深化全民阅读活动。完善网络综合治理,培育积极健康、向上向善的网络文化。
  230. 创新实施文化惠民工程,提高公共文化场馆免费开放服务水平。大力发展文化
  231. 产业。开展第四次全国文物普查,加强文物系统性保护和合理利用。推进非物`
  232. ]
  233. },
  234. {
  235. id: "222",
  236. name: "十四届全国人大二次会议政府工作报告2.docx ",
  237. page: 0,
  238. contents: [
  239. `促进社会综合融资成本稳中有降。畅通货币政策传导机制,避免资金沉
  240. 淀空转。增强资本市场内在稳定性。保持人民币汇率在合理均衡水平上的基本
  241. 稳定。大力发展科技金融、绿色金融、普惠金融、养老金融、数字金融。优化
  242. 融资增信、风险分担、信息共享等配套措施,更好满足中小微企业融资需求。
  243. 增强宏观政策取向一致性。围绕发展大局,加强财政、货币、就业、产业、
  244. 区域、科技、环保等政策协调配合,把非经济性政策纳入宏观政策取向一致性
  245. 评估,强化政策统筹,确保同向发力、形成合力。各地区各部门制定政策要认`,
  246. `制定推动文化传承发展的政策举措。深入推进国家文化数字化战略。
  247. 深化全民阅读活动。完善网络综合治理,培育积极健康、向上向善的网络文化。
  248. 创新实施文化惠民工程,提高公共文化场馆免费开放服务水平。大力发展文化
  249. 产业。开展第四次全国文物普查,加强文物系统性保护和合理利用。推进非物`
  250. ]
  251. }
  252. ]);
  253. const DOCUMENT_RESULT = {
  254. type: "document",
  255. text: "谷歌知识库",
  256. status: "loaded",
  257. data: {
  258. title: "AI Agent的论文",
  259. documents: [
  260. {
  261. type: "PDF",
  262. title: "科比的传奇一生,你知道多少?",
  263. list: [
  264. {
  265. title: "P1",
  266. content:
  267. "科比·布莱恩特(Kobe Bryant),1978年8月23日出生,2020年1月26日不幸逝世,是美国著名的职业篮球运动员,司职得分后卫/小前锋。他的NBA生涯全部在洛杉矶湖人队度过,共获得5次NBA总冠军、1次NBA常规赛MVP、2次NBA总决赛MVP"
  268. },
  269. {
  270. title: "P2",
  271. content:
  272. "科比·布莱恩特(Kobe Bryant),1978年8月23日出生,2020年1月26日不幸逝世,是美国著名的职业篮球运动员,司职得分后卫/小前锋。他的NBA生涯全部在洛杉矶湖人队度过,共获得5次NBA总冠军、1次NBA常规赛MVP、2次NBA总决赛MVP"
  273. }
  274. ]
  275. },
  276. {
  277. type: "PDF",
  278. title: "科比的传奇一生,你知道多少?",
  279. list: [
  280. {
  281. title: "P1",
  282. content:
  283. "科比·布莱恩特(Kobe Bryant),1978年8月23日出生,2020年1月26日不幸逝世,是美国著名的职业篮球运动员,司职得分后卫/小前锋。他的NBA生涯全部在洛杉矶湖人队度过,共获得5次NBA总冠军、1次NBA常规赛MVP、2次NBA总决赛MVP"
  284. },
  285. {
  286. title: "P2",
  287. content:
  288. "科比·布莱恩特(Kobe Bryant),1978年8月23日出生,2020年1月26日不幸逝世,是美国著名的职业篮球运动员,司职得分后卫/小前锋。他的NBA生涯全部在洛杉矶湖人队度过,共获得5次NBA总冠军、1次NBA常规赛MVP、2次NBA总决赛MVP"
  289. }
  290. ]
  291. }
  292. ]
  293. }
  294. };
  295. const { helper, ajax } = inject("$global");
  296. const userName = ref(helper.read("userName") || "");
  297. const dialogList = reactive(props.list || []);
  298. const randomKey = ref(0);
  299. const showFeedback = ref(false);
  300. const menuList = reactive([]);
  301. let dialogIndex = dialogList.length;
  302. const dialogScroll = ref("");
  303. const dialogConfig = ref({});
  304. const scrollToEnd = async () => {
  305. await nextTick();
  306. if (dialogScroll.value) {
  307. dialogScroll.value.scrollTop = dialogScroll.value.scrollHeight;
  308. }
  309. };
  310. let answerInterval = null;
  311. const stopWriting = () => {
  312. window.clearInterval(answerInterval);
  313. emit("set-readonly", false);
  314. if (dialogList[dialogIndex]) {
  315. dialogList[dialogIndex].other = {
  316. token: "4.0s | Tokens"
  317. };
  318. }
  319. scrollToEnd();
  320. dialogIndex += 1;
  321. };
  322. const addData = (data) => {
  323. dialogList.splice(dialogIndex, 1, data);
  324. randomKey.value = Math.random();
  325. scrollToEnd();
  326. };
  327. const mockLink = (text, file = null) => {
  328. let num2 = 0;
  329. let p1 = text;
  330. const p2 = `尊敬的领导,
  331. 因个人原因,我计划于2023年11月6日至11月10日请假。在此期间,我将妥善安排工作,确保任务顺利完成。恳请批准。
  332. 谢谢!
  333. 上海电科院`;
  334. let result = { question: "", capacity: null, answer: "", other: null, file: null };
  335. // 第一步,输入问题
  336. const step1 = () => {
  337. result.question = p1;
  338. if (file) {
  339. result.file = file;
  340. addData(result);
  341. }
  342. step2();
  343. };
  344. // 第二步,调用能力
  345. const step2 = () => {
  346. const mockData = DOCUMENT_RESULT;
  347. result.capacity = {
  348. type: mockData.type,
  349. text: mockData.text,
  350. status: "loading",
  351. data: null
  352. };
  353. menuList[dialogIndex] = {
  354. save: false,
  355. open: false,
  356. documentOpenIndex: -1
  357. };
  358. addData(result);
  359. setTimeout(() => {
  360. result.capacity = mockData;
  361. addData(result);
  362. step3();
  363. }, 1000);
  364. };
  365. // 第三步,输出答案
  366. const step3 = () => {
  367. emit("set-readonly", true);
  368. answerInterval = setInterval(() => {
  369. if (num2 < p2.length + 1) {
  370. result.answer = p2.slice(0, num2);
  371. num2 += 1;
  372. addData(result);
  373. } else {
  374. stopWriting();
  375. }
  376. }, 50);
  377. };
  378. step1();
  379. };
  380. const saveAnswer = (index) => {
  381. if (!props.readonly) {
  382. menuList[index].save = !menuList[index].save;
  383. }
  384. };
  385. const openCapacity = (index) => {
  386. if (!props.readonly) {
  387. menuList[index].open = !menuList[index].open;
  388. }
  389. };
  390. const openDocument = (index, documentIndex) => {
  391. if (menuList[index].documentOpenIndex === documentIndex) {
  392. menuList[index].documentOpenIndex = -1;
  393. } else {
  394. menuList[index].documentOpenIndex = documentIndex;
  395. }
  396. };
  397. const feedbackAnswer = () => {
  398. if (!props.readonly) {
  399. showFeedback.value = true;
  400. }
  401. };
  402. const handleOk = () => {
  403. showFeedback.value = false;
  404. };
  405. const handleCancel = () => {
  406. showFeedback.value = false;
  407. };
  408. const selectSuggestion = (text) => {
  409. if (!props.readonly) {
  410. mockLink(text);
  411. }
  412. };
  413. const copyAnswer = (text) => {
  414. if (!props.readonly) {
  415. helper.copyText(text, "复制成功");
  416. }
  417. };
  418. const reQuestion = (text) => {
  419. if (!props.readonly) {
  420. mockLink(text);
  421. }
  422. };
  423. const goKnowledge = () => {
  424. emit("go-document");
  425. };
  426. const addLoading = (data) => {
  427. const mockData = DOCUMENT_RESULT;
  428. data.capacity = {
  429. type: mockData.type,
  430. text: mockData.text,
  431. status: "loading",
  432. data: null
  433. };
  434. menuList[dialogIndex] = {
  435. save: false,
  436. open: false,
  437. documentOpenIndex: -1
  438. };
  439. addData(data);
  440. return data;
  441. };
  442. const loadingData = ref(null);
  443. const isLoaded = ref(false);
  444. const answerData = ref("");
  445. const addQuestion = (question, file = null) => {
  446. let result = { question, capacity: null, answer: "", other: null, file: null };
  447. addData(result);
  448. return result;
  449. };
  450. const addAnswer = (data) => {
  451. data.answer = answerData.value;
  452. addData(data);
  453. };
  454. const answerLoaded = () => {
  455. isLoaded.value = true;
  456. emit("set-readonly", true);
  457. loadingData.value.capacity = DOCUMENT_RESULT;
  458. addAnswer(loadingData.value);
  459. };
  460. const downloadFile = (url) => {
  461. window.open(url, "_blank");
  462. };
  463. onBeforeUnmount(() => {
  464. helper.$bus.off("send-message");
  465. helper.$bus.off("clear-message");
  466. helper.$bus.off("stop-writing");
  467. helper.webSocket.close();
  468. });
  469. const getHTML = (string) => {
  470. return marked.parse(string);
  471. };
  472. onMounted(() => {
  473. scrollToEnd();
  474. helper.webSocket = ajax.message.create(helper.read("token"), props.agentId, props.dialogId, props.type);
  475. helper.webSocket.onmessage = (event) => {
  476. const { type, message, step_message, files } = JSON.parse(event.data);
  477. if (!loadingData.value) return;
  478. if (type === "stream") {
  479. if (files && files.length > 0) {
  480. loadingData.value.file = files[0];
  481. addData(loadingData.value);
  482. } else {
  483. answerData.value += step_message ? getHTML(step_message): getHTML(message)
  484. if (answerData.value && !isLoaded.value) {
  485. answerLoaded();
  486. }
  487. addAnswer(loadingData.value);
  488. }
  489. }
  490. if (type === "message") {
  491. answerData.value = getHTML(message);
  492. if (answerData.value && !isLoaded.value) {
  493. answerLoaded();
  494. }
  495. addAnswer(loadingData.value);
  496. }
  497. if (type === "close") {
  498. if (!answerData.value) {
  499. answerLoaded();
  500. answerData.value = getHTML(message);
  501. addAnswer(loadingData.value);
  502. }
  503. stopWriting();
  504. answerData.value = "";
  505. isLoaded.value = false;
  506. }
  507. };
  508. helper.$bus.on("send-message", (value) => {
  509. dialogConfig.value = helper.dialogConfig;
  510. const question = props.type === "report" ? value.inputs.report_name : value;
  511. const data = addQuestion(question);
  512. loadingData.value = addLoading(data);
  513. const sendData =
  514. props.type === "report" || props.type === "excel"
  515. ? value
  516. : {
  517. message: value
  518. };
  519. if (props.type === 'doc') {
  520. sendData.doc_ids = [helper.read('docId')];
  521. }
  522. helper.webSocket.send(JSON.stringify(sendData));
  523. });
  524. helper.$bus.on("clear-message", () => {
  525. dialogList.splice(0);
  526. });
  527. helper.$bus.on("stop-writing", () => {
  528. stopWriting();
  529. });
  530. });
  531. return {
  532. goKnowledge,
  533. randomKey,
  534. openDocument,
  535. showFeedback,
  536. copyAnswer,
  537. dialogList,
  538. selectSuggestion,
  539. dialogScroll,
  540. reQuestion,
  541. menuList,
  542. saveAnswer,
  543. openCapacity,
  544. feedbackAnswer,
  545. handleOk,
  546. handleCancel,
  547. stopWriting,
  548. knowledgeList,
  549. dialogConfig,
  550. userName,
  551. downloadFile
  552. };
  553. }
  554. });
  555. </script>
  556. <style>
  557. .dialog-header {
  558. display: flex;
  559. align-items: center;
  560. .dialog-span {
  561. color: rgba(51, 51, 51, 1);
  562. font-size: 14px;
  563. font-weight: bold;
  564. }
  565. }
  566. </style>
  567. <style scoped>
  568. .user-name {
  569. width: 28px;
  570. height: 28px;
  571. border-radius: 14px;
  572. display: flex;
  573. align-items: center;
  574. justify-content: center;
  575. color: #fff;
  576. }
  577. .paper-download {
  578. padding-left: 50px;
  579. >span {
  580. width: 26px;
  581. height: 26px;
  582. border-radius: 3px;
  583. cursor: pointer;
  584. display: flex;
  585. align-items: center;
  586. justify-content: center;
  587. &:hover {
  588. background: rgba(150, 171, 185, 0.2);
  589. }
  590. }
  591. }
  592. .paper-wrap {
  593. display: flex;
  594. max-width: 200px;
  595. align-items: center;
  596. margin-left: 40px;
  597. margin-bottom: 10px;
  598. cursor: pointer;
  599. >img {
  600. width: 50px;
  601. margin-right: 10px;
  602. }
  603. >span {
  604. flex: 1;
  605. white-space: nowrap;
  606. overflow: hidden;
  607. text-overflow: ellipsis;
  608. >b {
  609. white-space: nowrap;
  610. overflow: hidden;
  611. text-overflow: ellipsis;
  612. display: block;
  613. width: 100%;
  614. }
  615. >em {
  616. font-style: normal;
  617. }
  618. }
  619. }
  620. .knowledge-detail {
  621. width: 320px;
  622. padding-top: 20px;
  623. .knowledge-content {
  624. height: 300px;
  625. overflow-y: auto;
  626. line-height: 30px;
  627. }
  628. .knowledge-footer {
  629. border-top: 1px solid rgba(229, 229, 229, 1);
  630. margin-top: 20px;
  631. padding-top: 20px;
  632. display: flex;
  633. justify-content: space-between;
  634. align-items: center;
  635. p {
  636. &:nth-child(1) {
  637. opacity: 0.8;
  638. }
  639. &:nth-child(2) {
  640. flex: 1;
  641. display: flex;
  642. justify-content: left;
  643. margin: 0 30px;
  644. >span {
  645. margin: 0 5px;
  646. cursor: pointer;
  647. &:hover,
  648. &.active {
  649. color: #00aea3;
  650. }
  651. }
  652. }
  653. &:nth-child(3) {
  654. font-weight: bold;
  655. cursor: pointer;
  656. &:hover {
  657. color: #00aea3;
  658. }
  659. }
  660. }
  661. }
  662. }
  663. .knowledge-wrap {
  664. padding: 10px 0 20px 50px;
  665. >header {
  666. display: flex;
  667. justify-content: space-between;
  668. >p {
  669. &:nth-child(1) {
  670. color: #7f7f7f;
  671. font-weight: bold;
  672. }
  673. &:nth-child(2) {
  674. cursor: pointer;
  675. &:hover {
  676. color: #00aea3;
  677. }
  678. }
  679. }
  680. }
  681. >section {
  682. >div {
  683. >div {
  684. height: 40px;
  685. display: inline-flex;
  686. align-items: center;
  687. >span {
  688. &:nth-child(1) {
  689. display: inline-block;
  690. background-color: rgba(0, 174, 163, 0.2);
  691. color: #00aea3;
  692. padding: 1px 5px;
  693. border-radius: 2px;
  694. margin-right: 5px;
  695. font-size: 12px;
  696. }
  697. &:nth-child(2) {
  698. cursor: pointer;
  699. &:hover {
  700. color: #00aea3;
  701. }
  702. }
  703. }
  704. }
  705. }
  706. }
  707. }
  708. .dialog-absolute {
  709. .dialog-header {
  710. position: absolute;
  711. &:nth-child(1) {
  712. transform: translateY(10px);
  713. }
  714. &:nth-child(3) {
  715. transform: translateY(16px);
  716. }
  717. }
  718. .dialog-footer {
  719. margin-left: 50px;
  720. &:nth-child(2) {
  721. margin-left: 50px;
  722. padding-left: 0;
  723. }
  724. }
  725. }
  726. .dialog-flex-wrap {
  727. position: relative;
  728. flex: 1;
  729. margin-top: 16px;
  730. height: 100%;
  731. }
  732. .dialog-flex {
  733. position: absolute;
  734. left: 0;
  735. top: 0;
  736. right: 0;
  737. bottom: 0;
  738. overflow-y: auto;
  739. overflow-x: hidden;
  740. }
  741. .section-open {
  742. margin-top: 12px;
  743. }
  744. .dialog-file {
  745. width: 421px;
  746. height: 48px;
  747. border-radius: 12px;
  748. background-color: rgba(255, 255, 255, 1);
  749. color: rgba(16, 16, 16, 1);
  750. font-size: 14px;
  751. border: 1px solid rgba(229, 229, 229, 1);
  752. display: flex;
  753. align-items: center;
  754. margin-bottom: 16px;
  755. padding: 0 8px;
  756. }
  757. .dialog-footer {
  758. border-radius: 12px;
  759. background-color: rgba(245, 247, 254, 1);
  760. padding: 12px 16px;
  761. margin: 16px 0;
  762. &:nth-child(2) {
  763. background-color: rgba(0, 0, 0, 0);
  764. margin: 0;
  765. }
  766. >p {
  767. color: rgba(16, 16, 16, 1);
  768. font-size: 14px;
  769. }
  770. >div {
  771. border: 1px solid rgba(64, 95, 234, 0.42);
  772. background-color: rgba(255, 255, 255, 1);
  773. color: rgba(16, 16, 16, 1);
  774. font-size: 14px;
  775. display: inline-flex;
  776. padding: 4px 8px;
  777. border-radius: 4px;
  778. align-items: center;
  779. cursor: pointer;
  780. height: 30px;
  781. &.disabled {
  782. cursor: not-allowed;
  783. }
  784. &:hover {
  785. background: rgb(245, 247, 254, 0.4);
  786. }
  787. >span {
  788. margin: 0 8px;
  789. }
  790. >b {
  791. margin-right: 8px;
  792. }
  793. }
  794. >section {
  795. padding: 0 16px;
  796. background-color: #ffffff;
  797. border-radius: 12px;
  798. margin-top: 16px;
  799. >p {
  800. display: inline-block;
  801. color: rgba(16, 16, 16, 1);
  802. font-size: 12px;
  803. margin-top: 16px;
  804. width: 100%;
  805. }
  806. >div {
  807. margin-top: 4px;
  808. overflow: hidden;
  809. margin-bottom: 16px;
  810. display: inline-block;
  811. width: 100%;
  812. >div {
  813. margin-top: 8px;
  814. >div {
  815. &:nth-child(1) {
  816. border-radius: 4px;
  817. color: rgba(16, 16, 16, 1);
  818. font-size: 12px;
  819. height: 24px;
  820. border: 1px solid rgba(229, 229, 229, 1);
  821. display: flex;
  822. justify-content: center;
  823. align-items: center;
  824. padding-right: 8px;
  825. cursor: pointer;
  826. &.disabled {
  827. cursor: not-allowed;
  828. }
  829. &:hover {
  830. background: rgba(229, 229, 229, 0.2);
  831. }
  832. >span {
  833. &:nth-child(1) {
  834. background-color: rgba(0, 174, 163, 0.2);
  835. color: #00aea3;
  836. font-size: 12px;
  837. border: 1px solid rgba(64, 95, 234, 0.13);
  838. padding: 0 4px;
  839. margin: 0 4px 0 0;
  840. }
  841. &:nth-child(3) {
  842. color: #00aea3;
  843. font-size: 12px;
  844. em {
  845. padding: 0 4px;
  846. font-style: normal;
  847. border-left: 1px solid rgba(64, 95, 234, 1);
  848. font-weight: bold;
  849. &:nth-child(1) {
  850. border: none;
  851. }
  852. }
  853. }
  854. }
  855. }
  856. &:nth-child(2) {
  857. >p {
  858. margin: 8px 0;
  859. display: flex;
  860. >span {
  861. transform: translateY(2px);
  862. color: #00aea3;
  863. font-weight: bold;
  864. font-size: 12px;
  865. margin-right: 8px;
  866. }
  867. }
  868. }
  869. }
  870. }
  871. >p {
  872. float: left;
  873. width: 48%;
  874. border-radius: 4px;
  875. background-color: rgba(245, 247, 254, 1);
  876. color: rgba(16, 16, 16, 1);
  877. font-size: 12px;
  878. margin-top: 8px;
  879. height: 36px;
  880. line-height: 36px;
  881. padding: 0 8px;
  882. display: flex;
  883. align-items: center;
  884. &:nth-child(odd) {
  885. margin-right: 4%;
  886. }
  887. }
  888. }
  889. }
  890. }
  891. .section-suggestions {
  892. margin: 12px 0 20px;
  893. .section-suggestion {
  894. width: 380px;
  895. height: 40px;
  896. line-height: 40px;
  897. border: 1px solid #e5e5e5;
  898. border-radius: 12px;
  899. padding: 0 8px;
  900. display: flex;
  901. align-items: center;
  902. justify-content: space-between;
  903. cursor: pointer;
  904. margin-top: 8px;
  905. &.disabled {
  906. cursor: not-allowed;
  907. }
  908. &:hover {
  909. background: rgb(245, 247, 254);
  910. }
  911. }
  912. }
  913. .dialog-other {
  914. margin-bottom: 16px;
  915. display: flex;
  916. align-items: center;
  917. justify-content: space-between;
  918. >p {
  919. display: flex;
  920. align-items: center;
  921. span {
  922. margin-left: 8px;
  923. color: rgba(16, 16, 16, 1);
  924. font-size: 12px;
  925. }
  926. }
  927. >div {
  928. display: flex;
  929. p {
  930. display: flex;
  931. align-items: center;
  932. justify-content: center;
  933. width: 30px;
  934. height: 30px;
  935. border-radius: 15px;
  936. border: 1px solid rgba(229, 229, 229, 1);
  937. margin-left: 8px;
  938. cursor: pointer;
  939. &.disabled {
  940. cursor: not-allowed;
  941. }
  942. &:hover {
  943. background-color: rgba(245, 247, 254, 1);
  944. }
  945. }
  946. }
  947. }
  948. .feedback-title {
  949. color: rgba(102, 102, 102, 1);
  950. font-size: 12px;
  951. margin: 0 0 8px 4px;
  952. }
  953. .feedback-content {
  954. margin-bottom: 16px;
  955. }
  956. .dialog-writing-button {
  957. position: absolute;
  958. bottom: -30px;
  959. left: 50%;
  960. transform: translateX(-50%);
  961. text-align: center;
  962. width: 106px;
  963. height: 34px;
  964. line-height: 34px;
  965. border-radius: 4px;
  966. background-color: rgba(255, 255, 255, 1);
  967. color: rgba(16, 16, 16, 1);
  968. font-size: 14px;
  969. border: 1px solid rgba(229, 229, 229, 1);
  970. display: flex;
  971. align-items: center;
  972. justify-content: center;
  973. cursor: pointer;
  974. z-index: 10;
  975. &:hover {
  976. background: rgb(245, 247, 254);
  977. }
  978. }
  979. </style>