chatArea.vue 55 KB

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