chatArea.vue 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021
  1. <template>
  2. <div class="chatArea" v-loading="loading">
  3. <div class="m-operation">
  4. <div>实时转录</div>
  5. <div>2023-11-11 11:11:24</div>
  6. </div>
  7. <div class="titBar">
  8. <div class="titBarLeft">
  9. <div
  10. @click="cutBar(index)"
  11. :class="pageStatus == index ? 'titBarBorder' : ''"
  12. v-for="(i, index) in titBarList"
  13. :key="index + 'a'"
  14. >
  15. <img :src="pageStatus == index ? i.ico : i.ico1" alt="" />{{
  16. i.title
  17. }}
  18. </div>
  19. </div>
  20. <div class="titBarRig">
  21. <!-- <img src="@/assets/icon/classroomObservation/put.png" alt="" />
  22. <div style="cursor: pointer">收起</div> -->
  23. </div>
  24. </div>
  25. <div class="ca-top">
  26. <!-- 开始页面 -->
  27. <startPage
  28. v-show="showIndexPage"
  29. @startTape="recordedStart"
  30. @uploadTape="uploadRecording"
  31. :uploadFileLoading="uploadFileLoading"
  32. />
  33. <!-- 原文速递 -->
  34. <transcription
  35. v-show="pageStatus == 1 && !showIndexPage"
  36. :showGetTextLoading="showGetTextLoading"
  37. :data="transcriptionData"
  38. >
  39. <!-- <el-button
  40. style="position: absolute; bottom: 10px; right: 20px"
  41. type="primary"
  42. @click.stop="saveEditorBar(true)"
  43. >保存</el-button
  44. > -->
  45. </transcription>
  46. <!-- ai对话 -->
  47. <tape
  48. ref="tapeRef"
  49. :aiNameList="roleList"
  50. :chatData="chatList"
  51. v-show="pageStatus == 0 && !showIndexPage"
  52. :loading="chatLoading"
  53. />
  54. <!-- <div class="t-t-m-Item" v-show="cardStatus==1"> -->
  55. <EditorBar
  56. class="editorBar"
  57. :showGetTextLoading="showGetTextLoading"
  58. v-model="editorBarData.content"
  59. v-if="pageStatus == 2 && !showIndexPage && editorBarData.type == '0'"
  60. v-loading="uploadFileLoading"
  61. >
  62. <el-button
  63. style="position: absolute; bottom: 20px; right: 20px; z-index: 10002"
  64. type="primary"
  65. @click.stop="saveEditorBar(true)"
  66. >保存</el-button
  67. >
  68. </EditorBar>
  69. <iframe
  70. ref="viframe"
  71. v-if="
  72. pageStatus == 2 &&
  73. !showIndexPage &&
  74. editorBarData.type == '1' &&
  75. /\.(xlsx|doc|docx)$/i.test(editorBarData.url)
  76. "
  77. style="width: 100%; height: 100%; border: none"
  78. v-loading="uploadFileLoading"
  79. :src="
  80. 'https://view.officeapps.live.com/op/view.aspx?src=' +
  81. encodeURIComponent(editorBarData.url)
  82. "
  83. ></iframe>
  84. <vpdf
  85. style="width: 100%; height: 100%; border: none"
  86. :pdfUrl="editorBarData.url"
  87. v-if="
  88. pageStatus == 2 &&
  89. !showIndexPage &&
  90. editorBarData.type == '1' &&
  91. /\.(pdf)$/i.test(editorBarData.url)
  92. "
  93. />
  94. <!-- </div> -->
  95. </div>
  96. <div class="ca-bottom">
  97. <div class="ca-b-operation">
  98. <div class="ca-b-o-header">
  99. <div class="ca-b-o-h-left">
  100. <!-- <div class="ca-b-o-h-l-select" @click.stop="changeAnalysis()">
  101. <span class="ca-b-o-h-l-s-icon el-icon-collection"></span>
  102. <div class="ca-b-o-h-s-l-text">课堂观察</div>
  103. <span class="ca-b-o-h-s-l-icon2 el-icon-caret-top"></span>
  104. </div> -->
  105. <!--
  106. <div class="ca-b-o-h-l-select" style="color: #3681fc">
  107. <div
  108. style="cursor: pointer"
  109. class="ca-b-o-h-s-l-text"
  110. @click.stop="languageShow = !languageShow"
  111. >
  112. {{ languageList.find((i) => i.label == languageRadio).lang }}
  113. </div>
  114. <div
  115. class="languageList"
  116. v-click-outside="handleBlur"
  117. v-if="languageShow"
  118. >
  119. <el-radio
  120. v-for="(i, index) in languageList"
  121. :key="index + 'lag'"
  122. :class="i.label == languageRadio ? 'radioBg' : ''"
  123. v-model.number="languageRadio"
  124. :label.Num="i.label"
  125. >{{ i.lang }}</el-radio
  126. >
  127. </div>
  128. </div> -->
  129. <div
  130. class="ca-b-o-h-l-btn"
  131. @click.stop="uploadRecording()"
  132. v-loading="uploadFileLoading"
  133. >
  134. <div class="ca-b-o-h-b-l-text">上传文件</div>
  135. </div>
  136. </div>
  137. <div class="ca-b-o-h-right">
  138. <div class="ca-b-o-h-r-radio">
  139. <div
  140. :class="
  141. (index == 0 &&
  142. (showIndexPage || [0, 1, 2].includes(controlsStatus))) ||
  143. (index == 1 &&
  144. !showIndexPage &&
  145. ![0, 1, 2].includes(controlsStatus))
  146. ? 'TapeCss'
  147. : ''
  148. "
  149. class="tapeSty"
  150. @click="cutTape(index)"
  151. v-for="(i, index) in tapeList"
  152. :key="index + 'b'"
  153. >
  154. <img
  155. :src="
  156. (index == 0 &&
  157. (showIndexPage || [0, 1, 2].includes(controlsStatus))) ||
  158. (index == 1 &&
  159. !showIndexPage &&
  160. ![0, 1, 2].includes(controlsStatus))
  161. ? i.ico
  162. : i.ico1
  163. "
  164. alt=""
  165. />
  166. </div>
  167. <!-- <span @click.stop="changeContinuousDialogue(!continuousDialogue)"
  168. >连续对话</span
  169. >
  170. <el-switch
  171. v-model="continuousDialogue"
  172. active-color="#3681FC"
  173. inactive-color="#b2bfc3"
  174. >
  175. </el-switch> -->
  176. </div>
  177. </div>
  178. </div>
  179. <div class="ca-b-o-main">
  180. <div
  181. class="ca-b-o-m-tape"
  182. v-show="controlsStatus == 0"
  183. @click.stop="recordedStart()"
  184. v-loading="uploadFileLoading"
  185. >
  186. <span class="el-icon-microphone"></span>
  187. <div class="ca-b-o-m-t-text">点击开始录音</div>
  188. </div>
  189. <div
  190. class="ca-b-o-m-tapeTwo"
  191. v-show="controlsStatus == 2"
  192. v-loading="uploadFileLoading"
  193. >
  194. <mini-audio
  195. v-if="audioUrl"
  196. :audio-source="audioUrl"
  197. class="audio_class"
  198. ></mini-audio>
  199. <div
  200. style="
  201. width: 32px;
  202. height: 32px;
  203. margin-left: 20px;
  204. cursor: pointer;
  205. background-color: #3681fc;
  206. border-radius: 50%;
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. "
  211. @click="recordedStart()"
  212. >
  213. <img
  214. style="width: 10px; height: 16px"
  215. src="../../../../assets/icon/classroomObservation/mai1.svg"
  216. alt=""
  217. />
  218. </div>
  219. </div>
  220. <div
  221. class="ca-b-o-m-inputAre"
  222. v-show="controlsStatus == 3"
  223. v-loading="textareaLoading"
  224. >
  225. <div class="ca-b-o-m-left">
  226. <textarea
  227. id="myTextarea"
  228. ref="textareaRef"
  229. min-rows="1"
  230. max-rows="5"
  231. v-model="textareaValue"
  232. placeholder="在此输入您想了解的内容"
  233. autosize="none"
  234. @input="textareaChange"
  235. @change="textareaChange"
  236. @keydown="textareaKeydown"
  237. ></textarea>
  238. </div>
  239. <div class="ca-b-o-m-right">
  240. <!-- <span @click.stop="tapeSubmit()"></span> -->
  241. <!-- <div :class="sendBtnDsiable ? 'ca-b-o-m-r-dsiableBtn' : ''">
  242. 发送
  243. </div> -->
  244. <el-button
  245. :disabled="textareaValue.trim().length == 0"
  246. type="primary"
  247. size="mini"
  248. @click="send()"
  249. >发送</el-button
  250. >
  251. </div>
  252. <div
  253. ref="roleListRef"
  254. v-click-outside="noShowRoleList"
  255. class="ca_b_o_m_roleList"
  256. v-if="showRoleList && choseRoleList.length != 0"
  257. >
  258. <div
  259. :class="[
  260. 'ca_b_o_m_rl_item',
  261. roleListIndex == index ? 'ca_b_o_m_rl_itemActive' : '',
  262. ]"
  263. v-for="(item, index) in choseRoleList"
  264. :key="item.assistant_id"
  265. @click="choseRole(item)"
  266. @mouseover="() => (roleListIndex = index)"
  267. >
  268. <div class="ca_b-o_m_rl_i_top">
  269. <el-avatar
  270. size="medium"
  271. :src="
  272. item.headUrl
  273. ? item.headUrl
  274. : require('@/assets/icon/classroomObservation/aiAvatar.png')
  275. "
  276. ></el-avatar>
  277. <div>
  278. <div>{{ item.assistantName }}</div>
  279. <span v-if="item.username">作者:{{ item.username }}</span>
  280. </div>
  281. </div>
  282. <div class="ca_b-o_m_rl_i_bottom">
  283. <span>{{ item.description }}</span>
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. <div
  289. class="ca-b-o-m-TapeArea"
  290. v-show="controlsStatus == 1"
  291. v-loading="uploadFileLoading"
  292. >
  293. <div class="ca-b-o-m-i-left">
  294. <img
  295. style="height: 120%"
  296. src="@/assets/icon/classroomObservation/isTape.svg"
  297. alt=""
  298. />
  299. <div>
  300. <div v-if="recordedForm.status == 1" style="color: #ee3e3e">
  301. 录音中...
  302. </div>
  303. <div v-if="recordedForm.status == 2" style="color: #6b798e">
  304. 已暂停...
  305. </div>
  306. <span>{{ recordedForm.time }}</span>
  307. </div>
  308. </div>
  309. <!-- <img
  310. style="height: 120%"
  311. src="@/assets/icon/classroomObservation/tapetime.png"
  312. alt=""
  313. /> -->
  314. <div
  315. style="
  316. width: 100px;
  317. display: flex;
  318. justify-content: space-between;
  319. "
  320. >
  321. <div class="lyStart" @click="stopRecorded()">
  322. <img
  323. style="width: 12px; height: 12px"
  324. src="@/assets/icon/classroomObservation/lyStart.svg"
  325. alt=""
  326. v-if="recordedForm.status == 1"
  327. />
  328. <img
  329. style="width: 12px; height: 12px"
  330. src="@/assets/icon/classroomObservation/start.png"
  331. alt=""
  332. v-if="recordedForm.status == 2"
  333. />
  334. </div>
  335. <div class="lyStart" @click="finishRecorded()">
  336. <img
  337. style="width: 12px; height: 12px"
  338. src="@/assets/icon/classroomObservation/lyStop.svg"
  339. alt=""
  340. />
  341. </div>
  342. </div>
  343. <!-- <div class="ca-b-o-m-left">
  344. <textarea :value="textareaValue" autosize="none"></textarea>
  345. </div>
  346. <div class="ca-b-o-m-right">
  347. <span @click.stop="tapeSubmit()"></span>
  348. <div :class="sendBtnDsiable ? 'ca-b-o-m-r-dsiableBtn' : ''">
  349. 发送
  350. </div>
  351. </div> -->
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. <!-- 录音转文字 -->
  357. <iframe
  358. allow="camera *; microphone *;display-capture;midi;encrypted-media;"
  359. src="https://beta.cloud.cocorobo.cn/browser/public/index.html"
  360. ref="iiframe"
  361. v-show="false"
  362. ></iframe>
  363. </div>
  364. </template>
  365. <script>
  366. import startPage from "./startPage.vue";
  367. import transcription from "./transcription.vue";
  368. import tape from "./tape.vue";
  369. import { v4 as uuidv4 } from "uuid";
  370. import Recorder from "js-audio-recorder";
  371. import MarkdownIt from "markdown-it";
  372. import EditorBar from "./wangEnduit.vue";
  373. const lamejs = require("lamejs");
  374. import vpdf from "./vpdf";
  375. const recorder = new Recorder({
  376. sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
  377. sampleRate: 48000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
  378. numChannels: 1, // 声道,支持 1 或 2, 默认是1
  379. // compiling: false,(0.x版本中生效,1.x增加中) // 是否边录边转换,默认是false
  380. });
  381. // 绑定事件-打印的是当前录音数据
  382. // recorder.onprogress = function (params) {
  383. // console.log('--------------START---------------')
  384. // console.log('录音时长(秒)', params.duration);
  385. // console.log('录音大小(字节)', params.fileSize);
  386. // console.log('录音音量百分比(%)', params.vol);
  387. // console.log('当前录音的总数据([DataView, DataView...])', params.data);
  388. // console.log('--------------END---------------')
  389. // };
  390. // 自定义指令,用于处理点击外部区域的事件
  391. const clickOutside = {
  392. bind(el, binding) {
  393. // 在元素上绑定一个点击事件监听器
  394. el.clickOutsideEvent = function (event) {
  395. // 检查点击事件是否发生在元素的内部
  396. if (!(el === event.target || el.contains(event.target))) {
  397. // 如果点击事件发生在元素的外部,则触发指令绑定的方法,将点击的event数据传过去
  398. binding.value(event);
  399. }
  400. };
  401. // 在文档上添加点击事件监听器
  402. document.addEventListener("click", el.clickOutsideEvent);
  403. },
  404. unbind(el) {
  405. // 在元素上解除点击事件监听器
  406. document.removeEventListener("click", el.clickOutsideEvent);
  407. },
  408. };
  409. const getFile = (url) => {
  410. return new Promise((resolve, reject) => {
  411. var credentials = {
  412. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  413. secretAccessKey: "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",
  414. }; //秘钥形式的登录上传
  415. window.AWS.config.update(credentials);
  416. window.AWS.config.region = "cn-northwest-1"; //设置区域
  417. let url2 = url;
  418. let _url2 = "";
  419. if (
  420. url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
  421. ) {
  422. _url2 = url2.split(
  423. "https://view.officeapps.live.com/op/view.aspx?src="
  424. )[1];
  425. } else {
  426. _url2 = url2;
  427. }
  428. var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
  429. let name = decodeURIComponent(
  430. _url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
  431. );
  432. var params = {
  433. Bucket: "ccrb",
  434. Key: name,
  435. };
  436. s3.getObject(params, function (err, data) {
  437. if (err) {
  438. console.log(err, err.stack);
  439. resolve({ data: 1 });
  440. } else {
  441. const fileContent = data.Body.toString("utf-8");
  442. resolve({ data: fileContent });
  443. } // sxuccessful response
  444. });
  445. // axios({
  446. });
  447. };
  448. export default {
  449. emits: ["updateFileId", "changeAudioUrl", "updateTranscription"],
  450. props: {
  451. tid: {
  452. type: String,
  453. require: true,
  454. },
  455. fileId: {
  456. type: String,
  457. default: "",
  458. },
  459. fileIdId: {
  460. type: String,
  461. default: "",
  462. },
  463. },
  464. components: {
  465. startPage,
  466. transcription,
  467. tape,
  468. EditorBar,
  469. vpdf,
  470. },
  471. directives: {
  472. "click-outside": clickOutside, // 注册自定义指令
  473. },
  474. data() {
  475. return {
  476. // continuousDialogue: true,
  477. controlsStatus: 0, //0--点击开始录音 1--录音中 2--录音完毕预览 3--文字输入
  478. pageStatus: 0, //0--ai对话 1--原文文稿 2--转录文稿
  479. showIndexPage: true, //是否显示初始页面
  480. languageRadio: 1, //设置选择语言
  481. languageShow: false, //控制显示
  482. loading: false,
  483. chatLoading: false,
  484. transcriptionLoading: false,
  485. uploadFileLoading: false,
  486. editorBarLoading: false,
  487. textareaValue: "",
  488. textareaLoading: false,
  489. showRoleList: false,
  490. showGetTextLoading: false,
  491. roleListIndex: 0,
  492. recordedForm: {
  493. time: "00:00:00", //时间
  494. status: 0, //0--未录音 1--正在录音 2--暂停 3--录音结束
  495. },
  496. roleList: [],
  497. publicRoleList: [],
  498. audioUrl: "",
  499. editorBarData: {
  500. type: "0", //0---文字 1-文件
  501. content: "",
  502. url: "",
  503. },
  504. fileUrl:
  505. "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E8%BD%AC%E5%BD%95%E6%96%87%E7%A8%BF1713172600896.xlsx",
  506. // 设置list
  507. languageList: [
  508. { label: 1, lang: "普通话" },
  509. { label: 2, lang: "广东话" },
  510. { label: 3, lang: "英语" },
  511. ],
  512. // 语音文字list
  513. tapeList: [
  514. {
  515. ico: require("@/assets/icon/classroomObservation/mai1.svg"),
  516. ico1: require("@/assets/icon/classroomObservation/mai2.svg"),
  517. },
  518. {
  519. ico: require("@/assets/icon/classroomObservation/wen1.svg"),
  520. ico1: require("@/assets/icon/classroomObservation/wen2.svg"),
  521. },
  522. ],
  523. titBarList: [
  524. {
  525. title: "Al对话",
  526. ico: require("@/assets/icon/classroomObservation/Group9101.svg"),
  527. ico1: require("@/assets/icon/classroomObservation/Group9102.svg"),
  528. },
  529. {
  530. title: "原文速览",
  531. ico1: require("@/assets/icon/classroomObservation/Vector.svg"),
  532. ico: require("@/assets/icon/classroomObservation/Vector2.svg"),
  533. },
  534. {
  535. title: "转录文稿",
  536. ico1: require("@/assets/icon/classroomObservation/zhuanlu.svg"),
  537. ico: require("@/assets/icon/classroomObservation/zhuanlu2.svg"),
  538. },
  539. ],
  540. transcriptionData: {
  541. content: "",
  542. },
  543. chatList: [],
  544. };
  545. },
  546. computed: {
  547. // 选择可以@的角色
  548. choseRoleList() {
  549. let result = [...this.roleList, ...this.publicRoleList];
  550. const _index = this.textareaValue.lastIndexOf("@");
  551. if (_index !== -1) {
  552. let roleName = this.textareaValue.substring(_index + 1);
  553. result = result.filter((i) => i.assistantName.indexOf(roleName) != -1);
  554. } else {
  555. return [];
  556. }
  557. return result;
  558. },
  559. },
  560. watch: {
  561. choseRoleList() {
  562. this.roleListIndex = 0;
  563. },
  564. },
  565. methods: {
  566. handleBlur(event) {
  567. // console.log("点击其它区域啦", event);
  568. this.languageShow = !this.languageShow;
  569. },
  570. // 上传录音
  571. uploadRecording() {
  572. if (this.uploadFileLoading) return this.$message.info("请稍等...");
  573. let input = document.createElement("input");
  574. input.type = "file";
  575. // input.accept = ".wav";
  576. // input.accept = "audio/*, .txt, .pdf, .xlsx";
  577. input.accept = ".wav,.txt,.pdf,.xlsx,.doc,.docx";
  578. input.click();
  579. input.onchange = () => {
  580. this.uploadFileLoading = true;
  581. let file = input.files[0];
  582. if (!/\.(wav|txt|pdf|xlsx|doc|docx)$/i.test(file.name)) {
  583. this.uploadFileLoading = false;
  584. return this.$message.info(
  585. "请上传.wav,.txt,.pdf,.xlsx,.doc,.docx格式的文件"
  586. );
  587. }
  588. this.uploadFile(file);
  589. // this.uploadWavFileAndGetText(file);
  590. };
  591. },
  592. cutBar(val) {
  593. this.pageStatus = val;
  594. if (this.pageStatus == 0) {
  595. //ai对话
  596. this.controlsStatus = 3;
  597. } else if (this.pageStatus == 1 || this.pageStatus == 2) {
  598. // 原文速览&&转录文稿
  599. if ([1, 2].includes(this.recordedForm.status)) {
  600. this.controlsStatus = 1;
  601. } else {
  602. this.controlsStatus = 2;
  603. }
  604. }
  605. this.showIndexPage = false;
  606. },
  607. cutTape(val) {
  608. if (val == 0) {
  609. if ([1, 2].includes(this.recordedForm.status)) {
  610. this.controlsStatus = 1;
  611. this.showIndexPage = true;
  612. } else if (this.audioUrl) {
  613. this.controlsStatus = 2;
  614. this.pageStatus = 1;
  615. } else {
  616. this.controlsStatus = 0;
  617. this.showIndexPage = true;
  618. }
  619. } else if (val == 1) {
  620. // if (this.pageStatus == 0) {
  621. //ai对话
  622. this.pageStatus = 0;
  623. this.controlsStatus = 3;
  624. // } else if (this.pageStatus == 1 || this.pageStatus == 2) {
  625. // // 原文速览&&转录文稿
  626. // this.controlsStatus = 2;
  627. // }
  628. this.showIndexPage = false;
  629. } else if (val == 2) {
  630. this.controlsStatus = 0;
  631. this.showIndexPage = true;
  632. }
  633. },
  634. recordedStart() {
  635. if (this.uploadFileLoading) return this.$message.info("请稍等...");
  636. // 开始录音
  637. if (this.audioUrl) {
  638. this.$confirm("再次录音会顶替掉原先的录音,您确定吗", "提醒", {
  639. confirmButtonText: "确定",
  640. cancelButtonText: "取消",
  641. type: "warning",
  642. })
  643. .then(() => {
  644. this.recordedForm.status = 0;
  645. this.audioUrl = "";
  646. recorder.initRecorder(); //初始化录音
  647. recorder.destroy(); // 销毁录音
  648. this.recordedStart();
  649. })
  650. .catch((_) => {
  651. console.log("不顶替");
  652. });
  653. } else if (this.controlsStatus != 1 && this.recordedForm.status == 0) {
  654. recorder.initRecorder(); //初始化录音
  655. recorder.destroy(); // 销毁录音
  656. // 开始录音
  657. recorder.start().then(
  658. () => {
  659. this.controlsStatus = 1;
  660. this.recordedForm.status = 1;
  661. recorder.onprogress = this.updateRecordedTime;
  662. this.$message.success("录音已开始");
  663. },
  664. (error) => {
  665. this.controlsStatus = 0;
  666. this.recordedForm.status = 0;
  667. // _this.$message.error(`${error.name} : ${error.message}`);
  668. this.$message.error(
  669. `没有找到可使用的麦克风,或者您没有允许此网页使用麦克风`
  670. );
  671. // 出错了
  672. console.log(`${error.name} : ${error.message}`);
  673. // if (_this.calcTimer) {
  674. // clearInterval(_this.calcTimer)
  675. // _this.calcTimer = null;
  676. // }
  677. }
  678. );
  679. } else if ([1, 2].includes(this.recordedForm.status)) {
  680. this.controlsStatus = 1;
  681. this.$message.info("还在录音中");
  682. }
  683. // this.controlsStatus = 1;
  684. },
  685. updateRecordedTime({ duration }) {
  686. // 更新currentTime,将秒数转换为时分秒格式
  687. let hours = Math.floor(duration / 3600);
  688. let minutes = Math.floor((duration % 3600) / 60);
  689. let seconds = Math.floor(duration % 60);
  690. this.recordedForm.time = `${hours.toString().padStart(2, "0")}:${minutes
  691. .toString()
  692. .padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
  693. },
  694. //切换观察
  695. // changeAnalysis() {
  696. // this.$message.info("切换观察");
  697. // },
  698. // 切换连续对话
  699. changeContinuousDialogue(newValue) {
  700. this.continuousDialogue = newValue;
  701. },
  702. // 点击发送旁的录音
  703. // tapeSubmit() {
  704. // this.$message.info("发送旁的录音");
  705. // this.mainBtnStatus = 0;
  706. // this.pageStatus = 1;
  707. // this.TapeNum = 0;
  708. // },
  709. async finishRecorded() {
  710. this.uploadFileLoading = true;
  711. recorder.stop();
  712. this.$message.success("已结束录音");
  713. this.showIndexPage = false;
  714. this.pageStatus = 1;
  715. this.controlsStatus = 2;
  716. this.recordedForm.status = 3;
  717. // let file = this.convertToMp3(recorder.getWAV());
  718. const mp3Blob = recorder.getWAVBlob();
  719. let audioFile = this.dataURLtoAudio(mp3Blob, "wav");
  720. this.uploadFile(audioFile);
  721. // this.uploadWavFileAndGetText(audioFile);
  722. },
  723. stopRecorded() {
  724. if (!recorder.ispause) {
  725. recorder.pause();
  726. this.recordedForm.status = 2;
  727. this.$message.warning("已暂停录音");
  728. } else {
  729. recorder.resume();
  730. this.recordedForm.status = 1;
  731. this.$message.success("已继续录音");
  732. }
  733. },
  734. changeAudioUrl(newValue) {
  735. if (!newValue) return;
  736. this.audioUrl = newValue;
  737. if (![1, 2].includes(this.pageStatus)) this.pageStatus = 1;
  738. this.controlsStatus = 2;
  739. this.showIndexPage = false;
  740. },
  741. // 发送消息
  742. send(_text = this.textareaValue) {
  743. this.textareaValue = "";
  744. // 判断输入的文本是否为空
  745. if (!_text.trim()) return;
  746. // 这里处理@的角色
  747. let _atRoleList = [];
  748. let _roleList = [...this.roleList, ...this.publicRoleList];
  749. _roleList.forEach((i) => {
  750. if (_text.indexOf(`@${i.assistantName}`) != -1) {
  751. _atRoleList.push(i);
  752. }
  753. });
  754. if (_atRoleList.length > 0) {
  755. //有@角色
  756. let _replaceText = _text;
  757. let _htmlText = _text;
  758. _atRoleList.forEach((_i) => {
  759. _replaceText = _replaceText.replaceAll(`@${_i.assistantName}`, ``);
  760. _htmlText = _htmlText.replaceAll(
  761. `@${_i.assistantName}`,
  762. `<span class='aite-name'>@${_i.assistantName}</span>`
  763. );
  764. });
  765. _atRoleList.forEach((_item, _index) => {
  766. const _uid = uuidv4();
  767. if (_index == 0) {
  768. this.chatList.push({
  769. loading: true,
  770. role: "user",
  771. content: _htmlText,
  772. uid: _uid,
  773. AI: "AI",
  774. aiContent: "",
  775. oldContent: "",
  776. isShowSynchronization: false,
  777. filename: _item.headUrl,
  778. index: this.chatList.length,
  779. is_mind_map: false,
  780. fileid: _item.assistantName,
  781. createtime: new Date().toLocaleString().replaceAll("/", "-"),
  782. });
  783. } else {
  784. this.chatList.push({
  785. loading: true,
  786. role: "user",
  787. content: "",
  788. uid: _uid,
  789. AI: "AI",
  790. aiContent: "",
  791. oldContent: "",
  792. isShowSynchronization: false,
  793. filename: _item.headUrl,
  794. index: this.chatList.length,
  795. is_mind_map: false,
  796. fileid: _item.assistantName,
  797. createtime: new Date().toLocaleString().replaceAll("/", "-"),
  798. });
  799. }
  800. this.scrollBottom();
  801. let params = {
  802. assistant_id: _item.assistant_id,
  803. userId: "602def61-005d-11ee-91d8-005056b86db5",
  804. message: _replaceText,
  805. session_name: `${this.tid}-classroomObservation`,
  806. uid: _uid,
  807. file_ids: this.fileId ? [this.fileId] : [],
  808. };
  809. this.ajax
  810. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
  811. .then((res) => {
  812. if (res.data.FunctionResponse.result == "发送成功") {
  813. } else {
  814. this.$message.warning(res.data.FunctionResponse.result);
  815. }
  816. })
  817. .catch((err) => {
  818. console.log(err);
  819. });
  820. this.getAtAuContent(
  821. _uid,
  822. _htmlText,
  823. _item.headUrl,
  824. _item.assistantName
  825. );
  826. });
  827. } else {
  828. //未@角色
  829. let _uuid = uuidv4();
  830. this.chatList.push({
  831. role: "user",
  832. content: `${_text}`,
  833. uid: _uuid,
  834. AI: "AI",
  835. aiContent: "",
  836. oldContent: "",
  837. isShowSynchronization: false,
  838. filename: "",
  839. index: this.chatList.length,
  840. is_mind_map: false,
  841. createtime: new Date().toLocaleString().replaceAll("/", "-"),
  842. loading: true,
  843. });
  844. this.scrollBottom();
  845. // 连续对话设置
  846. let _historyMessage = [];
  847. // this.chatList.forEach(i=>{
  848. // })
  849. _historyMessage.push({ role: "user", content: _text });
  850. let params = JSON.stringify({
  851. model: "gpt-3.5-turbo",
  852. temperature: 0,
  853. max_tokens: 4096,
  854. top_p: 1,
  855. frequency_penalty: 0,
  856. presence_penalty: 0,
  857. messages: _historyMessage,
  858. uid: _uuid,
  859. mind_map_question: "",
  860. });
  861. this.ajax
  862. .post("https://gpt4.cocorobo.cn/chat", params)
  863. .then((res) => {
  864. if (res.data.FunctionResponse.result == "发送成功") {
  865. } else {
  866. this.$message.warning(res.data.FunctionResponse.result);
  867. }
  868. })
  869. .catch((e) => {
  870. console.log(e);
  871. });
  872. this.getAiContent(_uuid);
  873. }
  874. },
  875. getAiContent(_uid) {
  876. let _source = new EventSource(`https://gpt4.cocorobo.cn/stream/${_uid}`); //http://gpt4.cocorobo.cn:8011/stream/ https://gpt4.cocorobo.cn/stream/
  877. let _allText = "";
  878. let _mdText = "";
  879. const md = new MarkdownIt();
  880. _source.onmessage = (_e) => {
  881. if (_e.data.replace("'", "").replace("'", "") == "[DONE]") {
  882. //对话已经完成
  883. _mdText = _mdText.replace("_", "");
  884. _source.close();
  885. this.chatList.find((i) => i.uid == _uid).aiContent = _mdText;
  886. this.chatList.find((i) => i.uid == _uid).isalltext = true;
  887. this.chatList.find((i) => i.uid == _uid).isShowSynchronization = true;
  888. this.chatList.find((i) => i.uid == _uid).loading = false;
  889. this.insertChat(_uid);
  890. return;
  891. } else {
  892. //对话还在继续
  893. let _text = "";
  894. _text = _e.data.replaceAll("'", "");
  895. if (_allText == "") {
  896. _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
  897. } else {
  898. _allText += _text;
  899. }
  900. _mdText = _allText + "_";
  901. _mdText = _mdText.replace(/\\n/g, "\n");
  902. _mdText = _mdText.replace(/\\/g, "");
  903. if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
  904. //转化返回的回复流数据
  905. _mdText = md.render(_mdText);
  906. this.chatList.find((i) => i.uid == _uid).aiContent = _mdText;
  907. this.chatList.find((i) => i.uid == _uid).loading = false;
  908. this.scrollBottom();
  909. // 处理流数据
  910. }
  911. };
  912. },
  913. getAtAuContent(_uid, _text, _headUrl, _assistantName) {
  914. let _source = new EventSource(
  915. `https://gpt4.cocorobo.cn/question/${_uid}`
  916. ); //http://gpt4.cocorobo.cn:8011/question/ https://gpt4.cocorobo.cn/question/
  917. let _allText = "";
  918. let _mdText = "";
  919. const md = new MarkdownIt();
  920. _source.onmessage = (_e) => {
  921. let _eData = JSON.parse(_e.data);
  922. if (_eData.content.replace("'", "").replace("'", "") == "[DONE]") {
  923. let _result = [];
  924. if ("result" in _eData) {
  925. _result = _eData.result;
  926. for (let i = 0; i < _result.length; i++) {
  927. _mdText = _mdText.replace(_result[i].text, _result[i].fileName);
  928. }
  929. }
  930. _mdText = _mdText.replace("_", "");
  931. this.chatList.find((i) => i.uid == _uid).aiContent = _mdText;
  932. this.chatList.find((i) => i.uid == _uid).isalltext = true;
  933. this.chatList.find((i) => i.uid == _uid).isShowSynchronization = true;
  934. this.chatList.find((i) => i.uid == _uid).loading = false;
  935. this.scrollBottom();
  936. this.insertChat(_uid);
  937. } else {
  938. let _text = _eData.content.replace("'", "").replace("'", "");
  939. if (_allText == "") {
  940. _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
  941. } else {
  942. _allText += _text;
  943. }
  944. _mdText = _allText + "_";
  945. _mdText = _mdText.replace(/\\n/g, "\n");
  946. _mdText = _mdText.replace(/\\/g, "");
  947. if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
  948. //转化返回的回复流数据
  949. _mdText = md.render(_mdText);
  950. this.chatList.find((i) => i.uid == _uid).aiContent = _mdText;
  951. this.chatList.find((i) => i.uid == _uid).loading = false;
  952. this.scrollBottom();
  953. // 处理流数据
  954. }
  955. };
  956. },
  957. textareaChange() {
  958. if (this.textareaValue.at(-1) == "@") {
  959. this.showRoleList = true;
  960. }
  961. this.$refs.textareaRef.style.height = "50px";
  962. this.$refs.textareaRef.style.height =
  963. this.$refs.textareaRef.scrollHeight + "px";
  964. if (this.$refs.roleListRef) {
  965. let roleListHeight =
  966. this.$refs.textareaRef.scrollHeight >= 500
  967. ? 520
  968. : this.$refs.textareaRef.scrollHeight + 20;
  969. this.$refs.roleListRef.style["margin-bottom"] = "70px";
  970. this.$refs.roleListRef.style["margin-bottom"] = roleListHeight + "px";
  971. this.$refs.roleListRef.style["max-height"] = `calc(100vh - ${
  972. roleListHeight + 160
  973. }px)`;
  974. }
  975. },
  976. // 滚动条触底
  977. scrollBottom() {
  978. this.$nextTick(() => {
  979. this.textareaChange();
  980. this.$refs.tapeRef.$el.querySelector(".t-chartArea").scrollTop =
  981. this.$refs.tapeRef.$el.querySelector(".t-chartArea").scrollHeight;
  982. });
  983. },
  984. // 点击了其他地方然后关闭角色列表
  985. noShowRoleList() {
  986. this.showRoleList = false;
  987. },
  988. convertToMp3(wavDataView) {
  989. // 获取wav头信息
  990. const wav = lamejs.WavHeader.readHeader(wavDataView); // 此处其实可以不用去读wav头信息,毕竟有对应的config配置
  991. const { channels, sampleRate } = wav;
  992. const mp3enc = new lamejs.Mp3Encoder(channels, sampleRate, 128);
  993. // 获取左右通道数据
  994. const result = recorder.getChannelData();
  995. const buffer = [];
  996. const leftData =
  997. result.left &&
  998. new Int16Array(result.left.buffer, 0, result.left.byteLength / 2);
  999. const rightData =
  1000. result.right &&
  1001. new Int16Array(result.right.buffer, 0, result.right.byteLength / 2);
  1002. const remaining = leftData.length + (rightData ? rightData.length : 0);
  1003. const maxSamples = 1152;
  1004. for (let i = 0; i < remaining; i += maxSamples) {
  1005. const left = leftData.subarray(i, i + maxSamples);
  1006. let right = null;
  1007. let mp3buf = null;
  1008. if (channels === 2) {
  1009. right = rightData.subarray(i, i + maxSamples);
  1010. mp3buf = mp3enc.encodeBuffer(left, right);
  1011. } else {
  1012. mp3buf = mp3enc.encodeBuffer(left);
  1013. }
  1014. if (mp3buf.length > 0) {
  1015. buffer.push(mp3buf);
  1016. }
  1017. }
  1018. const enc = mp3enc.flush();
  1019. if (enc.length > 0) {
  1020. buffer.push(enc);
  1021. }
  1022. return new Blob(buffer, { type: "audio/mp3" });
  1023. },
  1024. wavFileGetText(audioFile) {
  1025. let flag = true;
  1026. let textList = [];
  1027. // if (flag) {
  1028. // // 这里上传文件
  1029. // // _this.uploadWavFile(audioFile);
  1030. // this.controlsStatus = 2;
  1031. // this.showIndexPage = false;
  1032. // this.pageStatus = 1;
  1033. // this.editorBarData.type = "0";
  1034. // flag = false;
  1035. // this.uploadFileLoading = false;
  1036. // }
  1037. // let num = 0;
  1038. // let timer = null;
  1039. // this.showGetTextLoading = true;
  1040. // timer = setInterval(()=>{
  1041. // console.log(`这是第:${num}个`)
  1042. // let privText = `这是第- ${num} -个`
  1043. // textList.push({
  1044. // value:privText,
  1045. // startTime:"",
  1046. // endTime:"",
  1047. // time:"",
  1048. // })
  1049. // this.transcriptionData.content += privText;
  1050. // num++;
  1051. // let _result =`
  1052. // <table
  1053. // border="0"
  1054. // width="100%"
  1055. // cellpadding="0"
  1056. // cellspacing="0"
  1057. // style="text-align: center"
  1058. // >
  1059. // <tbody>
  1060. // <tr>
  1061. // <th>序号</th>
  1062. // <th>发言内容</th>
  1063. // </tr>
  1064. // `
  1065. // textList.forEach((item,index)=>{
  1066. // _result += `<tr>
  1067. // <td>${index+1}</td>
  1068. // <td>${item.value}</td>
  1069. // </tr>`
  1070. // })
  1071. // _result+=`
  1072. // <tr>
  1073. // <td></td>
  1074. // <td></td>
  1075. // </tr>
  1076. // </tbody>
  1077. // </table>`
  1078. // this.editorBarData.content = _result;
  1079. // if(num>=30)return clearInterval(timer);
  1080. // },2000)
  1081. // setTimeout(()=>{
  1082. // this.showGetTextLoading = false;
  1083. // },66000)
  1084. // return;
  1085. let iiframe = this.$refs["iiframe"];
  1086. let _this = this;
  1087. iiframe.contentWindow.window.document.getElementById(
  1088. "languageOptions"
  1089. ).selectedIndex = 2;
  1090. _this.transcriptionData.content = "";
  1091. iiframe.contentWindow.onRecognizedResult = function (e) {
  1092. if (flag) {
  1093. // 这里上传文件
  1094. // _this.uploadWavFile(audioFile);
  1095. _this.controlsStatus = 2;
  1096. _this.showIndexPage = false;
  1097. _this.pageStatus = 1;
  1098. _this.editorBarData.type = "0";
  1099. flag = false;
  1100. _this.uploadFileLoading = false;
  1101. _this.transcriptionData.content = "";
  1102. _this.editorBarData.content = "";
  1103. textList = [];
  1104. }
  1105. _this.showGetTextLoading = true;
  1106. let privText = e.privText;
  1107. console.log("👇转译对象👇");
  1108. console.log(e);
  1109. console.log("👇转译结果👇");
  1110. console.log(privText);
  1111. textList.push({
  1112. value: privText,
  1113. startTime: "",
  1114. endTime: "",
  1115. time: "",
  1116. });
  1117. _this.transcriptionData.content += privText;
  1118. let _result = `
  1119. <table
  1120. border="0"
  1121. width="100%"
  1122. cellpadding="0"
  1123. cellspacing="0"
  1124. style="text-align: center"
  1125. >
  1126. <tbody>
  1127. <tr>
  1128. <th>序号</th>
  1129. <th>发言内容</th>
  1130. </tr>
  1131. `;
  1132. textList.forEach((item, index) => {
  1133. _result += `<tr>
  1134. <td>${index + 1}</td>
  1135. <td>${item.value}</td>
  1136. </tr>`;
  1137. });
  1138. _result += `
  1139. <tr>
  1140. <td></td>
  1141. <td></td>
  1142. </tr>
  1143. </tbody>
  1144. </table>`;
  1145. _this.editorBarData.content = _result;
  1146. // _this.editorBarData.content += privText;
  1147. };
  1148. iiframe.contentWindow.onSessionStopped = function (e) {
  1149. console.log("转译完成");
  1150. console.log(e);
  1151. _this.$message.success("转译完成");
  1152. _this.showGetTextLoading = false;
  1153. _this.saveEditorBar();
  1154. };
  1155. iiframe.contentWindow.doContinuousPronunciationAssessment("", {
  1156. files: [audioFile],
  1157. });
  1158. },
  1159. uploadFile(file) {
  1160. var credentials = {
  1161. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  1162. secretAccessKey: "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",
  1163. }; //秘钥形式的登录上传
  1164. window.AWS.config.update(credentials);
  1165. window.AWS.config.region = "cn-northwest-1"; //设置区域
  1166. var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
  1167. var _this = this;
  1168. if (file) {
  1169. this.loading = true;
  1170. var params = {
  1171. Key:
  1172. file.name.split(".")[0] +
  1173. new Date().getTime() +
  1174. "." +
  1175. file.name.split(".")[file.name.split(".").length - 1],
  1176. ContentType: file.type,
  1177. Body: file,
  1178. "Access-Control-Allow-Credentials": "*",
  1179. ACL: "public-read",
  1180. }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  1181. var options = {
  1182. partSize: 2048 * 1024 * 1024,
  1183. queueSize: 2,
  1184. leavePartsOnError: true,
  1185. };
  1186. bucket
  1187. .upload(params, options)
  1188. .on("httpUploadProgress", function (evt) {
  1189. //这里可以写进度条
  1190. // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
  1191. })
  1192. .send(function (err, data) {
  1193. if (err) {
  1194. _this.$message.error("上传失败");
  1195. _this.uploadFileLoading = false;
  1196. _this.loading = false;
  1197. } else {
  1198. // 判断是不是音频文件
  1199. const audioRegex = /\.(mp3|wav|ogg|flac|m4a)$/i;
  1200. const txtRegex = /\.(txt)$/i;
  1201. const otherRegex = /\.(pdf|xlsx|doc|docx)$/i;
  1202. // if (audioRegex.test(data.Location)) {
  1203. // // console.log(data);
  1204. // _this.uploadWavFileAndGetText(file)
  1205. // _this.$emit("changeAudioUrl", data);
  1206. // // console.log("修改音频文件");
  1207. // // console.log(data)
  1208. // _this.uploadFileLoading = false;
  1209. // }else if(txtRegex.test(data.Location)){
  1210. // console.log("这hi是一个txt文件")
  1211. // } else if(otherRegex.test(data.Location)){
  1212. //
  1213. if (audioRegex.test(data.Location)) {
  1214. _this.wavFileGetText(file);
  1215. _this.$emit("changeAudioUrl", data);
  1216. _this.loading = false;
  1217. return;
  1218. }
  1219. _this.ajax
  1220. .put("https://gpt4.cocorobo.cn/upload_file_knowledge", {
  1221. url: data.Location,
  1222. })
  1223. .then((res) => {
  1224. let _data = res.data.FunctionResponse;
  1225. if (_data.result && _data.result.id) {
  1226. _this.$emit("updateFileId", _data.result.id);
  1227. // _this.$message.success("成功获取fileId");
  1228. _this.uploadFileLoading = false;
  1229. //处理文件
  1230. if (txtRegex.test(data.Location)) {
  1231. //txt
  1232. getFile(data.Location).then((_res) => {
  1233. _this.controlsStatus = 2;
  1234. _this.showIndexPage = false;
  1235. _this.pageStatus = 2;
  1236. // _this.transcriptionData.content += _res.data;
  1237. _this.editorBarData.type = "0";
  1238. _this.editorBarData.content = _res.data;
  1239. // _this.transcriptionData.content = _res.data;
  1240. _this.editorBarData.url = "";
  1241. _this.saveEditorBar();
  1242. });
  1243. } else if (otherRegex.test(data.Location)) {
  1244. //pdf、 docx、doc、xlxs
  1245. _this.editorBarData.type = "1";
  1246. _this.editorBarData.url = data.Location;
  1247. _this.editorBarData.content = "";
  1248. _this.saveEditorBar();
  1249. // console.log("pdf、xlsx、doc、docx文件处理");
  1250. }
  1251. _this.loading = false;
  1252. if (!_this.fileIdId) return;
  1253. let pram2 = {
  1254. id: _this.fileIdId,
  1255. json_data: JSON.stringify({
  1256. file_ids: _data.result.id,
  1257. }),
  1258. // json_data: JSON.stringify({file_ids:'file-r5phg4I2oFqly4WpW7oOOTnA'}),
  1259. };
  1260. _this.ajax
  1261. .post(
  1262. "https://gpt4.cocorobo.cn/update_classroom_observation",
  1263. pram2
  1264. )
  1265. .then((res) => {});
  1266. } else {
  1267. _this.$message.error("修改fileId失败");
  1268. }
  1269. // this.$emit("updateFileId", data.Location)
  1270. })
  1271. .catch((e) => {
  1272. _this.uploadFileLoading = false;
  1273. console.log(e);
  1274. _this.$message.error("获取fileId失败");
  1275. });
  1276. // }
  1277. // console.log(data.Location)
  1278. }
  1279. });
  1280. }
  1281. },
  1282. // 录音转wav
  1283. dataURLtoAudio(blob, filename) {
  1284. return new File([blob], filename, { type: "audio/wav" });
  1285. },
  1286. getRoleList() {
  1287. this.roleList = [];
  1288. let params = {
  1289. userId: "602def61-005d-11ee-91d8-005056b86db5",
  1290. };
  1291. this.ajax
  1292. .post("https://gpt4.cocorobo.cn/get_ai_agent_assistant_list", params)
  1293. .then((res) => {
  1294. let _data = res.data.FunctionResponse.result;
  1295. if (_data) {
  1296. this.roleList = JSON.parse(_data);
  1297. }
  1298. })
  1299. .catch((e) => {
  1300. this.$message.error("获取角色列表失败");
  1301. this.roleList = [];
  1302. });
  1303. },
  1304. getPublicRoleList() {
  1305. this.publicRoleList = [];
  1306. let params = {
  1307. userId: "602def61-005d-11ee-91d8-005056b86db5",
  1308. organizeid: "45facc0a-1211-11ec-80ad-005056b86db5",
  1309. };
  1310. this.ajax
  1311. .post(
  1312. "https://gpt4.cocorobo.cn/get_ai_agent_assistant_share_list",
  1313. params
  1314. )
  1315. .then((res) => {
  1316. let _data = res.data.FunctionResponse.result;
  1317. if (_data) {
  1318. this.publicRoleList = JSON.parse(_data);
  1319. }
  1320. })
  1321. .catch((e) => {
  1322. this.publicRoleList = [];
  1323. console.log("获取公共角色失败", e);
  1324. });
  1325. },
  1326. // 选择了@的角色
  1327. choseRole(_data) {
  1328. let _lastAtIndex = this.textareaValue.lastIndexOf("@");
  1329. this.textareaValue = `${this.textareaValue.slice(0, _lastAtIndex)}@${
  1330. _data.assistantName
  1331. } `;
  1332. this.$refs.textareaRef.focus();
  1333. this.showRoleList = false;
  1334. },
  1335. // 输入框键盘按下监听
  1336. textareaKeydown(_e) {
  1337. if (this.showRoleList && this.choseRoleList.length > 0) {
  1338. switch (_e.keyCode) {
  1339. case 38: //小键盘上
  1340. _e.preventDefault();
  1341. if (this.roleListIndex == 0) return;
  1342. this.roleListIndex--;
  1343. // 修改滚动条高度
  1344. this.$refs.roleListRef.scrollTop = this.roleListIndex * 105;
  1345. break;
  1346. case 40: //小键盘下
  1347. _e.preventDefault();
  1348. if (this.roleListIndex == this.choseRoleList.length - 1) return;
  1349. this.roleListIndex++;
  1350. this.$refs.roleListRef.scrollTop = this.roleListIndex * 105;
  1351. break;
  1352. case 13: //回车
  1353. _e.preventDefault();
  1354. this.choseRole(this.choseRoleList[this.roleListIndex]);
  1355. break;
  1356. }
  1357. } else {
  1358. if (_e.key === "Enter") {
  1359. if (_e.altKey) {
  1360. // 如果按下的是Alt+Enter,那么换行
  1361. this.textareaValue += "\n";
  1362. } else {
  1363. this.send();
  1364. }
  1365. }
  1366. }
  1367. },
  1368. getData() {
  1369. this.loading = true;
  1370. this.getRoleList();
  1371. this.getPublicRoleList();
  1372. this.getChatList().then((_) => {
  1373. this.loading = false;
  1374. this.scrollBottom();
  1375. });
  1376. },
  1377. // 保存转录文稿和原文速览
  1378. saveEditorBar(flag = false) {
  1379. if (
  1380. this.editorBarData.type == "0" &&
  1381. flag &&
  1382. this.editorBarData.content
  1383. ) {
  1384. // 如果是文本则转成txt并保存
  1385. var text = this.editorBarData.content;
  1386. // 创建一个Blob实例
  1387. var blob = new Blob([text], { type: "text/plain;charset=utf-8" });
  1388. blob.lastModifiedDate = new Date();
  1389. blob.name = `${this.tid}-classroomObservation.txt`;
  1390. this.uploadFile(blob);
  1391. } else {
  1392. this.loading = true;
  1393. this.$emit(
  1394. "updateTranscription",
  1395. {
  1396. transcriptionData: this.transcriptionData.content,
  1397. editorBarData: this.editorBarData,
  1398. },
  1399. () => {
  1400. this.loading = false;
  1401. }
  1402. );
  1403. }
  1404. },
  1405. changeEditorBar({ transcriptionData, editorBarData }) {
  1406. this.transcriptionData.content = transcriptionData;
  1407. this.editorBarData = editorBarData;
  1408. },
  1409. // 获取对话记录
  1410. getChatList() {
  1411. return new Promise((resolve, reject) => {
  1412. if (this.chatLoading) return this.$message.info("请稍等...");
  1413. this.chatList = [];
  1414. if (!this.tid) return setTimeout(() => this.getChatList(), 100);
  1415. this.chatLoading = true;
  1416. let params = {
  1417. userid: "602def61-005d-11ee-91d8-005056b86db5",
  1418. groupid: "602def61-005d-11ee-91d8-005056b8q12w",
  1419. // session_name:``
  1420. session_name: `${this.tid}-classroomObservation`,
  1421. };
  1422. this.ajax
  1423. .post("https://gpt4.cocorobo.cn/get_agent_park_chat", params)
  1424. .then((res) => {
  1425. let _data = JSON.parse(res.data.FunctionResponse);
  1426. if (_data.length > 0) {
  1427. let _chatList = [];
  1428. for (let i = 0; i < _data.length; i++) {
  1429. _chatList.push({
  1430. loading: false,
  1431. role: "user",
  1432. content: _data[i].problem,
  1433. uid: _data[i].id,
  1434. AI: "AI",
  1435. aiContent: _data[i].answer,
  1436. oldContent: _data[i].answer,
  1437. isShowSynchronization: false,
  1438. filename: _data[i].filename,
  1439. index: i,
  1440. is_mind_map: false,
  1441. fileid: _data[i].fileid,
  1442. createtime: _data[i].createtime,
  1443. });
  1444. }
  1445. this.chatList = _chatList;
  1446. this.chatLoading = false;
  1447. } else {
  1448. //没有对话记录
  1449. this.chatLoading = false;
  1450. }
  1451. resolve();
  1452. this.scrollBottom();
  1453. })
  1454. .catch((err) => {
  1455. console.log(err);
  1456. this.$message.error("获取对话记录失败");
  1457. this.chatLoading = false;
  1458. this.scrollBottom();
  1459. resolve();
  1460. });
  1461. });
  1462. },
  1463. //保存消息
  1464. insertChat(_uid) {
  1465. let _data = this.chatList.find((i) => i.uid == _uid);
  1466. if (!_data) return;
  1467. let params = {
  1468. userId: "602def61-005d-11ee-91d8-005056b86db5",
  1469. userName: "qgt",
  1470. groupId: "602def61-005d-11ee-91d8-005056b8q12w",
  1471. answer: _data.aiContent,
  1472. problem: _data.content,
  1473. file_id: _data.fileid ? _data.fileid : "",
  1474. alltext: _data.aiContent,
  1475. type: "chat",
  1476. filename: _data.filename,
  1477. session_name: `${this.tid}-classroomObservation`,
  1478. };
  1479. this.ajax
  1480. .post("https://gpt4.cocorobo.cn/insert_chat", params)
  1481. .then((res) => {});
  1482. },
  1483. },
  1484. mounted() {},
  1485. };
  1486. </script>
  1487. <style scoped>
  1488. .chatArea {
  1489. width: 100%;
  1490. height: 100%;
  1491. display: flex;
  1492. flex-direction: column;
  1493. /* align-items: center; */
  1494. /* justify-content: center; */
  1495. box-sizing: border-box;
  1496. padding: 20px;
  1497. }
  1498. .audio_class {
  1499. /* width: 100% !important; */
  1500. /* height: 100% !important; */
  1501. background: #ccc !important;
  1502. margin: 0 !important;
  1503. }
  1504. .audio_class >>> .slider .process {
  1505. background: #000;
  1506. }
  1507. .tapeSty {
  1508. cursor: pointer;
  1509. width: 40px;
  1510. height: 25px;
  1511. display: flex;
  1512. justify-content: center;
  1513. align-items: center;
  1514. /* padding: 10px 15px; */
  1515. border-radius: 20px;
  1516. }
  1517. .TapeCss {
  1518. background-color: #1467ee;
  1519. }
  1520. .titBar {
  1521. width: 100%;
  1522. height: 30px;
  1523. margin-bottom: 5px;
  1524. display: flex;
  1525. /* align-items: center; */
  1526. border-bottom: 1px #ccc solid;
  1527. z-index: 99;
  1528. }
  1529. .titBar > .titBarLeft {
  1530. width: 40%;
  1531. min-width: 400px;
  1532. flex-shrink: 0;
  1533. display: flex;
  1534. cursor: pointer;
  1535. justify-content: flex-start;
  1536. }
  1537. .titBar > .titBarRig {
  1538. display: flex;
  1539. flex: 1;
  1540. justify-content: flex-end;
  1541. align-items: center;
  1542. font-family: PingFang SC;
  1543. font-size: 14px;
  1544. font-weight: 400;
  1545. line-height: 22px;
  1546. text-align: left;
  1547. }
  1548. .titBar > .titBarRig > img {
  1549. margin-right: 5px;
  1550. width: 16px;
  1551. height: 16px;
  1552. cursor: pointer;
  1553. }
  1554. .titBarBorder {
  1555. font-weight: 600;
  1556. box-sizing: border-box;
  1557. border-bottom: 2px #1467ee solid;
  1558. }
  1559. .titBar > .titBarLeft > div {
  1560. height: 100%;
  1561. font-family: PingFang SC;
  1562. font-size: 16px;
  1563. min-width: 75px;
  1564. margin-right: 30px;
  1565. text-align: left;
  1566. display: flex;
  1567. align-items: center;
  1568. }
  1569. .titBar > .titBarLeft > div > img {
  1570. margin-right: 5px;
  1571. }
  1572. .m-operation {
  1573. width: 100%;
  1574. height: 30px;
  1575. display: flex;
  1576. font-size: 14px;
  1577. box-sizing: border-box;
  1578. padding-right: 30px;
  1579. margin-bottom: 10px;
  1580. align-items: baseline;
  1581. }
  1582. .m-operation :first-child {
  1583. font-family: PingFang SC;
  1584. font-size: 18px;
  1585. font-weight: 600;
  1586. line-height: 26px;
  1587. text-align: left;
  1588. margin-right: 10px;
  1589. }
  1590. .m-operation :nth-child(2) {
  1591. font-family: PingFang SC;
  1592. font-size: 12px;
  1593. font-weight: 400;
  1594. text-align: left;
  1595. }
  1596. .ca-top {
  1597. width: 100%;
  1598. flex: 1;
  1599. }
  1600. .ca-bottom {
  1601. width: 100%;
  1602. height: 120px;
  1603. }
  1604. .ca-b-operation {
  1605. width: 100%;
  1606. height: 100%;
  1607. display: flex;
  1608. flex-direction: column;
  1609. justify-content: flex-end;
  1610. position: relative;
  1611. }
  1612. .ca-b-o-header {
  1613. width: 100%;
  1614. height: 40px;
  1615. display: flex;
  1616. align-items: center;
  1617. }
  1618. .ca-b-o-h-left {
  1619. flex: 1;
  1620. height: 100%;
  1621. display: flex;
  1622. align-items: center;
  1623. }
  1624. .ca-b-o-h-l-select {
  1625. width: auto;
  1626. display: flex;
  1627. justify-content: center;
  1628. position: relative;
  1629. align-items: center;
  1630. font-size: 14px;
  1631. box-sizing: border-box;
  1632. padding: 5px 10px;
  1633. margin-right: 20px;
  1634. border-radius: 15px;
  1635. cursor: pointer;
  1636. background-color: white;
  1637. }
  1638. /* .ca-b-o-h-l-select:hover .languageBlock{
  1639. display: block;
  1640. }
  1641. .languageBlock {
  1642. display: none;
  1643. } */
  1644. .languageList {
  1645. position: absolute;
  1646. background-color: #fff;
  1647. top: calc(-100% - 100px);
  1648. left: 0%;
  1649. width: 120px;
  1650. /* padding: 0 10px; */
  1651. /* box-sizing: border-box; */
  1652. padding: 10px 0;
  1653. border-radius: 5px;
  1654. display: flex;
  1655. justify-content: space-between;
  1656. flex-direction: column;
  1657. align-items: center;
  1658. height: 100px;
  1659. }
  1660. .languageList >>> .el-radio {
  1661. width: 70%;
  1662. /* margin-bottom: 10px; */
  1663. padding: 5px 10px;
  1664. margin: 0;
  1665. border-radius: 5px;
  1666. }
  1667. .radioBg {
  1668. background: rgba(243, 247, 253, 1);
  1669. }
  1670. .ca-b-o-h-l-s-icon {
  1671. margin-right: 2px;
  1672. font-size: 16px;
  1673. }
  1674. .ca-b-o-h-s-l-icon2 {
  1675. margin-left: 5px;
  1676. font-size: 18px;
  1677. }
  1678. .ca-b-o-h-l-btn {
  1679. width: auto;
  1680. display: flex;
  1681. justify-content: center;
  1682. align-items: center;
  1683. font-size: 14px;
  1684. box-sizing: border-box;
  1685. padding: 5px 10px;
  1686. margin-right: 20px;
  1687. border-radius: 15px;
  1688. background-color: white;
  1689. cursor: pointer;
  1690. }
  1691. .ca-b-o-h-right {
  1692. width: auto;
  1693. height: 100%;
  1694. display: flex;
  1695. justify-content: center;
  1696. align-items: center;
  1697. }
  1698. .ca-b-o-h-r-radio {
  1699. display: flex;
  1700. align-items: center;
  1701. font-size: 14px;
  1702. background-color: #e7e7e7;
  1703. border-radius: 20px;
  1704. overflow: hidden;
  1705. }
  1706. .ca-b-o-h-r-radio > span {
  1707. margin-right: 5px;
  1708. cursor: pointer;
  1709. }
  1710. .ca-b-o-main {
  1711. width: 100%;
  1712. /* flex: 1; */
  1713. height: 64px;
  1714. margin-top: 5px;
  1715. border-radius: 16px;
  1716. transition: 0.3s;
  1717. position: relative;
  1718. }
  1719. .ca-b-o-main:hover {
  1720. box-shadow: 0 5px 10px 10px #e1e8eb;
  1721. }
  1722. .ca-b-o-m-tape {
  1723. width: 100%;
  1724. height: 100%;
  1725. cursor: pointer;
  1726. display: flex;
  1727. justify-content: center;
  1728. align-items: center;
  1729. font-size: 20px;
  1730. color: #3681fc;
  1731. border-radius: 16px;
  1732. background-color: white;
  1733. box-shadow: 0 5px 10px 10px #e6eaeb;
  1734. transition: 0.3s;
  1735. }
  1736. .ca-b-o-m-tapeTwo {
  1737. width: 100%;
  1738. height: 100%;
  1739. display: flex;
  1740. justify-content: center;
  1741. align-items: center;
  1742. font-size: 20px;
  1743. color: #3681fc;
  1744. box-sizing: border-box;
  1745. padding: 0 20px;
  1746. border-radius: 16px;
  1747. background-color: white;
  1748. box-shadow: 0 5px 10px 10px #e6eaeb;
  1749. transition: 0.3s;
  1750. }
  1751. .ca-b-o-m-tapeTwo >>> .vueAudioBetter {
  1752. width: 90%;
  1753. }
  1754. .ca-b-o-m-tape > span {
  1755. margin-right: 10px;
  1756. font-size: 22px;
  1757. }
  1758. .ca-b-o-m-tape:hover {
  1759. color: #1467ee;
  1760. }
  1761. .ca-b-o-m-inputAre {
  1762. width: 100%;
  1763. min-height: 100%;
  1764. height: auto;
  1765. display: flex;
  1766. align-items: flex-end;
  1767. border-radius: 16px;
  1768. background-color: white;
  1769. box-shadow: 0 5px 10px 10px #e6eaeb;
  1770. transition: 0.3s;
  1771. position: absolute;
  1772. bottom: 0;
  1773. }
  1774. .ca-b-o-m-TapeArea {
  1775. width: 100%;
  1776. height: 100%;
  1777. display: flex;
  1778. justify-content: space-between;
  1779. border-radius: 16px;
  1780. background-color: #f0f2f5;
  1781. box-shadow: 0 5px 10px 10px #e6eaeb;
  1782. transition: 0.3s;
  1783. align-items: center;
  1784. padding-right: 20px;
  1785. box-sizing: border-box;
  1786. }
  1787. .ca-b-o-m-i-left {
  1788. display: flex;
  1789. align-items: center;
  1790. }
  1791. .ca-b-o-m-i-left > div > div {
  1792. color: #ee3e3e;
  1793. font-weight: bold;
  1794. }
  1795. .ca-b-o-m-i-left > div > span {
  1796. font-size: 14px;
  1797. margin-top: 5px;
  1798. }
  1799. .ca-b-o-m-i-left > img {
  1800. margin-left: 10px;
  1801. border-radius: 50%;
  1802. margin-right: 20px;
  1803. }
  1804. .ca-b-o-m-left {
  1805. flex: 1;
  1806. height: auto;
  1807. min-height: 64px;
  1808. display: flex;
  1809. /* justify-content: center; */
  1810. align-items: center;
  1811. box-sizing: border-box;
  1812. padding-left: 20px;
  1813. }
  1814. .ca-b-o-m-left > textarea {
  1815. resize: none;
  1816. min-height: 50px;
  1817. margin: 7px 0;
  1818. max-height: 500px;
  1819. width: 100%;
  1820. font-size: 18px;
  1821. border: none;
  1822. outline: none;
  1823. resize: none;
  1824. overflow: auto;
  1825. }
  1826. .ca-b-o-m-right {
  1827. width: 100px;
  1828. min-width: 80px;
  1829. height: 64px;
  1830. max-height: 64px;
  1831. display: flex;
  1832. justify-content: center;
  1833. align-items: center;
  1834. margin-right: 10px;
  1835. }
  1836. #myTextarea::-webkit-input-placeholder {
  1837. /* Chrome, Opera, Safari */
  1838. font-size: 14px; /* 修改placeholder字体大小 */
  1839. color: grey; /* 修改placeholder文字颜色 */
  1840. }
  1841. #myTextarea:-moz-placeholder {
  1842. /* Firefox 18- */
  1843. font-size: 14px; /* 修改placeholder字体大小 */
  1844. color: grey; /* 修改placeholder文字颜色 */
  1845. opacity: 1; /* 修复Firefox的透明度问题 */
  1846. }
  1847. #myTextarea::-moz-placeholder {
  1848. /* Firefox 19+ */
  1849. font-size: 14px; /* 修改placeholder字体大小 */
  1850. color: grey; /* 修改placeholder文字颜色 */
  1851. opacity: 1; /* 修复Firefox的透明度问题 */
  1852. }
  1853. #myTextarea:-ms-input-placeholder {
  1854. /* Internet Explorer 10-11 */
  1855. font-size: 14px; /* 修改placeholder字体大小 */
  1856. color: grey; /* 修改placeholder文字颜色 */
  1857. }
  1858. /* .ca-b-o-m-right > span {
  1859. width: 24px;
  1860. height: 24px;
  1861. background: url("../../../../assets/icon/classroomObservation/tapeIng.png")
  1862. no-repeat;
  1863. background-size: 100% 100%;
  1864. cursor: pointer;
  1865. margin-right: 10px;
  1866. } */
  1867. .ca-b-o-m-right > div {
  1868. width: 52px;
  1869. height: 30px;
  1870. display: flex;
  1871. justify-content: center;
  1872. align-items: center;
  1873. color: white;
  1874. font-size: 14px;
  1875. border-radius: 5px;
  1876. background-color: #1467ee;
  1877. margin-right: 10px;
  1878. cursor: pointer;
  1879. }
  1880. .ca-b-o-m-r-dsiableBtn {
  1881. /* 禁止手势 */
  1882. cursor: not-allowed !important;
  1883. background-color: #aeccfe !important;
  1884. }
  1885. .lyStart {
  1886. width: 38px;
  1887. height: 32px;
  1888. display: flex;
  1889. align-items: center;
  1890. justify-content: center;
  1891. background-color: #fff;
  1892. border-radius: 5px;
  1893. cursor: pointer;
  1894. }
  1895. .ca_b_o_m_roleList {
  1896. position: absolute;
  1897. left: 0;
  1898. width: 100%;
  1899. height: auto;
  1900. max-height: calc(100vh - 230px);
  1901. margin-bottom: 70px;
  1902. overflow: auto;
  1903. background-color: white;
  1904. border-radius: 10px;
  1905. box-sizing: border-box;
  1906. padding: 15px;
  1907. }
  1908. .ca_b_o_m_rl_item {
  1909. width: 100%;
  1910. height: auto;
  1911. margin-bottom: 15px;
  1912. background-color: #f3f7fd;
  1913. border-radius: 10px;
  1914. cursor: pointer;
  1915. transition: 0.3s;
  1916. box-sizing: border-box;
  1917. padding: 10px;
  1918. }
  1919. .ca_b_o_m_rl_itemActive {
  1920. background-color: #c3ddfa;
  1921. }
  1922. .ca_b_o_m_rl_i_left {
  1923. width: 50px;
  1924. height: 50px;
  1925. border-radius: 50%;
  1926. margin-right: 15px;
  1927. }
  1928. .ca_b-o_m_rl_i_top {
  1929. display: flex;
  1930. }
  1931. .ca_b-o_m_rl_i_top > div {
  1932. margin-left: 10px;
  1933. }
  1934. .ca_b-o_m_rl_i_top > div > span {
  1935. font-size: 14px;
  1936. margin-top: 5px;
  1937. color: #6b798e;
  1938. }
  1939. .ca_b-o_m_rl_i_bottom {
  1940. margin-top: 10px;
  1941. width: 90%;
  1942. overflow: hidden;
  1943. display: block;
  1944. white-space: nowrap;
  1945. text-overflow: ellipsis;
  1946. }
  1947. .ca-top >>> .editorBar {
  1948. height: 100%;
  1949. position: relative;
  1950. max-height: calc(100vh - 300px);
  1951. }
  1952. .ca-top >>> .editorBar .text {
  1953. height: calc(100% - 42px);
  1954. max-height: calc(100% - 42px);
  1955. overflow: auto;
  1956. }
  1957. </style>