aiBoxCourseDetail.vue 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399
  1. <template>
  2. <div class="ai_body" v-loading="loading">
  3. <div class="ai_body_dialog" ref="chatDialog">
  4. <div class="dialog_content" v-for="item in array" :key="item.uid">
  5. <div v-if="item.content" style="margin-left: auto;">
  6. <div
  7. class="ai_btn_box"
  8. style="margin-left: auto;"
  9. v-if="!pan(item.content).length"
  10. >
  11. <img
  12. src="../../../assets/icon/course/pasete.png"
  13. @click="onCopy(item.content)"
  14. />
  15. </div>
  16. <div class="content content2" v-html="item.content"></div>
  17. <div class="role">
  18. <img src="../../../assets/icon/new/role2.png" />
  19. </div>
  20. </div>
  21. <div
  22. style="margin-top:20px;margin-bottom:20px ; margin-right: auto;"
  23. v-if="item.aiContent || item.loading"
  24. >
  25. <div class="role">
  26. <img
  27. :src="
  28. item.fileid
  29. ? item.fileid
  30. : require('../../../assets/icon/new/role1.png')
  31. "
  32. />
  33. </div>
  34. <div
  35. element-loading-background="#f6f9ff"
  36. :style="{
  37. minHeight: item.loading ? '50px' : 'unset',
  38. minWidth: item.loading ? '50px' : 'unset'
  39. }"
  40. class="content"
  41. v-loading="item.loading"
  42. >
  43. <span class="vditor-reset" v-html="item.aiContent"></span>
  44. <span class="createTime" v-text="item.createtime"></span>
  45. </div>
  46. <div
  47. class="ai_btn_box"
  48. v-if="!pan(item.aiContent).length && !item.loading"
  49. >
  50. <img
  51. src="../../../assets/icon/course/pasete.png"
  52. @click="onCopy(item.aiContent)"
  53. />
  54. </div>
  55. <div class="ai_tips_btn_box" v-if="chatTypeArray.includes(item.chatType) && !item.loading">
  56. <!-- @click="quickAdd(item.addedData, pr)" -->
  57. <span v-if="item.chatType == 'start'" @click="quickAdd('start')">{{ lang.ssAddTopic }}</span>
  58. <span v-if="item.chatType == 'recordCourseD'" @click="setCourseText(item.aiContent)">{{ lang.ssAdopt }}</span>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="ai_body_select" v-if="false">
  64. <div class="checkBox" v-if="checkBool">
  65. <div class="task">
  66. <div class="title">{{ lang.ssSelectOptTask }}</div>
  67. <div class="content">
  68. <div class="span" @click="addAllTask()">
  69. <div class="check">
  70. <img
  71. :src="checkImg"
  72. alt=""
  73. v-if="checkArray.length !== course.length"
  74. />
  75. <img :src="checkIsImg" alt="" v-else />
  76. </div>
  77. <span>{{ lang.ssSelectAll }}</span>
  78. </div>
  79. <div
  80. class="span"
  81. v-for="(item, index) in course"
  82. :key="index"
  83. @click="addTask(index)"
  84. >
  85. <div class="check">
  86. <img
  87. :src="checkImg"
  88. alt=""
  89. v-if="checkArray.indexOf(index) === -1"
  90. />
  91. <img :src="checkIsImg" alt="" v-else />
  92. </div>
  93. <span>{{ lang.ssTask }}{{ index + 1 }}</span>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="part">
  98. <div class="title">{{ lang.ssSelectOptPart }}</div>
  99. <div class="content">
  100. <div
  101. class="span"
  102. v-for="(item, index) in partArray"
  103. :key="index"
  104. :class="{ active: part == item.name }"
  105. @click="checkPart(item.name)"
  106. >
  107. {{ item.name }}
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <span
  113. class="check"
  114. :class="{ isCheck: checkBool }"
  115. v-if="!checkArray.length && !part"
  116. @click="checkBool = !checkBool"
  117. >{{ lang.ssSelectOptContent }}</span
  118. >
  119. <span
  120. class="check"
  121. :class="{ isCheck: checkBool }"
  122. @click="checkBool = !checkBool"
  123. v-else
  124. >
  125. <el-tooltip :content="taskName" placement="top" effect="dark">
  126. <!-- content to trigger tooltip here -->
  127. <span>{{ taskName }}</span>
  128. </el-tooltip>
  129. </span>
  130. </div>
  131. <div class="ai_body_input">
  132. <div class="ai_b_i_btnArea">
  133. <span class="clear" @click.stop="clear()">
  134. <svg
  135. width="20"
  136. height="20"
  137. viewBox="0 0 20 20"
  138. fill="none"
  139. xmlns="http://www.w3.org/2000/svg"
  140. >
  141. <path
  142. fill-rule="evenodd"
  143. clip-rule="evenodd"
  144. d="M2.5 3.125C2.5 2.77982 2.77982 2.5 3.125 2.5H16.875C17.2202 2.5 17.5 2.77982 17.5 3.125V8.02715C17.5 8.37233 17.2202 8.65215 16.875 8.65215C16.5298 8.65215 16.25 8.37233 16.25 8.02715V3.75H3.75V16.25H8.125C8.47018 16.25 8.75 16.5298 8.75 16.875C8.75 17.2202 8.47018 17.5 8.125 17.5H3.125C2.77982 17.5 2.5 17.2202 2.5 16.875V3.125Z"
  145. />
  146. <path
  147. fill-rule="evenodd"
  148. clip-rule="evenodd"
  149. d="M5.625 6.1521C5.625 5.80692 5.90482 5.5271 6.25 5.5271H13.125C13.4702 5.5271 13.75 5.80692 13.75 6.1521C13.75 6.49728 13.4702 6.7771 13.125 6.7771H6.25C5.90482 6.7771 5.625 6.49728 5.625 6.1521Z"
  150. />
  151. <path
  152. fill-rule="evenodd"
  153. clip-rule="evenodd"
  154. d="M5.625 9.2771C5.625 8.93192 5.90482 8.6521 6.25 8.6521H9.37496C9.72014 8.6521 9.99996 8.93192 9.99996 9.2771C9.99996 9.62228 9.72014 9.9021 9.37496 9.9021H6.25C5.90482 9.9021 5.625 9.62228 5.625 9.2771Z"
  155. />
  156. <path
  157. fill-rule="evenodd"
  158. clip-rule="evenodd"
  159. d="M12.465 11.507L15.9141 14.9048C16.1279 14.5365 16.25 14.1088 16.25 13.6521C16.25 12.2714 15.1307 11.1521 13.75 11.1521C13.2799 11.1521 12.8406 11.2815 12.465 11.507ZM15.0374 15.7957L11.5873 12.397C11.3726 12.7659 11.25 13.1944 11.25 13.6521C11.25 15.0328 12.3693 16.1521 13.75 16.1521C14.2211 16.1521 14.6613 16.0222 15.0374 15.7957ZM11.0797 11.0192C11.759 10.3303 12.7051 9.9021 13.75 9.9021C15.8211 9.9021 17.5 11.581 17.5 13.6521C17.5 14.6767 17.0882 15.6064 16.4226 16.2827C15.7431 16.9729 14.7961 17.4021 13.75 17.4021C11.6789 17.4021 10 15.7232 10 13.6521C10 12.6263 10.4127 11.6957 11.0797 11.0192Z"
  160. />
  161. </svg>
  162. <span>{{ lang.ssClearScreen }}</span>
  163. </span>
  164. <!-- <span class="clear" @click.stop="quickAdd('more')">
  165. <span>更多课程灵感</span>
  166. </span> -->
  167. <span class="clear" @click.stop="quickAdd('recordCheckJindu')">
  168. <span>{{ lang.ssSummaryDiscuss }}</span>
  169. </span>
  170. <span class="clear" @click.stop="quickAdd('recordCourseD')">
  171. <span>{{ lang.ssSummaryCourse }}</span>
  172. </span>
  173. <!-- <div style="margin-left: auto;">
  174. <el-switch v-model="continuous"></el-switch>
  175. <span @click.stop="continuous = !continuous">连续对话</span>
  176. </div> -->
  177. </div>
  178. <div
  179. class="ai_b_i_roleListBox"
  180. ref="roleListRef"
  181. v-if="showRoleList && choseRoleList.length > 0"
  182. >
  183. <div
  184. :class="[
  185. 'ai_b_i_rlb_item',
  186. index == choseRoleItem ? 'ai_b_i_rlb_itemActive' : ''
  187. ]"
  188. :ref="`roleItem${index}Ref`"
  189. v-for="(item, index) in choseRoleList"
  190. :key="item.id"
  191. @mouseover="choseRoleItem = index"
  192. @click.stop="choseRole(item)"
  193. >
  194. <div class="ai_b_i_rlb_itemTop">
  195. <img
  196. :src="
  197. item.headUrl
  198. ? item.headUrl
  199. : require('../../../assets/icon/new/role1.png')
  200. "
  201. alt=""
  202. />
  203. <div class="ai_b_i_rlb_i_name">
  204. <span>{{ item.assistantName }}</span>
  205. <span>{{ lang.ssAuthor }}{{ item.username }}</span>
  206. </div>
  207. </div>
  208. <div class="ai_b_i_rlb_itemBottom">
  209. {{ item.prologue }}
  210. </div>
  211. </div>
  212. </div>
  213. <div
  214. class="ai_b_i_jListPanel"
  215. @click="showjList = !showjList"
  216. v-if="showjList && jArray.length > 0"
  217. ></div>
  218. <div class="ai_b_i_jListBox" v-if="showjList && jArray.length > 0">
  219. <div class="jlist_box" v-for="(item, index) in jArray" :key="index">
  220. <el-tooltip
  221. :content="item.area + ':' + item.value"
  222. placement="left"
  223. effect="dark"
  224. popper-class="text_tooltip2"
  225. >
  226. <!-- content to trigger tooltip here -->
  227. <span>{{ item.area }}:{{ item.value }}</span>
  228. </el-tooltip>
  229. <div class="cancel" @click="cancelJ(item.string)">×</div>
  230. </div>
  231. </div>
  232. <!-- <div class="ai_b_i_textListBox">
  233. <div class="ai_b_i_tlb_left"></div>
  234. <div class="ai_b_i_tlb_right"></div>
  235. </div> -->
  236. <!-- @input="inputChange" -->
  237. <textarea
  238. class="ai_body_input_textarea"
  239. @keydown="textareaKeydown"
  240. :disabled="isVoice"
  241. ref="textareaRef"
  242. v-model.trim="courseText"
  243. :placeholder="
  244. isVoice
  245. ? isTalk
  246. ? ''
  247. : lang.ssClickStartRec
  248. : lang.ssEnterWantKnow
  249. "
  250. ></textarea>
  251. <span
  252. class="c_voiceBtn"
  253. v-if="!courseText && !isVoice"
  254. @click.stop="changeVoice(true)"
  255. >
  256. <svg
  257. width="22"
  258. height="22"
  259. viewBox="0 0 22 22"
  260. fill="none"
  261. xmlns="http://www.w3.org/2000/svg"
  262. >
  263. <path
  264. fill-rule="evenodd"
  265. clip-rule="evenodd"
  266. d="M11.4583 14.0308C13.8381 14.0308 15.7551 12.0651 15.7551 9.62496V6.23588C15.7551 3.79574 13.8381 1.83008 11.4583 1.83008C9.07845 1.83008 7.16138 3.79574 7.16138 6.23588V9.62496C7.16138 12.0651 9.07845 14.0308 11.4583 14.0308ZM8.4835 6.23588C8.4835 4.54134 9.80561 3.18571 11.4583 3.18571C13.1109 3.18571 14.433 4.54134 14.433 6.23588V9.62496C14.433 11.3195 13.1109 12.6751 11.4583 12.6751C9.80561 12.6751 8.4835 11.3195 8.4835 9.62496V6.23588ZM18.3333 10.6405C18.3333 10.2677 18.0358 9.96264 17.6722 9.96264C17.3417 9.96264 17.0442 10.2338 17.0111 10.5727C16.5484 13.3178 14.2347 15.3852 11.4583 15.3852C8.68181 15.3852 6.36811 13.3178 5.90537 10.5727C5.87231 10.2338 5.57484 9.96264 5.24431 9.96264C4.88073 9.96264 4.58325 10.2677 4.58325 10.6405V10.7421C5.1121 13.9279 7.65717 16.4019 10.7972 16.7069V19.635H7.93254C7.54315 19.635 7.22748 19.9587 7.22748 20.358C7.22748 20.7572 7.54315 21.0809 7.93254 21.0809H14.9832C15.3726 21.0809 15.6883 20.7572 15.6883 20.358C15.6883 19.9587 15.3726 19.635 14.9832 19.635H12.1193V16.7069C15.2593 16.4019 17.8044 13.9279 18.3002 10.776C18.3002 10.7591 18.3085 10.7337 18.3167 10.7082L18.3167 10.7082L18.3167 10.7082C18.325 10.6828 18.3333 10.6574 18.3333 10.6405Z"
  267. fill="black"
  268. fill-opacity="0.9"
  269. />
  270. </svg>
  271. </span>
  272. <span
  273. class="c_voiceBtn"
  274. :style="{right: faloading ? '85px' : '70px'}"
  275. v-if="!courseText && isVoice && !isTalk"
  276. @click.stop="changeVoice(false)"
  277. >
  278. <svg
  279. width="22"
  280. height="22"
  281. viewBox="0 0 22 22"
  282. fill="none"
  283. xmlns="http://www.w3.org/2000/svg"
  284. >
  285. <path
  286. fill-rule="evenodd"
  287. clip-rule="evenodd"
  288. d="M2.75 3.4375C2.75 3.0578 3.0578 2.75 3.4375 2.75H18.5625C18.9422 2.75 19.25 3.0578 19.25 3.4375V18.5625C19.25 18.9422 18.9422 19.25 18.5625 19.25H3.4375C3.0578 19.25 2.75 18.9422 2.75 18.5625V3.4375ZM4.125 4.125V17.875H17.875V4.125H4.125Z"
  289. fill="black"
  290. fill-opacity="0.9"
  291. />
  292. <path
  293. fill-rule="evenodd"
  294. clip-rule="evenodd"
  295. d="M6.875 6.875C6.875 6.4953 7.1828 6.1875 7.5625 6.1875H14.4375C14.8172 6.1875 15.125 6.4953 15.125 6.875V8.25C15.125 8.6297 14.8172 8.9375 14.4375 8.9375C14.0578 8.9375 13.75 8.6297 13.75 8.25V7.5625H11.6875V14.4375H12.375C12.7547 14.4375 13.0625 14.7453 13.0625 15.125C13.0625 15.5047 12.7547 15.8125 12.375 15.8125H9.625C9.2453 15.8125 8.9375 15.5047 8.9375 15.125C8.9375 14.7453 9.2453 14.4375 9.625 14.4375H10.3125V7.5625H8.25V8.25C8.25 8.6297 7.9422 8.9375 7.5625 8.9375C7.1828 8.9375 6.875 8.6297 6.875 8.25V6.875Z"
  296. fill="black"
  297. fill-opacity="0.9"
  298. />
  299. </svg>
  300. </span>
  301. <div
  302. :class="[
  303. 'c_pub_button_confirm',
  304. courseText ? '' : 'c_pub_button_confirmDisabled'
  305. ]"
  306. v-if="!faloading && !isVoice"
  307. @click="addContent"
  308. >
  309. {{ lang.ssSend }}
  310. </div>
  311. <div
  312. :class="['c_pub_button_confirmVoice']"
  313. v-if="!faloading && isVoice && !isTalk"
  314. @click="startVoice"
  315. >
  316. <svg
  317. width="22"
  318. height="22"
  319. viewBox="0 0 22 22"
  320. fill="none"
  321. xmlns="http://www.w3.org/2000/svg"
  322. >
  323. <path
  324. fill-rule="evenodd"
  325. clip-rule="evenodd"
  326. d="M11.4583 14.0308C13.8381 14.0308 15.7551 12.0651 15.7551 9.62496V6.23588C15.7551 3.79574 13.8381 1.83008 11.4583 1.83008C9.07845 1.83008 7.16138 3.79574 7.16138 6.23588V9.62496C7.16138 12.0651 9.07845 14.0308 11.4583 14.0308ZM8.4835 6.23588C8.4835 4.54134 9.80561 3.18571 11.4583 3.18571C13.1109 3.18571 14.433 4.54134 14.433 6.23588V9.62496C14.433 11.3195 13.1109 12.6751 11.4583 12.6751C9.80561 12.6751 8.4835 11.3195 8.4835 9.62496V6.23588ZM18.3333 10.6405C18.3333 10.2677 18.0358 9.96264 17.6722 9.96264C17.3417 9.96264 17.0442 10.2338 17.0111 10.5727C16.5484 13.3178 14.2347 15.3852 11.4583 15.3852C8.68181 15.3852 6.36811 13.3178 5.90537 10.5727C5.87231 10.2338 5.57484 9.96264 5.24431 9.96264C4.88073 9.96264 4.58325 10.2677 4.58325 10.6405V10.7421C5.1121 13.9279 7.65717 16.4019 10.7972 16.7069V19.635H7.93254C7.54315 19.635 7.22748 19.9587 7.22748 20.358C7.22748 20.7572 7.54315 21.0809 7.93254 21.0809H14.9832C15.3726 21.0809 15.6883 20.7572 15.6883 20.358C15.6883 19.9587 15.3726 19.635 14.9832 19.635H12.1193V16.7069C15.2593 16.4019 17.8044 13.9279 18.3002 10.776C18.3002 10.7591 18.3085 10.7337 18.3167 10.7082L18.3167 10.7082L18.3167 10.7082C18.325 10.6828 18.3333 10.6574 18.3333 10.6405Z"
  327. fill-opacity="0.9"
  328. />
  329. </svg>
  330. </div>
  331. <div
  332. :class="['c_pub_button_StopConfirmVoice']"
  333. v-if="!faloading && isVoice && isTalk"
  334. @click="stopVoice"
  335. >
  336. <svg
  337. width="22"
  338. height="22"
  339. viewBox="0 0 22 22"
  340. fill="none"
  341. xmlns="http://www.w3.org/2000/svg"
  342. >
  343. <path
  344. d="M11 19.25C6.4625 19.25 2.75 15.5375 2.75 11C2.75 6.4625 6.4625 2.75 11 2.75C15.5375 2.75 19.25 6.4625 19.25 11C19.25 15.5375 15.5375 19.25 11 19.25ZM11 17.1875C14.4031 17.1875 17.1875 14.4031 17.1875 11C17.1875 7.59687 14.4031 4.8125 11 4.8125C7.59687 4.8125 4.8125 7.59687 4.8125 11C4.8125 14.4031 7.59687 17.1875 11 17.1875Z"
  345. fill="#EE3E3E"
  346. />
  347. <path
  348. d="M12.75 8.25H9.25C8.69772 8.25 8.25 8.69772 8.25 9.25V12.75C8.25 13.3023 8.69772 13.75 9.25 13.75H12.75C13.3023 13.75 13.75 13.3023 13.75 12.75V9.25C13.75 8.69772 13.3023 8.25 12.75 8.25Z"
  349. fill="#EE3E3E"
  350. />
  351. </svg>
  352. </div>
  353. <div v-if="!faloading && isVoice"></div>
  354. <div class="c_pub_button_confirm" v-if="faloading" @click="stopSend">
  355. {{ lang.ssTerminate }}
  356. </div>
  357. </div>
  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 class="ai_body_input">
  365. <textarea
  366. style="padding-right: 85px;"
  367. rows="3"
  368. @keyup.enter="addContent"
  369. class="binfo_input binfo_textarea"
  370. cols
  371. v-model.trim="courseText"
  372. placeholder="在此输入您想了解的内容"
  373. ></textarea>
  374. <div
  375. class="c_pub_button_confirm"
  376. v-if="!loading && courseText"
  377. @click="addContent"
  378. >
  379. 发送
  380. </div>
  381. <div class="c_pub_button_confirm" @click="promptTit" v-else>发送</div>
  382. </div> -->
  383. </div>
  384. </template>
  385. <script>
  386. import checkImg from "../../../assets/icon/sourceFile/check.png";
  387. import checkIsImg from "../../../assets/icon/sourceFile/check_is.png";
  388. import { v4 as uuidv4 } from "uuid";
  389. import MarkdownIt from "markdown-it";
  390. import TurndownService from "turndown";
  391. const OpenCC = require("opencc-js");
  392. let converter = OpenCC.Converter({
  393. from: "cn",
  394. to: "hk"
  395. });
  396. export default {
  397. props: {
  398. courseId: {
  399. type: String,
  400. default: ""
  401. },
  402. courseText2: {
  403. type: String,
  404. default: ""
  405. },
  406. fileids: {
  407. type: Array,
  408. default: []
  409. },
  410. languageSetting: {
  411. type: Number,
  412. default: 0
  413. },
  414. viedoText: {
  415. type: String,
  416. default: ''
  417. },
  418. agentid: {
  419. type: String,
  420. },
  421. recordstart: {
  422. type: String,
  423. },
  424. recordCheckJindu: {
  425. type: String,
  426. },
  427. recordCourseD: {
  428. type: String,
  429. },
  430. courseInfo: {
  431. type: String
  432. }
  433. },
  434. data() {
  435. return {
  436. array: [],
  437. jArray: [],
  438. courseText: "",
  439. checkImg: checkImg,
  440. checkIsImg: checkIsImg,
  441. userid: this.$route.query.userid,
  442. oid: this.$route.query.oid,
  443. org: this.$route.query.org,
  444. checkArray: [],
  445. course: [],
  446. partArray: [],
  447. part: "",
  448. checkBool: false,
  449. loading: false,
  450. textareaHeight: 50,
  451. publicRoleList: [],
  452. roleList: [],
  453. textList: [
  454. {
  455. title: "项目式学习",
  456. dataList: [
  457. "请给我一些学生开展项目式学习可以使用的主题或问题参考,请说出学生将要解决的问题,以及学生要经历怎样的学习活动。",
  458. "请将一个关于生态保护项目的项目式学习展开描述,你需要描述学生如何解决这个问题,你需要至少写出四个活动,这些活动需要按照前后逻辑关系排列。",
  459. "请对驱动问题为“如何为学校建造一个富有特色的花坛?”的项目式学习进行子问题拆解,至少拆解为5个子问题,并根据子问题对应写出各环节的主要活动。"
  460. ]
  461. },
  462. {
  463. title: "教学评价",
  464. dataList: [
  465. "如果需要给学生的社区服务进行评价,给出评价维度和至少3个等级的表现描述。",
  466. "为6年级学生设计一份关于梧桐山研究报告的评估任务表,并给出参考的报告流程,至少包含8个步骤,并包括地图、图片和至少300个词。",
  467. "创建一个给5年级学生使用的课堂小测试,包含5道多选题,评价学生对于太阳能这个概念的理解。你需要给出题目和正确答案。"
  468. ]
  469. },
  470. {
  471. title: "教学设计",
  472. dataList: [
  473. "如果需要5年级学生感受“移步换景”的景观写作手法,你有什么合适的阅读材料推荐?你需要给出材料名称,以及材料的哪部分内容。",
  474. "设计一个针对8年级学生且关于人类迁徙主题的地理课,并在课程中设计至少1项小组活动。",
  475. "设计一个针对5年级学生的课程,课程综合科学和信息技术领域,解决生物与环境领域的生活问题,你需要给出完整的课程框架和活动。",
  476. "如果3年级的学生不能理解光合作用的实现过程,需要你帮我设计一个支持他们理解的教学活动,需要包含活动的形式、实施材料和清单。",
  477. "请基于贝叶斯定理为8年级学生出三道题目。",
  478. "如果需要八年级学生了解尼罗河流域的文化发展史,你有哪些推荐的网站或参考书籍?"
  479. ]
  480. },
  481. {
  482. title: "班级管理",
  483. dataList: [
  484. "创建一组给一年级学生使用的班级口号,要求大家注意卫生、保护环境,口号需要对仗工整,符合一年级学生的理解水平。",
  485. " 设计一套用于6年级学生的班级管理规章制度,内容需要包括学习、纪律、卫生、思想品德方面。"
  486. ]
  487. },
  488. {
  489. title: "课堂组织",
  490. dataList: [
  491. "请为“制作垃圾分类宣传单”的小组活动设计小组分工表,每个小组的成员为4-6人。",
  492. "请给5年级“校园植物图鉴”社团课程设计一份小组合作公约,需包含小组成员信息、小组项目目标、填写日期,总长度不超过300字,并且提供至少3处学生自行填写的部分。",
  493. "请用苏格拉底提问的方式,引导5年级学生拆解驱动问题:如何解决教室黑板反光的问题?其中需包含对于反光原因的分析与实验探究。"
  494. ]
  495. },
  496. {
  497. title: "教师发展",
  498. dataList: [
  499. "教师需要理解项目式学习的理论基础和基础概念,你需要生成一份阅读清单,要求内容为中文书籍或文献。",
  500. "设计一个教师进行个人学期总结的框架,需要体现在教学、教研、个人学习方面的进步。"
  501. ]
  502. },
  503. {
  504. title: "代码分析",
  505. dataList: [
  506. "这段代码实现了什么效果?",
  507. "请描述这段代码。",
  508. "根据这段代码,给我一些修改意见。"
  509. ]
  510. }
  511. ],
  512. showTextList: false,
  513. showRoleList: false,
  514. choseRoleItem: 0,
  515. choseTextItem: 0,
  516. continuous: true,
  517. showjList: false,
  518. faloading: false,
  519. fasource: null,
  520. saveUid: "",
  521. isVoice: false,
  522. isTalk: false,
  523. username: "",
  524. chatTypeArray: [
  525. // 'start'
  526. 'recordCourseD'
  527. ],
  528. agentJSON:{
  529. model: '',
  530. url: '',
  531. start: ''
  532. }
  533. };
  534. },
  535. watch: {
  536. courseId: {
  537. immediate: true,
  538. deep: true,
  539. handler(newValue, oldValue) {
  540. if (newValue) {
  541. this.getChatList().then(_ => {
  542. this.$nextTick(() => {
  543. console.log(this.$refs.chatDialog.scrollHeight);
  544. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  545. });
  546. });
  547. }
  548. }
  549. },
  550. agentid: {
  551. immediate: true,
  552. deep: true,
  553. handler(newValue, oldValue) {
  554. if (newValue) {
  555. this.getAgent()
  556. }
  557. }
  558. },
  559. },
  560. methods: {
  561. removeMarkdownSymbols(text) {
  562. return text
  563. .replace(/(?:\*\*|__)(.*?)\1/g, '$1') // 加粗
  564. .replace(/(?:\*|_)(.*?)\1/g, '$1') // 斜体
  565. .replace(/`(.*?)`/g, '$1') // 代码
  566. .replace(/^(#{1,6})\s*(.*)$/gm, '$2') // 标题
  567. .replace(/^\s*[-*+]\s+/gm, '') // 无序列表
  568. .replace(/^\s*\d+\.\s+/gm, '') // 有序列表
  569. .replace(/\[([^\]]+)\]\([^\)]+\)/g, '$1') // 链接
  570. .replace(/>\s+/g, '') // 引用
  571. .replace(/\n/g, '')
  572. .replaceAll(' ', '');
  573. },
  574. getLang() {
  575. let lang = "";
  576. if (this.languageSetting == 0) {
  577. lang = "Chinese.";
  578. } else if (this.languageSetting == 1) {
  579. lang = "Traditional Chinese.";
  580. } else if (this.languageSetting == 2) {
  581. lang = "English.";
  582. }
  583. return lang;
  584. },
  585. getLang2() {
  586. let lang = "";
  587. if (this.languageSetting == 0) {
  588. lang = "中文。";
  589. } else if (this.languageSetting == 1) {
  590. lang = "繁体中文。";
  591. } else if (this.languageSetting == 2) {
  592. lang = "英文。";
  593. }
  594. return lang;
  595. },
  596. cancelJ(string) {
  597. this.$emit("setIsQuote", string);
  598. },
  599. promptTit() {
  600. if (!this.loading && !this.courseText) {
  601. this.$message({
  602. message: this.lang.ssEnterWantKnowPls,
  603. type: "warning"
  604. });
  605. } else {
  606. this.$message({
  607. message: this.lang.ssAnswerFinishSend,
  608. type: "warning"
  609. });
  610. }
  611. },
  612. quickAdd(type){
  613. if(this.faloading){
  614. this.$message.error(this.lang.ssWaitAnswerSend)
  615. return
  616. }
  617. if(!this.viedoText){
  618. this.$message.error(this.lang.ssRecordAudioSend)
  619. return
  620. }
  621. this.faloading = true;
  622. let content = ''
  623. let string = ''
  624. if(type == 'start'){
  625. content = '追加议题'
  626. string = `## 转文本内容
  627. ${this.viedoText}
  628. ## 要求
  629. 根据<转文本内容>中的内容实现以下要求:${content}`
  630. }else if(type == 'recordCheckJindu'){
  631. content = '总结讨论'
  632. string = `## 转文本内容
  633. ${this.viedoText}
  634. ## 议程和问题引导
  635. ${this.viedoText}
  636. ## 要求
  637. ${this.recordCheckJindu}`
  638. }else if(type == 'recordCourseD'){
  639. content = '总结并生成课程概况'
  640. string = `## 课程信息
  641. ${this.courseInfo}
  642. ## 要求
  643. ${this.recordCourseD}
  644. ## 讨论
  645. ${this.viedoText}`
  646. }
  647. let _uuid = uuidv4();
  648. this.array.push({
  649. role: "user",
  650. content: `${content}`,
  651. uid: _uuid,
  652. AI: "AI",
  653. aiContent: "",
  654. oldContent: "",
  655. isShowSynchronization: false,
  656. filename: "",
  657. index: this.array.length,
  658. is_mind_map: false,
  659. createtime: new Date().toLocaleString().replaceAll("/", "-"),
  660. loading: true,
  661. chatType: type
  662. });
  663. // 注意:输出语言为${this.getLang2()}
  664. let _replaceText = `NOTICE
  665. Language: ${this.getLang()}
  666. ${string}`;
  667. this.$nextTick(() => {
  668. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  669. });
  670. let params = {
  671. assistant_id: this.agentid,
  672. userId: this.userid,
  673. message: _replaceText,
  674. session_name: this.continuous ? `${this.courseId}-courseDetail` : uuidv4(),
  675. uid: _uuid,
  676. model: this.agentJSON.model,
  677. sound_url: "",
  678. file_ids: this.agentJSON.model.includes('qwen') ? [] : [...this.fileids],//...this.fileids
  679. // model: "gpt-4o-2024-11-20"
  680. // model: "qwen-plus"
  681. };
  682. this.ajax
  683. .post(`${this.agentJSON.url.includes("llm") ? this.agentJSON.url+'/agent' : this.agentJSON.url}/ai_agent_park_chat_new`, params)
  684. .then(res => {
  685. if (
  686. converter(res.data.FunctionResponse.result) ==
  687. converter("发送成功")
  688. ) {
  689. } else {
  690. this.$message.warning(res.data.FunctionResponse.result);
  691. }
  692. })
  693. .catch(err => {
  694. console.log(err);
  695. });
  696. this.getAtAuContent2(_uuid);
  697. this.saveUid = _uuid;
  698. this.courseText = "";
  699. },
  700. addContent() {
  701. if (this.courseText.trim().length == 0)
  702. return this.$message.error(this.lang.ssEnterContent);
  703. if(this.faloading){
  704. this.$message.error(this.lang.ssWaitAnswerSend)
  705. return
  706. }
  707. let message = this.courseText;
  708. if (this.courseText) {
  709. let msg = ``;
  710. if (this.checkArray.length) {
  711. msg = `
  712. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".`;
  713. let task = [];
  714. if (this.part == this.lang.ssAllContent) {
  715. for (var i = 0; i < this.checkArray.length; i++) {
  716. let _index = this.checkArray[i];
  717. task.push(this.course[_index]);
  718. }
  719. } else if (this.part == this.lang.ssTaskDesign) {
  720. for (var i = 0; i < this.checkArray.length; i++) {
  721. let _index = this.checkArray[i];
  722. task.push(this.course[_index]);
  723. }
  724. } else if (this.part == this.lang.ssEvalDesign) {
  725. for (var i = 0; i < this.checkArray.length; i++) {
  726. let _index = this.checkArray[i];
  727. task.push(this.course[_index].eList);
  728. }
  729. }
  730. msg += `
  731. ## 修改内容
  732. ${JSON.stringify(task)}
  733. `;
  734. msg += `
  735. ## 要求
  736. ${this.courseText}
  737. `;
  738. message = msg;
  739. }
  740. if(this.viedoText){
  741. let msg = ``;
  742. msg += `
  743. ## 引用内容
  744. ${this.viedoText}
  745. `;
  746. msg += `
  747. ## 要求
  748. ${this.courseText}
  749. `;
  750. message = msg;
  751. }
  752. // 这里处理@的角色
  753. let _atRoleList = [];
  754. let _roleList = [...this.roleList, ...this.publicRoleList];
  755. _roleList.forEach(i => {
  756. if (message.indexOf(`@${i.assistantName}`) != -1) {
  757. _atRoleList.push(i);
  758. }
  759. });
  760. this.faloading = true;
  761. if (_atRoleList.length > 0) {
  762. //有@角色
  763. let _replaceText = `NOTICE
  764. Language: ${this.getLang()}
  765. ${message}`;
  766. let _htmlText = message;
  767. _atRoleList.forEach(_i => {
  768. _replaceText = _replaceText.replaceAll(`@${_i.assistantName}`, ``);
  769. _htmlText = _htmlText.replaceAll(
  770. `@${_i.assistantName}`,
  771. `<span class='aite-name'>@${_i.assistantName}</span>`
  772. );
  773. });
  774. _atRoleList.forEach((_item, _index) => {
  775. const _uid = uuidv4();
  776. if (_index == 0) {
  777. this.array.push({
  778. loading: true,
  779. role: "user",
  780. content: _htmlText,
  781. uid: _uid,
  782. AI: "AI",
  783. aiContent: "",
  784. oldContent: "",
  785. isShowSynchronization: false,
  786. filename: _item.assistantName,
  787. index: this.array.length,
  788. is_mind_map: false,
  789. fileid: _item.headUrl,
  790. createtime: new Date().toLocaleString().replaceAll("/", "-")
  791. });
  792. } else {
  793. this.array.push({
  794. loading: true,
  795. role: "user",
  796. content: "",
  797. uid: _uid,
  798. AI: "AI",
  799. aiContent: "",
  800. oldContent: "",
  801. isShowSynchronization: false,
  802. filename: _item.assistantName,
  803. index: this.array.length,
  804. is_mind_map: false,
  805. fileid: _item.headUrl,
  806. createtime: new Date().toLocaleString().replaceAll("/", "-")
  807. });
  808. }
  809. this.$nextTick(() => {
  810. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  811. });
  812. let params = {
  813. assistant_id: _item.assistant_id,
  814. userId: this.userid,
  815. message: _replaceText,
  816. session_name: `${this.courseId}-courseDetail`,
  817. uid: _uid,
  818. file_ids: [...this.fileids],
  819. model: "gpt-4o-2024-11-20"
  820. // model: "qwen-plus"
  821. };
  822. this.ajax
  823. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
  824. .then(res => {
  825. if (
  826. converter(res.data.FunctionResponse.result) ==
  827. converter("发送成功")
  828. ) {
  829. } else {
  830. this.$message.warning(res.data.FunctionResponse.result);
  831. }
  832. })
  833. .catch(err => {
  834. console.log(err);
  835. });
  836. this.getAtAuContent(_uid);
  837. this.saveUid = _uid;
  838. });
  839. this.courseText = "";
  840. } else {
  841. let _uuid = uuidv4();
  842. this.array.push({
  843. role: "user",
  844. content: `${this.courseText}`,
  845. uid: _uuid,
  846. AI: "AI",
  847. aiContent: "",
  848. oldContent: "",
  849. isShowSynchronization: false,
  850. filename: "",
  851. index: this.array.length,
  852. is_mind_map: false,
  853. createtime: new Date().toLocaleString().replaceAll("/", "-"),
  854. loading: true
  855. });
  856. let history = [];
  857. // if (this.continuous) {
  858. // this.array.forEach((i, index) => {
  859. // if (i.content)
  860. // history.push({
  861. // role: "user",
  862. // content: index == this.array.length - 1 ? `NOTICE
  863. // Language: ${this.getLang()}
  864. // ${message}` : `NOTICE
  865. // Language: ${this.getLang()}
  866. // ${i.content}`
  867. // });
  868. // if (i.aiContent)
  869. // history.push({ role: "assistant", content: i.aiContent });
  870. // });
  871. // } else {
  872. // history.push({ role: "user", content: message });
  873. // }
  874. // history = history.filter(
  875. // i =>
  876. // i.content !=
  877. // this.agentJSON.start
  878. // );
  879. // history = history.map(i => ({
  880. // role: i.role,
  881. // content: `NOTICE
  882. // Language: ${this.getLang()}
  883. // ${i.content}`
  884. // }));
  885. let _replaceText = `NOTICE
  886. Language: ${this.getLang()}
  887. ${message}`;
  888. this.$nextTick(() => {
  889. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  890. });
  891. let params = {
  892. assistant_id: this.agentid,
  893. userId: this.userid,
  894. message: _replaceText,
  895. session_name: this.continuous ? `${this.courseId}-courseDetail` : uuidv4(),
  896. model: this.agentJSON.model,
  897. sound_url: "",
  898. uid: _uuid,
  899. file_ids: this.agentJSON.model.includes('qwen') ? [] : [...this.fileids],//...this.fileids
  900. // model: "gpt-4o-2024-11-20"
  901. // model: "qwen-plus"
  902. };
  903. this.ajax
  904. .post(`${this.agentJSON.url.includes("llm") ? this.agentJSON.url+'/agent' : this.agentJSON.url}/ai_agent_park_chat_new`, params)
  905. .then(res => {
  906. if (
  907. converter(res.data.FunctionResponse.result) ==
  908. converter("发送成功")
  909. ) {
  910. } else {
  911. this.$message.warning(res.data.FunctionResponse.result);
  912. }
  913. })
  914. .catch(err => {
  915. console.log(err);
  916. });
  917. this.getAtAuContent2(_uuid);
  918. this.saveUid = _uuid;
  919. this.courseText = "";
  920. // let params = JSON.stringify({
  921. // // model: "gpt-3.5-turbo",
  922. // // model: "gpt-4o-2024-11-20",
  923. // model: "qwen-plus",
  924. // temperature: 0,
  925. // max_tokens: 4096,
  926. // top_p: 1,
  927. // frequency_penalty: 0,
  928. // presence_penalty: 0,
  929. // messages: history,
  930. // uid: _uuid,
  931. // mind_map_question: ""
  932. // });
  933. // this.courseText = "";
  934. // this.ajax
  935. // .post("https://gpt4.cocorobo.cn/chat", params)
  936. // .then(res => {
  937. // if (
  938. // converter(res.data.FunctionResponse.result) ==
  939. // converter("发送成功")
  940. // ) {
  941. // } else {
  942. // this.$message.warning(res.data.FunctionResponse.result);
  943. // }
  944. // })
  945. // .catch(e => {
  946. // console.log(e);
  947. // });
  948. // this.getAiContent(_uuid);
  949. // this.saveUid = _uuid;
  950. }
  951. }
  952. },
  953. getAiContent(_uid) {
  954. this.fasource = new EventSource(
  955. `https://gpt4.cocorobo.cn/stream/${_uid}`
  956. ); //http://gpt4.cocorobo.cn:8011/stream/ https://gpt4.cocorobo.cn/stream/
  957. let _allText = "";
  958. let _mdText = "";
  959. const md = new MarkdownIt();
  960. this.fasource.onmessage = _e => {
  961. if (_e.data.replace("'", "").replace("'", "") == "[DONE]") {
  962. //对话已经完成
  963. _mdText = _mdText.replace("_", "");
  964. this.fasource.close();
  965. this.fasource = null;
  966. this.$nextTick(() => {
  967. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  968. });
  969. this.array.find(i => i.uid == _uid).aiContent = _mdText;
  970. this.array.find(i => i.uid == _uid).isalltext = true;
  971. this.array.find(i => i.uid == _uid).isShowSynchronization = true;
  972. this.array.find(i => i.uid == _uid).loading = false;
  973. // 这里保存对话
  974. if (this.courseId) {
  975. this.insertChat(_uid);
  976. }
  977. return;
  978. } else {
  979. //对话还在继续
  980. let _text = "";
  981. _text = _e.data.replaceAll("'", "");
  982. if (_allText == "") {
  983. _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
  984. } else {
  985. _allText += _text;
  986. }
  987. _mdText = _allText + "_";
  988. _mdText = _mdText.replace(/\\n/g, "\n");
  989. _mdText = _mdText.replace(/\\/g, "");
  990. if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
  991. //转化返回的回复流数据
  992. _mdText = md.render(_mdText);
  993. this.array.find(i => i.uid == _uid).aiContent = _mdText;
  994. this.array.find(i => i.uid == _uid).loading = false;
  995. this.$nextTick(() => {
  996. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  997. });
  998. // 处理流数据
  999. }
  1000. };
  1001. },
  1002. getAtAuContent(_uid) {
  1003. this.fasource = new EventSource(
  1004. `https://gpt4.cocorobo.cn/question/${_uid}`
  1005. ); //http://gpt4.cocorobo.cn:8011/question/ https://gpt4.cocorobo.cn/question/
  1006. let _allText = "";
  1007. let _mdText = "";
  1008. const md = new MarkdownIt();
  1009. this.fasource.onmessage = _e => {
  1010. let _eData = JSON.parse(_e.data);
  1011. if (_eData.content.replace("'", "").replace("'", "") == "[DONE]") {
  1012. let _result = [];
  1013. if ("result" in _eData) {
  1014. _result = _eData.result;
  1015. for (let i = 0; i < _result.length; i++) {
  1016. _mdText = _mdText.replace(_result[i].text, _result[i].fileName);
  1017. }
  1018. }
  1019. _mdText = _mdText.replace("_", "");
  1020. this.array.find(i => i.uid == _uid).aiContent = _mdText;
  1021. this.array.find(i => i.uid == _uid).isalltext = true;
  1022. this.array.find(i => i.uid == _uid).isShowSynchronization = true;
  1023. this.array.find(i => i.uid == _uid).loading = false;
  1024. this.$nextTick(() => {
  1025. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  1026. });
  1027. this.fasource.close();
  1028. this.fasource = null;
  1029. if (this.courseId) {
  1030. this.insertChat(_uid);
  1031. }
  1032. } else {
  1033. let _text = _eData.content.replace("'", "").replace("'", "");
  1034. if (_allText == "") {
  1035. _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
  1036. } else {
  1037. _allText += _text;
  1038. }
  1039. _mdText = _allText + "_";
  1040. _mdText = _mdText.replace(/\\n/g, "\n");
  1041. _mdText = _mdText.replace(/\\/g, "");
  1042. if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
  1043. //转化返回的回复流数据
  1044. _mdText = md.render(_mdText);
  1045. this.array.find(i => i.uid == _uid).aiContent = _mdText;
  1046. this.array.find(i => i.uid == _uid).loading = false;
  1047. this.$nextTick(() => {
  1048. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  1049. });
  1050. // 处理流数据
  1051. }
  1052. };
  1053. },
  1054. getAtAuContent2(_uid) {
  1055. this.fasource = new EventSource(
  1056. `${this.agentJSON.url}/question/${_uid}`
  1057. ); //http://gpt4.cocorobo.cn:8011/question/ https://gpt4.cocorobo.cn/question/
  1058. let _allText = "";
  1059. let _mdText = "";
  1060. const md = new MarkdownIt();
  1061. this.fasource.onmessage = _e => {
  1062. let _eData = JSON.parse(_e.data);
  1063. if (_eData.content.replace("'", "").replace("'", "") == "[DONE]") {
  1064. let _result = [];
  1065. if ("result" in _eData) {
  1066. _result = _eData.result;
  1067. for (let i = 0; i < _result.length; i++) {
  1068. _mdText = _mdText.replace(_result[i].text, _result[i].fileName);
  1069. }
  1070. }
  1071. _mdText = _mdText.replace("_", "");
  1072. this.array.find(i => i.uid == _uid).aiContent = _mdText;
  1073. this.array.find(i => i.uid == _uid).isalltext = true;
  1074. this.array.find(i => i.uid == _uid).isShowSynchronization = true;
  1075. this.array.find(i => i.uid == _uid).loading = false;
  1076. this.$nextTick(() => {
  1077. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  1078. });
  1079. this.fasource.close();
  1080. this.fasource = null;
  1081. if (this.courseId) {
  1082. this.insertChat(_uid);
  1083. }
  1084. } else {
  1085. let _text = _eData.content.replace("'", "").replace("'", "");
  1086. if (_allText == "") {
  1087. _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
  1088. } else {
  1089. _allText += _text;
  1090. }
  1091. _mdText = _allText + "_";
  1092. _mdText = _mdText.replace(/\\n/g, "\n");
  1093. _mdText = _mdText.replace(/\\/g, "");
  1094. if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
  1095. //转化返回的回复流数据
  1096. _mdText = md.render(_mdText);
  1097. this.array.find(i => i.uid == _uid).aiContent = _mdText;
  1098. this.array.find(i => i.uid == _uid).loading = false;
  1099. this.$nextTick(() => {
  1100. this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  1101. });
  1102. // 处理流数据
  1103. }
  1104. };
  1105. },
  1106. async getUserName() {
  1107. let params = { uid: this.userid };
  1108. try {
  1109. let res = await this.ajax.get(
  1110. this.$store.state.api + "getUser",
  1111. params
  1112. );
  1113. this.username = res.data[0][0].name;
  1114. } catch (err) {
  1115. console.error(err);
  1116. }
  1117. },
  1118. //保存消息
  1119. async insertChat(_uid) {
  1120. let _data = this.array.find(i => i.uid == _uid);
  1121. this.saveUid = "";
  1122. this.faloading = false;
  1123. if (!this.username) {
  1124. await this.getUserName();
  1125. }
  1126. if (!_data) return;
  1127. let params = {
  1128. userId: this.userid,
  1129. userName: this.username,
  1130. groupId: "602def61-005d-11ee-91d8-005056b8q12w",
  1131. answer: _data.aiContent,
  1132. problem: _data.content,
  1133. file_id: _data.fileid ? _data.fileid : "",
  1134. alltext: _data.aiContent,
  1135. type: "chat",
  1136. filename: _data.filename,
  1137. session_name: `${this.courseId}-courseDetail` //这是对话记录位置
  1138. };
  1139. await this.ajax.post("https://gpt4.cocorobo.cn/insert_chat", params).then(res => {});
  1140. },
  1141. getAgent(){
  1142. return new Promise((resolve, reject) => {
  1143. let params = {
  1144. id: this.agentid
  1145. };
  1146. this.ajax
  1147. .post("https://gpt4.cocorobo.cn/get_ai_agent_assistant_id", params)
  1148. .then(res => {
  1149. let _data = JSON.parse(res.data.FunctionResponse.result);
  1150. console.log(res);
  1151. if (_data.length > 0) {
  1152. this.agentJSON = {
  1153. model: _data[0].modelType == 'GPT' ? "gpt-4o-2024-11-20" : _data[0].modelType,
  1154. url: _data[0].modelType.includes('qwen') ? 'https://llm.cocorobo.cn' : 'https://gpt4.cocorobo.cn',
  1155. start: _data[0].prologue ? _data[0].prologue : this.lang.ssHelloAssistant
  1156. }
  1157. }
  1158. resolve();
  1159. })
  1160. .catch(err => {
  1161. console.log(err);
  1162. resolve();
  1163. });
  1164. });
  1165. },
  1166. // 获取对应的聊天记录
  1167. getChatList() {
  1168. return new Promise(async (resolve, reject) => {
  1169. if(!this.agentJSON.model){ await this.getAgent() }
  1170. if (this.loading) return;
  1171. this.array = [];
  1172. this.loading = true;
  1173. let params = {
  1174. userid: this.userid,
  1175. groupid: "602def61-005d-11ee-91d8-005056b8q12w",
  1176. // session_name:``
  1177. session_name: `${this.courseId}-courseDetail`
  1178. };
  1179. this.ajax
  1180. .post("https://gpt4.cocorobo.cn/get_agent_park_chat", params)
  1181. .then(async res => {
  1182. let _data = JSON.parse(res.data.FunctionResponse).response;
  1183. if (_data.length > 0) {
  1184. let _chatList = [];
  1185. for (let i = 0; i < _data.length; i++) {
  1186. _chatList.push({
  1187. loading: false,
  1188. role: "user",
  1189. content: _data[i].problem,
  1190. uid: _data[i].id,
  1191. AI: "AI",
  1192. aiContent: _data[i].answer,
  1193. oldContent: _data[i].answer,
  1194. isShowSynchronization: false,
  1195. filename: _data[i].filename,
  1196. index: i,
  1197. is_mind_map: false,
  1198. fileid: _data[i].fileid,
  1199. createtime: _data[i].createtime,
  1200. isalltext: true
  1201. });
  1202. }
  1203. this.array = _chatList;
  1204. this.loading = false;
  1205. } else {
  1206. let _uid = uuidv4();
  1207. let _chatList = [];
  1208. _chatList.push({
  1209. loading: false,
  1210. role: "",
  1211. content: "",
  1212. uid: _uid,
  1213. AI: "AI",
  1214. aiContent: this.agentJSON.start,
  1215. oldContent: this.agentJSON.start,
  1216. isShowSynchronization: false,
  1217. filename: "",
  1218. index: 0,
  1219. is_mind_map: false,
  1220. fileid: "",
  1221. createtime: new Date().toLocaleString().replaceAll("/", "-"),
  1222. chatType: 'start',
  1223. isalltext: true
  1224. });
  1225. this.array = _chatList;
  1226. if (this.courseId) {
  1227. await this.insertChat(_uid);
  1228. }
  1229. if(this.recordstart){
  1230. let _uid2 = uuidv4();
  1231. const md = new MarkdownIt();
  1232. _chatList.push({
  1233. loading: false,
  1234. role: "",
  1235. content: "",
  1236. uid: _uid2,
  1237. AI: "AI",
  1238. aiContent: md.render(this.recordstart),
  1239. oldContent: md.render(this.recordstart),
  1240. isShowSynchronization: false,
  1241. filename: "",
  1242. index: 0,
  1243. is_mind_map: false,
  1244. fileid: "",
  1245. createtime: new Date().toLocaleString().replaceAll("/", "-"),
  1246. chatType: 'recordstart',
  1247. isalltext: true
  1248. });
  1249. if (this.courseId) {
  1250. await this.insertChat(_uid2);
  1251. }
  1252. }
  1253. //没有对话记录
  1254. this.loading = false;
  1255. }
  1256. resolve();
  1257. })
  1258. .catch(err => {
  1259. console.log(err);
  1260. this.$message.error(this.lang.ssGetChatFail);
  1261. this.loading = false;
  1262. resolve();
  1263. });
  1264. });
  1265. },
  1266. addTask(index) {
  1267. if (this.checkArray.indexOf(index) !== -1) {
  1268. this.checkArray.splice(this.checkArray.indexOf(index), 1);
  1269. } else {
  1270. this.checkArray.push(index);
  1271. }
  1272. console.log(index);
  1273. },
  1274. addAllTask() {
  1275. if (this.checkArray.length === this.course.length) {
  1276. this.checkArray = [];
  1277. } else {
  1278. this.checkArray = [];
  1279. this.course.forEach((item, index) => {
  1280. this.checkArray.push(index);
  1281. });
  1282. }
  1283. },
  1284. checkPart(name) {
  1285. this.part = name;
  1286. },
  1287. inputChange() {
  1288. if (this.courseText.at(-1) == "@") {
  1289. this.showRoleList = true;
  1290. }
  1291. if (this.courseText.at(-1) == "/") {
  1292. console.log("哇卡ka2");
  1293. }
  1294. this.$nextTick(() => {
  1295. this.$refs.textareaRef.style.height = "35px";
  1296. this.$refs.textareaRef.style.height =
  1297. this.$refs.textareaRef.scrollHeight + "px";
  1298. this.textareaHeight = this.$refs.textareaRef.style.height;
  1299. });
  1300. },
  1301. textareaKeydown(_e) {
  1302. if (this.showRoleList && this.choseRoleList.length > 0) {
  1303. console.log(_e.keyCode);
  1304. switch (_e.keyCode) {
  1305. case 38: //小键盘上
  1306. _e.preventDefault();
  1307. if (this.choseRoleItem == 0) return;
  1308. this.choseRoleItem--;
  1309. // 修改滚动条高度
  1310. this.$refs.roleListRef.scrollTo({
  1311. top:
  1312. this.$refs[`roleItem${this.choseRoleItem}Ref`][0].offsetTop -
  1313. 10,
  1314. behavior: "smooth"
  1315. });
  1316. // this.$refs.roleListRef.scrollTop = this.choseRoleItem * 107;
  1317. break;
  1318. case 40: //小键盘下
  1319. _e.preventDefault();
  1320. if (this.choseRoleItem == this.choseRoleList.length - 1) return;
  1321. this.choseRoleItem++;
  1322. this.$refs.roleListRef.scrollTo({
  1323. top:
  1324. this.$refs[`roleItem${this.choseRoleItem}Ref`][0].offsetTop -
  1325. 10,
  1326. behavior: "smooth"
  1327. });
  1328. // this.$refs.roleListRef.scrollTop = this.choseRoleItem * 107;
  1329. break;
  1330. case 13: //回车
  1331. _e.preventDefault();
  1332. this.choseRole(this.choseRoleList[this.choseRoleItem]);
  1333. break;
  1334. }
  1335. } else if (_e.key === "Enter") {
  1336. _e.preventDefault();
  1337. if (_e.shiftKey) {
  1338. this.courseText += "\n";
  1339. } else {
  1340. this.addContent();
  1341. }
  1342. }
  1343. },
  1344. clear() {
  1345. this.$confirm(this.lang.ssClearChatConfirm, this.lang.ssTip, {
  1346. confirmButtonText: this.lang.ssConfirm,
  1347. cancelButtonText: this.lang.ssCancel,
  1348. type: "warning"
  1349. })
  1350. .then(_ => {
  1351. this.loading = true;
  1352. let params = {
  1353. user_id: this.userid,
  1354. id: "602def61-005d-11ee-91d8-005056b8q12w",
  1355. session_name: `${this.courseId}-courseDetail`
  1356. };
  1357. this.ajax
  1358. .post("https://gpt4.cocorobo.cn/delete_park_session", params)
  1359. .then(res => {
  1360. this.array = [];
  1361. this.$message.success(this.lang.ssClearChatSuccess);
  1362. this.loading = false;
  1363. this.getChatList()
  1364. })
  1365. .catch(err => {
  1366. this.loading = false;
  1367. this.$message.error(this.lang.ssClearChatFail);
  1368. });
  1369. })
  1370. .catch(_ => {});
  1371. },
  1372. getRoleList() {
  1373. this.roleList = [];
  1374. let params = {
  1375. userId: this.userid
  1376. };
  1377. this.ajax
  1378. .post("https://gpt4.cocorobo.cn/get_ai_agent_assistant_list", params)
  1379. .then(res => {
  1380. let _data = res.data.FunctionResponse.result;
  1381. if (_data) {
  1382. this.roleList = JSON.parse(_data);
  1383. }
  1384. })
  1385. .catch(e => {
  1386. console.log(e);
  1387. // this.$message.error("获取角色列表失败");
  1388. this.roleList = [];
  1389. });
  1390. },
  1391. getPublicRoleList() {
  1392. this.publicRoleList = [];
  1393. let params = {
  1394. userId: this.userid,
  1395. organizeid: this.oid
  1396. };
  1397. this.ajax
  1398. .post(
  1399. "https://gpt4.cocorobo.cn/get_ai_agent_assistant_share_list",
  1400. params
  1401. )
  1402. .then(res => {
  1403. let _data = res.data.FunctionResponse.result;
  1404. if (_data) {
  1405. this.publicRoleList = JSON.parse(_data);
  1406. }
  1407. })
  1408. .catch(e => {
  1409. this.publicRoleList = [];
  1410. console.log(e);
  1411. // console.log("获取公共角色失败", e);
  1412. });
  1413. },
  1414. choseRole(item) {
  1415. let _lastAtIndex = this.courseText.lastIndexOf("@");
  1416. this.courseText = `${this.courseText.slice(0, _lastAtIndex)}@${
  1417. item.assistantName
  1418. } `;
  1419. this.$refs.textareaRef.focus();
  1420. this.showRoleList = false;
  1421. },
  1422. onCopy(content) {
  1423. const turndownService = new TurndownService();
  1424. // 添加自定义规则来处理表格
  1425. turndownService.addRule("table", {
  1426. filter: "table",
  1427. replacement: (content, node) => {
  1428. const rows = node.querySelectorAll("tr");
  1429. let markdown = "";
  1430. rows.forEach(row => {
  1431. const cells = row.querySelectorAll("th, td");
  1432. const rowMarkdown = Array.from(cells)
  1433. .map(cell => cell.textContent)
  1434. .join(" | ");
  1435. markdown += `| ${rowMarkdown} |\n`;
  1436. if (cells && cells.length && cells[0].tagName == "TH") {
  1437. let a = Array.from(cells)
  1438. .map(cell => "")
  1439. .join(" --- |");
  1440. markdown += `| --- |${a}\n`;
  1441. }
  1442. });
  1443. // 添加分隔行
  1444. // markdown = markdown.replace(/^/, '| --- |\n');
  1445. return markdown;
  1446. }
  1447. });
  1448. // 创建临时textarea元素
  1449. const tempInput = document.createElement("textarea");
  1450. tempInput.value = turndownService.turndown(content); // 设置要复制的内容
  1451. // 隐藏元素
  1452. tempInput.style.position = "absolute";
  1453. tempInput.style.left = "-9999px";
  1454. // 将元素添加到DOM中
  1455. document.body.appendChild(tempInput);
  1456. // 选中元素内容
  1457. tempInput.select();
  1458. // 执行复制操作
  1459. document.execCommand("copy");
  1460. // 移除临时元素
  1461. document.body.removeChild(tempInput);
  1462. this.$message({
  1463. message: this.lang.ssCopySuccess,
  1464. type: "success"
  1465. });
  1466. },
  1467. setCourseText(content){
  1468. const turndownService = new TurndownService();
  1469. // 添加自定义规则来处理表格
  1470. turndownService.addRule("table", {
  1471. filter: "table",
  1472. replacement: (content, node) => {
  1473. const rows = node.querySelectorAll("tr");
  1474. let markdown = "";
  1475. rows.forEach(row => {
  1476. const cells = row.querySelectorAll("th, td");
  1477. const rowMarkdown = Array.from(cells)
  1478. .map(cell => cell.textContent)
  1479. .join(" | ");
  1480. markdown += `| ${rowMarkdown} |\n`;
  1481. if (cells && cells.length && cells[0].tagName == "TH") {
  1482. let a = Array.from(cells)
  1483. .map(cell => "")
  1484. .join(" --- |");
  1485. markdown += `| --- |${a}\n`;
  1486. }
  1487. });
  1488. // 添加分隔行
  1489. // markdown = markdown.replace(/^/, '| --- |\n');
  1490. return markdown;
  1491. }
  1492. });
  1493. // 创建临时textarea元素
  1494. let _content = turndownService.turndown(content); // 设置要复制的内容
  1495. // 新增的确认提示框
  1496. if (this.courseText2) {
  1497. this.$confirm(this.lang.ssCourseBriefHas, this.lang.ssTip, {
  1498. confirmButtonText: this.lang.ssConfirm,
  1499. cancelButtonText: this.lang.ssCancel,
  1500. type: 'warning'
  1501. }).then(() => {
  1502. this.updatCourse(_content)
  1503. this.$message.success(this.lang.ssAdoptSuccess);
  1504. }).catch(() => {
  1505. });
  1506. } else {
  1507. this.updatCourse(_content)
  1508. this.$message.success(this.lang.ssAdoptSuccess);
  1509. }
  1510. },
  1511. updatCourse(content){
  1512. let _content = content+='*0*%*'
  1513. this.$emit('update:courseText2', _content);
  1514. setTimeout(() => {
  1515. this.$emit('update:courseText2', _content.replaceAll("*0*%*", ""));
  1516. }, 0);
  1517. },
  1518. stopSend() {
  1519. if (this.fasource) {
  1520. this.fasource.close();
  1521. if (this.array[this.array.length - 1].content == "wanSearch") {
  1522. this.array.pop();
  1523. }
  1524. this.array.find(i => i.uid == this.saveUid).loading = false;
  1525. this.faloading = false;
  1526. this.fasource = null;
  1527. this.insertChat(this.saveUid);
  1528. }
  1529. },
  1530. changeVoice(flag) {
  1531. this.isVoice = flag;
  1532. },
  1533. startVoice() {
  1534. let iiframe = this.$refs["iiframe"];
  1535. iiframe.contentWindow.window.document.getElementById(
  1536. "languageOptions"
  1537. ).selectedIndex = 2; //普通话
  1538. iiframe.contentWindow.testdoContinuousPronunciationAssessment();
  1539. this.isTalk = true;
  1540. iiframe.contentWindow.onRecognizedResult = e => {
  1541. let _msg = e.privText;
  1542. console.log(_msg);
  1543. if (_msg) this.courseText += _msg;
  1544. };
  1545. },
  1546. stopVoice() {
  1547. try {
  1548. if (!this.isTalk) return this.$message.info(this.lang.ssStartRecPls);
  1549. let iiframe = this.$refs["iiframe"];
  1550. iiframe.contentWindow.window.document
  1551. .getElementById("scenarioStopButton")
  1552. .click();
  1553. iiframe.contentWindow.onSessionStopped = (s, e) => {
  1554. this.isTalk = false;
  1555. if (this.courseText) {
  1556. this.addContent();
  1557. }
  1558. };
  1559. } catch (error) {
  1560. console.log(error);
  1561. this.isTalk = false;
  1562. if (this.courseText) {
  1563. this.addContent();
  1564. }
  1565. }
  1566. }
  1567. },
  1568. computed: {
  1569. pan() {
  1570. return content => {
  1571. try {
  1572. return JSON.parse(content);
  1573. } catch (error) {
  1574. return [];
  1575. }
  1576. };
  1577. },
  1578. courseTextLength() {
  1579. return this.courseText.length;
  1580. },
  1581. taskName() {
  1582. let task = "";
  1583. if (this.checkArray.length) {
  1584. task = this.lang.ssTask;
  1585. this.checkArray = this.checkArray.sort((a, b) => a - b);
  1586. let a = JSON.parse(JSON.stringify(this.checkArray));
  1587. for (let index = 0; index < a.length; index++) {
  1588. a[index]++;
  1589. }
  1590. task += a.join("/");
  1591. }
  1592. return task + " " + this.part;
  1593. },
  1594. choseRoleList() {
  1595. let result = [...this.roleList, ...this.publicRoleList];
  1596. const _index = this.courseText.lastIndexOf("@");
  1597. if (_index !== -1) {
  1598. let roleName = this.courseText.substring(_index + 1);
  1599. result = result.filter(i => i.assistantName.indexOf(roleName) != -1);
  1600. } else {
  1601. return [];
  1602. }
  1603. this.choseRoleItem = 0;
  1604. return result;
  1605. }
  1606. },
  1607. mounted() {
  1608. // 初始化需要从 lang 获取的数组
  1609. if (!this.course.length) {
  1610. this.course = [
  1611. { title: `${this.lang.ssTask}1` },
  1612. { title: `${this.lang.ssTask}2` },
  1613. { title: `${this.lang.ssTask}3` }
  1614. ];
  1615. }
  1616. this.partArray = [
  1617. { name: this.lang.ssAllContent },
  1618. { name: this.lang.ssTaskDesign },
  1619. { name: this.lang.ssEvalDesign }
  1620. ];
  1621. this.part = this.lang.ssAllContent;
  1622. // this.getChatList().then(_ => {
  1623. // this.$nextTick(() => {
  1624. // console.log(this.$refs.chatDialog.scrollHeight);
  1625. // this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
  1626. // });
  1627. // });
  1628. // this.getRoleList();
  1629. // this.getPublicRoleList();
  1630. // this.jArray = this.getString();
  1631. }
  1632. };
  1633. </script>
  1634. <style scoped>
  1635. .ai_body {
  1636. height: 100%;
  1637. width: calc(100%);
  1638. padding: 0 20px 10px;
  1639. box-sizing: border-box;
  1640. margin: 0 auto;
  1641. display: flex;
  1642. flex-direction: column;
  1643. }
  1644. .binfo_input {
  1645. width: 100%;
  1646. margin: 0;
  1647. padding: 12px 14px;
  1648. display: block;
  1649. min-width: 0;
  1650. outline: none;
  1651. box-sizing: border-box;
  1652. background: none;
  1653. border: none;
  1654. border-radius: 4px;
  1655. background: #fff;
  1656. font-size: 14px;
  1657. resize: none;
  1658. font-family: "Microsoft YaHei";
  1659. min-height: 48px;
  1660. /* border: 1px solid #3682fc00; */
  1661. border: 1.5px solid #cad1dc;
  1662. }
  1663. .binfo_textarea {
  1664. border: 1.5px solid #cad1dc;
  1665. font-size: 14px;
  1666. resize: none;
  1667. /* background: #f6f6f6; */
  1668. font-family: "Microsoft YaHei";
  1669. }
  1670. .binfo_textarea::-webkit-scrollbar {
  1671. /*滚动条整体样式*/
  1672. width: 6px;
  1673. /*高宽分别对应横竖滚动条的尺寸*/
  1674. height: 6px;
  1675. }
  1676. /*定义滚动条轨道 内阴影+圆角*/
  1677. .binfo_textarea::-webkit-scrollbar-track {
  1678. border-radius: 10px;
  1679. background-color: rgba(0, 0, 0, 0.1);
  1680. }
  1681. /*定义滑块 内阴影+圆角*/
  1682. .binfo_textarea::-webkit-scrollbar-thumb {
  1683. border-radius: 10px;
  1684. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1685. background-color: rgba(0, 0, 0, 0.1);
  1686. }
  1687. .binfo_input:focus-visible {
  1688. border: 1.5px solid #3681fc !important;
  1689. }
  1690. .ai_body_input {
  1691. position: relative;
  1692. display: flex;
  1693. margin-top: auto;
  1694. width: 100%;
  1695. /* height: auto; */
  1696. /* max-height: 80vh; */
  1697. justify-content: space-between;
  1698. align-items: flex-end;
  1699. border-radius: 10px;
  1700. border: 1.5px solid #3681fc !important;
  1701. /* padding: 10px;
  1702. padding-top: 20px; */
  1703. /* overflow: auto; */
  1704. }
  1705. .ai_b_i_btnArea {
  1706. width: calc(100% - 10px);
  1707. position: absolute;
  1708. bottom: calc(100% + 5px);
  1709. height: 30px;
  1710. display: flex;
  1711. /* justify-content: space-between; */
  1712. }
  1713. .ai_b_i_btnArea > div {
  1714. display: flex;
  1715. align-items: center;
  1716. }
  1717. .ai_b_i_btnArea > div > span {
  1718. margin-left: 5px;
  1719. cursor: pointer;
  1720. }
  1721. .ai_b_i_btnArea > .clear + .clear {
  1722. margin-left: 10px;
  1723. }
  1724. .ai_b_i_btnArea > .clear {
  1725. box-sizing: border-box;
  1726. padding: 5px 10px;
  1727. box-sizing: border-box;
  1728. cursor: pointer;
  1729. border: solid 1px #3781fb;
  1730. border-radius: 15px;
  1731. display: flex;
  1732. font-size: 15px;
  1733. align-items: center;
  1734. justify-content: center;
  1735. background-color: #fff;
  1736. }
  1737. .ai_b_i_btnArea > .clear > svg {
  1738. width: 17px;
  1739. height: 17px;
  1740. margin-right: 5px;
  1741. fill: black;
  1742. }
  1743. .ai_b_i_btnArea > .clear:hover {
  1744. background-color: #ebf4fe;
  1745. color: #409eff;
  1746. }
  1747. .ai_b_i_btnArea > .clear:hover > svg {
  1748. fill: #409eff;
  1749. }
  1750. .ai_b_i_textListBox {
  1751. width: 100%;
  1752. height: 300px;
  1753. background-color: #fff;
  1754. position: absolute;
  1755. bottom: calc(100% + 5px);
  1756. box-sizing: border-box;
  1757. padding: 10px;
  1758. overflow: auto;
  1759. border-radius: 8px;
  1760. border: 1px solid #e7e7e7;
  1761. box-shadow: 0 4px 10px 0 rgba(29, 57, 131, 0.08),
  1762. 1px 1px 20px 4px rgba(29, 57, 131, 0.05);
  1763. display: flex;
  1764. }
  1765. .ai_b_i_tlb_left {
  1766. width: 60px;
  1767. height: 100%;
  1768. background-color: red;
  1769. }
  1770. .ai_b_i_tlb_right {
  1771. flex: 1;
  1772. height: 100%;
  1773. background-color: yellow;
  1774. }
  1775. .ai_b_i_roleListBox {
  1776. width: 100%;
  1777. height: 300px;
  1778. background-color: #fff;
  1779. position: absolute;
  1780. bottom: calc(100% + 5px);
  1781. box-sizing: border-box;
  1782. padding: 10px;
  1783. overflow: auto;
  1784. border-radius: 8px;
  1785. border: 1px solid #e7e7e7;
  1786. box-shadow: 0 4px 10px 0 rgba(29, 57, 131, 0.08),
  1787. 1px 1px 20px 4px rgba(29, 57, 131, 0.05);
  1788. }
  1789. .ai_b_i_rlb_item {
  1790. width: calc(100% - 20px);
  1791. height: auto;
  1792. padding: 10px;
  1793. background-color: #f3f7fd;
  1794. margin-bottom: 20px;
  1795. border-radius: 8px;
  1796. display: flex;
  1797. flex-direction: column;
  1798. justify-content: center;
  1799. transition: 0.3s;
  1800. cursor: pointer;
  1801. }
  1802. .ai_b_i_rlb_itemActive {
  1803. background-color: #d1d5db !important;
  1804. }
  1805. /* .ai_b_i_rlb_item:hover{
  1806. background-color: #d1d5db;
  1807. } */
  1808. .ai_b_i_rlb_itemTop {
  1809. display: flex;
  1810. }
  1811. .ai_b_i_rlb_itemTop > img {
  1812. width: 40px;
  1813. height: 40px;
  1814. margin-right: 10px;
  1815. border-radius: 100%;
  1816. overflow: hidden;
  1817. }
  1818. .ai_b_i_rlb_itemTop > div {
  1819. display: flex;
  1820. flex-direction: column;
  1821. }
  1822. .ai_b_i_rlb_itemTop > div > span {
  1823. font-size: 16px;
  1824. font-weight: bold;
  1825. }
  1826. .ai_b_i_rlb_itemTop > div > span:last-child {
  1827. font-size: 14px;
  1828. color: #999;
  1829. }
  1830. .ai_b_i_rlb_itemBottom {
  1831. margin-top: 10px;
  1832. display: flex;
  1833. }
  1834. .ai_b_i_rlb_itemBottom > span {
  1835. width: 60px;
  1836. height: 30px;
  1837. border-radius: 15px;
  1838. display: flex;
  1839. }
  1840. .ai_body_input_textarea {
  1841. flex: 1;
  1842. margin: 10px 5px 10px 5px;
  1843. min-height: 35px;
  1844. height: 35px;
  1845. max-height: 100px;
  1846. border: none;
  1847. outline: none;
  1848. resize: none;
  1849. font-size: 16px;
  1850. overflow: auto;
  1851. padding-right: 100px;
  1852. background-color: #fff !important;
  1853. }
  1854. .ai_body_input_textarea::-webkit-input-placeholder {
  1855. font-size: 16px;
  1856. /* 修改placeholder字体大小 */
  1857. color: grey;
  1858. /* 修改placeholder文字颜色 */
  1859. }
  1860. .ai_body_input_textarea::-moz-placeholder {
  1861. font-size: 16px;
  1862. /* 修改placeholder字体大小 */
  1863. color: grey;
  1864. /* 修改placeholder文字颜色 */
  1865. opacity: 1;
  1866. /* 修复Firefox的透明度问题 */
  1867. }
  1868. .ai_body_input_textarea::-moz-placeholder {
  1869. font-size: 16px;
  1870. /* 修改placeholder字体大小 */
  1871. color: grey;
  1872. /* 修改placeholder文字颜色 */
  1873. opacity: 1;
  1874. /* 修复Firefox的透明度问题 */
  1875. }
  1876. .ai_body_input_textarea::-ms-input-placeholder {
  1877. font-size: 16px;
  1878. /* 修改placeholder字体大小 */
  1879. color: grey;
  1880. /* 修改placeholder文字颜色 */
  1881. }
  1882. .ai_body_input_textarea::-webkit-scrollbar {
  1883. width: 6px;
  1884. }
  1885. .ai_body_input_textarea::-webkit-scrollbar-track {
  1886. background: #d8d9dc;
  1887. border-radius: 2px;
  1888. }
  1889. .ai_body_input_textarea::-webkit-scrollbar-thumb {
  1890. background: #c9c9c9;
  1891. border-radius: 10px;
  1892. }
  1893. .ai_body_input_textarea::-webkit-scrollbar-thumb:hover {
  1894. background: #c9c9c9;
  1895. }
  1896. .c_pub_button_confirm {
  1897. /* position: absolute;
  1898. bottom: 13px;
  1899. right: 13px; */
  1900. /* margin-top: 10px; */
  1901. width: 60px;
  1902. margin-right: 5px;
  1903. display: flex;
  1904. justify-content: center;
  1905. margin-bottom: 10px;
  1906. position: absolute;
  1907. right: 10px;
  1908. bottom: 0px;
  1909. white-space: nowrap;
  1910. border-radius: 10px;
  1911. }
  1912. .c_pub_button_confirmVoice {
  1913. width: 30px;
  1914. height: 36px;
  1915. min-width: auto;
  1916. margin-right: 5px;
  1917. display: flex;
  1918. justify-content: center;
  1919. align-items: center;
  1920. margin-bottom: 10px;
  1921. position: absolute;
  1922. right: 10px;
  1923. bottom: 0px;
  1924. white-space: nowrap;
  1925. border-radius: 10px;
  1926. background-color: #3681fc;
  1927. cursor: pointer;
  1928. padding: 0 10px;
  1929. }
  1930. .c_pub_button_confirmVoice > svg {
  1931. fill: #fff;
  1932. width: 25px;
  1933. height: 25px;
  1934. }
  1935. .c_pub_button_StopConfirmVoice {
  1936. width: 30px;
  1937. height: 36px;
  1938. min-width: auto;
  1939. margin-right: 5px;
  1940. display: flex;
  1941. justify-content: center;
  1942. align-items: center;
  1943. margin-bottom: 10px;
  1944. position: absolute;
  1945. right: 10px;
  1946. bottom: 0px;
  1947. white-space: nowrap;
  1948. border-radius: 10px;
  1949. background-color: #dde2e2;
  1950. cursor: pointer;
  1951. padding: 0 10px;
  1952. }
  1953. .c_pub_button_StopConfirmVoice > svg {
  1954. width: 25px;
  1955. height: 25px;
  1956. }
  1957. .c_voiceBtn {
  1958. width: 25px;
  1959. height: 25px;
  1960. position: absolute;
  1961. right: 85px;
  1962. bottom: 0px;
  1963. margin-bottom: 17px;
  1964. cursor: pointer;
  1965. }
  1966. .c_voiceBtn > svg {
  1967. width: 100%;
  1968. height: 100%;
  1969. }
  1970. .c_pub_button_confirmDisabled {
  1971. background-color: #aeccfe;
  1972. }
  1973. .ai_body_dialog {
  1974. padding: 10px 0;
  1975. box-sizing: border-box;
  1976. /* min-height: calc(20vh - 10px); */
  1977. /* height: calc(100%); */
  1978. overflow: auto;
  1979. margin-bottom: 10px;
  1980. }
  1981. .dialog_content {
  1982. width: 100%;
  1983. display: flex;
  1984. flex-direction: column;
  1985. }
  1986. .dialog_content > div {
  1987. display: flex;
  1988. align-items: flex-start;
  1989. width: 100%;
  1990. flex-wrap: wrap;
  1991. }
  1992. .dialog_content + .dialog_content {
  1993. margin: 15px 0;
  1994. }
  1995. .dialog_content > div .right {
  1996. flex-direction: row-reverse;
  1997. }
  1998. .dialog_content > div .right .role {
  1999. margin-right: 0;
  2000. margin-left: 10px;
  2001. }
  2002. .dialog_content > div .role {
  2003. min-width: 30px;
  2004. width: 30px;
  2005. height: 30px;
  2006. margin-right: 10px;
  2007. border-radius: 50%;
  2008. }
  2009. .dialog_content > div .role > img {
  2010. height: 100%;
  2011. width: 100%;
  2012. border-radius: 100%;
  2013. }
  2014. .dialog_content > div .content {
  2015. padding: 10px 10px;
  2016. border-radius: 2px 8px 8px 8px;
  2017. width: auto;
  2018. word-break: break-word;
  2019. box-sizing: border-box;
  2020. /* white-space: pre-line; */
  2021. max-width: calc(100% - 85px);
  2022. background: #f6f9ff;
  2023. /* overflow: hidden; */
  2024. margin: 0 10px;
  2025. position: relative;
  2026. }
  2027. .createTime {
  2028. width: 100%;
  2029. height: 20px;
  2030. position: absolute;
  2031. bottom: -25px;
  2032. left: 0;
  2033. font-size: 14px;
  2034. white-space: nowrap;
  2035. color: #919191;
  2036. }
  2037. .dialog_content > div .content2 {
  2038. background: #3681fc;
  2039. color: #fff;
  2040. border-radius: 8px 2px 8px 8px;
  2041. /* margin-left: auto; */
  2042. }
  2043. .ai_body_select {
  2044. position: relative;
  2045. }
  2046. .ai_body_select > .check {
  2047. background: #e7e7e7;
  2048. display: flex;
  2049. width: fit-content;
  2050. padding: 0 10px;
  2051. height: 30px;
  2052. border-radius: 21px;
  2053. font-size: 14px;
  2054. align-items: center;
  2055. justify-content: center;
  2056. color: #0061ff;
  2057. font-weight: 700;
  2058. margin: 10px 0;
  2059. cursor: pointer;
  2060. }
  2061. .ai_body_select > .check::before {
  2062. content: "";
  2063. width: 15px;
  2064. height: 15px;
  2065. display: block;
  2066. background-image: url("../../../assets/icon/course/aiPart.png");
  2067. background-size: 100% 100%;
  2068. margin-right: 5px;
  2069. }
  2070. .ai_body_select > .check::after {
  2071. content: "";
  2072. width: 15px;
  2073. height: 15px;
  2074. display: block;
  2075. background-image: url("../../../assets/icon/course/aiPart_arrow.png");
  2076. background-size: 100% 100%;
  2077. margin-right: 5px;
  2078. }
  2079. .ai_body_select > .isCheck {
  2080. background: #0061ff;
  2081. display: flex;
  2082. width: fit-content;
  2083. padding: 0 10px;
  2084. height: 30px;
  2085. border-radius: 21px;
  2086. font-size: 14px;
  2087. align-items: center;
  2088. justify-content: center;
  2089. color: #fff;
  2090. font-weight: 700;
  2091. margin: 10px 0;
  2092. cursor: pointer;
  2093. max-width: 100%;
  2094. box-sizing: border-box;
  2095. }
  2096. .ai_body_select > .isCheck > span {
  2097. width: calc(100% - 40px);
  2098. display: block;
  2099. overflow: hidden;
  2100. white-space: nowrap;
  2101. text-overflow: ellipsis;
  2102. }
  2103. .ai_body_select > .isCheck::before {
  2104. content: "";
  2105. width: 15px;
  2106. height: 15px;
  2107. display: block;
  2108. background-image: url("../../../assets/icon/course/aiPart_active.png");
  2109. background-size: 100% 100%;
  2110. margin-right: 5px;
  2111. }
  2112. .ai_body_select > .isCheck::after {
  2113. content: "";
  2114. width: 15px;
  2115. height: 15px;
  2116. display: block;
  2117. background-image: url("../../../assets/icon/course/aiPart_arrow_active.png");
  2118. background-size: 100% 100%;
  2119. margin-right: 5px;
  2120. }
  2121. .ai_body_select > .checkBox {
  2122. position: absolute;
  2123. bottom: 40px;
  2124. border: 1px solid #e0eafb;
  2125. width: 100%;
  2126. height: 300px;
  2127. background: #fff;
  2128. border-radius: 5px;
  2129. padding: 10px;
  2130. box-sizing: border-box;
  2131. }
  2132. .ai_body_select > .checkBox > .task > .title,
  2133. .ai_body_select > .checkBox > .part > .title {
  2134. font-size: 14px;
  2135. font-weight: 700;
  2136. margin-bottom: 5px;
  2137. }
  2138. .ai_body_select > .checkBox > .task {
  2139. height: calc(100% - 60px);
  2140. }
  2141. .ai_body_select > .checkBox > .part {
  2142. }
  2143. .ai_body_select > .checkBox > .task > .content {
  2144. height: calc(100% - 40px);
  2145. overflow: auto;
  2146. }
  2147. .ai_body_select > .checkBox > .task > .content > .span + .span {
  2148. margin-top: 5px;
  2149. }
  2150. .ai_body_select > .checkBox > .task > .content > .span {
  2151. display: flex;
  2152. align-items: center;
  2153. font-size: 14px;
  2154. cursor: pointer;
  2155. }
  2156. .ai_body_select > .checkBox > .task > .content > .span > .check {
  2157. width: 13px;
  2158. height: 13px;
  2159. display: flex;
  2160. align-items: center;
  2161. margin-right: 5px;
  2162. }
  2163. .ai_body_select > .checkBox > .task > .content > .span > .check > img {
  2164. width: 100%;
  2165. height: 100%;
  2166. }
  2167. .ai_body_select > .checkBox > .part > .content {
  2168. display: flex;
  2169. align-items: center;
  2170. font-size: 14px;
  2171. justify-content: space-between;
  2172. }
  2173. .ai_body_select > .checkBox > .part > .content > .span {
  2174. padding: 3px 6px;
  2175. border: 1px solid #e0eafb;
  2176. border-radius: 40px;
  2177. cursor: pointer;
  2178. }
  2179. .ai_body_select > .checkBox > .part > .content > .span.active {
  2180. color: #0061ff;
  2181. border-color: #0061ff;
  2182. }
  2183. .ai_b_i_jListPanel {
  2184. width: 400px;
  2185. height: 100%;
  2186. top: 0;
  2187. right: 0;
  2188. position: fixed;
  2189. /* background-color: #000; */
  2190. z-index: 990;
  2191. }
  2192. .ai_b_i_jListBox {
  2193. width: 100%;
  2194. max-height: 300px;
  2195. background-color: #fff;
  2196. position: absolute;
  2197. bottom: calc(100% + 5px);
  2198. box-sizing: border-box;
  2199. padding: 10px;
  2200. overflow: auto;
  2201. border-radius: 8px;
  2202. border: 1px solid #e7e7e7;
  2203. box-shadow: 0 4px 10px 0 rgba(29, 57, 131, 0.08),
  2204. 1px 1px 20px 4px rgba(29, 57, 131, 0.05);
  2205. z-index: 999;
  2206. }
  2207. .jlist_box {
  2208. background: #f1f1f1;
  2209. border-radius: 5px;
  2210. margin-bottom: 10px;
  2211. padding: 8px 18px 8px 8px;
  2212. box-sizing: border-box;
  2213. width: 100%;
  2214. position: relative;
  2215. }
  2216. .jlist_box .cancel {
  2217. position: absolute;
  2218. top: 8px;
  2219. right: 5px;
  2220. cursor: pointer;
  2221. font-size: 14px;
  2222. }
  2223. .jlist_box > span {
  2224. display: -webkit-box;
  2225. -webkit-box-orient: vertical;
  2226. -webkit-line-clamp: 3;
  2227. text-overflow: ellipsis;
  2228. overflow: hidden;
  2229. word-break: break-all;
  2230. }
  2231. .ai_btn_box {
  2232. min-width: fit-content;
  2233. margin-top: auto;
  2234. }
  2235. .ai_btn_box > img {
  2236. cursor: pointer;
  2237. width: 15px;
  2238. }
  2239. .ai_tips_btn_box{
  2240. width: 100%;
  2241. padding: 0 20px 0 50px;
  2242. display: flex;
  2243. flex-wrap: wrap;
  2244. margin-top: 27px;
  2245. box-sizing: border-box;
  2246. }
  2247. .ai_tips_btn_box > span{
  2248. cursor: pointer;
  2249. background: #9bc1ff;
  2250. color: #ffffff;
  2251. width: fit-content;
  2252. padding: 8px;
  2253. border-radius: 5px;
  2254. transition: all .3s;
  2255. margin-right: 5px;
  2256. }
  2257. .ai_tips_btn_box > span + span{
  2258. margin-top: 6px;
  2259. }
  2260. .ai_tips_btn_box > span:hover{
  2261. background: #3683ff;
  2262. }
  2263. </style>