dialogArea.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735
  1. <template>
  2. <div class="dialog">
  3. <div v-show="cardType == 0">
  4. <div class="d_top" ref="chatRef">
  5. <div class="d_t_chat" v-for="(item, index) in chatList" :key="index">
  6. <div
  7. class="d_t_c_user"
  8. v-if="item.content && item.content != 'addAsk'"
  9. >
  10. <div class="d_t_c_u_left">
  11. <div class="d_t_c_u_l_content">{{ item.content }}</div>
  12. <div class="d_t_c_u_l_time">{{ item.createtime }}</div>
  13. </div>
  14. <div class="d_t_c_u_right">
  15. <span>我</span>
  16. </div>
  17. </div>
  18. <div class="d_t_c_ai" v-if="item.content != 'addAsk'">
  19. <div class="d_t_c_a_left">
  20. <el-avatar v-if="item.filename" :src="item.filename"></el-avatar>
  21. <span v-else>Ai</span>
  22. </div>
  23. <div class="d_t_c_a_right">
  24. <div
  25. class="d_t_c_a_r_content"
  26. style="display: flex;justify-content: space-between;flex-wrap: wrap;"
  27. v-if="pan(item.aiContent).length"
  28. >
  29. <div
  30. v-if="!pan(item.aiContent).length"
  31. class="d_t_c_a_r_content"
  32. v-loading="item.loading"
  33. v-html="item.aiContent"
  34. ></div>
  35. <div
  36. v-else
  37. v-for="i in pan(item.aiContent)"
  38. style="position: relative;"
  39. class="d_t_c_a_r_c_img"
  40. >
  41. <img
  42. style="width: 130px;height: 130px;object-fit: cover;"
  43. :src="i.image"
  44. alt=""
  45. @click="previewImg(i.image)"
  46. />
  47. <span class="download_image" @click.stop="download(i.image)">
  48. <img
  49. :src="
  50. require('../../../assets/icon/fileIcon/download.png')
  51. "
  52. />
  53. </span>
  54. </div>
  55. </div>
  56. <div
  57. v-else
  58. class="d_t_c_a_r_content"
  59. v-loading="item.loading"
  60. v-html="htmlContent(item.aiContent)"
  61. ></div>
  62. <div
  63. v-if="!pan(item.aiContent).length && !item.loading"
  64. class="aiCopy"
  65. >
  66. <img
  67. @click="onCopy(item.aiContent)"
  68. style="width: 30px;"
  69. src="../../../assets/icon/course/copyTxt.png"
  70. alt=""
  71. />
  72. <img
  73. @click.stop="aiTalkAll(item)"
  74. style="width: 15px;margin:7px 0 7px 7px;"
  75. :src="require('../../../assets/icon/course/megaphone3.svg')"
  76. />
  77. <img v-if="chatList.length-2 == index" @click.stop="refresh(item)" style="width: 15px;margin:7px 0 7px 7px;" :src="require('../../../assets/icon/course/refresh.svg')">
  78. </div>
  79. <div class="d_t_c_a_r_time">{{ item.createtime }}</div>
  80. </div>
  81. </div>
  82. <div
  83. class="s_t_addAsk"
  84. v-if="
  85. item.content == 'addAsk' &&
  86. !item.aiContent.questions &&
  87. item.aiContent.length &&
  88. !item.loading
  89. "
  90. >
  91. <span
  92. v-for="item2 in item.aiContent"
  93. :key="item2.index"
  94. @click.stop="send(item2.label)"
  95. >{{ item2.label }}</span
  96. >
  97. </div>
  98. <div
  99. class="s_t_addAsk"
  100. v-if="
  101. item.content == 'addAsk' &&
  102. item.aiContent.questions &&
  103. !item.loading
  104. "
  105. >
  106. <span
  107. v-for="(item2, index2) in item.aiContent.questions"
  108. :key="index2"
  109. @click.stop="send(item2.question ? item2.question : item2)"
  110. >{{ item2.question ? item2.question : item2 }}</span
  111. >
  112. </div>
  113. <div
  114. class="s_t_addAsk"
  115. v-if="item.content == 'addAsk' && item.loading"
  116. >
  117. <span style="width:50px;height:50px" v-loading="true"></span>
  118. </div>
  119. </div>
  120. </div>
  121. <div class="d_bottom">
  122. <div class="s_b_btnAreaTop">
  123. <div class="s_b_bat_left">
  124. <el-tooltip
  125. class="item"
  126. effect="dark"
  127. content="清空聊天记录"
  128. placement="top"
  129. >
  130. <img
  131. :src="require('../../../assets/icon/course/clean.svg')"
  132. @click.stop="clear()"
  133. />
  134. </el-tooltip>
  135. <el-tooltip
  136. class="item"
  137. effect="dark"
  138. :content="openMegaphone ? '关闭喇叭' : '打开喇叭'"
  139. placement="top"
  140. >
  141. <img
  142. v-if="!openMegaphone"
  143. :src="require('../../../assets/icon/course/megaphone2.svg')"
  144. @click.stop="$parent.changeMegaphone()"
  145. />
  146. <img
  147. v-else
  148. :src="require('../../../assets/icon/course/megaphone.svg')"
  149. @click.stop="$parent.changeMegaphone()"
  150. />
  151. </el-tooltip>
  152. </div>
  153. <div class="s_b_bat_right"></div>
  154. </div>
  155. <div class="d_b_btnArea">
  156. <div class="d_b_ba-item" @click.stop="choiceRole()">
  157. <img
  158. style="width: 20px;"
  159. src="../../../assets/icon/course/role.png"
  160. alt=""
  161. />
  162. 选择智能体
  163. </div>
  164. </div>
  165. <div class="d_b_inputArea">
  166. <!-- <div class="d_b_tape" @click="goTape()"></div> -->
  167. <div class="d_b_input">
  168. <el-input
  169. :disabled="loading || chatLoading || sendFnType == 1"
  170. v-loading="loading || chatLoading"
  171. @keyup.enter.native="send()"
  172. :placeholder="
  173. sendFnType == 0
  174. ? '请在此输入您想了解的内容'
  175. : '请点击录音按钮开始录音'
  176. "
  177. class="d_b_i_left"
  178. v-model="text"
  179. ></el-input>
  180. <!-- <div class="d_b_i_right" @click="sendFile()">
  181. <span></span>
  182. </div> -->
  183. </div>
  184. <div class="voice_or_keyboard">
  185. <el-tooltip
  186. v-if="sendFnType == 0"
  187. class="item"
  188. effect="dark"
  189. content="使用语音"
  190. placement="top"
  191. >
  192. <img
  193. :src="require('../../../assets/icon/course/voice.svg')"
  194. @click.stop="changeFnType(1)"
  195. />
  196. </el-tooltip>
  197. <el-tooltip
  198. v-if="sendFnType == 1"
  199. class="item"
  200. effect="dark"
  201. content="使用键盘"
  202. placement="top"
  203. >
  204. <img
  205. :src="require('../../../assets/icon/course/keyboard.svg')"
  206. @click.stop="changeFnType(0)"
  207. />
  208. </el-tooltip>
  209. </div>
  210. <div class="d_b_btn" @click="send()" v-if="sendFnType == 0">
  211. <span v-if="!loading && !chatLoading"></span>
  212. <div v-else @click.stop="stopSend()">停止</div>
  213. </div>
  214. <div class="d_b_btn" v-if="sendFnType == 1">
  215. <img
  216. v-if="!loading && !chatLoading && !isTalk"
  217. @click.stop="talk()"
  218. :src="require('../../../assets/icon/course/voice2.svg')"
  219. />
  220. <img
  221. style="width:50px;height:50px"
  222. v-else-if="!loading && !chatLoading && isTalk"
  223. @click.stop="stopTalk()"
  224. :src="require('../../../assets/icon/course/isTape.svg')"
  225. />
  226. <div v-else @click.stop="stopSend()">停止</div>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. <div class="" v-show="cardType == 1">
  232. <div class="choiceTop">
  233. <div class="choiceRoleHeader">
  234. <div>切换角色:</div>
  235. <span>您希望以下哪个角色回答您的问题,请选择:</span>
  236. </div>
  237. <div class="choiceSelect">
  238. <el-button
  239. class="option"
  240. :style="{
  241. background: sortOption == 0 ? '#36A9FC' : '',
  242. color: sortOption == 0 ? '#fff' : ''
  243. }"
  244. @click="optBtn(0)"
  245. plain
  246. >我的</el-button
  247. >
  248. <el-button
  249. class="option"
  250. :style="{
  251. background: sortOption == 1 ? '#36A9FC' : '',
  252. color: sortOption == 1 ? '#fff' : ''
  253. }"
  254. @click="optBtn(1)"
  255. plain
  256. >社区</el-button
  257. >
  258. </div>
  259. <div
  260. class="characterBlock"
  261. v-if="sortOption == 0"
  262. v-for="(item, index) in roleList"
  263. :key="item.id"
  264. @click.stop="choseRole(item)"
  265. >
  266. <div class="imgLeft">
  267. <div class="img">
  268. <img style="width: 100%;height: 100%;" :src="item.avatar" />
  269. </div>
  270. </div>
  271. <div class="txtRight">
  272. <div class="bir">{{ item.assistantName }}</div>
  273. <div
  274. :style="{
  275. color: '#fff',
  276. display:
  277. choseRoleItem.assistant_id == item.assistant_id
  278. ? 'block'
  279. : 'none'
  280. }"
  281. >
  282. 已选择
  283. </div>
  284. <!-- <span></span> -->
  285. </div>
  286. </div>
  287. <div
  288. class="characterBlock"
  289. v-if="sortOption == 1"
  290. v-for="(item, index) in roleList2"
  291. :key="item.id"
  292. @click.stop="choseRole(item)"
  293. >
  294. <div class="imgLeft">
  295. <div class="img">
  296. <img
  297. style="width: 100%;height: 100%;"
  298. :src="
  299. item.headUrl
  300. ? item.headUrl
  301. : require('../../../assets/icon/course/ai.png')
  302. "
  303. />
  304. </div>
  305. </div>
  306. <div class="txtRight">
  307. <div class="bir">{{ item.assistantName }}</div>
  308. <div
  309. :style="{
  310. color: '#fff',
  311. display:
  312. choseRoleItem.assistant_id == item.assistant_id
  313. ? 'block'
  314. : 'none'
  315. }"
  316. >
  317. 已选择
  318. </div>
  319. <!-- <span></span> -->
  320. </div>
  321. </div>
  322. <!-- <div class="characterBlock" @click="addCharacter">
  323. <div class="imgLeft">
  324. <div class="img2">
  325. <img style="width: 100%;height: 100%;" src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/basil_add-outline1715564539170.png">
  326. </div>
  327. </div>
  328. <div class="txtRight">
  329. <div style="color: #fff;margin-left: 5px;">添加新角色</div>
  330. </div>
  331. </div> -->
  332. <!-- <div class="filterSubjects">
  333. <div class="fs_title">筛选科目</div>
  334. <div class="fs_box">
  335. <div :class="['fs_b_item',subjectsType==index?'fs_b_itemActive':'']" v-for="(item,index) in subjectsList" :key="index" @click="subjectsType = index">{{ item }}</div>
  336. </div>
  337. </div>
  338. <div class="roleList">
  339. <div class="r_title">角色列表 ({{ roleList.length }})</div>
  340. <div class="r_box">
  341. <div :class="['r_b_item',roleType==index?'r_b_itemActive':'']" v-for="(item,index) in roleList" :key="item.id" @click.stop="roleType=index">
  342. <img :src="item.avatar">
  343. <span>{{ item.name }}</span>
  344. </div>
  345. </div>
  346. </div> -->
  347. </div>
  348. <div class="choiceBottom">
  349. <el-button class="cb_btn" size="mini" @click="noChangeRole()"
  350. >取消</el-button
  351. >
  352. <el-button
  353. class="cb_btn"
  354. size="mini"
  355. type="primary"
  356. @click="changeRole()"
  357. >确定</el-button
  358. >
  359. </div>
  360. </div>
  361. <iframe
  362. allow="camera *; microphone *;display-capture;midi;encrypted-media;"
  363. src="https://beta.cloud.cocorobo.cn/browser/public/index.html"
  364. ref="iiframe"
  365. v-show="false"
  366. ></iframe>
  367. </div>
  368. </template>
  369. <script>
  370. import { v4 as uuidv4 } from "uuid";
  371. import MarkdownIt from "markdown-it";
  372. var OpenCC = require("opencc-js");
  373. let converter = OpenCC.Converter({
  374. from: "hk",
  375. to: "cn"
  376. });
  377. export default {
  378. props: {
  379. fileId: {
  380. type: Array,
  381. default: () => []
  382. },
  383. openMegaphone: {
  384. type: Boolean,
  385. default: false
  386. }
  387. },
  388. data() {
  389. return {
  390. sendFnType: 0,
  391. isTalk: false,
  392. cardType: 0, //0-对话 1-选角色
  393. userid: this.$route.query.userid,
  394. courseId: this.$route.query.courseId,
  395. org: this.$route.query.org,
  396. choseRoleItem: {},
  397. text: "",
  398. sortOption: 0, //切换角色 0我的 1 社区
  399. subjectsList: [
  400. "语文",
  401. "数学",
  402. "英语",
  403. "科学",
  404. "信息",
  405. "历史",
  406. "地理",
  407. "政治",
  408. "生物",
  409. "化学",
  410. "物理",
  411. "其他"
  412. ],
  413. subjectsType: -1,
  414. rightSubjects: -1,
  415. roleType: -1,
  416. rightRole: -1,
  417. loading: false,
  418. chatLoading: false,
  419. roleList2: [],
  420. chatList: [],
  421. nowChatList: [],
  422. source: null,
  423. saveUid: "",
  424. aiTalkList: [],
  425. aiIsTalk: false,
  426. aiTalkUid: ""
  427. };
  428. },
  429. computed: {
  430. pan() {
  431. return content => {
  432. try {
  433. return JSON.parse(content);
  434. } catch (error) {
  435. return [];
  436. }
  437. };
  438. },
  439. htmlContent() {
  440. const md = new MarkdownIt();
  441. return _md => {
  442. return md.render(_md);
  443. };
  444. }
  445. },
  446. methods: {
  447. refresh(item) {
  448. this.send(item.content);
  449. },
  450. changeFnType(newValue) {
  451. if (this.isTalk) return this.$message.info("请先停止录音");
  452. this.sendFnType = newValue;
  453. },
  454. talk() {
  455. let iiframe = this.$refs["iiframe"];
  456. iiframe.contentWindow.window.document.getElementById(
  457. "languageOptions"
  458. ).selectedIndex = 2; //普通话
  459. iiframe.contentWindow.testdoContinuousPronunciationAssessment();
  460. this.isTalk = true;
  461. iiframe.contentWindow.onRecognizedResult = e => {
  462. let _msg = e.privText;
  463. if (!_msg) this.text += _msg;
  464. };
  465. },
  466. stopTalk() {
  467. if (!this.isTalk) return this.$message.info("请先开始录音");
  468. //this.isTalk = false;
  469. let iiframe = this.$refs["iiframe"];
  470. iiframe.contentWindow.window.document
  471. .getElementById("scenarioStopButton")
  472. .click();
  473. iiframe.contentWindow.onSessionStopped = (s, e) => {
  474. this.isTalk = false;
  475. this.send();
  476. };
  477. },
  478. stopSend() {
  479. if (this.source) {
  480. this.source.close();
  481. if (this.chatList[this.chatList.length - 1].content == "wanSearch") {
  482. this.chatList.pop();
  483. }
  484. this.loading = false;
  485. this.chatLoading = false;
  486. this.source = null;
  487. this.insertChat(this.saveUid);
  488. }
  489. },
  490. onCopy(content) {
  491. // 创建临时textarea元素
  492. const tempInput = document.createElement("textarea");
  493. tempInput.value = content; // 设置要复制的内容
  494. // 隐藏元素
  495. tempInput.style.position = "absolute";
  496. tempInput.style.left = "-9999px";
  497. // 将元素添加到DOM中
  498. document.body.appendChild(tempInput);
  499. // 选中元素内容
  500. tempInput.select();
  501. // 执行复制操作
  502. document.execCommand("copy");
  503. // 移除临时元素
  504. document.body.removeChild(tempInput);
  505. this.$message({
  506. message: "复制成功",
  507. type: "success"
  508. });
  509. },
  510. previewImg(url) {
  511. this.$hevueImgPreview(url);
  512. },
  513. clear() {
  514. this.chatList = [];
  515. },
  516. // addCharacter(){
  517. // this.$message.info("点击了添加新角色")
  518. // },
  519. optBtn(val) {
  520. this.sortOption = val;
  521. },
  522. choiceRole() {
  523. if (this.loading) return this.$message.info("请稍等");
  524. this.cardType = 1;
  525. },
  526. // sendFile() {
  527. // if (this.loading) return this.$message.info("请稍等");
  528. // this.$message.info("点击了附件");
  529. // },
  530. // goTape() {
  531. // if (this.loading) return this.$message.info("请稍等");
  532. // this.$message.info(`点击了语音`);
  533. // },
  534. send(_text = this.text) {
  535. if (this.loading || this.chatLoading) return this.$message.info("请稍等");
  536. if (_text.trim().length == 0) return this.$message.info("请输入内容");
  537. this.chatLoading = true;
  538. if (this.choseRoleItem.assistant_id) {
  539. let _uid = uuidv4();
  540. let _item = this.choseRoleItem;
  541. this.chatList.push({
  542. loading: true,
  543. role: "user",
  544. content: `${_text}`,
  545. uid: _uid,
  546. AI: "AI",
  547. aiContent: "",
  548. oldContent: "",
  549. isShowSynchronization: false,
  550. filename: _item.headUrl,
  551. index: this.chatList.length,
  552. is_mind_map: false,
  553. fileid: _item.assistantName
  554. // createtime: new Date().toLocaleString().replaceAll("/", "-")
  555. });
  556. this.text = "";
  557. let params = {
  558. assistant_id: this.choseRoleItem.assistant_id,
  559. userId: this.userid,
  560. message: _text,
  561. session_name: `${this.courseId}-studyStudent-md`,
  562. uid: _uid,
  563. file_ids: this.fileId
  564. };
  565. this.ajax
  566. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
  567. .then(res => {
  568. if (
  569. converter(res.data.FunctionResponse.result) ==
  570. converter("发送成功")
  571. ) {
  572. } else {
  573. this.chatLoading = false;
  574. console.log(res.data.FunctionResponse.result);
  575. //this.$message.warning(res.data.FunctionResponse.result);
  576. }
  577. })
  578. .catch(err => {
  579. this.chatLoading = false;
  580. console.log(err);
  581. });
  582. this.saveUid = _uid;
  583. this.getAtAuContent(_uid);
  584. } else {
  585. let _uuid = uuidv4();
  586. this.chatList.push({
  587. role: "user",
  588. content: `${_text}`,
  589. uid: _uuid,
  590. AI: "AI",
  591. aiContent: "",
  592. oldContent: "",
  593. isShowSynchronization: false,
  594. filename: "",
  595. index: this.chatList.length,
  596. is_mind_map: false,
  597. loading: true
  598. });
  599. this.scrollBottom();
  600. let history = [];
  601. this.nowChatList.forEach(i => {
  602. if (i.content == "wanSearch") {
  603. return history.push({
  604. role: "assistant",
  605. content: JSON.stringify(i.aiContent)
  606. });
  607. } else if (i.content == "getImage") {
  608. return history.push({
  609. role: "assistant",
  610. content: i.aiContent
  611. });
  612. }
  613. if (i.content) {
  614. history.push({
  615. role: "user",
  616. content: i.content
  617. });
  618. }
  619. if (i.aiContent) {
  620. history.push({
  621. role: "assistant",
  622. content: i.aiContent
  623. });
  624. }
  625. });
  626. history.push({ role: "user", content: _text });
  627. let params = {
  628. assistant_id: "f8e1ebb2-2e0d-11ef-8bf4-12e77c4cb76b",
  629. userId: this.userid,
  630. message: _text,
  631. session_name: `${this.courseId}-studyStudent-md`,
  632. uid: _uuid,
  633. file_ids: this.fileId
  634. };
  635. // history.pop();
  636. // let params = {
  637. // model: "gpt-3.5-turbo",
  638. // temperature: 0,
  639. // max_tokens: 4096,
  640. // top_p: 1,
  641. // frequency_penalty: 0,
  642. // presence_penalty: 0,
  643. // messages: history,
  644. // uid: _uuid,
  645. // mind_map_question: _text
  646. // };
  647. // let params = {
  648. // message: {
  649. // anthropic_version: "bedrock-2023-05-31",
  650. // max_tokens: 4096,
  651. // temperature: 0,
  652. // top_p: 1,
  653. // messages: history
  654. // },
  655. // uid: _uuid,
  656. // model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
  657. // };
  658. this.text = "";
  659. console.log("发送信息", params);
  660. this.ajax
  661. // .post("https://claude3.cocorobo.cn/chat", params)
  662. // .post("https://gpt4.cocorobo.cn/chat", params)
  663. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
  664. .then(res => {
  665. if (
  666. converter(res.data.FunctionResponse.result) ==
  667. converter("发送成功")
  668. ) {
  669. } else {
  670. this.chatLoading = false;
  671. // this.$message.warning(res.data.FunctionResponse.result);
  672. console.log(res.data.FunctionResponse.result);
  673. }
  674. })
  675. .catch(e => {
  676. this.chatLoading = false;
  677. console.log(e);
  678. });
  679. this.saveUid = _uuid;
  680. this.getAtAuContent(_uuid);
  681. // this.getAiContent(_uuid);
  682. }
  683. },
  684. // 获取ai对话
  685. getAiContent(_uid) {
  686. // this.source = new EventSource(`https://claude3.cocorobo.cn/streamChat/${_uid}`);
  687. // this.source = new EventSource(`https://gpt4.cocorobo.cn/question/${_uid}`);
  688. // this.source = new EventSource(`https://gpt4.cocorobo.cn/stream/${_uid}`); //http://gpt4.cocorobo.cn:8011/stream/ https://gpt4.cocorobo.cn/stream/
  689. let _allText = "";
  690. let _mdText = "";
  691. // const md = new MarkdownIt();
  692. this.source.onmessage = _e => {
  693. if (_e.data.replace("'", "").replace("'", "") == "[DONE]") {
  694. //对话已经完成
  695. _mdText = _mdText.replace("_", "");
  696. this.source.close();
  697. this.scrollBottom();
  698. this.chatLoading = false;
  699. this.chatList.find(i => i.uid == _uid).aiContent = _mdText;
  700. this.chatList.find(i => i.uid == _uid).isalltext = true;
  701. this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
  702. this.chatList.find(i => i.uid == _uid).loading = false;
  703. this.nowChatList.push(this.chatList.find(i => i.uid == _uid));
  704. this.addAsk(this.chatList.find(i => i.uid == _uid).content);
  705. // 这里保存对话
  706. this.insertChat(_uid);
  707. return;
  708. } else {
  709. //对话还在继续
  710. let _text = "";
  711. _text = _e.data.replaceAll("'", "");
  712. if (_allText == "") {
  713. _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
  714. } else {
  715. _allText += _text;
  716. }
  717. _mdText = _allText + "_";
  718. _mdText = _mdText.replace(/\\n/g, "\n");
  719. _mdText = _mdText.replace(/\\/g, "");
  720. if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
  721. //转化返回的回复流数据
  722. // _mdText = md.render(_mdText);
  723. this.chatList.find(i => i.uid == _uid).aiContent = _mdText;
  724. this.chatList.find(i => i.uid == _uid).loading = false;
  725. this.scrollBottom();
  726. // 处理流数据
  727. }
  728. };
  729. },
  730. getAtAuContent(_uid) {
  731. this.source = new EventSource(
  732. `https://gpt4.cocorobo.cn/question/${_uid}`
  733. );
  734. //http://gpt4.cocorobo.cn:8011/question/ https://gpt4.cocorobo.cn/question/
  735. let _allText = "";
  736. let _mdText = "";
  737. let _index = 0;
  738. let _talkText = "";
  739. // const md = new MarkdownIt();
  740. this.source.onmessage = _e => {
  741. let _eData = JSON.parse(_e.data);
  742. if (_eData.content.replace("'", "").replace("'", "") == "[DONE]") {
  743. let _result = [];
  744. if ("result" in _eData) {
  745. _result = _eData.result;
  746. for (let i = 0; i < _result.length; i++) {
  747. _mdText = _mdText.replace(_result[i].text, _result[i].fileName);
  748. }
  749. }
  750. _mdText = _mdText.replace("_", "");
  751. if (this.openMegaphone && this.aiTalkUid == _uid) {
  752. this.aiTalkUid = "";
  753. if (_talkText != "") {
  754. let _resultText = this.removeMarkdown(_talkText);
  755. this.aiTalkList.push(_resultText);
  756. _talkText = "";
  757. if (!this.aiIsTalk) this.aiTalk(1);
  758. }
  759. }
  760. this.chatLoading = false;
  761. this.chatList.find(i => i.uid == _uid).aiContent = _mdText;
  762. this.chatList.find(i => i.uid == _uid).isalltext = true;
  763. this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
  764. this.chatList.find(i => i.uid == _uid).loading = false;
  765. this.nowChatList.push(this.chatList.find(i => i.uid == _uid));
  766. this.addAsk(this.chatList.find(i => i.uid == _uid).content);
  767. this.source.close();
  768. this.insertChat(_uid);
  769. } else {
  770. _index += 1;
  771. let _text = _eData.content.replace("'", "").replace("'", "");
  772. if (_allText == "") {
  773. _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
  774. _talkText += _text.replace(/^\n+/, "");
  775. } else {
  776. _allText += _text;
  777. _talkText += _text;
  778. }
  779. _mdText = _allText + "_";
  780. _mdText = _mdText.replace(/\\n/g, "\n");
  781. _mdText = _mdText.replace(/\\/g, "");
  782. if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
  783. //转化返回的回复流数据
  784. // _mdText = md.render(_mdText);
  785. if (_index == 10) {
  786. this.chatList.find(i => i.uid == _uid).aiContent = _mdText;
  787. this.chatList.find(i => i.uid == _uid).loading = false;
  788. this.$nextTick(() => {
  789. this.$refs.chatRef.scrollTop = this.$refs.chatRef.scrollHeight;
  790. });
  791. _index = 0;
  792. }
  793. if (this.openMegaphone && /[,。:;?!)]/.test(_talkText)) {
  794. let _resultText = this.removeMarkdown(_talkText);
  795. if (this.aiTalkUid != _uid) {
  796. this.aiTalkList = [];
  797. }
  798. this.aiTalkList.push(_resultText);
  799. _talkText = "";
  800. if (this.aiTalkUid != _uid) {
  801. this.aiTalkUid = _uid;
  802. this.aiTalk(0);
  803. } else if (!this.aiIsTalk) {
  804. this.aiTalk(1);
  805. }
  806. }
  807. // 处理流数据
  808. }
  809. };
  810. },
  811. //保存消息
  812. insertChat(_uid) {
  813. if (_uid == "") return;
  814. let _data = this.chatList.find(i => i.uid == _uid);
  815. if (!_data) return;
  816. let params = {
  817. userId: this.userid,
  818. userName: "qgt",
  819. groupId: "602def61-005d-11ee-91d8-005056b8q12w",
  820. answer: _data.aiContent,
  821. problem: _data.content,
  822. file_id: _data.fileid ? _data.fileid : "",
  823. alltext: _data.aiContent,
  824. type: "chat",
  825. filename: _data.filename,
  826. session_name: `${this.courseId}-studyStudent-md` //这是对话记录位置
  827. };
  828. this.saveUid = "";
  829. this.ajax
  830. .post("https://gpt4.cocorobo.cn/insert_chat", params)
  831. .then(res => {});
  832. },
  833. // 获取对应的聊天记录
  834. getChatList() {
  835. return new Promise((resolve, reject) => {
  836. if (this.loading) return this.$message.info("请稍等...");
  837. this.chatList = [];
  838. this.loading = true;
  839. this.chatLoading = true;
  840. let params = {
  841. userid: this.userid,
  842. groupid: "602def61-005d-11ee-91d8-005056b8q12w",
  843. // session_name:``
  844. session_name: `${this.courseId}-studyStudent-md`
  845. };
  846. this.ajax
  847. .post("https://gpt4.cocorobo.cn/get_agent_park_chat", params)
  848. .then(res => {
  849. let _data = JSON.parse(res.data.FunctionResponse);
  850. if (_data.length > 0) {
  851. let _chatList = [];
  852. for (let i = 0; i < _data.length; i++) {
  853. _chatList.push({
  854. loading: false,
  855. role: "user",
  856. content: _data[i].problem,
  857. uid: _data[i].id,
  858. AI: "AI",
  859. aiContent: _data[i].answer,
  860. oldContent: _data[i].answer,
  861. isShowSynchronization: false,
  862. filename: _data[i].filename,
  863. index: i,
  864. is_mind_map: false,
  865. fileid: _data[i].fileid
  866. });
  867. }
  868. this.chatList = _chatList;
  869. // console.log(' this.chatList', this.chatList);
  870. this.loading = false;
  871. this.chatLoading = false;
  872. } else {
  873. //没有对话记录
  874. this.chatLoading = false;
  875. this.loading = false;
  876. }
  877. resolve();
  878. })
  879. .catch(err => {
  880. console.log(err);
  881. this.$message.error("获取对话记录失败");
  882. this.loading = false;
  883. this.chatLoading = false;
  884. resolve();
  885. });
  886. });
  887. },
  888. getRoleList() {
  889. this.roleList = [];
  890. let params = {
  891. userId: this.userid
  892. };
  893. this.ajax
  894. .post("https://gpt4.cocorobo.cn/get_ai_agent_assistant_list", params)
  895. .then(res => {
  896. let _data = res.data.FunctionResponse.result;
  897. if (_data.length == 0) return;
  898. if (_data) {
  899. this.roleList = JSON.parse(_data);
  900. }
  901. })
  902. .catch(e => {
  903. console.log("获取角色列表失败");
  904. this.roleList = [];
  905. });
  906. },
  907. getPublicRoleList() {
  908. this.roleList2 = [];
  909. let params = {
  910. userId: this.userid,
  911. // organizeid: this.org,
  912. organizeid: "45facc0a-1211-11ec-80ad-005056b86db5"
  913. };
  914. this.ajax
  915. .post(
  916. "https://gpt4.cocorobo.cn/get_ai_agent_assistant_share_list",
  917. params
  918. )
  919. .then(res => {
  920. let _data = res.data.FunctionResponse.result;
  921. if (_data.length == 0) return;
  922. if (_data) {
  923. this.roleList2 = JSON.parse(_data);
  924. }
  925. })
  926. .catch(e => {
  927. this.roleList2 = [];
  928. console.log("获取公共角色失败", e);
  929. });
  930. },
  931. addAsk(_text) {
  932. // this.chatLoading = true;
  933. let _uuid = uuidv4();
  934. let _msg = `NOTICERole: 你是一个多功能的AI助手,能够根据学生的文本内容判断其情感状态,并提供相应的支持和引导。Output: Provide your output in json format.ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced \"Format example\".Instruction: Based on the context, follow \"Format example\", write content.# Context## 任务1.学生文本内容,执行以下任务。首先,请你判断学生是否进行情感倾诉,比如心情不好、遭遇校园暴力、对他人进行人身攻击等。如果是,请扮演一个心理咨询师的角色,坚持人本主义的立场,善良、温柔地引导对方,安抚对方的情绪,为对方提供心理支持。剩下的其它情况,请你扮演提问引导者的角色,延续学生的提问,围绕问题本身,提出3个问题,激发学生的深度思考、创造性思考。2.人本主义心理学人本主义心理学强调个体的主观体验和自我实现,认为每个人都有内在的潜力和价值。心理咨询师应当以同理心、无条件积极关注和真诚的态度对待来访者,帮助他们发现自身的力量和解决问题的能力。3.提问引导技巧提问引导技巧包括开放性问题、反思性问题和假设性问题等,旨在通过提问激发对方的思考和探索,帮助他们深入理解问题并找到解决方案。## 工作流程1. 仔细阅读并分析学生提供的文本内容。2. 判断学生是否进行情感倾诉。3. 如果是情感倾诉,扮演心理咨询师的角色,提供情感支持和引导。4. 如果不是情感倾诉,扮演提问引导者的角色,围绕问题本身提出3个问题。## 限制/注意事项 1.在回答时应保持专业性和权威性,确保信息的准确性和可靠性。2.避免生成与问题无关或不恰当的回答,确保回答的相关性和实用性。3.在提供情感支持时,注意用词温柔,避免引起对方的负面情绪。## 要求1. 内容包含情感支持或追加问题。2. 情感支持部分应体现同理心和积极关注。3. 追加问题应具有启发性和深度。## 学生文本内容${_text}# Format example [{\"index\": 1,\"label\": \"不同国家的垃圾分类标准和方法?\"},{\"index\": 2, \"label\": \"可回收垃圾的处理流程和再利用方法?\"},{\"index\": 3,\"label\": \"有害垃圾对环境和人体健康的潜在影响?\"}]`;
  935. _msg = _msg.replace(/[\r\n]/g, "");
  936. this.chatList.push({
  937. role: "user",
  938. content: `addAsk`,
  939. uid: _uuid,
  940. AI: "AI",
  941. aiContent: "",
  942. oldContent: "",
  943. isShowSynchronization: false,
  944. filename: "",
  945. index: this.chatList.length,
  946. is_mind_map: false,
  947. loading: true
  948. });
  949. this.scrollBottom();
  950. let history = [];
  951. // this.nowChatList.forEach(i => {
  952. // if (i.content == "wanSearch") {
  953. // // history.push({
  954. // // role:"assistant",
  955. // // content: JSON.stringify(i.aiContent)
  956. // // })
  957. // return;
  958. // } else if (i.content == "getImage") {
  959. // return history.push({
  960. // role: "assistant",
  961. // content: i.aiContent
  962. // });
  963. // }else if(i.content == "addAsk"){
  964. // }
  965. // if (i.content) {
  966. // history.push({
  967. // role: "user",
  968. // content: i.content
  969. // });
  970. // }
  971. // if (i.aiContent) {
  972. // history.push({
  973. // role: "assistant",
  974. // content: i.aiContent
  975. // });
  976. // }
  977. // });
  978. history.push({ type: "text", text: _msg });
  979. console.log(history);
  980. // let params = {
  981. // model: "gpt-3.5-turbo",
  982. // temperature: 0,
  983. // max_tokens: 4096,
  984. // top_p: 1,
  985. // frequency_penalty: 0,
  986. // presence_penalty: 0,
  987. // messages:history,
  988. // stream: false,
  989. // uid: _uuid,
  990. // mind_map_question: ""
  991. // };
  992. let params = {
  993. assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
  994. userId: this.userid,
  995. message: history,
  996. session_name: _uuid,
  997. // uid: _uuid,
  998. file_ids: this.fileId
  999. };
  1000. // let params = {
  1001. // message: {
  1002. // anthropic_version: "bedrock-2023-05-31",
  1003. // max_tokens: 4096,
  1004. // temperature: 0,
  1005. // top_p: 1,
  1006. // messages: [{ role: "user", content: _msg }]
  1007. // },
  1008. // uid: _uuid,
  1009. // model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
  1010. // };
  1011. this.text = "";
  1012. this.ajax
  1013. // .post("https://gpt4.cocorobo.cn/chat", params)
  1014. // .post("https://claude3.cocorobo.cn/chat", params)
  1015. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  1016. .then(res => {
  1017. console.log(res);
  1018. let _data = res.data.FunctionResponse.message;
  1019. console.log(_data);
  1020. _data = _data.replaceAll("```json", "").replaceAll("```", "");
  1021. this.chatList.find(i => i.uid == _uuid).aiContent = JSON.parse(_data);
  1022. this.chatList.find(i => i.uid == _uuid).isalltext = true;
  1023. this.chatList.find(i => i.uid == _uuid).isShowSynchronization = true;
  1024. this.chatList.find(i => i.uid == _uuid).loading = false;
  1025. this.scrollBottom();
  1026. // this.chatLoading = false;
  1027. })
  1028. .catch(e => {
  1029. this.chatLoading = false;
  1030. this.chatList.find(i => i.uid == _uuid).loading = false;
  1031. console.log(e);
  1032. });
  1033. },
  1034. changeRole() {
  1035. this.cardType = 0;
  1036. // this.rightSubjects = this.subjectsType;
  1037. // this.rightRole = this.roleType;
  1038. if (this.choseRoleItem.assistant_id) {
  1039. this.chatList = [];
  1040. this.nowChatList = [];
  1041. let _uuid = uuidv4();
  1042. this.chatList.push({
  1043. role: "user",
  1044. content: `您好,${this.choseRoleItem.assistantName}`,
  1045. uid: _uuid,
  1046. AI: "AI",
  1047. aiContent: this.choseRoleItem.prologue
  1048. ? this.choseRoleItem.prologue
  1049. : "您好,有什么需要我帮忙的吗?",
  1050. oldContent: "",
  1051. isShowSynchronization: false,
  1052. filename: this.choseRoleItem.headUrl,
  1053. index: this.chatList.length,
  1054. is_mind_map: false,
  1055. loading: false
  1056. });
  1057. this.scrollBottom();
  1058. }
  1059. },
  1060. choseRole(item) {
  1061. this.choseRoleItem = item;
  1062. console.log("选择角色", this.choseRoleItem);
  1063. },
  1064. noChangeRole() {
  1065. this.cardType = 0;
  1066. this.choseRoleItem = {};
  1067. // this.subjectsType = this.rightSubjects;
  1068. // this.roleType = this.rightRole;
  1069. },
  1070. scrollBottom() {
  1071. this.$nextTick(() => {
  1072. this.$refs.chatRef.scrollTop = this.$refs.chatRef.scrollHeight;
  1073. });
  1074. },
  1075. download(_url) {
  1076. let xhr = new XMLHttpRequest();
  1077. xhr.open("GET", _url, true);
  1078. xhr.responseType = "blob";
  1079. xhr.onload = () => {
  1080. if (xhr.status === 200) {
  1081. let blob = xhr.response;
  1082. // const _blob = new Blob([blob], { type: fileType });
  1083. const downloadElement = document.createElement("a");
  1084. const url = window.URL.createObjectURL(blob);
  1085. downloadElement.href = url;
  1086. downloadElement.download = "Image.jpg";
  1087. downloadElement.click();
  1088. window.URL.revokeObjectURL(url); // 释放内存
  1089. } else {
  1090. this.$message.error("此图片不支持下载");
  1091. }
  1092. };
  1093. xhr.onerror = e => {
  1094. console.log(e);
  1095. this.$message.error("此图片不支持下载");
  1096. };
  1097. xhr.send();
  1098. },
  1099. removeMarkdown(text) {
  1100. return text
  1101. .replace(/[#*_~`>+\-]/g, "") // 移除 #、*、_、~、`、>、+、- 符号
  1102. .replace(/!\[.*?\]\(.*?\)/g, "") // 移除图片
  1103. .replace(/\[.*?\]\(.*?\)/g, "") // 移除链接
  1104. .replace(/```[\s\S]*?```/g, "") // 移除代码块(不使用 s 标志)
  1105. .replace(/`[^`]*`/g, "") // 移除行内代码
  1106. .replace(/\d+\./g, "") // 移除有序列表
  1107. .replace(/^\s*[-*+]\s+/gm, "") // 移除无序列表
  1108. .replace(/\s+/g, " ") // 将多个空白字符替换为一个空格
  1109. .trim(); // 去除字符串两端的空白字符
  1110. },
  1111. aiTalk(type = 0) {
  1112. //0 新的 1继续
  1113. if (type == 0 && this.aiIsTalk) {
  1114. let _talkTextIiframe2 = this.$refs.iiframe2;
  1115. try {
  1116. _talkTextIiframe2.contentWindow.pausesynthesizer();
  1117. _talkTextIiframe2.contentWindow.closesynthesizer();
  1118. this.aiIsTalk = false;
  1119. if (this.aiTalkList.length) this.aiTalk(0);
  1120. } catch (error) {
  1121. // console.log("error")
  1122. this.aiIsTalk = false;
  1123. if (this.aiTalkList.length) this.aiTalk(0);
  1124. }
  1125. } else {
  1126. let _text = this.aiTalkList.shift();
  1127. let _talkTextIiframe2 = this.$refs.iiframe2;
  1128. if (_text) {
  1129. this.aiIsTalk = true;
  1130. // console.log("👇说👇");
  1131. // console.log(_text);
  1132. _talkTextIiframe2.contentWindow.texttospeech(
  1133. _text,
  1134. () => {
  1135. this.aiTalk(1);
  1136. },
  1137. () => {
  1138. this.aiTalk(0);
  1139. }
  1140. );
  1141. } else {
  1142. this.aiIsTalk = false;
  1143. try {
  1144. _talkTextIiframe2.contentWindow.closesynthesizer();
  1145. } catch (error) {
  1146. return
  1147. }
  1148. }
  1149. }
  1150. // if(_text){
  1151. // this.aiIsTalk = true;
  1152. // }
  1153. },
  1154. aiTalkAll(item) {
  1155. let _resultText = this.removeMarkdown(item.aiContent);
  1156. this.aiTalkUid = item.uid;
  1157. this.aiTalkList = [];
  1158. this.aiTalkList.push(_resultText);
  1159. this.aiTalk(0)
  1160. // console.log(_resultText);
  1161. }
  1162. },
  1163. mounted() {
  1164. this.getRoleList();
  1165. this.getPublicRoleList();
  1166. this.getChatList().then(_ => {
  1167. this.scrollBottom();
  1168. });
  1169. this.nowChatList = [];
  1170. }
  1171. };
  1172. </script>
  1173. <style scoped>
  1174. .dialog {
  1175. width: 100%;
  1176. height: 100%;
  1177. box-sizing: border-box;
  1178. }
  1179. .dialog > div {
  1180. width: 100%;
  1181. height: 100%;
  1182. }
  1183. .aiCopy {
  1184. position: absolute;
  1185. right: 5px;
  1186. bottom: 0%;
  1187. display: flex;
  1188. flex-direction: column;
  1189. justify-content: flex-end;
  1190. /* transform: translate(0, -30%); */
  1191. cursor: pointer;
  1192. }
  1193. .characterBlock {
  1194. display: flex;
  1195. background: rgba(54, 169, 252, 1);
  1196. width: 100%;
  1197. height: 80px;
  1198. margin: 0 auto;
  1199. border-radius: 10px;
  1200. margin-bottom: 15px;
  1201. cursor: pointer;
  1202. }
  1203. .characterBlock > .imgLeft {
  1204. width: 100px;
  1205. display: flex;
  1206. justify-content: center;
  1207. align-items: center;
  1208. }
  1209. .characterBlock > .imgLeft > .img {
  1210. width: 60px;
  1211. height: 60px;
  1212. overflow: hidden;
  1213. border-radius: 50%;
  1214. }
  1215. .characterBlock > .imgLeft > .img2 {
  1216. width: 70px;
  1217. height: 70px;
  1218. overflow: hidden;
  1219. border-radius: 50%;
  1220. }
  1221. .characterBlock > .txtRight {
  1222. flex: 1;
  1223. display: flex;
  1224. justify-content: flex-start;
  1225. align-items: center;
  1226. }
  1227. .characterBlock > .txtRight > .bir {
  1228. width: 180px;
  1229. height: 35px;
  1230. display: flex;
  1231. align-items: center;
  1232. background-color: #fff;
  1233. border-radius: 10px;
  1234. box-sizing: border-box;
  1235. padding: 5px 10px;
  1236. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  1237. margin-right: 10px;
  1238. white-space: nowrap;
  1239. overflow: hidden;
  1240. text-overflow: ellipsis;
  1241. }
  1242. .d_top {
  1243. width: 100%;
  1244. height: calc(100% - 130px);
  1245. overflow: auto;
  1246. box-sizing: border-box;
  1247. padding: 20px 0;
  1248. }
  1249. .d_t_chat {
  1250. width: 100%;
  1251. display: flex;
  1252. box-sizing: border-box;
  1253. padding: 10px;
  1254. flex-direction: column;
  1255. }
  1256. .d_t_chat > div {
  1257. display: flex;
  1258. align-items: flex-start;
  1259. width: 100%;
  1260. }
  1261. .d_t_c_user {
  1262. box-sizing: border-box;
  1263. padding-left: 35px;
  1264. }
  1265. .d_t_c_u_left {
  1266. width: 90%;
  1267. height: auto;
  1268. }
  1269. .d_t_c_u_l_content {
  1270. width: auto;
  1271. max-width: 100%;
  1272. height: auto;
  1273. box-sizing: border-box;
  1274. padding: 10px;
  1275. color: white;
  1276. background-color: #3681fc;
  1277. border-radius: 8px 2px 8px 8px;
  1278. white-space: pre-line;
  1279. }
  1280. .d_t_c_u_l_time {
  1281. width: 100%;
  1282. display: flex;
  1283. justify-content: flex-end;
  1284. font-size: 12px;
  1285. color: #9f9f9f;
  1286. margin-top: 5px;
  1287. }
  1288. .d_t_c_u_right {
  1289. width: 35px;
  1290. height: 35px;
  1291. display: flex;
  1292. justify-content: center;
  1293. margin-left: 5px;
  1294. }
  1295. .d_t_c_u_right > span {
  1296. width: 32px;
  1297. height: 32px;
  1298. display: flex;
  1299. justify-content: center;
  1300. align-items: center;
  1301. color: white;
  1302. background-color: #3681fc;
  1303. border-radius: 50%;
  1304. }
  1305. .d_t_c_ai {
  1306. box-sizing: border-box;
  1307. padding-right: 35px;
  1308. margin-top: 10px;
  1309. position: relative;
  1310. }
  1311. .d_t_c_a_right {
  1312. min-width: 90%;
  1313. height: auto;
  1314. }
  1315. .d_t_c_a_r_content {
  1316. width: auto;
  1317. max-width: 100%;
  1318. height: auto;
  1319. box-sizing: border-box;
  1320. padding: 10px;
  1321. background-color: #f6f8ff;
  1322. border-radius: 2px 8px 8px 8px;
  1323. white-space: pre-line;
  1324. word-break: break-all;
  1325. }
  1326. .d_t_c_a_r_time {
  1327. width: 100%;
  1328. display: flex;
  1329. justify-content: flex-start;
  1330. font-size: 12px;
  1331. color: #9f9f9f;
  1332. margin-top: 5px;
  1333. }
  1334. .d_t_c_a_left {
  1335. width: 35px;
  1336. height: 35px;
  1337. display: flex;
  1338. justify-content: center;
  1339. margin-right: 5px;
  1340. }
  1341. .d_t_c_a_left > span {
  1342. width: 32px;
  1343. height: 32px;
  1344. display: flex;
  1345. justify-content: center;
  1346. align-items: center;
  1347. color: white;
  1348. background-color: #3681fc;
  1349. border-radius: 50%;
  1350. }
  1351. .d_bottom {
  1352. width: 100%;
  1353. height: 130px;
  1354. display: flex;
  1355. flex-direction: column;
  1356. justify-content: space-between;
  1357. }
  1358. .d_b_btnArea {
  1359. width: 100%;
  1360. height: 30px;
  1361. display: flex;
  1362. align-items: center;
  1363. box-sizing: border-box;
  1364. padding: 0 10px;
  1365. }
  1366. .d_b_ba-item {
  1367. width: auto;
  1368. box-sizing: border-box;
  1369. padding: 0 10px;
  1370. height: 25px;
  1371. background-color: white;
  1372. display: flex;
  1373. justify-content: center;
  1374. align-items: center;
  1375. /* 阴影 */
  1376. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.363);
  1377. border-radius: 15px;
  1378. margin-right: 10px;
  1379. font-size: 14px;
  1380. cursor: pointer;
  1381. }
  1382. .d_b_inputArea {
  1383. width: 100%;
  1384. height: 55px;
  1385. box-sizing: border-box;
  1386. border-top: solid 1px #ededed;
  1387. display: flex;
  1388. justify-content: space-between;
  1389. padding-right: 10px;
  1390. align-items: center;
  1391. }
  1392. .d_b_tape {
  1393. width: 35px;
  1394. height: 35px;
  1395. background: url("../../../assets/icon/course/tape.png") no-repeat;
  1396. background-size: 50% 60%;
  1397. background-position: center;
  1398. cursor: pointer;
  1399. }
  1400. .d_b_input {
  1401. /* width: 75%; */
  1402. flex: 1;
  1403. height: 45px;
  1404. background-color: #f3f3f3;
  1405. border-radius: 50px;
  1406. margin: 0 10px;
  1407. display: flex;
  1408. overflow: hidden;
  1409. align-items: center;
  1410. }
  1411. .d_b_i_left {
  1412. width: 100%;
  1413. line-height: 45px;
  1414. height: 100%;
  1415. }
  1416. .d_b_i_left >>> .el-input__inner {
  1417. border: none;
  1418. background-color: #f3f3f3;
  1419. outline: none;
  1420. border-radius: 50px 0 0 50px;
  1421. }
  1422. .d_b_i_right {
  1423. width: 45px;
  1424. height: 45px;
  1425. display: flex;
  1426. justify-content: center;
  1427. align-items: center;
  1428. }
  1429. .d_b_i_right > span {
  1430. width: 35px;
  1431. height: 35px;
  1432. background: url("../../../assets/icon/course/file.png") no-repeat;
  1433. background-size: 50% 60%;
  1434. background-position: center;
  1435. cursor: pointer;
  1436. }
  1437. .d_b_btn {
  1438. width: 40px;
  1439. height: 40px;
  1440. background-color: #3681fc;
  1441. display: flex;
  1442. justify-content: center;
  1443. align-items: center;
  1444. border-radius: 50%;
  1445. cursor: pointer;
  1446. }
  1447. .d_b_btn > div {
  1448. color: white;
  1449. width: 100%;
  1450. height: 100%;
  1451. display: flex;
  1452. justify-content: center;
  1453. align-items: center;
  1454. }
  1455. .d_b_btn > span {
  1456. width: 30px;
  1457. height: 30px;
  1458. background: url("../../../assets/icon/course/send.png") no-repeat;
  1459. background-size: 70% 70%;
  1460. background-position: center;
  1461. }
  1462. .d_b_btn > img {
  1463. width: 30px;
  1464. height: 30px;
  1465. }
  1466. .choiceTop {
  1467. width: 100%;
  1468. height: 95%;
  1469. overflow-x: hidden;
  1470. box-sizing: border-box;
  1471. padding: 10px;
  1472. }
  1473. .choiceBottom {
  1474. width: 100%;
  1475. height: 5%;
  1476. display: flex;
  1477. align-items: center;
  1478. justify-content: flex-end;
  1479. }
  1480. .cb_btn {
  1481. margin: 0 10px;
  1482. }
  1483. .choiceRoleHeader {
  1484. width: 100%;
  1485. /* margin: 10px; */
  1486. margin-bottom: 20px;
  1487. }
  1488. .choiceRoleHeader > div {
  1489. font-size: 16px;
  1490. font-weight: bold;
  1491. }
  1492. .choiceRoleHeader > span {
  1493. font-size: 14px;
  1494. }
  1495. .choiceSelect {
  1496. width: 100%;
  1497. display: flex;
  1498. height: 35px;
  1499. justify-content: flex-start;
  1500. align-items: center;
  1501. margin: 15px 0;
  1502. }
  1503. .choiceSelect > .option {
  1504. width: 80px;
  1505. height: 100%;
  1506. border-radius: 5px;
  1507. margin-right: 10px;
  1508. display: flex;
  1509. justify-content: center;
  1510. align-items: center;
  1511. cursor: pointer;
  1512. }
  1513. .filterSubjects {
  1514. margin: 10px;
  1515. width: 100%;
  1516. height: auto;
  1517. }
  1518. .fs_box {
  1519. width: 100%;
  1520. display: flex;
  1521. flex-wrap: wrap;
  1522. margin-top: 10px;
  1523. }
  1524. .fs_b_item {
  1525. width: auto;
  1526. height: 35px;
  1527. font-size: 14px;
  1528. box-sizing: border-box;
  1529. padding: 0 9px;
  1530. background-color: #f3f7fd;
  1531. border: solid 1px #f3f7fd;
  1532. border-radius: 5px;
  1533. margin-right: 8px;
  1534. margin-bottom: 8px;
  1535. display: flex;
  1536. justify-content: center;
  1537. align-items: center;
  1538. cursor: pointer;
  1539. }
  1540. .fs_b_itemActive {
  1541. border: solid 1px #4d8ffc;
  1542. color: #4d8ffc;
  1543. background-color: #f3f7fd;
  1544. }
  1545. .roleList {
  1546. width: 100%;
  1547. height: auto;
  1548. margin: 10px;
  1549. }
  1550. .r_box {
  1551. width: 100%;
  1552. height: auto;
  1553. display: flex;
  1554. flex-wrap: wrap;
  1555. }
  1556. .r_b_item {
  1557. height: 40px;
  1558. font-size: 14px;
  1559. display: flex;
  1560. /* justify-content: center; */
  1561. align-items: center;
  1562. background-color: #f0f2f5;
  1563. border-radius: 5px;
  1564. margin: 5px;
  1565. cursor: pointer;
  1566. box-sizing: border-box;
  1567. padding: 0 4px;
  1568. border: solid 1px #f0f2f5;
  1569. }
  1570. .r_b_itemActive {
  1571. box-sizing: border-box;
  1572. border: solid 1px #aeccfe;
  1573. color: #4d8ffb;
  1574. }
  1575. .r_b_item > img {
  1576. min-width: 24px;
  1577. min-height: 24px;
  1578. width: 24px;
  1579. height: 24px;
  1580. border-radius: 50%;
  1581. margin-right: 10px;
  1582. /* margin-left: 10px; */
  1583. }
  1584. .s_t_addAsk {
  1585. width: 100%;
  1586. height: auto;
  1587. padding: 10px 20px;
  1588. display: flex;
  1589. flex-direction: column;
  1590. justify-content: center;
  1591. align-items: center;
  1592. box-sizing: border-box;
  1593. }
  1594. .s_t_addAsk > span {
  1595. box-sizing: border-box;
  1596. width: auto;
  1597. height: auto;
  1598. padding: 15px;
  1599. margin-bottom: 10px;
  1600. background-color: #f5f6f7;
  1601. border-radius: 10px;
  1602. cursor: pointer;
  1603. border: solid 1px #e8e9ec;
  1604. transition: 0.3s;
  1605. }
  1606. .s_t_addAsk > span:hover {
  1607. background-color: #e8e9ec;
  1608. }
  1609. .d_t_c_a_r_c_img:hover .download_image {
  1610. display: block;
  1611. }
  1612. .download_image {
  1613. position: absolute;
  1614. display: none;
  1615. right: 5px;
  1616. bottom: 5px;
  1617. width: 30px;
  1618. height: 30px;
  1619. cursor: pointer;
  1620. }
  1621. .download_image > img {
  1622. width: 100%;
  1623. height: 100%;
  1624. }
  1625. .s_b_btnAreaTop {
  1626. width: 100%;
  1627. height: 35px;
  1628. margin-bottom: 5px;
  1629. display: flex;
  1630. align-items: center;
  1631. box-sizing: border-box;
  1632. padding: 0 10px;
  1633. overflow: auto;
  1634. display: flex;
  1635. justify-content: space-between;
  1636. }
  1637. .s_b_bat_left {
  1638. width: auto;
  1639. height: 100%;
  1640. display: flex;
  1641. align-items: flex-end;
  1642. }
  1643. .s_b_bat_left > img {
  1644. width: 25px;
  1645. height: 25px;
  1646. cursor: pointer;
  1647. margin-right: 5px;
  1648. }
  1649. .voice_or_keyboard {
  1650. width: 35px;
  1651. height: 35px;
  1652. margin-right: 10px;
  1653. }
  1654. .voice_or_keyboard > img {
  1655. width: 100%;
  1656. height: 100%;
  1657. cursor: pointer;
  1658. }
  1659. </style>