report.vue 139 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100
  1. <template>
  2. <div class="layout" :class="{ 'dark-theme': isDarkTheme }">
  3. <!-- 添加密码修改弹窗组件 -->
  4. <ChangePasswordDialog
  5. v-model:visible="showPasswordDialog"
  6. />
  7. <div class="header">
  8. <div class="user-profile-bar">
  9. <div class="logo">
  10. <img
  11. src="../assets/logoa.png"
  12. alt="logo"
  13. class="logo-img"
  14. />
  15. <!-- <span>Raycos Tech</span> -->
  16. </div>
  17. <div class="user-info-bar">
  18. <!-- 添加主题切换按钮 -->
  19. <div class="theme-switch" @click="toggleTheme" :title="isDarkTheme ? '切换到浅色模式' : '切换到深色模式'">
  20. <transition name="theme-icon" mode="out-in">
  21. <img
  22. v-if="isDarkTheme"
  23. :key="isDarkTheme"
  24. src="../assets/sun2.png"
  25. alt="切换到浅色模式"
  26. class="theme-icon"
  27. />
  28. <img v-else class="theme-icon" src="../assets/night2.png" alt="切换到深色模式">
  29. </transition>
  30. </div>
  31. <div class="user-info" v-if="!isMobile" @click="toggleDropdown">
  32. <div class="user-name">商户名称:{{ userInfo.merchant_name || '未登录用户' }}</div>
  33. <div class="user-name" style="margin-left: 10px;">当前用户:{{ userInfo.username || '未登录用户' }}</div>
  34. <!-- <div class="user-role">{{ userInfo.role || '未设置角色' }}</div> -->
  35. </div>
  36. <div class="avatar" @click="toggleDropdown">
  37. <img src="../assets/avter.png" alt="用户头像" />
  38. </div>
  39. </div>
  40. <!-- Logo :draggable="false"-->
  41. <!-- 下拉菜单 -->
  42. <div class="dropdown-menu" v-show="showDropdown">
  43. <div class="dropdown-item" @click="handleModifyPassword">
  44. <i class="fas fa-key"></i>
  45. 修改密码
  46. </div>
  47. <div class="dropdown-item" @click="handleCreateInvitation">
  48. <i class="fas fa-user-plus"></i>
  49. 创建邀请
  50. </div>
  51. <div class="dropdown-item" @click="handleLogout">
  52. <i class="fas fa-sign-out-alt"></i>
  53. 退出登录
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <div
  59. class="collapse-left-button"
  60. :class="{ 'menu-collapsed': isMenuCollapsed }"
  61. @click="toggleMenu"
  62. >
  63. <img
  64. :src="isMenuCollapsed ? rightIcon : leftIcon"
  65. alt="toggle"
  66. class="collapse-icon"
  67. />
  68. </div>
  69. <div class="menu" :class="{ collapsed: isMenuCollapsed }">
  70. <!-- 添加收缩按钮 -->
  71. <!-- New Conversation 按钮 -->
  72. <button class="new-conversation-btn" @click="addNewConversation">
  73. <img class="tab-icon" src="../assets/svg/plus.svg" alt="" />
  74. <span>New Conversation</span>
  75. </button>
  76. <!-- 会话列表 -->
  77. <div class="conversation-list">
  78. <div
  79. v-for="conversation in conversations"
  80. :key="conversation.id"
  81. :class="[
  82. 'conversation-item',
  83. { active: currentConversationId === conversation.id },
  84. ]"
  85. @click="switchConversation(conversation.id)"
  86. >
  87. {{ conversation.title }}
  88. </div>
  89. </div>
  90. <!-- 添加模型配置和语音配置的容器 -->
  91. <div class="config-container">
  92. <KnowledgeConfig />
  93. <ModelConfig />
  94. <VoiceConfig />
  95. </div>
  96. </div>
  97. <div class="chat">
  98. <div class="chat-header">
  99. <h2>智能运维助手</h2>
  100. <div class="chat-status">
  101. <span class="status-indicator online"></span>
  102. <span>在线</span>
  103. </div>
  104. </div>
  105. <!-- 欢迎消息 -->
  106. <div v-if="messages.length === 0" class="welcome-section">
  107. <!-- Do you want 部分 -->
  108. <div class="suggestion-section">
  109. <h3>嗨,我是你的智能助手</h3>
  110. <div class="cards-container">
  111. <div class="suggestion-card">
  112. <div class="card-header">
  113. <img
  114. src="../assets/svg/hot-for-ux.svg"
  115. alt="hot topics"
  116. class="tab-icon"
  117. />
  118. <h4>推荐问题</h4>
  119. </div>
  120. <p class="card-subtitle">为您精选的热门问题</p>
  121. <div class="suggestion-items">
  122. <!-- Combine both QA pairs and guides -->
  123. <div
  124. v-for="(item, index) in [
  125. ...currentQaPairs,
  126. ...currentDesignGuides,
  127. ]"
  128. :key="index"
  129. class="suggestion-item"
  130. @click="handleQaClick(item)"
  131. >
  132. {{ item.question }}
  133. </div>
  134. </div>
  135. </div>
  136. <!-- Hot Topics 卡片 --><!-- Design Guide 卡片 -->
  137. <!-- <div class="suggestion-card">
  138. <div class="card-header">
  139. <img
  140. src="../assets/svg/hot-for-ux.svg"
  141. alt="hot topics"
  142. class="tab-icon"
  143. />
  144. <h4>知识库相关问题:</h4>
  145. </div>
  146. <p class="card-subtitle">我们可以这样向知识库提问</p>
  147. <div class="suggestion-items">
  148. <div
  149. v-for="(qa, index) in currentQaPairs"
  150. :key="index"
  151. class="suggestion-item"
  152. @click="handleQaClick(qa)"
  153. >
  154. {{ qa.question }}
  155. </div>
  156. </div>
  157. </div>
  158. <div class="suggestion-card">
  159. <div class="card-header">
  160. <img
  161. src="../assets/svg/read.svg"
  162. alt="hot topics"
  163. class="tab-icon"
  164. />
  165. <h4>网上热搜问答</h4>
  166. </div>
  167. <p class="card-subtitle">搜索网上的热门回答</p>
  168. <div class="suggestion-items">
  169. <div
  170. v-for="(guide, index) in currentDesignGuides"
  171. :key="index"
  172. class="suggestion-item"
  173. @click="handleQaClick(guide)"
  174. >
  175. {{ guide.question }}
  176. </div>
  177. </div>
  178. </div> -->
  179. </div>
  180. </div>
  181. </div>
  182. <!-- 修改消息列表部分 -->
  183. <div v-else class="message-list" ref="messageList">
  184. <!-- 添加流式思考步骤显示 -->
  185. <div v-if="currentThinkingSteps && currentThinkingSteps.length > 0" class="thinking-steps-stream">
  186. <div v-for="(step, index) in currentThinkingSteps"
  187. :key="index"
  188. class="thinking-step-stream"
  189. :class="[step.type, {'fade-in': true}]">
  190. {{ step.content }}
  191. <div v-if="index === currentThinkingSteps.length - 1" class="typing-indicator">
  192. <span></span>
  193. <span></span>
  194. <span></span>
  195. </div>
  196. </div>
  197. </div>
  198. <div
  199. v-for="message in messages"
  200. :key="message.id"
  201. :class="[
  202. 'message-item',
  203. message.role === 'user' ? 'user' : 'assistant',
  204. ]"
  205. >
  206. <div class="message-bubble">
  207. <div class="message-content">
  208. <!-- 添加thinking steps显示 -->
  209. <div v-if="message.thinkingSteps && message.thinkingSteps.length > 0" class="thinking-steps">
  210. <div v-for="(step, index) in message.thinkingSteps"
  211. :key="index"
  212. class="thinking-step"
  213. :class="step.type">
  214. {{ step.content }}
  215. </div>
  216. </div>
  217. <template v-if="message.role === 'user' && message.files">
  218. <div
  219. v-for="file in message.files"
  220. :key="file.name"
  221. class="file-message"
  222. >
  223. <!-- 图片文件显示 -->
  224. <template v-if="isImageFile(file)">
  225. <div class="image-preview">
  226. <img :src="file.url" class="preview-image" />
  227. </div>
  228. </template>
  229. <!-- 视频文件显示 -->
  230. <template v-else-if="isVideoFile(file)">
  231. <div class="video-preview">
  232. <video
  233. controls
  234. class="preview-video"
  235. :src="file.url"
  236. preload="metadata"
  237. >
  238. Your browser does not support the video tag.
  239. </video>
  240. </div>
  241. </template>
  242. <!-- 文档文件显示 -->
  243. <template v-else>
  244. <div class="file-info-display">
  245. <img :src="getFileIcon(file)" class="file-type-icon" />
  246. <div class="file-details">
  247. <span class="file-name" :title="file.name">{{
  248. file.name
  249. }}</span>
  250. <span class="file-size">{{ file.size }}</span>
  251. </div>
  252. </div>
  253. </template>
  254. </div>
  255. </template>
  256. <div
  257. class="message-text"
  258. v-if="message.role === 'assistant'"
  259. v-html="renderMarkdown(message.displayContent)"
  260. ></div>
  261. <div v-else>{{ message.content }}</div>
  262. <!-- 音频控制按钮 -->
  263. <div
  264. v-if="message.role === 'assistant'"
  265. class="audio-controls"
  266. >
  267. <button class="audio-btn" @click="handleAudioClick(message)">
  268. <!-- 只在当前消息正在播放时显示波形动画 -->
  269. <div
  270. v-if="currentPlayingId === message.id"
  271. class="wave-animation"
  272. >
  273. <span class="wave-bar"></span>
  274. <span class="wave-bar"></span>
  275. <span class="wave-bar"></span>
  276. <span class="wave-bar"></span>
  277. </div>
  278. <!-- 其他情况显示播放图标 -->
  279. <img v-else :src="playIcon" alt="播放" class="audio-icon" />
  280. </button>
  281. </div>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. <!-- 输入框 -->
  287. <div class="input-container">
  288. <!-- 搜索开关组 -->
  289. <div class="search-toggles" :class="{ 'compact': isCompact }">
  290. <div class="left_item" style="display: flex;">
  291. <div class="search-toggle-item" style="width:33%;">
  292. <div class="toggle-content">
  293. <GlobalOutlined />
  294. <span class="toggle-text" >互联网</span><!-- v-show="!isCompact" -->
  295. <div class="toggle-switch">
  296. <input
  297. type="checkbox"
  298. id="webSearchToggle"
  299. v-model="enableWebSearch"
  300. @change="handleWebSearchToggle"
  301. :disabled="attachedFiles.length > 0"
  302. class="toggle-input"
  303. />
  304. <label
  305. for="webSearchToggle"
  306. class="toggle-label"
  307. :class="{ disabled: attachedFiles.length > 0 }"
  308. >
  309. <span class="toggle-slider"></span>
  310. </label>
  311. </div>
  312. </div>
  313. </div>
  314. <div class="search-toggle-item" style="width:33%;">
  315. <div class="toggle-content">
  316. <DatabaseOutlined />
  317. <span class="toggle-text" >知识库</span><!-- v-show="!isCompact" -->
  318. <div class="toggle-switch">
  319. <input
  320. type="checkbox"
  321. id="knowledgeSearchToggle"
  322. v-model="enableKnowledgeSearch"
  323. @change="handleKnowledgeToggle"
  324. class="toggle-input"
  325. />
  326. <label
  327. for="knowledgeSearchToggle"
  328. class="toggle-label"
  329. >
  330. <span class="toggle-slider"></span>
  331. </label>
  332. </div>
  333. </div>
  334. </div>
  335. <div class="search-toggle-item" style="width:33%;">
  336. <div class="toggle-content">
  337. <DatabaseOutlined />
  338. <span class="toggle-text" >智能体</span><!-- v-show="!isCompact" -->
  339. <div class="toggle-switch">
  340. <input
  341. type="checkbox"
  342. id="inferenceModelId"
  343. v-model="inferenceModel"
  344. class="toggle-input"
  345. />
  346. <label
  347. for="inferenceModelId"
  348. class="toggle-label"
  349. >
  350. <span class="toggle-slider"></span>
  351. </label>
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. <div class="search-toggle-item">
  357. <div class="toggle-content">
  358. <!-- <SelectOutlined /> -->
  359. <!-- <span class="toggle-text">模型选择</span> -->
  360. <select
  361. class="model-select"
  362. :value="selectedModel"
  363. @change="handleModelChange($event.target.value)"
  364. :disabled="isLoadingModels"
  365. >
  366. <option v-if="isLoadingModels" value="">加载中...</option>
  367. <option v-else-if="models.length === 0" value="">无可用模型</option>
  368. <option
  369. v-for="model in models"
  370. :key="model.id"
  371. :value="model.id"
  372. >
  373. {{ model.name }}
  374. </option>
  375. </select>
  376. </div>
  377. </div>
  378. </div>
  379. <!-- 添加附件面板 -->
  380. <div v-if="showAttachments" class="attachments-panel">
  381. <div class="panel-content">
  382. <div class="attachments-header">
  383. <span>Attachments</span>
  384. <button class="close-btn" @click="toggleAttachments">
  385. <img src="../assets/svg/close.svg" alt="" />
  386. </button>
  387. </div>
  388. <div
  389. v-if="attachedFiles.length === 0"
  390. style="display: flex; justify-content: center"
  391. >
  392. <div
  393. class="upload-area"
  394. :class="{ 'has-files': attachedFiles.length > 0 }"
  395. @click="triggerFileInput"
  396. @drop.prevent="handleFileDrop"
  397. @dragover.prevent
  398. @dragenter.prevent
  399. >
  400. <!-- 移除条件判断,让整个区域始终可点击 -->
  401. <template v-if="isUploading">
  402. <div class="upload-loading">
  403. <div class="loading-spinner"></div>
  404. <div class="upload-text">Uploading...</div>
  405. </div>
  406. </template>
  407. <template v-else>
  408. <img
  409. src="../assets/svg/upload.svg"
  410. alt="upload"
  411. class="upload-icon"
  412. />
  413. <div class="upload-text">Upload files</div>
  414. <div class="upload-hint">
  415. Click or drag files to this area to upload
  416. </div>
  417. </template>
  418. <input
  419. type="file"
  420. ref="fileInput"
  421. style="display: none"
  422. @change="handleFileUpload"
  423. multiple
  424. />
  425. </div>
  426. </div>
  427. <!-- 上传内容列表 -->
  428. <div v-if="attachedFiles.length !== 0">
  429. <div class="file-list">
  430. <div
  431. v-for="file in attachedFiles"
  432. :key="file.name"
  433. class="file-item"
  434. :class="{ 'is-image': isImageFile(file) }"
  435. >
  436. <div :class="isImageFile(file) ? 'file-wrapper' : ''">
  437. <!-- 添加文件 loading 状态 -->
  438. <div v-if="file.isUploading" class="file-loading">
  439. <div class="loading-spinner"></div>
  440. </div>
  441. <!-- 其他文件显示逻辑保持不变 -->
  442. <img
  443. v-else-if="isImageFile(file)"
  444. :src="file.url"
  445. alt="file"
  446. class="file-icon"
  447. />
  448. <video
  449. v-else-if="isVideoFile(file)"
  450. :src="file.url"
  451. class="file-icon"
  452. preload="metadata"
  453. >
  454. Your browser does not support the video tag.
  455. </video>
  456. <img
  457. v-else
  458. :src="getFileIcon(file)"
  459. alt="file"
  460. :class="
  461. isImageFile(file) || isVideoFile(file)
  462. ? 'file-icon'
  463. : ''
  464. "
  465. />
  466. <button
  467. class="remove-btn"
  468. @click.stop="removeFile(file)"
  469. v-if="!file.isUploading"
  470. >
  471. ×
  472. </button>
  473. </div>
  474. <div class="file-info" v-if="!isImageFile(file)">
  475. <span class="file-name">{{ file.name }}</span>
  476. <span class="file-size">{{ file.sizeFormatted }}</span>
  477. </div>
  478. </div>
  479. <button class="add-more-btn" @click.stop="triggerFileInput">
  480. <img src="../assets/svg/plus.svg" alt="add" />
  481. </button>
  482. </div>
  483. <input
  484. type="file"
  485. ref="fileInput"
  486. style="display: none"
  487. @change="handleFileUpload"
  488. multiple
  489. />
  490. </div>
  491. <!-- <div v-if="attachedFiles.length" class="attached-files">
  492. <div
  493. v-for="file in attachedFiles"
  494. :key="file.name"
  495. class="file-item"
  496. >
  497. <FileOutlined />
  498. <span>{{ file.name }}</span>
  499. <button class="remove-btn" @click="removeFile(file)">
  500. </button>
  501. </div>
  502. </div> -->
  503. </div>
  504. </div>
  505. <!-- 输入框部分 -->
  506. <div class="input-wrapper">
  507. <button class="attachment-btn" @click="toggleAttachments">
  508. <img
  509. src="../assets/svg/attachment.svg"
  510. alt="attachment"
  511. class="tab-icon"
  512. />
  513. </button>
  514. <input
  515. type="text"
  516. class="message-input"
  517. v-model="inputContent"
  518. @keyup.enter="sendMessage"
  519. placeholder="Type a message..."
  520. /><!-- @input="handleInputChange" :disabled="(!inputContent && attachedFiles.length === 0)"-->
  521. <button
  522. class="send-btn"
  523. @click="sendMessage"
  524. >
  525. <template v-if="isTyping">
  526. <span class="loading-btn">
  527. <span class="loading-square"></span>
  528. </span>
  529. </template>
  530. <template v-else>
  531. <img src="../assets/svg/up.svg" alt="send" />
  532. </template>
  533. </button>
  534. </div>
  535. </div>
  536. </div>
  537. <div
  538. v-if="!isMobile"
  539. class="right_menu"
  540. :class="{
  541. collapsed: !isRightMenuVisible
  542. }"
  543. :style="{ width: rightMenuWidth + 'px' }"
  544. >
  545. <div v-if="inferenceModel">
  546. <div style="height: 91vh;overflow: auto;" class="file-list">
  547. <!-- <div class="panel-header">
  548. <h3>查询结果</h3>
  549. <button class="panel-toggle">
  550. <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  551. <polyline points="6,9 12,15 18,9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  552. </svg>
  553. </button>
  554. </div> -->
  555. <!-- 步骤显示区域 -->
  556. <div id="stepsContainer" v-show="showSteps" class="steps-container">
  557. <h3 class="steps-title">📋 处理步骤</h3>
  558. <div id="stepsList"></div>
  559. </div>
  560. <!-- 结果显示区域 -->
  561. <div id="resultContent" v-html="formatted_data"></div>
  562. </div>
  563. </div>
  564. <!-- 修改收缩按钮的位置和样式 -->
  565. <!-- <div
  566. class="collapse-button"
  567. :class="{
  568. 'menu-expanded': !isRightMenuCollapsed,
  569. 'menu-collapsed': isRightMenuCollapsed
  570. }"
  571. @click="toggleRightMenu"
  572. >
  573. <img
  574. :src="isRightMenuCollapsed ? leftIcon : rightIcon"
  575. alt="toggle"
  576. class="collapse-icon"
  577. />
  578. </div> -->
  579. <!-- 添加拖动条 -->
  580. <div
  581. class="resize-handle"
  582. @mousedown="startResize"
  583. @touchstart="startResize"
  584. ></div>
  585. <div class="right-menu-content">
  586. <!-- 添加 Tab 切换 -->
  587. <!-- 搜索面板 -->
  588. <div v-show="activeTab === 'search'" class="panel-container">
  589. <!-- <div class="search-header">
  590. <span>搜索结果</span>
  591. <div class="web-search-toggle">
  592. <input
  593. type="checkbox"
  594. id="searchToggle"
  595. v-model="enableWebSearch"
  596. class="toggle-input"
  597. />
  598. <label for="searchToggle" class="toggle-label">
  599. {{ enableWebSearch ? '搜索已开启' : '搜索已关闭' }}
  600. </label>
  601. </div>
  602. </div> -->
  603. <!-- v-if="enableWebSearch" -->
  604. <SearchResults
  605. :searchResults="searchResults"
  606. :loading="isSearchLoading"
  607. :total="searchTotal"
  608. :enableWebSearch="enableWebSearch"
  609. :message="currentSearchQuery"
  610. @update:enableWebSearch="handleSearchToggle"
  611. />
  612. </div>
  613. <!-- 文档预览面板 -->
  614. <div v-show="activeTab === 'preview'" class="panel-container">
  615. <div class="preview-header">
  616. <span>文档预览</span>
  617. </div>
  618. <div class="document-preview">
  619. <div class="preview-container">
  620. <!-- 文档列表 -->
  621. <!-- <div class="document-list">
  622. <div v-if="attachedFiles.length === 0" class="empty-state">
  623. <FileOutlined class="empty-icon" />
  624. <p>暂无文档</p>
  625. </div>
  626. <div v-else v-for="doc in attachedFiles" :key="doc.name" class="document-item"
  627. :class="{ 'active': currentDoc?.name === doc.name }"
  628. @click="handleDocClick(doc)">
  629. <div class="document-info">
  630. <div class="doc-icon">
  631. <img
  632. v-if="isImageFile(doc)"
  633. :src="doc.url"
  634. class="preview-thumbnail"
  635. alt="preview"
  636. />
  637. <video
  638. v-else-if="isVideoFile(doc)"
  639. :src="doc.url"
  640. class="preview-thumbnail"
  641. preload="metadata"
  642. />
  643. <img
  644. v-else
  645. :src="getFileIcon(doc)"
  646. alt="file"
  647. class="file-icon"
  648. />
  649. </div>
  650. <div class="info">
  651. <div class="name" :title="doc.name">{{ doc.name }}</div>
  652. <div class="size">{{ doc.sizeFormatted || formatFileSize(doc.size) }}</div>
  653. </div>
  654. </div>
  655. <div class="actions">
  656. <button class="action-btn" @click.stop="handleDownload(doc)" title="下载">
  657. <DownloadOutlined />
  658. </button>
  659. </div>
  660. </div>
  661. </div> -->
  662. <!-- 直接预览区域 -->
  663. <div v-if="currentDoc" class="direct-preview">
  664. <div class="preview-header">
  665. <span>{{ currentDoc.name }}</span>
  666. <button class="close-btn" @click="closePreview">
  667. <CloseOutlined />
  668. </button>
  669. </div>
  670. <div class="preview-body">
  671. <!-- 图片预览 -->
  672. <img
  673. v-if="isImageFile(currentDoc)"
  674. :src="currentDoc.url"
  675. class="preview-image"
  676. alt="preview"
  677. />
  678. <!-- 视频预览 -->
  679. <video
  680. v-else-if="isVideoFile(currentDoc)"
  681. :src="currentDoc.url"
  682. controls
  683. class="preview-video"
  684. />
  685. <!-- Word文档预览 -->
  686. <div v-else-if="isWordFile(currentDoc)">
  687. <vue-office-docx
  688. :src="currentDoc.url"
  689. class="doc-preview"
  690. @rendered="handleRendered"
  691. @error="handleError"
  692. />
  693. </div>
  694. <!-- Excel文档预览 -->
  695. <div v-else-if="isExcelFile(currentDoc)">
  696. <vue-office-excel
  697. :options="excelOptions"
  698. @rendered="handleRendered"
  699. @error="handleExcelError"
  700. :src="currentDoc.url"
  701. class="doc-preview"
  702. />
  703. </div>
  704. <!-- PDF预览-->
  705. <iframe v-else-if="isPdfFile(currentDoc)" :src="currentDoc.url" style="width: 100%; height: 100%;" frameborder="0"></iframe>
  706. <!-- 其他文件预览 -->
  707. <div v-else class="file-preview">
  708. <FileOutlined class="large-icon" />
  709. <p>该文件类型暂不支持预览</p>
  710. </div>
  711. </div>
  712. </div>
  713. </div>
  714. </div>
  715. </div>
  716. <!-- 添加知识库结果面板 -->
  717. <div v-show="activeTab === 'knowledge'" class="panel-container">
  718. <!-- <div class="search-header">
  719. <span>知识库搜索结果</span>
  720. </div> -->
  721. <!-- v-if="enableKnowledgeSearch" -->
  722. <KnowledgeResults
  723. :searchResults="knowledgeResults"
  724. :loading="isKnowledgeLoading"
  725. :total="knowledgeTotal"
  726. :message="currentSearchQuery"
  727. />
  728. </div>
  729. </div>
  730. </div>
  731. </div>
  732. </template>
  733. <script setup>
  734. import { ref, reactive, nextTick, onUnmounted, onMounted, computed, watch } from "vue";
  735. import {
  736. PlusOutlined,
  737. FireOutlined,
  738. ReadOutlined,
  739. HeartOutlined,
  740. SmileOutlined,
  741. CommentOutlined,
  742. CloudUploadOutlined,
  743. PaperClipOutlined,
  744. ShareAltOutlined,
  745. EllipsisOutlined,
  746. CloseOutlined,
  747. FileOutlined,
  748. ArrowUpOutlined,
  749. UploadOutlined,
  750. FileSearchOutlined,
  751. GlobalOutlined,
  752. DatabaseOutlined,
  753. FolderOutlined,
  754. SelectOutlined,
  755. DownloadOutlined,
  756. } from "@ant-design/icons-vue";
  757. import leftIcon from "../assets/svg/left.svg";
  758. import rightIcon from "../assets/svg/right.svg";
  759. import plusIcon from "../assets/svg/plus.svg";
  760. import hotForUxIcon from "../assets/svg/hot-for-ux.svg";
  761. import readIcon from "../assets/svg/read.svg";
  762. import attachmentIcon from "../assets/svg/attachment.svg";
  763. import uploadIcon from "../assets/svg/upload.svg";
  764. import closeIcon from "../assets/svg/close.svg";
  765. import upIcon from "../assets/svg/up.svg";
  766. import wordIcon from "../assets/svg/word.svg";
  767. import pauseIcon from "../assets/svg/pause.svg";
  768. import playIcon from "../assets/svg/play.svg";
  769. import axios from "axios";
  770. import { useStore } from "vuex";
  771. import MarkdownIt from "markdown-it";
  772. import ModelConfig from "../components/ModelConfig/index.vue";
  773. import SearchResults from "../components/SearchResults/index.vue";
  774. import VoiceConfig from "../components/VoiceConfig/index.vue";
  775. import KnowledgeConfig from "../components/KnowledgeConfig/index.vue";
  776. import ExportButton from "../components/ExportButton/index.vue";
  777. import dayjs from 'dayjs';
  778. import DocumentPreview from "../components/DocumentPreview/index.vue";
  779. import KnowledgeResults from "../components/KnowledgeResults/index.vue";
  780. import ChangePasswordDialog from '../components/ChangePasswordDialog.vue'
  781. import { useRouter } from 'vue-router'
  782. import { message } from 'ant-design-vue';
  783. import VueOfficeDocx from '@vue-office/docx';
  784. import VueOfficeExcel from '@vue-office/excel';
  785. /* import '@vue-office/docx/lib/index.css';
  786. import '@vue-office/excel/lib/index.css'; */
  787. // 初始化 markdown-it
  788. const md = new MarkdownIt({
  789. html: true,
  790. linkify: true,
  791. typographer: true,
  792. });
  793. // 响应式状态
  794. const headerOpen = ref(false);
  795. const inputContent = ref("");
  796. const showAttachments = ref(false);
  797. const isRightMenuCollapsed = ref(false);
  798. const fileInput = ref(null);
  799. const attachedFiles = ref([]);
  800. const messages = ref([]);
  801. const isLoading = ref(false);
  802. const currentConversationId = ref(1);
  803. const conversationCounter = ref(1);
  804. const messageList = ref(null);
  805. const store = useStore();
  806. const router = useRouter()
  807. // 会话数据
  808. const conversations = ref([
  809. {
  810. id: 1,
  811. title: "当前会话",
  812. messages: [],
  813. },
  814. ]);
  815. // 添加打字效果相关的状态
  816. const typingSpeed = 50; // 打字速度(毫秒/字符)
  817. const isTyping = ref(false);
  818. const typingTimeout = ref(null); // 添加打字超时引用
  819. // 添加音频播放相关的响应式变量
  820. const audioPlayer = ref(null);
  821. const isPlaying = ref(false);
  822. // 添加当前播放消息的 ID
  823. const currentPlayingId = ref(null);
  824. const currentAudioSource = ref(null);
  825. // 添加新的响应式变量
  826. const isUploading = ref(false);
  827. // 添加新的响应式状态
  828. const documentSummary = ref(null);
  829. const isLoadingSummary = ref(false);
  830. const currentQaPairs = ref([]);
  831. const currentDesignGuides = ref([]);
  832. let rotationInterval = null;
  833. // 添加新的响应式状态
  834. const searchResults = ref([]);
  835. const isSearchLoading = ref(false);
  836. const searchTotal = ref(0);
  837. // 添加互联网搜索开关状态
  838. const enableWebSearch = ref(false);
  839. // 添加新的响应式变量
  840. const isMenuCollapsed = ref(false);
  841. // 添加移动端检测
  842. const isMobile = ref(false);
  843. //知识库搜索
  844. const enableKnowledgeSearch = ref(false);
  845. const knowledgeResults = ref([]);
  846. const knowledgeTotal = ref(0);
  847. const isKnowledgeLoading = ref(false);
  848. const formatted_data = ref('');
  849. const showSteps = ref(false);
  850. const steps = ref([]);
  851. // SSE消息处理函数
  852. const handleSSEMessage = (event, data) => {
  853. // 立即处理每个事件
  854. switch (event) {
  855. case 'html_start':
  856. formatted_data.value = '';
  857. break;
  858. case 'html_chunk':
  859. if (data && typeof data.html === 'string') {
  860. // 直接追加新内容到现有内容
  861. formatted_data.value += data.html;
  862. // 确保滚动到最新内容
  863. nextTick(() => {
  864. const resultContent = document.getElementById('resultContent');
  865. if (resultContent) {
  866. resultContent.scrollTop = resultContent.scrollHeight;
  867. }
  868. });
  869. }
  870. break;
  871. case 'html_end':
  872. // 完成渲染,可以在这里添加完成的标记
  873. break;
  874. case 'init_steps':
  875. showSteps.value = true;
  876. // 立即初始化步骤
  877. initializeSteps(data.steps);
  878. break;
  879. case 'step_update':
  880. // 立即更新步骤状态
  881. updateStepElement(data.step_id, data.status, data.details, data.progress);
  882. break;
  883. case 'final_summary':
  884. break;
  885. case 'stream_end':
  886. showSteps.value = false;
  887. /* // 立即初始化步骤
  888. initializeSteps(data.steps); */
  889. break;
  890. case 'error':
  891. console.error('SSE错误:', data.message);
  892. /* ElMessage.error(data.message || '处理过程中出现错误'); */
  893. break;
  894. }
  895. };
  896. // 初始化步骤
  897. const initializeSteps = (stepsData) => {
  898. const stepsList = document.getElementById('stepsList');
  899. if (!stepsList) return;
  900. stepsList.innerHTML = '';
  901. steps.value = stepsData;
  902. stepsData.forEach(step => {
  903. stepsList.appendChild(createStepElement(step));
  904. });
  905. };
  906. // 创建步骤元素
  907. const createStepElement = (step) => {
  908. const stepEl = document.createElement('div');
  909. stepEl.className = `step ${step.status}`;
  910. stepEl.id = `step-${step.step_id}`;
  911. /* <div class="step-icon">${getStepIcon(step.status)}</div> */
  912. stepEl.innerHTML = `
  913. <div class="step-header">
  914. <div class="step-header-content">
  915. <div class="step-icon" style="display: none;">${getStepIcon(step.status)}</div>
  916. <div class="step-name">${step.name || step.step_id}</div>
  917. </div>
  918. </div>
  919. <div class="step-details">${step.details || ''}</div>
  920. <div class="progress-bar">
  921. <div class="progress-fill" style="width: ${step.progress || 0}%"></div>
  922. </div>
  923. `;
  924. return stepEl;
  925. };
  926. // 更新步骤元素
  927. const updateStepElement = (stepId, status, details, progress) => {
  928. const stepEl = document.getElementById(`step-${stepId}`);
  929. if (!stepEl) return;
  930. stepEl.className = `step ${status}`;
  931. stepEl.querySelector('.step-icon').textContent = getStepIcon(status);
  932. if (details) {
  933. stepEl.querySelector('.step-details').textContent = details;
  934. }
  935. if (progress !== undefined) {
  936. stepEl.querySelector('.progress-fill').style.width = `${progress}%`;
  937. }
  938. };
  939. // 获取步骤图标
  940. const getStepIcon = (status) => {
  941. switch (status) {
  942. case 'pending': return '⏳';
  943. case 'running': return '🔄';
  944. case 'completed': return '✅';
  945. case 'error': return '❌';
  946. default: return '⏳';
  947. }
  948. };
  949. // 智能体
  950. const inferenceModel = ref(false);
  951. // 检测设备类型
  952. const checkMobile = () => {
  953. isMobile.value = window.innerWidth <= 768;
  954. if (isMobile.value) {
  955. isRightMenuCollapsed.value = true; // 在移动设备下自动收起右侧菜单
  956. isMenuCollapsed.value = true;
  957. }else{
  958. isRightMenuCollapsed.value = false;
  959. isMenuCollapsed.value = false;
  960. }
  961. };
  962. // 添加窗口大小改变事件监听
  963. onMounted(() => {
  964. checkMobile(); // 初始检查
  965. window.addEventListener('resize', checkMobile);
  966. });
  967. const showDropdown = ref(false);
  968. const toggleDropdown = () => {
  969. console.log(showDropdown.value);
  970. showDropdown.value = !showDropdown.value;
  971. };
  972. // 添加遮罩层点击处理
  973. const handleOverlayClick = () => {
  974. if (isMobile.value) {
  975. isMenuCollapsed.value = true;
  976. isRightMenuCollapsed.value = true;
  977. document.body.style.overflow = 'auto';
  978. }
  979. };
  980. // 修改菜单切换逻辑
  981. const toggleMenu = () => {
  982. isMenuCollapsed.value = !isMenuCollapsed.value;
  983. if (isMobile.value) {
  984. document.body.style.overflow = isMenuCollapsed.value ? 'auto' : 'hidden';
  985. if (!isMenuCollapsed.value) {
  986. isRightMenuCollapsed.value = true; // 确保右侧菜单关闭
  987. }
  988. }
  989. // 更新聊天区域的位置
  990. if (document.querySelector('.chat')) {
  991. document.querySelector('.chat').style.left = isMenuCollapsed.value ? '0' : '260px';
  992. }
  993. };
  994. // 修改右侧菜单切换逻辑
  995. const toggleRightMenu = () => {
  996. isRightMenuCollapsed.value = false;
  997. if (isRightMenuCollapsed.value) {
  998. // 收起菜单时的处理
  999. if (document.querySelector('.chat')) {
  1000. document.querySelector('.chat').style.right = '0';
  1001. }
  1002. } else {
  1003. enableWebSearch.value = true;
  1004. // 展开菜单时的处理
  1005. if (document.querySelector('.chat')) {
  1006. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1007. }
  1008. }
  1009. if (isMobile.value) {
  1010. document.body.style.overflow = isRightMenuCollapsed.value ? 'auto' : 'hidden';
  1011. if (!isRightMenuCollapsed.value) {
  1012. isMenuCollapsed.value = true;
  1013. }
  1014. }
  1015. };
  1016. // 修改自动展开右侧菜单的方法
  1017. const expandRightMenu = () => {
  1018. isRightMenuCollapsed.value = false;
  1019. if (document.querySelector('.chat')) {
  1020. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1021. }
  1022. };
  1023. // 修改获取文档摘要的方法
  1024. const fetchDocumentSummary = async () => {
  1025. isLoadingSummary.value = true;
  1026. try {
  1027. const response = await axios.get(
  1028. `${import.meta.env.VITE_BASE_AI_API}/api/document/summary?limit=2`,
  1029. {
  1030. headers: {
  1031. 'Authorization': `JWT ${localStorage.getItem('token')}`
  1032. }
  1033. }
  1034. );
  1035. console.log("API Response:", response.data);
  1036. if (response.data.status === 200) {
  1037. documentSummary.value = response.data.data;
  1038. console.log("Document Summary:", documentSummary.value);
  1039. startRotation();
  1040. }
  1041. } catch (error) {
  1042. console.error("获取文档摘要失败:", error);
  1043. } finally {
  1044. isLoadingSummary.value = false;
  1045. }
  1046. };
  1047. // 修改轮换显示逻辑
  1048. const startRotation = () => {
  1049. if (rotationInterval) {
  1050. clearInterval(rotationInterval);
  1051. }
  1052. const updateItems = () => {
  1053. if (!documentSummary.value?.length) {
  1054. console.log("没有可用的文档摘要数据");
  1055. return;
  1056. }
  1057. // 处理第一篇文档的问题(如:热门话题)
  1058. try {
  1059. const firstDocData = documentSummary.value[0];
  1060. if (firstDocData?.questions) {
  1061. // 直接使用questions数组中的问题
  1062. const formattedQaPairs = firstDocData.questions.map((question) => ({
  1063. question,
  1064. }));
  1065. // 随机抽取3个问题显示
  1066. const shuffled = [...formattedQaPairs].sort(() => 0.5 - Math.random());
  1067. currentQaPairs.value = shuffled.slice(0, 3);
  1068. }
  1069. } catch (error) {
  1070. console.error("处理第一篇文档问题失败:", error);
  1071. }
  1072. // 处理第二篇文档的问题(如:设计指南)
  1073. try {
  1074. const secondDocData = documentSummary.value[1];
  1075. if (secondDocData?.questions) {
  1076. // 直接使用questions数组中的问题
  1077. const formattedGuides = secondDocData.questions.map((question) => ({
  1078. question,
  1079. }));
  1080. // 随机抽取3个问题显示
  1081. const shuffled = [...formattedGuides].sort(() => 0.5 - Math.random());
  1082. currentDesignGuides.value = shuffled.slice(0, 3);
  1083. }
  1084. } catch (error) {
  1085. console.error("处理第二篇文档问题失败:", error);
  1086. }
  1087. };
  1088. // 初始更新
  1089. updateItems();
  1090. // 每5秒更新一次
  1091. rotationInterval = setInterval(updateItems, 5000);
  1092. };
  1093. // 处理QA点击事件
  1094. const handleQaClick = (qa) => {
  1095. console.log("QA clicked:", qa); // 添加日志
  1096. if (qa?.question) {
  1097. inputContent.value = qa.question;
  1098. sendMessage();
  1099. }
  1100. };
  1101. // 在组件卸载时清理定时器
  1102. onUnmounted(() => {
  1103. if (rotationInterval) {
  1104. clearInterval(rotationInterval);
  1105. }
  1106. });
  1107. // 方法
  1108. const toggleAttachments = () => {
  1109. showAttachments.value = !showAttachments.value;
  1110. };
  1111. const removeFile = (file) => {
  1112. attachedFiles.value = attachedFiles.value.filter((f) => f !== file);
  1113. if(attachedFiles.value.length === 0){
  1114. rightMenuWidth.value = 0;
  1115. if(document.querySelector('.chat')){
  1116. document.querySelector('.chat').style.right = `0px`;
  1117. }
  1118. }else{
  1119. rightMenuWidth.value = 450;
  1120. if(document.querySelector('.chat')){
  1121. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1122. }
  1123. }
  1124. console.log(attachedFiles.value.length);
  1125. };
  1126. const triggerFileInput = () => {
  1127. // 如果正在上传,不触发新的上传
  1128. if (isUploading.value) return;
  1129. fileInput.value?.click();
  1130. };
  1131. const uploadFile = async (file) => {
  1132. try {
  1133. const formData = new FormData();
  1134. formData.append("file", file);
  1135. const response = await axios.post(
  1136. `${import.meta.env.VITE_BASE_AI_API}/upload/file`,
  1137. formData,
  1138. {
  1139. headers: {
  1140. "Content-Type": "multipart/form-data",
  1141. },
  1142. }
  1143. );
  1144. if (response.data.status === 2000) {
  1145. return response.data.data.fileUrl; // 返回文件上传后的URL
  1146. } else {
  1147. throw new Error(response.data.message || "文件上传失败");
  1148. }
  1149. } catch (error) {
  1150. console.error("文件上传失败:", error);
  1151. throw error;
  1152. }
  1153. };
  1154. const handleFileUpload = async (event) => {
  1155. const files = Array.from(event.target.files);
  1156. if (files.length === 0) return;
  1157. // 添加文件大小检查
  1158. const MAX_VIDEO_SIZE = 10 * 1024 * 1024; // 10MB in bytes
  1159. const invalidFiles = files.filter((file) => {
  1160. if (isVideoFile(file) && file.size > MAX_VIDEO_SIZE) {
  1161. return true;
  1162. }
  1163. return false;
  1164. });
  1165. if (invalidFiles.length > 0) {
  1166. // 如果有超出大小限制的视频文件,显示错误提示
  1167. alert("Video files must not exceed 10MB");
  1168. event.target.value = ""; // 清空input
  1169. return;
  1170. }
  1171. isUploading.value = true;
  1172. rightMenuWidth.value = 450;
  1173. try {
  1174. for (const file of files) {
  1175. // 创建一个带有上传状态的文件对象
  1176. const fileWithStatus = {
  1177. name: file.name,
  1178. size: file.size,
  1179. sizeFormatted: formatFileSize(file.size),
  1180. type: file.type,
  1181. isUploading: true,
  1182. };
  1183. // 先添加到文件列表中
  1184. attachedFiles.value.push(fileWithStatus);
  1185. try {
  1186. const url = await uploadFile(file);
  1187. // 直接修改数组中的对象
  1188. const index = attachedFiles.value.findIndex(
  1189. (f) => f.name === file.name
  1190. );
  1191. if (index !== -1) {
  1192. // 使用数组替换方式更新,确保响应式更新
  1193. attachedFiles.value.splice(index, 1, {
  1194. ...fileWithStatus,
  1195. url,
  1196. isUploading: false,
  1197. });
  1198. }
  1199. } catch (error) {
  1200. // 如果上传失败,从列表中移除该文件
  1201. attachedFiles.value = attachedFiles.value.filter(
  1202. (f) => f.name !== file.name
  1203. );
  1204. console.error("单个文件上传失败:", error);
  1205. }
  1206. }
  1207. } catch (error) {
  1208. console.error("文件上传失败:", error);
  1209. } finally {
  1210. isUploading.value = false;
  1211. event.target.value = ""; // 清空input以允许重复上传相同文件
  1212. // 修改文件上传后的处理逻辑
  1213. if (attachedFiles.value.length > 0) {
  1214. // 切换到预览标签页
  1215. activeTab.value = 'preview';
  1216. // 展开右侧菜单
  1217. isRightMenuCollapsed.value = false;
  1218. // 如果在移动端,调整布局
  1219. if (document.querySelector('.chat')) {
  1220. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1221. }
  1222. }
  1223. }
  1224. if (files.length > 0 && enableWebSearch.value) {
  1225. enableWebSearch.value = false; // 如果有文件上传,自动关闭互联网搜索
  1226. }
  1227. };
  1228. const formatFileSize = (bytes) => {
  1229. if (!bytes || isNaN(bytes)) return "0 B";
  1230. const k = 1024;
  1231. const sizes = ["B", "KB", "MB", "GB"];
  1232. const i = Math.floor(Math.log(bytes) / Math.log(k));
  1233. return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
  1234. };
  1235. const getFileIcon = (file) => {
  1236. // 如果文件已经有 URL 且是图片类型,返回 URL
  1237. if (file.url && isImageFile(file)) {
  1238. return file.url;
  1239. }
  1240. // 其他所有情况返回文档图标
  1241. return wordIcon;
  1242. };
  1243. const isImageFile = (file) => {
  1244. const imageTypes = ["jpg", "jpeg", "png", "gif", "webp"];
  1245. const ext = file.name?.split(".")?.pop()?.toLowerCase() || "";
  1246. return imageTypes.includes(ext);
  1247. };
  1248. const isVideoFile = (file) => {
  1249. const videoTypes = ["mp4", "webm", "ogg"];
  1250. const ext = file.name?.split(".")?.pop()?.toLowerCase() || "";
  1251. return videoTypes.includes(ext);
  1252. };
  1253. const getFileType = (file) => {
  1254. const ext = file.name.split(".").pop().toLowerCase();
  1255. const imageTypes = ["jpg", "jpeg", "png", "gif", "webp"];
  1256. const videoTypes = ["mp4", "webm", "ogg"];
  1257. if (imageTypes.includes(ext)) return "image";
  1258. if (videoTypes.includes(ext)) return "video";
  1259. return "document";
  1260. };
  1261. // 添加滚动到底部的方法
  1262. const scrollToBottom = () => {
  1263. if (messageList.value) {
  1264. nextTick(() => {
  1265. messageList.value.scrollTop = messageList.value.scrollHeight;
  1266. });
  1267. }
  1268. };
  1269. // 添加 session_id 的响应式引用
  1270. const session_id = ref("");
  1271. // 添加取消控制器
  1272. const abortController = ref(null);
  1273. // 修改发送消息方法
  1274. const sendMessage = async () => {
  1275. // 检查登录状态
  1276. const token = localStorage.getItem('token');
  1277. if (!token) {
  1278. router.push('/login');
  1279. return;
  1280. }
  1281. if(isTyping.value){
  1282. isTyping.value = false;
  1283. // 如果存在正在进行的请求,取消它
  1284. if (abortController.value) {
  1285. abortController.value.abort();
  1286. abortController.value = null;
  1287. }
  1288. // 清除打字效果的定时器
  1289. if (typingTimeout.value) {
  1290. clearTimeout(typingTimeout.value);
  1291. typingTimeout.value = null;
  1292. }
  1293. return;
  1294. }
  1295. if (
  1296. (!inputContent.value.trim() && attachedFiles.value.length === 0) ||
  1297. isTyping.value
  1298. )
  1299. return;
  1300. isTyping.value = true;
  1301. // 保存当前输入内容
  1302. const currentMessage = inputContent.value.trim();
  1303. // 立即清空输入框
  1304. inputContent.value = '';
  1305. // 根据开启的搜索类型执行相应的搜索
  1306. if (enableWebSearch.value) {
  1307. currentSearchQuery.value = currentMessage;
  1308. // 执行互联网搜索
  1309. sendMessageS(currentMessage).catch((error) => {
  1310. console.error("Web search failed:", error);
  1311. });
  1312. } else if (enableKnowledgeSearch.value) {
  1313. currentSearchQuery.value = currentMessage;
  1314. // 执行知识库搜索
  1315. handleKnowledgeSearch({
  1316. query: currentMessage,
  1317. page: 1,
  1318. pageSize: 20
  1319. });
  1320. }
  1321. // 构建消息内容,包含文件信息
  1322. let messageContent = currentMessage;
  1323. // 收集文件URLs
  1324. const imageUrls = [];
  1325. const videoUrls = [];
  1326. const documentUrls = [];
  1327. attachedFiles.value.forEach((file) => {
  1328. const fileType = getFileType(file);
  1329. if (fileType === "image") {
  1330. imageUrls.push(file.url);
  1331. } else if (fileType === "video") {
  1332. videoUrls.push(file.url);
  1333. } else {
  1334. documentUrls.push(file.url);
  1335. }
  1336. });
  1337. // 添加用户消息
  1338. const userMessage = {
  1339. id: Date.now(),
  1340. role: "user",
  1341. content: currentMessage,
  1342. displayContent: currentMessage,
  1343. files: attachedFiles.value.map((file) => ({
  1344. name: file.name,
  1345. size: file.sizeFormatted,
  1346. type: file.type,
  1347. url: file.url,
  1348. })),
  1349. };
  1350. messages.value.push(userMessage);
  1351. // 添加临时AI消息
  1352. const tempAiMessage = {
  1353. id: Date.now() + 1,
  1354. role: "assistant",
  1355. content: "思考中...",
  1356. displayContent: "思考中...",
  1357. isLoading: true,
  1358. };
  1359. messages.value.push(tempAiMessage);
  1360. try {
  1361. // 创建新的 AbortController
  1362. abortController.value = new AbortController();
  1363. if(!inferenceModel.value){
  1364. // 构建请求参数
  1365. /* const requestData = {
  1366. message: currentMessage,
  1367. chat_config_id: "2",
  1368. user_id: "13365429324",
  1369. session_id: session_id.value || "",
  1370. source: "pc",
  1371. image_urls: attachedFiles.value.filter(f => isImageFile(f)).map(f => f.url),
  1372. video_urls: attachedFiles.value.filter(f => isVideoFile(f)).map(f => f.url),
  1373. documents: attachedFiles.value.filter(f => !isImageFile(f) && !isVideoFile(f)).map(f => f.url),
  1374. merchant_id: JSON.parse(localStorage.getItem('userInfo')).merchant.merchant_id||1,
  1375. model_type: selectedModelInfo.value.type,
  1376. model_name: selectedModelInfo.value.name
  1377. }; */
  1378. const apiEndpoint = enableWebSearch.value
  1379. ? `${import.meta.env.VITE_BASE_AI_API}/api/chat/web-search-llm/`
  1380. : `${import.meta.env.VITE_BASE_AI_API}/api/chat/online/multimodal`;
  1381. const response = await axios.post(apiEndpoint, {
  1382. message: currentMessage,
  1383. chat_config_id: "2",
  1384. user_id: "13365429324",
  1385. session_id: session_id.value,
  1386. source: "pc",
  1387. image_urls: imageUrls,
  1388. video_urls: videoUrls,
  1389. documents: documentUrls,
  1390. merchant_id:JSON.parse(localStorage.getItem('userInfo')).merchant.merchant_id,
  1391. model_type: selectedModelInfo.value.type,
  1392. model_name: selectedModelInfo.value.name
  1393. },
  1394. {
  1395. headers: {
  1396. 'Authorization': `JWT ${localStorage.getItem('token')}`
  1397. },
  1398. signal: abortController.value.signal
  1399. }
  1400. );
  1401. // 移除临时消息
  1402. messages.value = messages.value.filter(
  1403. (msg) => msg.id !== tempAiMessage.id
  1404. );
  1405. // 统一处理响应数据
  1406. const responseData = enableWebSearch.value ? response.data.data : response.data;
  1407. const messageContent = enableWebSearch.value ? responseData.answer : responseData.choices[0].message.content;
  1408. const audioInfo = enableWebSearch.value ? responseData.audio_info?.audio : responseData.audio_info?.audio;
  1409. const sessionId = enableWebSearch.value ? responseData.session_id : responseData.session_id;
  1410. // 更新 session_id
  1411. if (sessionId) {
  1412. session_id.value = sessionId;
  1413. }
  1414. // 创建新的AI消息
  1415. const aiMessage = reactive({
  1416. id: Date.now() + 2,
  1417. role: "assistant",
  1418. content: messageContent,
  1419. displayContent: "",
  1420. audioData: audioInfo || null,
  1421. });
  1422. messages.value.push(aiMessage);
  1423. // 如果有音频数据,自动播放
  1424. if (aiMessage.audioData && !isPlaying.value) {
  1425. await playAudioMessage(aiMessage.audioData, aiMessage.id);
  1426. }
  1427. // 显示打字效果
  1428. await typeMessage(aiMessage);
  1429. }else{
  1430. // 构建请求参数
  1431. const requestData = {
  1432. query: currentMessage,
  1433. /* user_id: "13365429324",
  1434. session_id: session_id.value || "", */
  1435. };
  1436. // 发送初始请求获取SSE URL
  1437. let reader = null;
  1438. formatted_data.value=''
  1439. try {
  1440. // 只发送SSE请求
  1441. const sseResponse = await fetch(`${import.meta.env.VITE_BASE_AI_API}/api/agents/database/streaming/`, {
  1442. method: 'POST',
  1443. headers: {
  1444. 'Authorization': `JWT ${token}`,
  1445. 'Content-Type': 'application/json'
  1446. },
  1447. body: JSON.stringify(requestData)
  1448. });
  1449. if (!sseResponse.ok) {
  1450. throw new Error('SSE请求失败');
  1451. }
  1452. // 处理SSE响应
  1453. reader = sseResponse.body.getReader();
  1454. const decoder = new TextDecoder();
  1455. let buffer = '';
  1456. let currentEvent = '';
  1457. let streamContent = '';
  1458. // 读取流数据
  1459. while (true) {
  1460. const { done, value } = await reader.read();
  1461. if (done) break;
  1462. buffer += decoder.decode(value, { stream: true });
  1463. const lines = buffer.split('\n');
  1464. // 保留最后一行(可能不完整)
  1465. buffer = lines.pop() || '';
  1466. for (const line of lines) {
  1467. if (line.startsWith('event:')) {
  1468. currentEvent = line.substring(6).trim();
  1469. } else if (line.startsWith('data:')) {
  1470. try {
  1471. const dataStr = line.substring(5).trim();
  1472. if (dataStr) {
  1473. const data = JSON.parse(dataStr);
  1474. // 立即处理每条消息
  1475. handleSSEMessage(currentEvent || 'message', data);
  1476. if(currentEvent === 'final_summary'){
  1477. // 移除临时消息
  1478. messages.value = messages.value.filter(
  1479. (msg) => msg.id !== tempAiMessage.id
  1480. );
  1481. // 创建新的AI消息
  1482. const aiMessage = reactive({
  1483. id: Date.now() + 2,
  1484. role: "assistant",
  1485. content: data.summary,
  1486. displayContent: "",
  1487. audioData: null,
  1488. });
  1489. isTyping.value = true;
  1490. messages.value.push(aiMessage);
  1491. // 显示打字效果
  1492. try {
  1493. await typeMessage(aiMessage);
  1494. } catch (error) {
  1495. console.error('打字效果出错:', error);
  1496. // 如果打字效果失败,直接显示完整内容
  1497. aiMessage.displayContent = aiMessage.content;
  1498. } finally {
  1499. isTyping.value = false;
  1500. }
  1501. }
  1502. }
  1503. } catch (e) {
  1504. console.error('Failed to parse SSE data:', line, e);
  1505. }
  1506. } else if (line === '') {
  1507. // 空行表示事件结束,重置当前事件
  1508. currentEvent = '';
  1509. }
  1510. }
  1511. }
  1512. // 设置初始的formatted_data(如果流式数据还没开始更新)
  1513. /* if (!streamContent) {
  1514. formatted_data.value = responseData.result.html;
  1515. } */
  1516. } catch (error) {
  1517. console.error('请求或处理过程出错:', error);
  1518. ElMessage.error('请求失败,请稍后重试');
  1519. throw error;
  1520. } finally {
  1521. // 确保在结束时关闭reader
  1522. if (reader) {
  1523. try {
  1524. await reader.cancel();
  1525. } catch (error) {
  1526. console.error('关闭reader时出错:', error);
  1527. }
  1528. }
  1529. }
  1530. }
  1531. } catch (error) {
  1532. console.error("发送消息失败:", error);
  1533. // 移除临时消息
  1534. messages.value = messages.value.filter(msg => msg.id !== tempAiMessage.id);
  1535. // 添加错误消息
  1536. messages.value.push({
  1537. id: Date.now() + 2,
  1538. role: "assistant",
  1539. content: "发送消息失败,请重试",
  1540. displayContent: "发送消息失败,请重试",
  1541. });
  1542. } finally {
  1543. isTyping.value = false;
  1544. abortController.value = null;
  1545. }
  1546. };
  1547. // 修改 sendMessageS 方法
  1548. const sendMessageS = async (query) => {
  1549. isSearchLoading.value = true;
  1550. try {
  1551. const response = await axios.post(
  1552. `${import.meta.env.VITE_BASE_AI_API}/api/web-search-results/`,
  1553. {
  1554. query: query,
  1555. num_results: 20,
  1556. page: 1,
  1557. page_size: 20,
  1558. engine: "tavily",
  1559. }
  1560. );
  1561. console.log(response)
  1562. if (response.data && response.data.code === 200) {
  1563. searchResults.value = response.data.data.result || [];
  1564. console.log(searchResults.value)
  1565. searchTotal.value = response.data.data.total || 0;
  1566. }
  1567. } catch (error) {
  1568. console.error("Web search failed:", error);
  1569. searchResults.value = [];
  1570. searchTotal.value = 0;
  1571. } finally {
  1572. isSearchLoading.value = false;
  1573. }
  1574. };
  1575. // 修改打字效果方法
  1576. const typeMessage = async (message) => {
  1577. if (!message || !message.content) {
  1578. console.error("Invalid message or content is missing");
  1579. return;
  1580. }
  1581. return new Promise((resolve) => {
  1582. const minDelay = 20; // 最小打字延迟
  1583. const maxDelay = 50; // 最大打字延迟
  1584. let i = 0;
  1585. message.displayContent = ""; // 确保开始时是空的
  1586. const typeChar = () => {
  1587. if (i < message.content.length && isTyping.value) {
  1588. // 处理特殊字符和标点符号
  1589. let chunk = "";
  1590. const char = message.content[i];
  1591. // 如果是中文字符,整个字符一起显示
  1592. if (/[\u4e00-\u9fa5]/.test(char)) {
  1593. chunk = char;
  1594. }
  1595. // 如果是标点符号,与前面的字符一起显示
  1596. else if (/[.,!?;,。!?;]/.test(char)) {
  1597. chunk = char;
  1598. }
  1599. // 如果是空格,与下一个单词一起显示
  1600. else if (char === " " && i + 1 < message.content.length) {
  1601. let j = i + 1;
  1602. while (j < message.content.length && !/[\s\n]/.test(message.content[j])) {
  1603. j++;
  1604. }
  1605. chunk = message.content.substring(i, j);
  1606. }
  1607. // 其他情况,单个字符显示
  1608. else {
  1609. chunk = char;
  1610. }
  1611. message.displayContent = message.content.substring(0, i) + chunk;
  1612. i += chunk.length;
  1613. // 根据字符类型动态调整延迟
  1614. const delay = chunk.length > 1 ? maxDelay : minDelay;
  1615. typingTimeout.value = setTimeout(typeChar, delay);
  1616. } else {
  1617. if (!isTyping.value) {
  1618. // 如果打字被取消,直接显示完整内容
  1619. message.displayContent = message.content;
  1620. }
  1621. resolve();
  1622. }
  1623. };
  1624. typeChar();
  1625. });
  1626. };
  1627. // 模拟API请求
  1628. const mockApiRequest = async (message) => {
  1629. await new Promise((resolve) => setTimeout(resolve, 1000));
  1630. return `This is a response to: ${message}`;
  1631. };
  1632. // 会话管理
  1633. const addNewConversation = () => {
  1634. conversationCounter.value++;
  1635. const newConversation = {
  1636. id: Date.now(),
  1637. title: `New Conversation ${conversationCounter.value}`,
  1638. messages: [],
  1639. };
  1640. conversations.value.push(newConversation);
  1641. session_id.value = ""; // 重置 session_id
  1642. switchConversation(newConversation.id);
  1643. };
  1644. const switchConversation = (conversationId) => {
  1645. currentConversationId.value = conversationId;
  1646. const conversation = conversations.value.find((c) => c.id === conversationId);
  1647. messages.value = conversation ? conversation.messages : [];
  1648. session_id.value = ""; // 重置 session_id
  1649. };
  1650. const handleFileDrop = async (event) => {
  1651. if (isUploading.value) return;
  1652. const files = Array.from(event.dataTransfer.files);
  1653. if (files.length === 0) return;
  1654. // 添加文件大小检查
  1655. const MAX_VIDEO_SIZE = 10 * 1024 * 1024; // 10MB in bytes
  1656. const invalidFiles = files.filter((file) => {
  1657. if (isVideoFile(file) && file.size > MAX_VIDEO_SIZE) {
  1658. return true;
  1659. }
  1660. return false;
  1661. });
  1662. isUploading.value = true;
  1663. try {
  1664. for (const file of files) {
  1665. const fileWithStatus = {
  1666. name: file.name,
  1667. size: file.size,
  1668. sizeFormatted: formatFileSize(file.size),
  1669. type: file.type,
  1670. isUploading: true,
  1671. };
  1672. attachedFiles.value.push(fileWithStatus);
  1673. try {
  1674. const url = await uploadFile(file);
  1675. // 直接修改数组中的对象
  1676. const index = attachedFiles.value.findIndex(
  1677. (f) => f.name === file.name
  1678. );
  1679. if (index !== -1) {
  1680. // 使用数组替换方式更新,确保响应式更新
  1681. attachedFiles.value.splice(index, 1, {
  1682. ...fileWithStatus,
  1683. url,
  1684. isUploading: false,
  1685. });
  1686. }
  1687. } catch (error) {
  1688. attachedFiles.value = attachedFiles.value.filter(
  1689. (f) => f.name !== file.name
  1690. );
  1691. console.error("单个文件上传失败:", error);
  1692. }
  1693. }
  1694. } catch (error) {
  1695. console.error("文件上传失败:", error);
  1696. } finally {
  1697. isUploading.value = false;
  1698. // 修改文件上传后的处理逻辑
  1699. if (attachedFiles.value.length > 0) {
  1700. // 切换到预览标签页
  1701. activeTab.value = 'preview';
  1702. // 展开右侧菜单
  1703. isRightMenuCollapsed.value = false;
  1704. // 如果在移动端,调整布局
  1705. if (document.querySelector('.chat')) {
  1706. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1707. }
  1708. }
  1709. }
  1710. if (files.length > 0 && enableWebSearch.value) {
  1711. enableWebSearch.value = false; // 如果有文件上传,自动关闭互联网搜索
  1712. }
  1713. };
  1714. // 添加音频点击处理方法
  1715. const handleAudioClick = (message) => {
  1716. if(message.audioData){
  1717. if (currentPlayingId.value === message.id) {
  1718. stopAudio();
  1719. } else {
  1720. playAudioMessage(message.audioData, message.id);
  1721. }
  1722. }else{
  1723. // 用户消息的文本转语音处理
  1724. if (currentPlayingId.value === message.id) {
  1725. stopAudio();
  1726. } else {
  1727. playUserMessage(message.content, message.id);
  1728. }
  1729. }
  1730. };
  1731. // 添加播放用户消息的方法
  1732. const playUserMessage = async (text, messageId) => {
  1733. try {
  1734. // 如果当前有其他音频在播放,先停止
  1735. if (currentPlayingId.value && currentPlayingId.value !== messageId) {
  1736. stopAudio();
  1737. }
  1738. // 如果已经在播放这条消息,直接返回(这种情况应该不会发生,因为会被上面的 handleAudioClick 处理)
  1739. if (currentPlayingId.value === messageId) {
  1740. return;
  1741. }
  1742. const response = await axios.post(`${import.meta.env.VITE_BASE_AI_API}/api/voices/play_text`, {
  1743. text: text
  1744. }, {
  1745. headers: {
  1746. 'Authorization': `JWT ${localStorage.getItem('token')}`
  1747. },
  1748. });
  1749. if(response.data.code === 200){
  1750. // 创建音频元素
  1751. const audio = new Audio(`${import.meta.env.VITE_BASE_AI_API}${response.data.audio_url}`);
  1752. // 保存当前播放的音频和ID
  1753. currentAudioSource.value = audio;
  1754. currentPlayingId.value = messageId;
  1755. isPlaying.value = true;
  1756. // 播放结束时清理
  1757. audio.onended = () => {
  1758. currentPlayingId.value = null;
  1759. currentAudioSource.value = null;
  1760. isPlaying.value = false;
  1761. };
  1762. // 播放错误时清理
  1763. audio.onerror = (e) => {
  1764. console.error('播放文本失败:', e);
  1765. message.error('播放失败,请稍后重试');
  1766. currentPlayingId.value = null;
  1767. currentAudioSource.value = null;
  1768. isPlaying.value = false;
  1769. };
  1770. // 开始播放
  1771. await audio.play();
  1772. }
  1773. } catch (error) {
  1774. console.error('播放文本失败:', error);
  1775. message.error('播放失败,请稍后重试');
  1776. currentPlayingId.value = null;
  1777. currentAudioSource.value = null;
  1778. isPlaying.value = false;
  1779. }
  1780. };
  1781. // 修改停止播放方法
  1782. const stopAudio = () => {
  1783. if (audioPlayer.value) {
  1784. audioPlayer.value.pause();
  1785. audioPlayer.value.currentTime = 0;
  1786. audioPlayer.value = null;
  1787. }
  1788. if (currentAudioSource.value) {
  1789. currentAudioSource.value.pause();
  1790. currentAudioSource.value.currentTime = 0;
  1791. currentAudioSource.value = null;
  1792. }
  1793. isPlaying.value = false;
  1794. currentPlayingId.value = null;
  1795. };
  1796. // 在组件卸载时清理
  1797. onUnmounted(() => {
  1798. stopAudio();
  1799. });
  1800. // 添加 renderMarkdown 方法
  1801. const renderMarkdown = (content) => {
  1802. if (!content) return "";
  1803. /* // 处理代码块
  1804. content = content.replace(/```([\s\S]*?)```/g, (match, code) => {
  1805. return `<pre class="code-block"><code>${code}</code></pre>`;
  1806. });
  1807. // 处理行内代码
  1808. content = content.replace(/`([^`]+)`/g, '<code>$1</code>');
  1809. // 处理标题
  1810. content = content.replace(/^(#{1,6})\s+(.*)$/gm, (match, hashes, title) => {
  1811. const level = hashes.length;
  1812. return `<h${level}>${title}</h${level}>`;
  1813. }); */
  1814. return md.render(content);
  1815. };
  1816. // 添加新的响应式变量
  1817. const rightMenuWidth = ref(0); // 默认宽度
  1818. const minWidth = 0; // 最小宽度
  1819. const maxWidth = 800; // 最大宽度
  1820. // 添加拖动相关方法
  1821. const startResize = (e) => {
  1822. e.preventDefault();
  1823. const startX = e.type === 'mousedown' ? e.clientX : e.touches[0].clientX;
  1824. const startWidth = rightMenuWidth.value;
  1825. const handleMove = (e) => {
  1826. if (isRightMenuCollapsed.value) return;
  1827. const currentX = e.type === 'mousemove' ? e.clientX : e.touches[0].clientX;
  1828. const diff = startX - currentX;
  1829. let newWidth = Math.min(Math.max(startWidth + diff, minWidth), maxWidth);
  1830. rightMenuWidth.value = newWidth;
  1831. // 更新聊天区域的右边距和按钮位置
  1832. if (document.querySelector('.chat')) {
  1833. document.querySelector('.chat').style.right = `${newWidth}px`;
  1834. }
  1835. };
  1836. const handleEnd = () => {
  1837. document.removeEventListener('mousemove', handleMove);
  1838. document.removeEventListener('mouseup', handleEnd);
  1839. document.removeEventListener('touchmove', handleMove);
  1840. document.removeEventListener('touchend', handleEnd);
  1841. };
  1842. document.addEventListener('mousemove', handleMove);
  1843. document.addEventListener('mouseup', handleEnd);
  1844. document.addEventListener('touchmove', handleMove);
  1845. document.addEventListener('touchend', handleEnd);
  1846. };
  1847. // 添加搜索开关状态
  1848. const isSearchEnabled = ref(true);
  1849. // 添加切换搜索方法
  1850. const toggleSearch = () => {
  1851. isSearchEnabled.value = !isSearchEnabled.value;
  1852. };
  1853. // 修改 toggleWebSearch 方法
  1854. const toggleWebSearch = () => {
  1855. enableWebSearch.value = !enableWebSearch.value;
  1856. isSearchEnabled.value = enableWebSearch.value;
  1857. // 只有当当前标签是搜索标签时才折叠面板
  1858. if (!enableWebSearch.value && activeTab.value === 'search') {
  1859. isRightMenuCollapsed.value = true;
  1860. currentSearchQuery.value = '';
  1861. if (document.querySelector('.chat')) {
  1862. document.querySelector('.chat').style.right = '0';
  1863. }
  1864. } else if (enableWebSearch.value && inputContent.value.trim()) {
  1865. isRightMenuCollapsed.value = false;
  1866. currentSearchQuery.value = inputContent.value;
  1867. if (document.querySelector('.chat')) {
  1868. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1869. }
  1870. }
  1871. };
  1872. // 添加新的响应式变量
  1873. const currentSearchQuery = ref('');
  1874. // 添加输入变化处理方法
  1875. const handleInputChange = () => {
  1876. if (inputContent.value.trim()) {
  1877. currentSearchQuery.value = inputContent.value;
  1878. // 根据当前选中的搜索类型执行相应的搜索
  1879. if (enableWebSearch.value) {
  1880. /* sendMessageS(inputContent.value).catch((error) => {
  1881. console.error("Web search failed:", error);
  1882. }); */
  1883. } else if (enableKnowledgeSearch.value) {
  1884. handleKnowledgeSearch({
  1885. query: inputContent.value,
  1886. page: 1,
  1887. pageSize: 20
  1888. });
  1889. }
  1890. }
  1891. };
  1892. // 添加处理搜索开关的方法
  1893. const handleSearchToggle = (value) => {
  1894. console.log(enableWebSearch);
  1895. enableWebSearch.value = value;
  1896. if (value) {
  1897. // 开启搜索时,确保右侧面板展开
  1898. expandRightMenu();
  1899. activeTab.value = 'search';
  1900. }
  1901. };
  1902. // 添加新的响应式变量
  1903. const activeTab = ref('search'); // 默认显示搜索面板
  1904. // 处理文档选择
  1905. const handleDocumentSelect = (document) => {
  1906. // 处理文档选择逻辑
  1907. console.log('Selected document:', document);
  1908. };
  1909. // 添加收缩状态控制
  1910. const isCollapsed = ref(false);
  1911. // 监听屏幕宽度变化
  1912. const updateCollapsedState = () => {
  1913. isCollapsed.value = window.innerWidth <= 480;
  1914. };
  1915. onUnmounted(() => {
  1916. window.removeEventListener('resize', updateCollapsedState);
  1917. });
  1918. // 添加收缩状态控制
  1919. const isCompact = ref(false);
  1920. // 监听屏幕宽度变化
  1921. const updateCompactState = () => {
  1922. isCompact.value = window.innerWidth <= 768;
  1923. };
  1924. onUnmounted(() => {
  1925. window.removeEventListener('resize', updateCompactState);
  1926. });
  1927. // 添加计算属性
  1928. const isRightMenuVisible = computed(() => {
  1929. // 移除搜索开关对菜单显示的影响
  1930. checkMobile();
  1931. return !isRightMenuCollapsed.value;
  1932. /* return (!isRightMenuCollapsed.value && (
  1933. (enableWebSearch.value && activeTab.value === 'search') ||
  1934. (enableKnowledgeSearch.value && activeTab.value === 'knowledge') ||
  1935. (activeTab.value === 'preview' && attachedFiles.value.length > 0)
  1936. )); */
  1937. });
  1938. /* // 智能体
  1939. const handleInferenceModel = () => {
  1940. inferenceModel.value = !inferenceModel.value;
  1941. }; */
  1942. watch(inferenceModel, (newValue) => {
  1943. console.log('智能体状态:', newValue);
  1944. if (newValue) {
  1945. // 打开右侧窗口
  1946. rightMenuWidth.value = 450;
  1947. isRightMenuCollapsed.value = false;
  1948. if (document.querySelector('.chat')) {
  1949. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1950. }
  1951. enableKnowledgeSearch.value=false
  1952. enableWebSearch.value = false;
  1953. } else {
  1954. // 关闭右侧窗口
  1955. isRightMenuCollapsed.value = true;
  1956. if(enableKnowledgeSearch.value){
  1957. }else{
  1958. rightMenuWidth.value = 0;
  1959. if (document.querySelector('.chat')) {
  1960. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  1961. }
  1962. }
  1963. }
  1964. });
  1965. // 修改知识库搜索开关处理方法
  1966. const handleKnowledgeToggle = async (event) => {
  1967. if (event.target.checked) {
  1968. rightMenuWidth.value = 450;
  1969. // 使用 nextTick 确保 DOM 更新后再操作
  1970. await nextTick();
  1971. const chatElement = document.querySelector('.chat');
  1972. if (chatElement) {
  1973. chatElement.style.right = `${rightMenuWidth.value}px`;
  1974. } else {
  1975. console.warn('未找到聊天容器元素');
  1976. }
  1977. // 开启知识库搜索时关闭互联网搜索
  1978. enableWebSearch.value = false;
  1979. inferenceModel.value = false;
  1980. // 切换到知识库标签页
  1981. activeTab.value = 'knowledge';
  1982. // 如果有输入内容,执行知识库搜索
  1983. if (inputContent.value.trim()) {
  1984. handleKnowledgeSearch({
  1985. query: inputContent.value,
  1986. page: 1,
  1987. pageSize: 20
  1988. });
  1989. }
  1990. } else {
  1991. rightMenuWidth.value = 0;
  1992. await nextTick();
  1993. const chatElement = document.querySelector('.chat');
  1994. if (chatElement) {
  1995. chatElement.style.right = `${rightMenuWidth.value}px`;
  1996. } else {
  1997. console.warn('未找到聊天容器元素');
  1998. }
  1999. }
  2000. };
  2001. // 修改知识库搜索方法
  2002. const handleKnowledgeSearch = async (params) => {
  2003. if (!params.query.trim() || !enableKnowledgeSearch.value) return;
  2004. isKnowledgeLoading.value = true;
  2005. try {
  2006. const response = await axios.post(
  2007. `${import.meta.env.VITE_BASE_AI_API}/chataids/mysql_fuzzy_search/`,
  2008. {
  2009. // collection_names: ["25"], // 固定使用 "25" 作为 collection name
  2010. keywords: params.query, // 使用查询关键词
  2011. documents: [], // 保持空数组
  2012. document_ids: [], // 保持空数组
  2013. limit: 5 // 固定返回5条结果
  2014. },
  2015. {
  2016. headers: {
  2017. 'Authorization': `JWT ${localStorage.getItem('token')}`
  2018. }
  2019. }
  2020. );
  2021. console.log(response);
  2022. if (response.data && response.data.status === 200) {
  2023. knowledgeResults.value = response.data.data.data || [];
  2024. knowledgeTotal.value = response.data.data.data.total || 0;
  2025. }
  2026. } catch (error) {
  2027. console.error('Knowledge search failed:', error);
  2028. knowledgeResults.value = [];
  2029. knowledgeTotal.value = 0;
  2030. } finally {
  2031. isKnowledgeLoading.value = false;
  2032. }
  2033. }
  2034. // 修改处理互联网搜索开关的方法
  2035. const handleWebSearchToggle = (event) => {
  2036. if (event.target.checked) {
  2037. rightMenuWidth.value = 450;
  2038. if (document.querySelector('.chat')) {
  2039. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  2040. }
  2041. // 开启互联网搜索时关闭知识库搜索
  2042. enableKnowledgeSearch.value = false;
  2043. inferenceModel.value = false;
  2044. // 切换到搜索标签页
  2045. activeTab.value = 'search';
  2046. // 如果有输入内容,执行互联网搜索
  2047. if (inputContent.value.trim()) {
  2048. currentSearchQuery.value = inputContent.value;
  2049. /* sendMessageS(inputContent.value).catch((error) => {
  2050. console.error("Web search failed:", error);
  2051. }); */
  2052. }
  2053. }else{
  2054. rightMenuWidth.value = 0;
  2055. if (document.querySelector('.chat')) {
  2056. document.querySelector('.chat').style.right = `${rightMenuWidth.value}px`;
  2057. }
  2058. }
  2059. };
  2060. // 添加新的响应式变量
  2061. const API_BASE_URL = import.meta.env.VITE_BASE_AI_API;
  2062. const models = ref([]);
  2063. const selectedModel = ref(null);
  2064. const isLoadingModels = ref(false);
  2065. // 添加计算属性获取选中的模型信息
  2066. const selectedModelInfo = computed(() => {
  2067. if (!selectedModel.value || !models.value.length) return { type: '', name: '' };
  2068. const model = models.value.find(m => m.id === selectedModel.value);
  2069. return {
  2070. type: model?.type || '',
  2071. name: model?.name || ''
  2072. };
  2073. });
  2074. // 添加获取模型列表的方法
  2075. const fetchModels = async () => {
  2076. isLoadingModels.value = true;
  2077. try {
  2078. const response = await fetch(`${API_BASE_URL}/api/models?merchant_id=${JSON.parse(localStorage.getItem('userInfo')).merchant.merchant_id}`);
  2079. const data = await response.json();
  2080. console.log(data);
  2081. if (data.code === 2000) {
  2082. // 确保每个模型对象都有必要的字段
  2083. models.value = (data.data.models || []).map(model => ({
  2084. id: model.id,
  2085. name: model.name,
  2086. type: model.type || model.model_type || 'default' // 确保有type字段
  2087. }));
  2088. if (models.value.length > 0) {
  2089. selectedModel.value = models.value[0].id; // 默认选择第一个模型
  2090. }
  2091. }
  2092. } catch (error) {
  2093. console.error('Failed to fetch models:', error);
  2094. } finally {
  2095. isLoadingModels.value = false;
  2096. }
  2097. };
  2098. // 添加模型选择改变的处理方法
  2099. const handleModelChange = (modelId) => {
  2100. selectedModel.value = modelId;
  2101. };
  2102. // 用户信息
  2103. const userInfo = ref({
  2104. name: '',
  2105. role: ''
  2106. });
  2107. const getUserInfo = () => {
  2108. const storedUserInfo = localStorage.getItem('userInfo');
  2109. if (storedUserInfo) {
  2110. userInfo.value = JSON.parse(storedUserInfo);
  2111. }
  2112. }
  2113. // 在组件挂载时获取模型列表
  2114. onMounted(() => {
  2115. updateCompactState();
  2116. window.addEventListener('resize', updateCompactState);
  2117. updateCollapsedState();
  2118. window.addEventListener('resize', updateCollapsedState);
  2119. checkMobile();
  2120. window.addEventListener('resize', checkMobile);
  2121. fetchModels();
  2122. fetchDocumentSummary();
  2123. const storedUserInfo = localStorage.getItem('userInfo');
  2124. if (storedUserInfo) {
  2125. try {
  2126. userInfo.value = JSON.parse(storedUserInfo);
  2127. } catch (error) {
  2128. console.error('解析用户信息失败:', error);
  2129. }
  2130. }
  2131. });
  2132. const showPasswordDialog = ref(false)
  2133. const handleModifyPassword = () => {
  2134. showPasswordDialog.value = true
  2135. showDropdown.value = false // 关闭下拉菜单
  2136. }
  2137. const handleLogout = async () => {
  2138. try {
  2139. // 调用退出登录接口
  2140. await axios.post(`${import.meta.env.VITE_BASE_AI_API}/user/logout`, {}, {
  2141. headers: {
  2142. 'Authorization': `JWT ${localStorage.getItem('token')}`
  2143. }
  2144. });
  2145. // 清除本地存储的信息
  2146. localStorage.removeItem('token');
  2147. localStorage.removeItem('userInfo');
  2148. localStorage.removeItem('permissions');
  2149. localStorage.removeItem('username');
  2150. localStorage.removeItem('mobile');
  2151. // 清除 Vuex store 中的用户信息
  2152. store.commit('app/setUser', {
  2153. user: {},
  2154. permission: [],
  2155. auth: {}
  2156. });
  2157. // 关闭下拉菜单
  2158. showDropdown.value = false;
  2159. // 跳转到登录页面
  2160. router.push('/login');
  2161. } catch (error) {
  2162. console.error('退出登录失败:', error);
  2163. // 即使接口调用失败,也清除本地信息并跳转
  2164. localStorage.clear();
  2165. router.push('/login');
  2166. }
  2167. };
  2168. const handleCreateInvitation = async () => {
  2169. try {
  2170. const response = await axios.post(`${import.meta.env.VITE_BASE_AI_API}/user/create_invitation`, {}, {
  2171. headers: {
  2172. 'Authorization': `JWT ${localStorage.getItem('token')}`
  2173. }
  2174. });
  2175. console.log(response);
  2176. if (response.data.code === 200) {
  2177. message.success('创建邀请成功');
  2178. // 从当前窗口location获取基础URL
  2179. const baseUrl = `${window.location.protocol}//${window.location.host}`;
  2180. // 跳转到完整URL
  2181. window.location.href = `${baseUrl}${response.data.data.invitation_link}`;
  2182. } else {
  2183. message.error(response.data.message || '创建邀请失败');
  2184. }
  2185. } catch (error) {
  2186. console.error('创建邀请失败:', error);
  2187. message.error(error.response?.data?.message || '创建邀请失败,请稍后重试');
  2188. }
  2189. showDropdown.value = false; // 关闭下拉菜单
  2190. };
  2191. /* return {
  2192. loginForm,
  2193. formData,
  2194. rules,
  2195. loading,
  2196. rememberMe,
  2197. loginType,
  2198. countdown,
  2199. handleLogin,
  2200. sendVerificationCode,
  2201. switchToMobileLogin,
  2202. switchToAccountLogin,
  2203. switchToWechatLogin,
  2204. wechatLoginModal,
  2205. wechatQrCode,
  2206. getWechatQrCode,
  2207. handleWechatLoginCancel,
  2208. handleCreateInvitation
  2209. }; */
  2210. // These variables are already declared above
  2211. /* const currentAudioSource = ref(null);
  2212. const currentPlayingId = ref(null); */
  2213. // 添加播放音频消息的方法
  2214. const playAudioMessage = async (audioData, messageId) => {
  2215. try {
  2216. // 如果当前有其他音频在播放,先停止
  2217. if (currentPlayingId.value && currentPlayingId.value !== messageId) {
  2218. stopAudio();
  2219. }
  2220. // 如果已经在播放这条消息,直接返回
  2221. if (currentPlayingId.value === messageId) {
  2222. return;
  2223. }
  2224. // 创建新的音频元素
  2225. const audio = new Audio(audioData);
  2226. // 保存当前播放的音频和ID
  2227. currentAudioSource.value = audio;
  2228. currentPlayingId.value = messageId;
  2229. isPlaying.value = true;
  2230. // 播放结束时清理
  2231. audio.onended = () => {
  2232. currentPlayingId.value = null;
  2233. currentAudioSource.value = null;
  2234. isPlaying.value = false;
  2235. };
  2236. // 播放错误时清理
  2237. audio.onerror = (e) => {
  2238. console.error('播放音频失败:', e);
  2239. message.error('播放失败,请稍后重试');
  2240. currentPlayingId.value = null;
  2241. currentAudioSource.value = null;
  2242. isPlaying.value = false;
  2243. };
  2244. // 开始播放
  2245. await audio.play();
  2246. } catch (error) {
  2247. console.error('播放音频失败:', error);
  2248. message.error('播放失败,请稍后重试');
  2249. currentPlayingId.value = null;
  2250. currentAudioSource.value = null;
  2251. isPlaying.value = false;
  2252. }
  2253. };
  2254. // 主题状态
  2255. const isDarkTheme = ref(false);
  2256. // 应用主题
  2257. const applyTheme = (isDark) => {
  2258. document.documentElement.classList.toggle('dark-theme', isDark);
  2259. };
  2260. // 切换主题
  2261. const toggleTheme = () => {
  2262. isDarkTheme.value = !isDarkTheme.value;
  2263. localStorage.setItem('theme', isDarkTheme.value ? 'dark' : 'light');
  2264. applyTheme(isDarkTheme.value);
  2265. };
  2266. // 初始化主题
  2267. onMounted(() => {
  2268. if (document.querySelector('.chat')) {
  2269. document.querySelector('.chat').style.right = `0px`;
  2270. }
  2271. checkMobile();
  2272. // 优先使用存储的主题设置
  2273. const savedTheme = localStorage.getItem('theme');
  2274. if (savedTheme) {
  2275. isDarkTheme.value = savedTheme === 'dark';
  2276. } else {
  2277. // 如果没有存储的主题,则使用系统主题
  2278. isDarkTheme.value = window.matchMedia('(prefers-color-scheme: dark)').matches;
  2279. }
  2280. applyTheme(isDarkTheme.value);
  2281. // 监听系统主题变化
  2282. const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
  2283. mediaQuery.addEventListener('change', (e) => {
  2284. if (!localStorage.getItem('theme')) {
  2285. isDarkTheme.value = e.matches;
  2286. applyTheme(e.matches);
  2287. }
  2288. });
  2289. });
  2290. /* return {
  2291. isDarkTheme,
  2292. toggleTheme,
  2293. // ... existing return values ...
  2294. }; */
  2295. const excelOptions = ref({
  2296. xls: false, // 预览xlsx文件设为false;预览xls文件设为true
  2297. minColLength: 15, // excel最少渲染列数
  2298. minRowLength: 50, // excel最少渲染行数,增加以确保显示更多内容
  2299. widthOffset: 50, // 增加列宽偏移量,使内容显示更完整
  2300. heightOffset: 30, // 增加行高偏移量
  2301. forceRender: true, // 强制渲染
  2302. maxSheetLength: 10, // 最多渲染工作表数量
  2303. showGridLines: true, // 显示网格线
  2304. defaultFontSize: 12, // 默认字体大小
  2305. defaultRowHeight: 24, // 默认行高
  2306. autoFitColumn: true, // 自动适应列宽
  2307. overflowColumns: true, // 允许列内容溢出
  2308. showToolbar: true, // 显示工具栏
  2309. });
  2310. // 添加Excel渲染完成的处理函数
  2311. const handleRendered = () => {
  2312. console.log('Excel文件渲染完成');
  2313. nextTick(() => {
  2314. // 手动触发一次重新计算大小
  2315. window.dispatchEvent(new Event('resize'));
  2316. });
  2317. };
  2318. // 添加Excel错误处理函数的详细信息
  2319. const handleExcelError = (error) => {
  2320. console.error('Excel文件渲染失败:', error);
  2321. message.error('Excel预览失败:' + (error.message || '请尝试下载后查看'));
  2322. };
  2323. const isWordFile = (file) => {
  2324. if (!file) return false;
  2325. const wordTypes = ['doc', 'docx'];
  2326. const ext = file.name?.split('.')?.pop()?.toLowerCase() || '';
  2327. const isWord = wordTypes.includes(ext);
  2328. if (isWord && file.type) {
  2329. return file.type === 'application/msword' ||
  2330. file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
  2331. }
  2332. return isWord;
  2333. };
  2334. const isExcelFile = (file) => {
  2335. if (!file) return false;
  2336. const excelTypes = ['xls', 'xlsx'];
  2337. const ext = file.name?.split('.')?.pop()?.toLowerCase() || '';
  2338. return excelTypes.includes(ext);
  2339. };
  2340. const isPdfFile = (file) => {
  2341. if (!file) return false;
  2342. return file.name?.toLowerCase()?.endsWith('.pdf') || false;
  2343. };
  2344. const currentDoc = ref(null);
  2345. // 监听文档列表变化
  2346. watch(() => attachedFiles.value, (newFiles) => {
  2347. if (newFiles && newFiles.length > 0) {
  2348. currentDoc.value = newFiles[newFiles.length - 1]; // 预览最新上传的文档
  2349. } else {
  2350. currentDoc.value = null;
  2351. }
  2352. }, {
  2353. immediate: true,
  2354. deep: true
  2355. });
  2356. const handleDownload = (doc) => {
  2357. if (doc.url) {
  2358. const link = document.createElement('a');
  2359. link.href = doc.url;
  2360. link.download = doc.name;
  2361. document.body.appendChild(link);
  2362. link.click();
  2363. document.body.removeChild(link);
  2364. }
  2365. };
  2366. const closePreview = () => {
  2367. currentDoc.value = null;
  2368. };
  2369. // 添加文档点击事件处理
  2370. const handleDocClick = (doc) => {
  2371. currentDoc.value = doc;
  2372. };
  2373. /*
  2374. */
  2375. // 添加流式思考步骤
  2376. const currentThinkingSteps = ref([]);
  2377. // 添加流式思考步骤
  2378. const addThinkingStep = (step) => {
  2379. currentThinkingSteps.value.push({
  2380. type: step.type || 'default',
  2381. content: step.content,
  2382. timestamp: Date.now()
  2383. });
  2384. };
  2385. // 清除当前思考步骤
  2386. const clearThinkingSteps = () => {
  2387. currentThinkingSteps.value = [];
  2388. };
  2389. // 在消息发送完成后将思考步骤添加到消息中
  2390. const finalizeThinkingSteps = (messageId) => {
  2391. const message = messages.value.find(m => m.id === messageId);
  2392. if (message) {
  2393. message.thinkingSteps = [...currentThinkingSteps.value];
  2394. clearThinkingSteps();
  2395. }
  2396. };
  2397. </script>
  2398. <style scoped>
  2399. .layout {
  2400. display: flex;
  2401. width: 100%;
  2402. height: 100vh;
  2403. overflow: hidden;
  2404. position: relative;
  2405. }
  2406. .header {
  2407. position: fixed;
  2408. top: 0;
  2409. left: 0;
  2410. width: 100%;
  2411. height: 64px;
  2412. background: #f7f7f8;
  2413. border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  2414. z-index: 999;
  2415. }
  2416. .user-profile-bar {
  2417. margin: 0 auto;
  2418. position: relative;
  2419. display: flex;
  2420. align-items: center;
  2421. justify-content: space-between;
  2422. cursor: pointer;
  2423. }
  2424. .user-info-bar {
  2425. display: flex;
  2426. align-items: center;
  2427. justify-content: flex-end;
  2428. width: auto;
  2429. height: 100%;
  2430. background-color: var(--primary-bg);
  2431. border-radius: 10px;
  2432. padding: 4px 12px;
  2433. margin-right: 12px;
  2434. box-shadow: var(--shadow-sm);
  2435. }
  2436. .avatar {
  2437. width: 32px;
  2438. height: 32px;
  2439. border-radius: 50%;
  2440. overflow: hidden;
  2441. margin-left: 12px;
  2442. cursor: pointer;
  2443. transition: transform 0.2s ease;
  2444. }
  2445. .avatar:hover {
  2446. transform: scale(1.05);
  2447. }
  2448. .avatar img {
  2449. width: 100%;
  2450. height: 100%;
  2451. object-fit: cover;
  2452. }
  2453. .user-info {
  2454. display: flex;
  2455. /* flex-direction: column; */
  2456. margin-right: 8px;
  2457. cursor: pointer;
  2458. }
  2459. .user-name {
  2460. font-size: 13px;
  2461. font-weight: 400;
  2462. color: var(--primary-text);
  2463. line-height: 1.4;
  2464. }
  2465. .dropdown-menu {
  2466. position: absolute;
  2467. top: 100%;
  2468. right: 0;
  2469. background: white;
  2470. border-radius: 8px;
  2471. box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  2472. min-width: 160px;
  2473. z-index: 1000;
  2474. margin-top: 4px;
  2475. }
  2476. .dropdown-item {
  2477. padding: 12px 16px;
  2478. display: flex;
  2479. align-items: center;
  2480. color: var(--primary-text);
  2481. transition: background-color 0.2s;
  2482. }
  2483. .dropdown-item:hover {
  2484. background-color: #f5f5f5;
  2485. }
  2486. .dropdown-item i {
  2487. margin-right: 8px;
  2488. font-size: 14px;
  2489. color: #666;
  2490. }
  2491. .menu {
  2492. margin-top: 64px;
  2493. padding-top: 15px;
  2494. background: #f7f7f8;
  2495. width: 260px;
  2496. height: 93%;
  2497. display: flex;
  2498. flex-direction: column;
  2499. border-right: 1px solid rgba(0, 0, 0, 0.06);
  2500. position: absolute;
  2501. left: 0;
  2502. /* transform: translateX(0); */
  2503. transition: all 0.3s ease;
  2504. z-index: 2;
  2505. }
  2506. .menu.collapsed {
  2507. display: none;
  2508. transform: translateX(-260px);
  2509. width: 0;
  2510. }
  2511. .conversations {
  2512. padding: 0 12px;
  2513. flex: 1;
  2514. overflow-y: auto;
  2515. }
  2516. .chat {
  2517. flex: 1;
  2518. margin: 75px 24px 24px;
  2519. display: flex;
  2520. flex-direction: column;
  2521. gap: 24px;
  2522. overflow-y: auto;
  2523. overflow-x: hidden;
  2524. transition: all 0.3s ease;
  2525. position: absolute;
  2526. left: 0;
  2527. right: 0;
  2528. top: 0;
  2529. bottom: 0;
  2530. justify-content: space-between;
  2531. background-color: var(--primary-bg);
  2532. /* margin: 16px; */
  2533. border-radius: 16px;
  2534. box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  2535. }
  2536. .chat-header {
  2537. padding: 20px 24px;
  2538. border-bottom: 1px solid var(--border-color);
  2539. display: flex;
  2540. align-items: center;
  2541. justify-content: space-between;
  2542. background: var(--secondary-bg);
  2543. }
  2544. .chat-header h2 {
  2545. font-size: 18px;
  2546. font-weight: 600;
  2547. color: var(--text-primary);
  2548. margin: 0;
  2549. }
  2550. .chat-status {
  2551. display: flex;
  2552. align-items: center;
  2553. gap: 8px;
  2554. font-size: 14px;
  2555. color: var(--text-secondary);
  2556. }
  2557. .status-indicator {
  2558. width: 8px;
  2559. height: 8px;
  2560. border-radius: 50%;
  2561. background: var(--success-color);
  2562. animation: pulse 2s infinite;
  2563. }
  2564. .menu:not(.collapsed) + .chat {
  2565. left: 260px;
  2566. }
  2567. .chat {
  2568. right: 0;
  2569. transition: all 0.3s ease;
  2570. }
  2571. .layout:has(.right_menu:not(.collapsed)) .chat {
  2572. right: 450px;
  2573. }
  2574. .right_menu:not(.collapsed) ~ .chat {
  2575. right: 450px;
  2576. }
  2577. .messages {
  2578. flex: 1;
  2579. overflow-y: auto;
  2580. padding-right: 16px;
  2581. }
  2582. .sender {
  2583. box-shadow: none;
  2584. border: 1px solid #e5e6eb;
  2585. border-radius: 8px;
  2586. padding: 8px;
  2587. }
  2588. .logo {
  2589. height: 64px;
  2590. display: flex;
  2591. align-items: center;
  2592. padding: 0 20px;
  2593. }
  2594. .logo-img {
  2595. /* width: 24px; */
  2596. height: 40px;
  2597. }
  2598. .logo span {
  2599. margin-left: 12px;
  2600. font-size: 16px;
  2601. font-weight: 600;
  2602. color: rgba(0, 0, 0, 0.88);
  2603. }
  2604. .new-conversation-btn {
  2605. margin: 0 12px 12px;
  2606. height: 40px;
  2607. background: rgba(235, 245, 255, 0.7);
  2608. border: none;
  2609. border-radius: 8px;
  2610. color: #1677ff;
  2611. font-size: 14px;
  2612. display: flex;
  2613. align-items: center;
  2614. justify-content: center;
  2615. gap: 8px;
  2616. cursor: pointer;
  2617. transition: background-color 0.2s;
  2618. }
  2619. .new-conversation-btn:hover {
  2620. background: rgba(235, 245, 255, 0.9);
  2621. }
  2622. .conversation-list {
  2623. background: var(--secondary-bg);
  2624. flex: 1;
  2625. color: var(--primary-text);
  2626. padding: 0 8px;
  2627. overflow-y: auto;
  2628. }
  2629. .conversation-item {
  2630. padding: 12px;
  2631. margin: 4px 0;
  2632. border-radius: 8px;
  2633. color: var(--primary-text);
  2634. font-size: 14px;
  2635. cursor: pointer;
  2636. transition: background-color 0.2s;
  2637. }
  2638. .conversation-item:hover {
  2639. background: rgba(0, 0, 0, 0.04);
  2640. }
  2641. .conversation-item.active {
  2642. background: var(--secondary-bg);
  2643. box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  2644. }
  2645. .conversation-list::-webkit-scrollbar {
  2646. width: 4px;
  2647. }
  2648. .conversation-list::-webkit-scrollbar-thumb {
  2649. background: rgba(0, 0, 0, 0.15);
  2650. border-radius: 2px;
  2651. }
  2652. .conversation-list::-webkit-scrollbar-track {
  2653. background: transparent;
  2654. }
  2655. :deep(.welcome-message) {
  2656. background: #fff;
  2657. border-radius: 8px;
  2658. padding: 16px;
  2659. display: flex;
  2660. align-items: flex-start;
  2661. gap: 16px;
  2662. }
  2663. :deep(.welcome-message .title) {
  2664. font-size: 16px;
  2665. font-weight: 500;
  2666. color: rgba(0, 0, 0, 0.88);
  2667. margin-bottom: 4px;
  2668. }
  2669. :deep(.welcome-message .description) {
  2670. color: rgba(0, 0, 0, 0.45);
  2671. font-size: 14px;
  2672. }
  2673. :deep(.prompt-card) {
  2674. background: #f7f8fa;
  2675. border-radius: 8px;
  2676. padding: 16px;
  2677. margin-bottom: 12px;
  2678. }
  2679. :deep(.prompt-card-title) {
  2680. font-size: 16px;
  2681. font-weight: 500;
  2682. margin-bottom: 8px;
  2683. display: flex;
  2684. align-items: center;
  2685. gap: 8px;
  2686. }
  2687. :deep(.prompt-option) {
  2688. background: #f5f5f5;
  2689. padding: 8px 12px;
  2690. border-radius: 4px;
  2691. margin-top: 8px;
  2692. cursor: pointer;
  2693. transition: background 0.3s;
  2694. }
  2695. :deep(.prompt-option:hover) {
  2696. background: #e8e8e8;
  2697. }
  2698. .input-container {
  2699. padding: 15px;
  2700. width: 98%;
  2701. /* margin: auto auto 0;
  2702. display: flex;
  2703. flex-direction: column; */
  2704. gap: 8px;
  2705. background-color: var(--secondary-bg);
  2706. border-radius: 5px;
  2707. }
  2708. .tabs-wrapper {
  2709. display: flex;
  2710. gap: 8px;
  2711. margin-bottom: 4px;
  2712. }
  2713. .tab-item {
  2714. display: flex;
  2715. align-items: center;
  2716. gap: 6px;
  2717. padding: 4px 12px;
  2718. border-radius: 4px;
  2719. cursor: pointer;
  2720. font-size: 14px;
  2721. color: rgba(0, 0, 0, 0.88);
  2722. background: transparent;
  2723. transition: background-color 0.2s;
  2724. }
  2725. .tab-item:hover {
  2726. background: rgba(0, 0, 0, 0.04);
  2727. }
  2728. .tab-item.active {
  2729. background: #f5f5f5;
  2730. }
  2731. .tab-item .anticon {
  2732. font-size: 14px;
  2733. }
  2734. .input-wrapper {
  2735. display: flex;
  2736. align-items: center;
  2737. padding: 8px 12px;
  2738. border: 1px solid var(--border-color);
  2739. border-radius: 8px;
  2740. background: var(--secondary-bg);
  2741. color: var(--primary-text);
  2742. }
  2743. .message-input {
  2744. flex: 1;
  2745. border: none;
  2746. outline: none;
  2747. padding: 8px;
  2748. font-size: 14px;
  2749. background: transparent;
  2750. color: var(--primary-text);
  2751. }
  2752. .message-input::placeholder {
  2753. color: var(--primary-text);
  2754. }
  2755. .attachment-btn,
  2756. .send-btn {
  2757. display: flex;
  2758. align-items: center;
  2759. justify-content: center;
  2760. width: 32px;
  2761. height: 32px;
  2762. border: none;
  2763. background: transparent;
  2764. cursor: pointer;
  2765. color: rgba(0, 0, 0, 0.45);
  2766. border-radius: 4px;
  2767. padding: 0;
  2768. }
  2769. .attachment-btn:hover,
  2770. .send-btn:hover {
  2771. background: rgba(0, 0, 0, 0.04);
  2772. color: var(--primary-text);
  2773. }
  2774. .attachments-panel {
  2775. background: var(--primary-bg);
  2776. border-radius: 12px;
  2777. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  2778. overflow: hidden;
  2779. }
  2780. .panel-content {
  2781. background: var(--primary-bg);
  2782. }
  2783. .attachments-header {
  2784. padding: 12px 16px;
  2785. border-bottom: 1px solid #f0f0f0;
  2786. display: flex;
  2787. justify-content: space-between;
  2788. align-items: center;
  2789. }
  2790. .attachments-header span {
  2791. font-size: 14px;
  2792. font-weight: 500;
  2793. color: var(--primary-text);
  2794. }
  2795. .close-btn {
  2796. border: none;
  2797. background: transparent;
  2798. cursor: pointer;
  2799. padding: 4px;
  2800. display: flex;
  2801. align-items: center;
  2802. justify-content: center;
  2803. color: rgba(0, 0, 0, 0.45);
  2804. }
  2805. .upload-area {
  2806. padding: 24px;
  2807. border-radius: 8px;
  2808. text-align: center;
  2809. cursor: pointer;
  2810. color: var(--primary-text);
  2811. transition: all 0.3s;
  2812. }
  2813. .upload-area.has-files {
  2814. padding: 12px;
  2815. background: var(--primary-bg);
  2816. }
  2817. .upload-icon {
  2818. width: 32px;
  2819. height: 32px;
  2820. margin-bottom: 8px;
  2821. }
  2822. .upload-text {
  2823. font-size: 14px;
  2824. color: var(--primary-text);
  2825. margin-bottom: 4px;
  2826. }
  2827. .upload-hint {
  2828. font-size: 12px;
  2829. color: var(--primary-text);
  2830. }
  2831. .file-list {
  2832. display: flex;
  2833. flex-wrap: wrap;
  2834. gap: 8px;
  2835. padding: 10px;
  2836. }
  2837. .file-item {
  2838. position: relative;
  2839. width: 260px;
  2840. padding: 8px 12px;
  2841. margin: 4px 0;
  2842. background: var(--secondary-bg);
  2843. border-radius: 8px;
  2844. }
  2845. .file-item.is-image {
  2846. width: 68px;
  2847. padding: 0;
  2848. margin: 4px 0;
  2849. }
  2850. .file-wrapper {
  2851. position: relative;
  2852. width: 100%;
  2853. height: 100%;
  2854. }
  2855. .file-icon {
  2856. width: 68px;
  2857. height: 68px;
  2858. object-fit: cover;
  2859. border-radius: 4px;
  2860. }
  2861. .file-wrapper video.file-icon {
  2862. background: #000;
  2863. }
  2864. .remove-btn {
  2865. position: absolute;
  2866. top: -8px;
  2867. right: -8px;
  2868. width: 16px;
  2869. height: 16px;
  2870. padding: 0;
  2871. border: none;
  2872. background: #545454;
  2873. border-radius: 50%;
  2874. cursor: pointer;
  2875. display: flex;
  2876. align-items: center;
  2877. justify-content: center;
  2878. font-size: 14px;
  2879. line-height: 1;
  2880. color: #fff;
  2881. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  2882. }
  2883. .remove-btn:hover {
  2884. opacity: 0.8;
  2885. }
  2886. .file-info {
  2887. margin-top: 8px;
  2888. }
  2889. .file-name {
  2890. display: block;
  2891. max-width: 150px;
  2892. color: var(--primary-text);
  2893. font-size: 14px;
  2894. white-space: nowrap;
  2895. overflow: hidden;
  2896. text-overflow: ellipsis;
  2897. }
  2898. .file-info .file-name {
  2899. max-width: 150px;
  2900. color: var(--primary-text);
  2901. }
  2902. .file-name:hover {
  2903. cursor: pointer;
  2904. }
  2905. .file-size {
  2906. display: block;
  2907. color: var(--primary-text);
  2908. font-size: 12px;
  2909. margin-top: 4px;
  2910. }
  2911. .add-more-btn {
  2912. display: flex;
  2913. align-items: center;
  2914. justify-content: center;
  2915. width: 68px;
  2916. height: 68px;
  2917. border: 1px dashed #d9d9d9;
  2918. border-radius: 6px;
  2919. background: transparent;
  2920. cursor: pointer;
  2921. transition: all 0.3s;
  2922. margin: 4px 0;
  2923. }
  2924. .add-more-btn:hover {
  2925. border-color: #1677ff;
  2926. background: #f0f7ff;
  2927. }
  2928. /* 欢迎区域样式 */
  2929. .welcome-section {
  2930. max-width: 800px;
  2931. margin: 0 auto;
  2932. width: 50%;
  2933. }
  2934. .welcome-header {
  2935. display: flex;
  2936. align-items: flex-start;
  2937. gap: 16px;
  2938. margin-bottom: 24px;
  2939. }
  2940. .avatar {
  2941. width: 40px;
  2942. height: 40px;
  2943. border-radius: 50%;
  2944. }
  2945. .avatar img{
  2946. width: 100%;
  2947. height: 100%;
  2948. border-radius: 50%;
  2949. }
  2950. .welcome-info {
  2951. flex: 1;
  2952. }
  2953. .welcome-info h2 {
  2954. font-size: 20px;
  2955. font-weight: 500;
  2956. color: rgba(0, 0, 0, 0.88);
  2957. margin: 0 0 4px 0;
  2958. }
  2959. .welcome-info p {
  2960. font-size: 14px;
  2961. color: rgba(0, 0, 0, 0.45);
  2962. margin: 0;
  2963. }
  2964. .action-buttons {
  2965. display: flex;
  2966. gap: 8px;
  2967. }
  2968. .icon-btn {
  2969. padding: 8px;
  2970. border: none;
  2971. background: transparent;
  2972. cursor: pointer;
  2973. color: rgba(0, 0, 0, 0.45);
  2974. }
  2975. /* 建议区域样式 */
  2976. .suggestion-section {
  2977. margin-top: 70px;
  2978. }
  2979. .suggestion-section h3 {
  2980. font-size: 14px;
  2981. color: rgba(0, 0, 0, 0.45);
  2982. margin-bottom: 16px;
  2983. }
  2984. .cards-container {
  2985. display: flex;
  2986. gap: 16px;
  2987. }
  2988. .suggestion-card {
  2989. flex: 1;
  2990. border-radius: 8px;
  2991. padding: 16px;
  2992. background: #ffffff; /* 替换 var(--ant-color-bg-container) */
  2993. border-radius: 8px; /* 替换 var(--ant-border-radius-lg) */
  2994. transition: border 0.3s, background 0.3s; /* 替换 var(--ant-motion-duration-slow) */
  2995. border: 1px solid #f0f0f0; /* 替换合的 border 属性 */
  2996. }
  2997. .loading-btn {
  2998. display: flex;
  2999. align-items: center;
  3000. justify-content: center;
  3001. width: 32px;
  3002. height: 32px;
  3003. background: #4d7cff;
  3004. border-radius: 50%;
  3005. position: relative;
  3006. }
  3007. .loading-square {
  3008. width: 14px;
  3009. height: 14px;
  3010. background: #fff;
  3011. border-radius: 3px;
  3012. display: block;
  3013. animation: loading-square-blink 1s infinite;
  3014. }
  3015. @keyframes loading-square-blink {
  3016. 0%, 100% { opacity: 1; }
  3017. 50% { opacity: 0.5; }
  3018. }
  3019. :root {
  3020. --ant-color-bg-container: #ffffff;
  3021. --ant-border-radius-lg: 8px;
  3022. --ant-motion-duration-slow: 0.3s;
  3023. --ant-line-width: 1px;
  3024. --ant-line-type: solid;
  3025. --ant-color-border-secondary: #f0f0f0;
  3026. }
  3027. .card-header {
  3028. display: flex;
  3029. align-items: center;
  3030. gap: 8px;
  3031. margin-bottom: 8px;
  3032. }
  3033. .card-header h4 {
  3034. font-size: 16px;
  3035. font-weight: 500;
  3036. color: rgba(0, 0, 0, 0.88);
  3037. margin: 0;
  3038. }
  3039. .icon.red {
  3040. color: #ff4d4f;
  3041. }
  3042. .icon.blue {
  3043. color: #1890ff;
  3044. }
  3045. .card-subtitle {
  3046. font-size: 14px;
  3047. color: rgba(0, 0, 0, 0.45);
  3048. margin-bottom: 16px;
  3049. }
  3050. .suggestion-items {
  3051. display: flex;
  3052. flex-direction: column;
  3053. gap: 8px;
  3054. }
  3055. .suggestion-item {
  3056. padding: 8px 12px;
  3057. background: #f5f5f5;
  3058. border-radius: 4px;
  3059. font-size: 12px;
  3060. color: rgba(0, 0, 0, 0.88);
  3061. display: flex;
  3062. align-items: center;
  3063. gap: 8px;
  3064. cursor: pointer;
  3065. transition: opacity 0.3s ease;
  3066. }
  3067. .suggestion-item:hover {
  3068. background: #e8e8e8;
  3069. }
  3070. .tab-icon {
  3071. width: 16px;
  3072. }
  3073. .attached-files {
  3074. padding: 16px;
  3075. }
  3076. .file-item {
  3077. display: flex;
  3078. align-items: center;
  3079. gap: 8px;
  3080. padding: 8px;
  3081. border-radius: 4px;
  3082. }
  3083. .file-item:hover {
  3084. background: var(--secondary-bg);
  3085. }
  3086. .remove-btn {
  3087. margin-left: auto;
  3088. padding: 4px;
  3089. border: none;
  3090. background: transparent;
  3091. cursor: pointer;
  3092. color: var(--primary-text);
  3093. }
  3094. .remove-btn:hover {
  3095. color: var(--primary-text);
  3096. }
  3097. .send-btn:disabled {
  3098. opacity: 0.5;
  3099. cursor: not-allowed;
  3100. }
  3101. .upload-area {
  3102. /* border: 2px dashed #d9d9d9; */
  3103. border-radius: 8px;
  3104. padding: 20px;
  3105. text-align: center;
  3106. cursor: pointer;
  3107. transition: border-color 0.3s;
  3108. }
  3109. /* .upload-area:hover,
  3110. .upload-area.drag-over {
  3111. border-color: #1677ff;
  3112. } */
  3113. .file-item {
  3114. display: flex;
  3115. align-items: center;
  3116. width: 236px;
  3117. height: 68px;
  3118. padding: 0;
  3119. margin: 4px 0;
  3120. background: var(--secondary-bg);
  3121. color: var(--primary-text);
  3122. border-radius: 4px;
  3123. }
  3124. .file-item .remove-btn {
  3125. margin-left: auto;
  3126. padding: 4px 8px;
  3127. background: transparent;
  3128. border: none;
  3129. cursor: pointer;
  3130. }
  3131. /* 聊天内容显示框 */
  3132. .message-list {
  3133. width: 60%;
  3134. overflow-y: auto;
  3135. overflow-x: hidden;
  3136. padding: 0 20px;
  3137. display: flex;
  3138. flex-direction: column;
  3139. gap: 16px;
  3140. margin: 0px auto 0;
  3141. }
  3142. .message-item {
  3143. display: flex;
  3144. margin-bottom: 12px;
  3145. }
  3146. /* 用户消息靠右显示 */
  3147. .user {
  3148. display: flex;
  3149. justify-content: flex-end;
  3150. }
  3151. .message-bubble {
  3152. max-width: 80%;
  3153. padding: 12px 16px;
  3154. border-radius: 12px;
  3155. background: #fff;
  3156. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  3157. }
  3158. /* 用户消息的气泡样式 */
  3159. .user .message-bubble {
  3160. background: #edf2f7;
  3161. color: rgba(0, 0, 0, 0.88);
  3162. }
  3163. /* AI消息的气泡样式 */
  3164. .assistant .message-bubble {
  3165. background: #f7f7f8;
  3166. color: rgba(0, 0, 0, 0.88);
  3167. }
  3168. .message-content {
  3169. font-size: 14px;
  3170. line-height: 1.5;
  3171. white-space: pre-wrap;
  3172. word-break: break-word;
  3173. }
  3174. .right_menu {
  3175. /* 修改现有样式 */
  3176. /* position: absolute;
  3177. right: 0; */
  3178. margin-top: 64px;
  3179. height: 93%;
  3180. background: #f7f7f8;
  3181. border-left: 1px solid rgba(0, 0, 0, 0.06);
  3182. transform: translateX(0);
  3183. transition: transform 0.3s ease, width 0.3s ease;
  3184. z-index: 2;
  3185. position: relative;
  3186. }
  3187. .right_menu.collapsed {
  3188. transform: translateX(100%);
  3189. width: 0;
  3190. }
  3191. /* 当右侧菜单展开时,给聊天区域添加右边距 */
  3192. .right_menu:not(.collapsed) + .chat {
  3193. margin-right: 450px;
  3194. }
  3195. .collapse-left-button{
  3196. position: absolute;
  3197. left: 260px;
  3198. top: 50%;
  3199. transform: translateY(-50%);
  3200. width: 20px;
  3201. height: 40px;
  3202. background: var(--secondary-bg);
  3203. border: 1px solid var(--border-color);
  3204. border-right: none;
  3205. border-radius: 4px 0 0 4px;
  3206. display: flex;
  3207. align-items: center;
  3208. justify-content: center;
  3209. cursor: pointer;
  3210. z-index: 2;
  3211. transition: all 0.3s ease;
  3212. }
  3213. .menu-collapsed {
  3214. left: 0px;
  3215. border-right: 1px solid var(--border-color);
  3216. border-left: none;
  3217. border-radius: 0 4px 4px 0;
  3218. }
  3219. /* .collapse-button {
  3220. position: absolute;
  3221. left: -20px;
  3222. top: 50%;
  3223. transform: translateY(-50%);
  3224. width: 20px;
  3225. height: 40px;
  3226. background: #fff;
  3227. border: 1px solid rgba(0, 0, 0, 0.06);
  3228. border-right: none;
  3229. border-radius: 4px 0 0 4px;
  3230. display: flex;
  3231. align-items: center;
  3232. justify-content: center;
  3233. cursor: pointer;
  3234. z-index: 3;
  3235. transition: left 0.3s ease;
  3236. } */
  3237. /* .collapse-button.menu-expanded {
  3238. border-right: 1px solid rgba(0, 0, 0, 0.06);
  3239. border-left: none;
  3240. border-radius: 0 4px 4px 0;
  3241. } */
  3242. /* .collapse-button:hover {
  3243. background: #f5f5f5;
  3244. } */
  3245. /* .collapse-icon {
  3246. width: 12px;
  3247. height: 12px;
  3248. } */
  3249. .right-menu-content {
  3250. height: 100%;
  3251. overflow-y: auto;
  3252. }
  3253. .right_menu.collapsed .right-menu-content {
  3254. display: none;
  3255. }
  3256. /* 添加打字效果的光标样式 */
  3257. /* .assistant .message-content {
  3258. position: relative;
  3259. }
  3260. .assistant .message-content::after {
  3261. content: '|';
  3262. position: absolute;
  3263. margin-left: 2px;
  3264. animation: cursor-blink 1s infinite;
  3265. }
  3266. @keyframes cursor-blink {
  3267. 0%, 100% { opacity: 1; }
  3268. 50% { opacity: 0; }
  3269. }*/
  3270. .file-message {
  3271. background: #f7f7f8;
  3272. border-radius: 8px;
  3273. padding: 12px;
  3274. margin-bottom: 8px;
  3275. }
  3276. .file-info-display {
  3277. display: flex;
  3278. align-items: center;
  3279. gap: 12px;
  3280. margin-bottom: 8px;
  3281. }
  3282. .file-type-icon {
  3283. width: 24px;
  3284. height: 24px;
  3285. object-fit: contain;
  3286. }
  3287. .file-details {
  3288. display: flex;
  3289. flex-direction: column;
  3290. }
  3291. /* .file-name {
  3292. font-size: 14px;
  3293. color: rgba(0, 0, 0, 0.88);
  3294. margin-bottom: 4px;
  3295. } */
  3296. .file-size {
  3297. font-size: 12px;
  3298. color: rgba(0, 0, 0, 0.45);
  3299. }
  3300. .file-action {
  3301. font-size: 12px;
  3302. color: rgba(0, 0, 0, 0.45);
  3303. padding-left: 36px;
  3304. }
  3305. /* 修改用户消息气泡样式,确保文件信息正确显示 */
  3306. .user .message-bubble {
  3307. background: #edf2f7;
  3308. color: rgba(0, 0, 0, 0.88);
  3309. }
  3310. .user .file-message {
  3311. background: #f7f7f8;
  3312. }
  3313. /* 图片预览样式 */
  3314. .image-preview {
  3315. position: relative;
  3316. width: 200px;
  3317. border-radius: 8px;
  3318. overflow: hidden;
  3319. background: #fff;
  3320. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  3321. }
  3322. .preview-image {
  3323. width: 100%;
  3324. height: auto;
  3325. display: block;
  3326. }
  3327. .image-info {
  3328. position: absolute;
  3329. bottom: 0;
  3330. left: 0;
  3331. right: 0;
  3332. padding: 8px;
  3333. background: rgba(255, 255, 255, 0.9);
  3334. font-size: 12px;
  3335. color: rgba(0, 0, 0, 0.45);
  3336. text-align: center;
  3337. border-top: 1px solid rgba(0, 0, 0, 0.06);
  3338. }
  3339. /* 文档显示样式保持不变 */
  3340. .file-info-display {
  3341. display: flex;
  3342. align-items: center;
  3343. gap: 12px;
  3344. margin-bottom: 8px;
  3345. }
  3346. .file-type-icon {
  3347. width: 24px;
  3348. height: 24px;
  3349. object-fit: contain;
  3350. }
  3351. .file-details {
  3352. display: flex;
  3353. flex-direction: column;
  3354. }
  3355. /* .file-name {
  3356. font-size: 14px;
  3357. color: rgba(0, 0, 0, 0.88);
  3358. margin-bottom: 4px;
  3359. } */
  3360. .file-size {
  3361. font-size: 12px;
  3362. color: rgba(0, 0, 0, 0.45);
  3363. }
  3364. .file-action {
  3365. font-size: 12px;
  3366. color: rgba(0, 0, 0, 0.45);
  3367. padding-left: 36px;
  3368. }
  3369. /* 添加音频控制相关样式 */
  3370. .audio-controls {
  3371. margin-top: 8px;
  3372. }
  3373. .audio-btn {
  3374. background: transparent;
  3375. border: none;
  3376. padding: 4px 8px;
  3377. cursor: pointer;
  3378. display: flex;
  3379. align-items: center;
  3380. justify-content: center;
  3381. border-radius: 4px;
  3382. transition: background-color 0.2s;
  3383. min-width: 32px;
  3384. height: 32px;
  3385. }
  3386. .audio-btn:hover {
  3387. background: rgba(0, 0, 0, 0.04);
  3388. }
  3389. .audio-icon {
  3390. width: 20px;
  3391. height: 20px;
  3392. }
  3393. /* 音频波形动画样式 */
  3394. .wave-animation {
  3395. display: flex;
  3396. align-items: center;
  3397. height: 20px;
  3398. gap: 2px;
  3399. }
  3400. .wave-bar {
  3401. display: inline-block;
  3402. width: 3px;
  3403. height: 100%;
  3404. background: #1677ff;
  3405. border-radius: 1px;
  3406. animation: wave 1s ease-in-out infinite;
  3407. }
  3408. .wave-bar:nth-child(1) {
  3409. animation-delay: 0s;
  3410. }
  3411. .wave-bar:nth-child(2) {
  3412. animation-delay: 0.2s;
  3413. }
  3414. .wave-bar:nth-child(3) {
  3415. animation-delay: 0.4s;
  3416. }
  3417. .wave-bar:nth-child(4) {
  3418. animation-delay: 0.6s;
  3419. }
  3420. @keyframes wave {
  3421. 0%,
  3422. 100% {
  3423. height: 6px;
  3424. }
  3425. 50% {
  3426. height: 18px;
  3427. }
  3428. }
  3429. .audio-btn {
  3430. background: transparent;
  3431. border: none;
  3432. padding: 4px 8px;
  3433. cursor: pointer;
  3434. display: flex;
  3435. align-items: center;
  3436. justify-content: center;
  3437. border-radius: 4px;
  3438. transition: background-color 0.2s;
  3439. min-width: 32px;
  3440. height: 32px;
  3441. }
  3442. .audio-btn:hover {
  3443. background: rgba(0, 0, 0, 0.04);
  3444. }
  3445. .audio-icon {
  3446. width: 20px;
  3447. height: 20px;
  3448. }
  3449. .message-text {
  3450. margin: 0;
  3451. white-space: normal; /* 确保文本会换行 */
  3452. word-wrap: break-word; /* 长单词或 URL 会被断开以适应容器宽度 */
  3453. overflow: auto;
  3454. font-size: 12px;
  3455. line-height: 20px;
  3456. }
  3457. .message-text ::v-deep p {
  3458. font-size: 12px !important;
  3459. margin: 5px 0 10px;
  3460. padding: 0;
  3461. font-size: inherit;
  3462. line-height: 22px;
  3463. font-weight: inherit;
  3464. }
  3465. .message-text ::v-deep ol {
  3466. padding-bottom: 10px;
  3467. }
  3468. .message-text ::v-deep .source-section h3 {
  3469. margin: 20px 0 3px;
  3470. color: #333;
  3471. font-size: 16px;
  3472. }
  3473. .message-text ::v-deep ol li {
  3474. padding-top: 3px;
  3475. }
  3476. .message-text ::v-deep ol li a {
  3477. font-size: 14px;
  3478. color: #1296db;
  3479. }
  3480. .message-text ::v-deep table {
  3481. border-collapse: collapse;
  3482. }
  3483. .message-text ::v-deep table th,
  3484. .message-text ::v-deep table td {
  3485. border: 1px solid #ddd;
  3486. padding: 8px;
  3487. }
  3488. .message-text ::v-deep table th {
  3489. background-color: #f2f2f2;
  3490. }
  3491. .message-text ::v-deep table td {
  3492. background-color: #fff;
  3493. }
  3494. .message-text ::v-deep table tr:nth-child(even) {
  3495. background-color: #f2f2f2;
  3496. }
  3497. .video-preview {
  3498. position: relative;
  3499. width: 300px;
  3500. border-radius: 8px;
  3501. overflow: hidden;
  3502. background: #fff;
  3503. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  3504. margin-bottom: 8px;
  3505. }
  3506. .preview-video {
  3507. width: 100%;
  3508. height: auto;
  3509. display: block;
  3510. max-height: 300px;
  3511. }
  3512. /* 添加 loading 相关样式 */
  3513. .upload-loading {
  3514. display: flex;
  3515. flex-direction: column;
  3516. align-items: center;
  3517. gap: 12px;
  3518. }
  3519. .loading-spinner {
  3520. width: 24px;
  3521. height: 24px;
  3522. border: 2px solid #f3f3f3;
  3523. border-top: 2px solid #1677ff;
  3524. border-radius: 50%;
  3525. animation: spin 1s linear infinite;
  3526. }
  3527. .file-loading {
  3528. position: absolute;
  3529. top: 0;
  3530. left: 0;
  3531. right: 0;
  3532. bottom: 0;
  3533. background: rgba(255, 255, 255, 0.8);
  3534. display: flex;
  3535. align-items: center;
  3536. justify-content: center;
  3537. z-index: 1;
  3538. }
  3539. @keyframes spin {
  3540. 0% {
  3541. transform: rotate(0deg);
  3542. }
  3543. 100% {
  3544. transform: rotate(360deg);
  3545. }
  3546. }
  3547. /* 上传区域在上传时的样式 */
  3548. .upload-area {
  3549. position: relative;
  3550. cursor: pointer; /* 始终保持指针样式 */
  3551. }
  3552. .upload-area.uploading {
  3553. opacity: 0.7;
  3554. }
  3555. /* 添加配置容器的样式 */
  3556. .config-container {
  3557. margin-top: auto;
  3558. border-top: 1px solid rgba(0, 0, 0, 0.06);
  3559. }
  3560. .web-search-toggle {
  3561. display: flex;
  3562. align-items: center;
  3563. /* margin-left: auto; */
  3564. padding: 0 12px;
  3565. }
  3566. .toggle-input {
  3567. position: relative;
  3568. width: 36px;
  3569. height: 20px;
  3570. margin-right: 8px;
  3571. appearance: none;
  3572. background: #ccc;
  3573. border-radius: 10px;
  3574. cursor: pointer;
  3575. transition: background 0.3s;
  3576. }
  3577. .toggle-input:checked {
  3578. background: #1677ff;
  3579. }
  3580. .toggle-input::before {
  3581. content: "";
  3582. position: absolute;
  3583. top: 2px;
  3584. left: 2px;
  3585. width: 16px;
  3586. height: 16px;
  3587. background: white;
  3588. border-radius: 50%;
  3589. transition: transform 0.3s;
  3590. }
  3591. .toggle-input:checked::before {
  3592. transform: translateX(16px);
  3593. }
  3594. .toggle-label {
  3595. font-size: 14px;
  3596. color: var(--primary-text);
  3597. cursor: pointer;
  3598. }
  3599. .toggle-input:disabled {
  3600. opacity: 0.5;
  3601. cursor: not-allowed;
  3602. }
  3603. .toggle-label.disabled {
  3604. color: var(--primary-text);
  3605. cursor: not-allowed;
  3606. }
  3607. .disabled-hint {
  3608. font-size: 12px;
  3609. color: var(--primary-text);
  3610. margin-left: 4px;
  3611. }
  3612. /* 添加菜单收缩相关样式 */
  3613. .menu {
  3614. /* 现有样式保持不变 */
  3615. transition: width 0.3s ease;
  3616. position: relative;
  3617. }
  3618. .menu.collapsed {
  3619. width: 0;
  3620. padding: 0;
  3621. }
  3622. /* 添加收缩按钮样式 */
  3623. .collapse-button {
  3624. position: absolute;
  3625. top: 50%;
  3626. transform: translateY(-50%);
  3627. width: 20px;
  3628. height: 40px;
  3629. background: var(--secondary-bg);
  3630. border: 1px solid var(--border-color);
  3631. display: flex;
  3632. align-items: center;
  3633. justify-content: center;
  3634. cursor: pointer;
  3635. z-index: 3;
  3636. transition: right 0.3s ease, left 0.3s ease;
  3637. }
  3638. .collapse-button:hover {
  3639. background: var(--secondary-bg);
  3640. }
  3641. .collapse-icon {
  3642. width: 12px;
  3643. height: 12px;
  3644. }
  3645. /* 添加响应式布局样式 */
  3646. @media screen and (max-width: 768px) {
  3647. .layout {
  3648. /* 移动端布局调整 */
  3649. flex-direction: column;
  3650. }
  3651. .menu {
  3652. /* 移动端菜单调整 */
  3653. position: fixed;
  3654. width: 100%;
  3655. height: 93%;
  3656. z-index: 1000;
  3657. transform: translateX(-100%);
  3658. }
  3659. .menu.collapsed {
  3660. transform: translateX(-100%);
  3661. }
  3662. .collapse-left-button {
  3663. z-index: 999;
  3664. /* 移动端收缩按钮调整 */
  3665. /* display: none; */
  3666. }
  3667. .chat {
  3668. /* 移动端聊天区域调整 */
  3669. width: 100%;
  3670. margin: 0;
  3671. padding: 16px;
  3672. left: 0 !important;
  3673. right: 0 !important;
  3674. }
  3675. .message-list {
  3676. /* 移动端消息列表调整 */
  3677. width: 100%;
  3678. padding: 10px;
  3679. }
  3680. .input-container {
  3681. /* 移动端输入区域调整 */
  3682. width: 98%;
  3683. padding: 10px;
  3684. }
  3685. .cards-container {
  3686. /* 移动端卡片容器调整 */
  3687. flex-direction: column;
  3688. }
  3689. .suggestion-card {
  3690. /* 移动端建议卡片调整 */
  3691. width: 100%;
  3692. }
  3693. .welcome-section {
  3694. /* 移动端欢迎区域调整 */
  3695. width: 100%;
  3696. padding: 0;
  3697. }
  3698. .right_menu {
  3699. /* 移动端右侧菜单调整 */
  3700. position: fixed;
  3701. width: 100%;
  3702. height: 100%;
  3703. z-index: 998;
  3704. }
  3705. .right_menu.collapsed {
  3706. transform: translateX(100%);
  3707. }
  3708. /* 移动端文件预览调整 */
  3709. .image-preview,
  3710. .video-preview {
  3711. width: 100%;
  3712. max-width: 300px;
  3713. }
  3714. /* 移动端文件列表调整 */
  3715. .file-list {
  3716. justify-content: center;
  3717. }
  3718. .file-item {
  3719. width: 100%;
  3720. max-width: 300px;
  3721. }
  3722. /* 移动端标签栏调整 */
  3723. .tabs-wrapper {
  3724. flex-wrap: wrap;
  3725. gap: 4px;
  3726. }
  3727. .web-search-toggle {
  3728. width: 100%;
  3729. justify-content: flex-start;
  3730. margin-top: 8px;
  3731. }
  3732. /* 移动端消息气泡调整 */
  3733. .message-bubble {
  3734. max-width: 90%;
  3735. }
  3736. .collapse-button {
  3737. left: -20px !important;
  3738. }
  3739. .collapse-button.menu-expanded {
  3740. left: auto !important;
  3741. right: 0;
  3742. }
  3743. }
  3744. /* 添加移动端手势支持 */
  3745. @media (hover: none) and (pointer: coarse) {
  3746. .menu {
  3747. /* 支持触摸滑动 */
  3748. touch-action: pan-y;
  3749. }
  3750. .message-list {
  3751. /* 支持触摸滚动 */
  3752. -webkit-overflow-scrolling: touch;
  3753. }
  3754. }
  3755. /* 优化移动端字体大小 */
  3756. @media screen and (max-width: 480px) {
  3757. .message-content {
  3758. font-size: 14px;
  3759. }
  3760. .suggestion-item {
  3761. font-size: 13px;
  3762. }
  3763. .file-name {
  3764. font-size: 13px;
  3765. }
  3766. }
  3767. /* 修改现有的响应式样式 */
  3768. @media screen and (max-width: 768px) {
  3769. .layout {
  3770. overflow-x: hidden;
  3771. }
  3772. .chat {
  3773. /* 调整聊天区域以保持一致的宽度 */
  3774. padding: 16px 0 ;
  3775. margin: 0;
  3776. width: 100%;
  3777. }
  3778. .message-list {
  3779. /* 保持消息列表的宽度一致 */
  3780. width: 100%;
  3781. max-width: 800px;
  3782. margin: 60px auto 0;
  3783. padding: 0 10px;
  3784. }
  3785. .input-container {
  3786. /* 保持输入区域的宽度一致 */
  3787. width: 95%;
  3788. max-width: 800px;
  3789. margin: 0 auto;
  3790. padding: 0;
  3791. }
  3792. .welcome-section {
  3793. /* 保持欢迎区域的宽度一致 */
  3794. width: 100%;
  3795. max-width: 800px;
  3796. margin: 0 auto;
  3797. /* padding: 0 16px; */
  3798. }
  3799. .cards-container {
  3800. /* 保持卡片布局 */
  3801. flex-direction: row;
  3802. flex-wrap: wrap;
  3803. gap: 16px;
  3804. }
  3805. .suggestion-card {
  3806. /* 调整卡片大小 */
  3807. flex: 1 1 300px;
  3808. min-width: 300px;
  3809. }
  3810. .message-bubble {
  3811. /* 保持消息气泡的样式 */
  3812. max-width: 80%;
  3813. padding: 12px 16px;
  3814. }
  3815. /* 调整文件预览区域 */
  3816. .image-preview,
  3817. .video-preview {
  3818. width: 200px;
  3819. margin: 0 auto;
  3820. }
  3821. /* 调整文件列表布局 */
  3822. .file-list {
  3823. display: flex;
  3824. flex-wrap: wrap;
  3825. gap: 8px;
  3826. justify-content: flex-start;
  3827. }
  3828. .file-item {
  3829. width: calc(50% - 8px);
  3830. min-width: 200px;
  3831. }
  3832. /* 调整标签栏布局 */
  3833. .tabs-wrapper {
  3834. flex-wrap: nowrap;
  3835. overflow-x: auto;
  3836. -webkit-overflow-scrolling: touch;
  3837. padding-bottom: 8px;
  3838. }
  3839. /* 调整搜索开关位置 */
  3840. .web-search-toggle {
  3841. position: relative;
  3842. width: auto;
  3843. }
  3844. /* 调整菜单样式 */
  3845. .menu {
  3846. position: fixed;
  3847. left: 0;
  3848. top: 0;
  3849. bottom: 0;
  3850. width: 260px;
  3851. transform: translateX(-100%);
  3852. transition: transform 0.3s ease;
  3853. z-index: 1000;
  3854. }
  3855. .menu.collapsed {
  3856. transform: translateX(-100%);
  3857. }
  3858. .menu:not(.collapsed) {
  3859. transform: translateX(0);
  3860. }
  3861. /* 调整右侧菜单样式 */
  3862. /* .right_menu {
  3863. position: fixed;
  3864. right: 0;
  3865. top: 0;
  3866. bottom: 0;
  3867. width: 300px;
  3868. transform: translateX(100%);
  3869. transition: transform 0.3s ease;
  3870. z-index: 998;
  3871. } */
  3872. .right_menu.collapsed {
  3873. transform: translateX(100%);
  3874. }
  3875. .right_menu:not(.collapsed) {
  3876. transform: translateX(0);
  3877. }
  3878. /* 添加遮罩层样式 */
  3879. .menu-overlay {
  3880. position: fixed;
  3881. top: 0;
  3882. left: 0;
  3883. right: 0;
  3884. bottom: 0;
  3885. background: rgba(0, 0, 0, 0.5);
  3886. z-index: 999;
  3887. display: none;
  3888. }
  3889. .menu:not(.collapsed) ~ .menu-overlay,
  3890. .right_menu:not(.collapsed) ~ .menu-overlay {
  3891. display: block;
  3892. }
  3893. }
  3894. /* 添加更细致的断点控制 */
  3895. @media screen and (max-width: 480px) {
  3896. .message-content {
  3897. font-size: 14px;
  3898. line-height: 1.5;
  3899. }
  3900. .suggestion-item {
  3901. font-size: 14px;
  3902. padding: 10px;
  3903. }
  3904. .input-wrapper {
  3905. padding:5px;
  3906. }
  3907. .message-input {
  3908. font-size: 14px;
  3909. }
  3910. }
  3911. /* 确保滚动流畅 */
  3912. * {
  3913. -webkit-overflow-scrolling: touch;
  3914. }
  3915. /* 防止页面横向滚动 */
  3916. body {
  3917. overflow-x: hidden;
  3918. width: 100%;
  3919. }
  3920. /* 优化触摸体验 */
  3921. button,
  3922. .suggestion-item,
  3923. .conversation-item {
  3924. touch-action: manipulation;
  3925. }
  3926. /* 添加拖动条样式 */
  3927. .resize-handle {
  3928. position: absolute;
  3929. left: -5px;
  3930. top: 0;
  3931. width: 10px;
  3932. height: 100%;
  3933. cursor: col-resize;
  3934. background: transparent;
  3935. z-index: 3;
  3936. }
  3937. .resize-handle:hover {
  3938. background: rgba(0, 0, 0, 0.1);
  3939. }
  3940. /* 确保拖动时不会选中文本 */
  3941. .resize-handle:active {
  3942. user-select: none;
  3943. }
  3944. /* 移动端样式调整 */
  3945. @media screen and (max-width: 768px) {
  3946. .resize-handle {
  3947. display: none;
  3948. }
  3949. .right_menu {
  3950. width: 100% !important;
  3951. }
  3952. }
  3953. .search-header {
  3954. display: flex;
  3955. justify-content: space-between;
  3956. align-items: center;
  3957. padding: 16px;
  3958. border-bottom: 1px solid var(--border-color);
  3959. }
  3960. .search-header span {
  3961. font-size: 16px;
  3962. font-weight: bold;
  3963. }
  3964. /* 添加开关样式 */
  3965. .web-search-toggle {
  3966. display: flex;
  3967. align-items: center;
  3968. color: var(--primary-text);
  3969. }
  3970. .toggle-input {
  3971. position: relative;
  3972. width: 36px;
  3973. height: 20px;
  3974. margin-right: 8px;
  3975. appearance: none;
  3976. background: #ccc;
  3977. border-radius: 10px;
  3978. cursor: pointer;
  3979. transition: background 0.3s;
  3980. }
  3981. .toggle-input:checked {
  3982. background: #1677ff;
  3983. }
  3984. .toggle-input::before {
  3985. content: "";
  3986. position: absolute;
  3987. top: 2px;
  3988. left: 2px;
  3989. width: 16px;
  3990. height: 16px;
  3991. background: white;
  3992. border-radius: 50%;
  3993. transition: transform 0.3s;
  3994. }
  3995. .toggle-input:checked::before {
  3996. transform: translateX(16px);
  3997. }
  3998. .toggle-label {
  3999. font-size: 14px;
  4000. color: rgba(0, 0, 0, 0.88);
  4001. cursor: pointer;
  4002. }
  4003. /* 添加 Tab 样式 */
  4004. .right-menu-tabs {
  4005. display: flex;
  4006. border-bottom: 1px solid #f0f0f0;
  4007. background: var(--secondary-bg);
  4008. }
  4009. .tab-item {
  4010. flex: 1;
  4011. padding: 12px;
  4012. display: flex;
  4013. align-items: center;
  4014. justify-content: center;
  4015. gap: 8px;
  4016. cursor: pointer;
  4017. transition: all 0.3s;
  4018. border-bottom: 2px solid transparent;
  4019. color: rgba(0, 0, 0, 0.65);
  4020. }
  4021. .tab-item:hover {
  4022. color: #1677ff;
  4023. }
  4024. .tab-item.active {
  4025. color: #1677ff;
  4026. border-bottom-color: #1677ff;
  4027. background: #f6f9fe;
  4028. }
  4029. .panel-container {
  4030. height: calc(100% - 45px); /* 减去 tab 的高度 */
  4031. overflow-y: auto;
  4032. }
  4033. /* 修改右侧菜单内容样式 */
  4034. .right-menu-content {
  4035. height: 100%;
  4036. display: flex;
  4037. flex-direction: column;
  4038. }
  4039. /* 预览面板样式 */
  4040. .preview-header {
  4041. padding: 16px;
  4042. border-bottom: 1px solid var(--border-color);
  4043. color: var(--primary-text);
  4044. font-size: 16px;
  4045. font-weight: bold;
  4046. }
  4047. .search-toggles {
  4048. display: flex;
  4049. gap: 12px;
  4050. padding: 8px 12px;
  4051. /* background: var(--secondary-bg); */
  4052. border-radius: 8px;
  4053. transition: all 0.3s ease;
  4054. justify-content: space-between;
  4055. &.compact {
  4056. .search-toggle-item {
  4057. padding: 6px;
  4058. min-width: auto;
  4059. width: auto;
  4060. }
  4061. .toggle-content {
  4062. gap: 4px;
  4063. justify-content: center;
  4064. }
  4065. .toggle-text {
  4066. /* display: none; */
  4067. }
  4068. .toggle-switch {
  4069. margin-left: 8px;
  4070. }
  4071. }
  4072. }
  4073. .search-toggle-item {
  4074. position: relative;
  4075. display: flex;
  4076. align-items: center;
  4077. color: var(--primary-text);
  4078. border-radius: 6px;
  4079. padding: 6px;
  4080. transition: all 0.3s;
  4081. /* width: 140px; */
  4082. @media screen and (max-width: 768px) {
  4083. width: auto;
  4084. padding: 6px 8px;
  4085. }
  4086. &:hover {
  4087. background: rgba(0, 0, 0, 0.02);
  4088. }
  4089. }
  4090. .toggle-content {
  4091. display: flex;
  4092. align-items: center;
  4093. gap: 8px;
  4094. color: rgba(0, 0, 0, 0.65);
  4095. transition: all 0.3s;
  4096. width: 100%;
  4097. .anticon {
  4098. font-size: 16px;
  4099. flex-shrink: 0;
  4100. }
  4101. .toggle-text {
  4102. font-size: 14px;
  4103. transition: all 0.3s;
  4104. white-space: nowrap;
  4105. color: var(--primary-text);
  4106. }
  4107. }
  4108. .toggle-switch {
  4109. position: relative;
  4110. display: flex;
  4111. align-items: center;
  4112. }
  4113. .toggle-input {
  4114. position: absolute;
  4115. opacity: 0;
  4116. width: 0;
  4117. height: 0;
  4118. &:checked + .toggle-label {
  4119. .toggle-slider {
  4120. background: #1677ff;
  4121. &:before {
  4122. transform: translateX(16px);
  4123. }
  4124. }
  4125. }
  4126. &:disabled + .toggle-label {
  4127. cursor: not-allowed;
  4128. .toggle-slider {
  4129. background: #d9d9d9;
  4130. &:before {
  4131. background: #f5f5f5;
  4132. }
  4133. }
  4134. }
  4135. }
  4136. .toggle-label {
  4137. display: flex;
  4138. align-items: center;
  4139. cursor: pointer;
  4140. .toggle-slider {
  4141. position: relative;
  4142. width: 36px;
  4143. height: 20px;
  4144. background: #d9d9d9;
  4145. border-radius: 10px;
  4146. transition: all 0.3s;
  4147. &:before {
  4148. content: '';
  4149. position: absolute;
  4150. top: 2px;
  4151. left: 2px;
  4152. width: 16px;
  4153. height: 16px;
  4154. background: white;
  4155. border-radius: 50%;
  4156. transition: transform 0.3s;
  4157. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  4158. }
  4159. }
  4160. &.disabled {
  4161. cursor: not-allowed;
  4162. }
  4163. }
  4164. /* 移动端适配 */
  4165. @media screen and (max-width: 480px) {
  4166. .search-toggles {
  4167. padding: 6px;
  4168. gap: 6px;
  4169. }
  4170. .search-toggle-item {
  4171. padding: 6px;
  4172. }
  4173. .toggle-content {
  4174. gap: 4px;
  4175. }
  4176. }
  4177. @media screen and (max-width: 768px) {
  4178. .search-toggles {
  4179. &:not(.compact) {
  4180. .search-toggle-item {
  4181. padding: 6px 8px;
  4182. }
  4183. .toggle-content {
  4184. gap: 4px;
  4185. }
  4186. .toggle-text {
  4187. font-size: 12px;
  4188. }
  4189. }
  4190. }
  4191. }
  4192. @media screen and (max-width: 480px) {
  4193. .search-toggles {
  4194. padding: 0px;
  4195. gap: 6px;
  4196. &:not(.compact) {
  4197. .toggle-text {
  4198. /* display: none; */
  4199. }
  4200. .search-toggle-item {
  4201. padding: 6px;
  4202. }
  4203. }
  4204. }
  4205. }
  4206. /* 深色模式支持 */
  4207. @media (prefers-color-scheme: dark) {
  4208. .search-toggle-item {
  4209. background: rgba(255, 255, 255, 0.04);
  4210. &:hover {
  4211. background: rgba(255, 255, 255, 0.08);
  4212. }
  4213. }
  4214. .toggle-content {
  4215. color: rgba(255, 255, 255, 0.65);
  4216. }
  4217. .toggle-label {
  4218. .toggle-slider {
  4219. background: #424242;
  4220. &:before {
  4221. background: #8c8c8c;
  4222. }
  4223. }
  4224. }
  4225. .toggle-input:checked + .toggle-label {
  4226. .toggle-slider {
  4227. background: #1677ff;
  4228. &:before {
  4229. background: white;
  4230. }
  4231. }
  4232. }
  4233. .toggle-input:disabled + .toggle-label {
  4234. .toggle-slider {
  4235. background: #1f1f1f;
  4236. &:before {
  4237. background: #434343;
  4238. }
  4239. }
  4240. }
  4241. }
  4242. /* 修改右侧菜单面板样式 */
  4243. .right_menu {
  4244. position: fixed;
  4245. right: 0;
  4246. top: 0;
  4247. bottom: 0;
  4248. width: 450px;
  4249. background: #fff;
  4250. border-left: 1px solid rgba(0, 0, 0, 0.06);
  4251. display: flex;
  4252. flex-direction: column;
  4253. transition: transform 0.3s ease;
  4254. z-index: 998;
  4255. }
  4256. .right_menu.collapsed {
  4257. transform: translateX(100%);
  4258. }
  4259. .right-menu-content {
  4260. height: 100%;
  4261. display: flex;
  4262. flex-direction: column;
  4263. overflow: hidden;
  4264. }
  4265. /* Tab 样式调整 */
  4266. .right-menu-tabs {
  4267. display: flex;
  4268. background: var(--secondary-bg);
  4269. color: var(--primary-text);
  4270. border-bottom: 1px solid #f0f0f0;
  4271. padding: 0;
  4272. height: 46px;
  4273. flex-shrink: 0;
  4274. }
  4275. .tab-item {
  4276. flex: 1;
  4277. display: flex;
  4278. align-items: center;
  4279. justify-content: center;
  4280. gap: 8px;
  4281. padding: 12px;
  4282. color: var(--primary-text);
  4283. cursor: pointer;
  4284. transition: all 0.3s;
  4285. border-bottom: 2px solid transparent;
  4286. font-size: 14px;
  4287. }
  4288. .tab-item.active {
  4289. color: #1677ff;
  4290. border-bottom-color: #1677ff;
  4291. background: rgba(22, 119, 255, 0.04);
  4292. }
  4293. .tab-item:hover {
  4294. color: #1677ff;
  4295. }
  4296. /* 面板容器样式 */
  4297. .panel-container {
  4298. flex: 1;
  4299. overflow-y: auto;
  4300. background: var(--secondary-bg);
  4301. display: flex;
  4302. flex-direction: column;
  4303. }
  4304. /* 搜索头部样式 */
  4305. .search-header {
  4306. padding: 16px;
  4307. border-bottom: 1px solid var(--border-color);
  4308. display: flex;
  4309. justify-content: space-between;
  4310. align-items: center;
  4311. background: var(--secondary-bg);
  4312. flex-shrink: 0;
  4313. }
  4314. .search-header span {
  4315. font-size: 16px;
  4316. font-weight: 500;
  4317. color: var(--primary-text);
  4318. }
  4319. /* 知识库结果面板样式 */
  4320. .knowledge-results {
  4321. flex: 1;
  4322. padding: 16px 5px;
  4323. overflow-y: auto;
  4324. }
  4325. /* 调整聊天区域的右边距 */
  4326. .chat {
  4327. transition: right 0.3s ease;
  4328. }
  4329. .right_menu:not(.collapsed) ~ .chat {
  4330. right: 450px;
  4331. }
  4332. /* 移动端适配 */
  4333. @media screen and (max-width: 768px) {
  4334. .right_menu {
  4335. width: 93%;
  4336. }
  4337. .right_menu:not(.collapsed) ~ .chat {
  4338. right: 100%;
  4339. }
  4340. .tab-item {
  4341. padding: 8px;
  4342. }
  4343. .tab-item .anticon {
  4344. font-size: 16px;
  4345. }
  4346. .tab-item span {
  4347. font-size: 12px;
  4348. }
  4349. .search-header {
  4350. padding: 12px;
  4351. }
  4352. .search-header span {
  4353. font-size: 14px;
  4354. }
  4355. }
  4356. /* 优化滚动条样式 */
  4357. .panel-container::-webkit-scrollbar {
  4358. width: 4px;
  4359. }
  4360. .panel-container::-webkit-scrollbar-thumb {
  4361. background: rgba(0, 0, 0, 0.1);
  4362. border-radius: 2px;
  4363. }
  4364. .panel-container::-webkit-scrollbar-track {
  4365. background: transparent;
  4366. }
  4367. /* 添加阴影效果 */
  4368. .right_menu {
  4369. box-shadow: -2px 0 8px rgba(0, 0, 0, 0.06);
  4370. }
  4371. /* 优化过渡动画 */
  4372. .right_menu,
  4373. .chat,
  4374. .tab-item,
  4375. .panel-container {
  4376. transition: all 0.3s ease;
  4377. }
  4378. /* 确保内容不会溢出 */
  4379. .right-menu-content {
  4380. max-height: 100%;
  4381. background-color: var(--secondary-bg) !important;
  4382. }
  4383. .panel-container {
  4384. max-height: calc(100% - 46px); /* 减去 tab 的高度 */
  4385. }
  4386. /* 菜单展开时的按钮样式 */
  4387. .collapse-button.menu-expanded {
  4388. left: -20px;
  4389. border-right: none;
  4390. border-radius: 4px 0 0 4px;
  4391. }
  4392. /* 菜单收起时的按钮样式 */
  4393. .collapse-button.menu-collapsed {
  4394. left: -20px;
  4395. border-left: none;
  4396. border-radius: 0 4px 4px 0;
  4397. }
  4398. /* 确保右侧菜单收起时按钮仍然可见 */
  4399. .right_menu.collapsed .collapse-button {
  4400. right: auto;
  4401. left: -20px;
  4402. }
  4403. /* 添加模型选择框样式 */
  4404. .model-select {
  4405. background: transparent;
  4406. border: 1px solid #d9d9d9;
  4407. border-radius: 4px;
  4408. padding: 4px 8px;
  4409. font-size: 14px;
  4410. color: var(--primary-text);
  4411. cursor: pointer;
  4412. transition: all 0.3s;
  4413. outline: none;
  4414. margin-left: auto;
  4415. width:100%;
  4416. &:hover {
  4417. border-color: #1677ff;
  4418. }
  4419. &:focus {
  4420. border-color: #1677ff;
  4421. box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
  4422. }
  4423. &:disabled {
  4424. background: #f5f5f5;
  4425. cursor: not-allowed;
  4426. color: rgba(0, 0, 0, 0.25);
  4427. }
  4428. option {
  4429. background: white;
  4430. color: rgba(0, 0, 0, 0.88);
  4431. }
  4432. }
  4433. @media screen and (max-width: 768px) {
  4434. .model-select {
  4435. /* width: 80px; */
  4436. font-size: 12px;
  4437. padding: 2px 4px;
  4438. }
  4439. }
  4440. /* 全局主题变量 */
  4441. :root {
  4442. /* 浅色主题变量 */
  4443. --primary-bg: #f7fafc;
  4444. --secondary-bg: #ffffff;
  4445. --primary-text: #333333;
  4446. --secondary-text: #666666;
  4447. --border-color: #e0e0e0;
  4448. --hover-bg: #f0f0f0;
  4449. --card-bg: #ffffff;
  4450. --shadow-color: rgba(0, 0, 0, 0.1);
  4451. --highlight-color: #1890ff;
  4452. /* 动画时间 */
  4453. --theme-transition: 0.3s ease;
  4454. }
  4455. /* 深色主题变量 */
  4456. :root.dark-theme {
  4457. --primary-bg: #1a1a1a;
  4458. --secondary-bg: #2d2d2d;
  4459. --primary-text: #ffffff;
  4460. --secondary-text: #b3b3b3;
  4461. --border-color: #404040;
  4462. --hover-bg: #363636;
  4463. --card-bg: #2d2d2d;
  4464. --shadow-color: rgba(0, 0, 0, 0.3);
  4465. --highlight-color: #40a9ff;
  4466. }
  4467. /* 主题过渡动画 */
  4468. .layout * {
  4469. transition: background-color var(--theme-transition),
  4470. color var(--theme-transition),
  4471. border-color var(--theme-transition),
  4472. box-shadow var(--theme-transition);
  4473. }
  4474. /* 主题切换按钮样式 */
  4475. .theme-switch {
  4476. display: flex;
  4477. align-items: center;
  4478. justify-content: center;
  4479. width: 28px;
  4480. height: 28px;
  4481. margin-right: 8px;
  4482. padding: 6px;
  4483. border-radius: 50%;
  4484. cursor: pointer;
  4485. transition: all var(--theme-transition);
  4486. }
  4487. .panel-header {
  4488. width: 100%;
  4489. padding: 10px;
  4490. border-bottom: 1px solid var(--border-color);
  4491. height: 30px;
  4492. /* display: flex;
  4493. align-items: center;
  4494. justify-content: space-between; */
  4495. background: var(--bg-primary);
  4496. }
  4497. .panel-header h3 {
  4498. font-size: 16px;
  4499. font-weight: 600;
  4500. color: var(--text-primary);
  4501. margin: 0;
  4502. }
  4503. .theme-switch:hover {
  4504. background-color: var(--hover-bg);
  4505. }
  4506. .theme-icon {
  4507. width: 18px;
  4508. height: 18px;
  4509. color: var(--primary-text);
  4510. transition: transform 0.2s ease;
  4511. }
  4512. .theme-switch:hover .theme-icon {
  4513. transform: scale(1.1);
  4514. }
  4515. /* 主题图标切换动画 */
  4516. .theme-icon-enter-active,
  4517. .theme-icon-leave-active {
  4518. transition: transform 0.3s ease, opacity 0.3s ease;
  4519. }
  4520. .theme-icon-enter-from,
  4521. .theme-icon-leave-to {
  4522. opacity: 0;
  4523. transform: scale(0.8) rotate(-45deg);
  4524. }
  4525. .theme-icon-enter-to,
  4526. .theme-icon-leave-from {
  4527. opacity: 1;
  4528. transform: scale(1) rotate(0);
  4529. }
  4530. /* 应用主题样式到现有组件 */
  4531. :deep(.layout) {
  4532. background-color: var(--primary-bg);
  4533. color: var(--primary-text);
  4534. }
  4535. :deep(.header) {
  4536. background-color: var(--secondary-bg);
  4537. /* border-bottom: 1px solid var(--border-color); */
  4538. box-shadow: var(--shadow-sm)
  4539. }
  4540. :deep(.menu) {
  4541. background-color: var(--secondary-bg);
  4542. border-right: 1px solid var(--border-color);
  4543. }
  4544. :deep(.user-info-bar) {
  4545. /* background-color: var(--secondary-bg); */
  4546. color: var(--primary-text);
  4547. }
  4548. :deep(.dropdown-menu) {
  4549. background-color: var(--card-bg);
  4550. border: 1px solid var(--border-color);
  4551. box-shadow: 0 2px 8px var(--shadow-color);
  4552. }
  4553. :deep(.dropdown-item) {
  4554. color: var(--primary-text);
  4555. }
  4556. :deep(.dropdown-item:hover) {
  4557. background-color: var(--hover-bg);
  4558. }
  4559. :deep(.suggestion-card) {
  4560. background-color: var(--card-bg);
  4561. border: 1px solid var(--border-color);
  4562. }
  4563. :deep(.suggestion-item) {
  4564. color: var(--primary-text);
  4565. }
  4566. :deep(.suggestion-item:hover) {
  4567. background-color: var(--hover-bg);
  4568. }
  4569. :deep(.message-bubble) {
  4570. background-color: var(--card-bg);
  4571. border: 1px solid var(--border-color);
  4572. }
  4573. /* 确保主题样式应用到聊天消息 */
  4574. :deep(.message-item.user .message-bubble) {
  4575. /* background-color: var(--highlight-color); */
  4576. color: var(--primary-text);
  4577. }
  4578. :deep(.message-item.assistant .message-bubble) {
  4579. background-color: var(--card-bg);
  4580. color: var(--primary-text);
  4581. }
  4582. /* 搜索区域样式 */
  4583. :deep(.search-section) {
  4584. background-color: var(--card-bg);
  4585. border: 1px solid var(--border-color);
  4586. padding: 20px;
  4587. border-radius: 8px;
  4588. }
  4589. :deep(.search-input) {
  4590. background-color: var(--primary-bg);
  4591. border: 1px solid var(--border-color);
  4592. color: var(--primary-text);
  4593. }
  4594. :deep(.search-input:hover),
  4595. :deep(.search-input:focus) {
  4596. border-color: var(--highlight-color);
  4597. box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
  4598. }
  4599. /* 提示问题区域样式 */
  4600. :deep(.suggestion-section) {
  4601. background-color: var(--card-bg);
  4602. border-radius: 8px;
  4603. padding: 20px;
  4604. margin-top: 20px;
  4605. }
  4606. :deep(.suggestion-section h3) {
  4607. color: var(--primary-text);
  4608. margin-bottom: 16px;
  4609. }
  4610. :deep(.cards-container) {
  4611. display: grid;
  4612. gap: 16px;
  4613. grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  4614. }
  4615. :deep(.suggestion-card) {
  4616. background-color: var(--secondary-bg);
  4617. border: 1px solid var(--border-color);
  4618. border-radius: 8px;
  4619. padding: 16px;
  4620. transition: all var(--theme-transition);
  4621. }
  4622. :deep(.suggestion-card:hover) {
  4623. border-color: var(--highlight-color);
  4624. box-shadow: 0 2px 8px var(--shadow-color);
  4625. }
  4626. :deep(.card-header) {
  4627. display: flex;
  4628. align-items: center;
  4629. gap: 8px;
  4630. margin-bottom: 8px;
  4631. }
  4632. :deep(.card-header h4) {
  4633. color: var(--primary-text);
  4634. margin: 0;
  4635. }
  4636. :deep(.card-subtitle) {
  4637. color: var(--secondary-text);
  4638. margin-bottom: 12px;
  4639. }
  4640. :deep(.suggestion-items) {
  4641. display: flex;
  4642. flex-direction: column;
  4643. gap: 8px;
  4644. }
  4645. :deep(.suggestion-item) {
  4646. padding: 8px 12px;
  4647. border-radius: 4px;
  4648. background-color: var(--primary-bg);
  4649. color: var(--primary-text);
  4650. cursor: pointer;
  4651. transition: all var(--theme-transition);
  4652. }
  4653. :deep(.suggestion-item:hover) {
  4654. background-color: var(--hover-bg);
  4655. color: var(--highlight-color);
  4656. }
  4657. /* 保存问题区域样式 */
  4658. :deep(.save-question) {
  4659. background-color: var(--card-bg);
  4660. border: 1px solid var(--border-color);
  4661. border-radius: 8px;
  4662. padding: 20px;
  4663. margin-top: 20px;
  4664. }
  4665. :deep(.save-question-title) {
  4666. color: var(--primary-text);
  4667. margin-bottom: 16px;
  4668. font-weight: bold;
  4669. }
  4670. :deep(.save-question-input) {
  4671. width: 100%;
  4672. padding: 8px 12px;
  4673. border: 1px solid var(--border-color);
  4674. border-radius: 4px;
  4675. background-color: var(--primary-bg);
  4676. color: var(--primary-text);
  4677. margin-bottom: 8px;
  4678. }
  4679. :deep(.save-question-input:focus) {
  4680. border-color: var(--highlight-color);
  4681. outline: none;
  4682. box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
  4683. }
  4684. /* 搜索结果区域样式 */
  4685. :deep(.search-results) {
  4686. background-color: var(--secondary-bg);
  4687. /* border: 1px solid var(--border-color); */
  4688. border-radius: 8px;
  4689. /* padding: 20px; */
  4690. /* margin-top: 20px; */
  4691. }
  4692. :deep(.search-results-title) {
  4693. color: var(--primary-text);
  4694. margin-bottom: 16px;
  4695. }
  4696. :deep(.no-results) {
  4697. color: var(--secondary-text);
  4698. text-align: center;
  4699. padding: 40px 0;
  4700. }
  4701. /* 输入框和按钮样式 */
  4702. :deep(.ant-input),
  4703. :deep(.ant-input-search-button) {
  4704. background-color: var(--primary-bg);
  4705. border-color: var(--border-color);
  4706. color: var(--primary-text);
  4707. }
  4708. :deep(.ant-input:hover),
  4709. :deep(.ant-input:focus) {
  4710. border-color: var(--highlight-color);
  4711. }
  4712. :deep(.ant-input-search-button) {
  4713. background-color: var(--highlight-color);
  4714. border-color: var(--highlight-color);
  4715. color: #ffffff;
  4716. }
  4717. :deep(.ant-input-search-button:hover) {
  4718. background-color: var(--highlight-color);
  4719. opacity: 0.9;
  4720. }
  4721. /* 标签页样式 */
  4722. :deep(.ant-tabs-tab) {
  4723. color: var(--secondary-text);
  4724. }
  4725. :deep(.ant-tabs-tab-active) {
  4726. color: var(--highlight-color) !important;
  4727. }
  4728. :deep(.ant-tabs-ink-bar) {
  4729. background-color: var(--highlight-color);
  4730. }
  4731. /* 图标样式适配 */
  4732. :deep(.tab-icon) {
  4733. filter: var(--icon-filter);
  4734. }
  4735. /* 其他已有的样式保持不变 */
  4736. </style>
  4737. <style>
  4738. /* 添加图标滤镜变量 */
  4739. :root {
  4740. --icon-filter: none;
  4741. }
  4742. :root.dark-theme {
  4743. --icon-filter: brightness(0) invert(1);
  4744. }
  4745. </style>
  4746. <style lang="less" scoped>
  4747. // ... existing code ...
  4748. /* 文档预览样式 */
  4749. .document-preview {
  4750. height: 100%;
  4751. overflow: hidden;
  4752. display: flex;
  4753. flex-direction: column;
  4754. }
  4755. .preview-container {
  4756. display: flex;
  4757. height: 100%;
  4758. gap: 16px;
  4759. }
  4760. .document-list {
  4761. width: 300px;
  4762. flex-shrink: 0;
  4763. overflow-y: auto;
  4764. padding: 16px;
  4765. border-right: 1px solid var(--border-color);
  4766. }
  4767. .empty-state {
  4768. display: flex;
  4769. flex-direction: column;
  4770. align-items: center;
  4771. justify-content: center;
  4772. padding: 48px 0;
  4773. color: var(--primary-text);
  4774. .empty-icon {
  4775. font-size: 48px;
  4776. margin-bottom: 16px;
  4777. }
  4778. p {
  4779. font-size: 14px;
  4780. margin: 0;
  4781. }
  4782. }
  4783. .document-item {
  4784. display: flex;
  4785. align-items: center;
  4786. justify-content: space-between;
  4787. padding: 12px;
  4788. border-radius: 8px;
  4789. margin-bottom: 8px;
  4790. background: var(--secondary-bg);
  4791. transition: all 0.3s;
  4792. cursor: pointer;
  4793. &:hover {
  4794. background: var(--hover-bg);
  4795. }
  4796. &.active {
  4797. background: var(--primary-bg);
  4798. border: 1px solid var(--primary-color);
  4799. }
  4800. }
  4801. .document-info {
  4802. display: flex;
  4803. align-items: center;
  4804. gap: 12px;
  4805. flex: 1;
  4806. }
  4807. .doc-icon {
  4808. width: 40px;
  4809. height: 40px;
  4810. display: flex;
  4811. align-items: center;
  4812. justify-content: center;
  4813. }
  4814. .preview-thumbnail {
  4815. width: 100%;
  4816. height: 100%;
  4817. object-fit: cover;
  4818. border-radius: 4px;
  4819. }
  4820. /* .file-icon {
  4821. width: 24px;
  4822. height: 24px;
  4823. } */
  4824. .info {
  4825. flex: 1;
  4826. min-width: 0;
  4827. .name {
  4828. font-size: 14px;
  4829. color: var(--primary-text);
  4830. margin-bottom: 4px;
  4831. white-space: nowrap;
  4832. overflow: hidden;
  4833. text-overflow: ellipsis;
  4834. }
  4835. .size {
  4836. font-size: 12px;
  4837. color: var(--secondary-text);
  4838. }
  4839. }
  4840. .actions {
  4841. display: flex;
  4842. gap: 8px;
  4843. }
  4844. .action-btn {
  4845. width: 32px;
  4846. height: 32px;
  4847. border: none;
  4848. background: transparent;
  4849. border-radius: 4px;
  4850. cursor: pointer;
  4851. display: flex;
  4852. align-items: center;
  4853. justify-content: center;
  4854. color: var(--primary-text);
  4855. transition: all 0.3s;
  4856. &:hover {
  4857. background: rgba(0, 0, 0, 0.04);
  4858. color: var(--primary-color);
  4859. }
  4860. }
  4861. .direct-preview {
  4862. flex: 1;
  4863. display: flex;
  4864. flex-direction: column;
  4865. overflow: hidden;
  4866. background: var(--secondary-bg);
  4867. border-radius: 8px;
  4868. }
  4869. .preview-header {
  4870. padding: 16px;
  4871. border-bottom: 1px solid var(--border-color);
  4872. display: flex;
  4873. justify-content: space-between;
  4874. align-items: center;
  4875. span {
  4876. font-size: 16px;
  4877. font-weight: 500;
  4878. color: var(--primary-text);
  4879. }
  4880. .close-btn {
  4881. border: none;
  4882. background: transparent;
  4883. cursor: pointer;
  4884. color: var(--primary-text);
  4885. display: flex;
  4886. align-items: center;
  4887. justify-content: center;
  4888. padding: 8px;
  4889. border-radius: 4px;
  4890. transition: all 0.3s;
  4891. &:hover {
  4892. background: rgba(0, 0, 0, 0.04);
  4893. color: var(--primary-color);
  4894. }
  4895. }
  4896. }
  4897. .preview-body {
  4898. flex: 1;
  4899. overflow: auto;
  4900. padding: 24px;
  4901. display: flex;
  4902. align-items: flex-start;
  4903. justify-content: center;
  4904. }
  4905. .preview-image {
  4906. max-width: 100%;
  4907. max-height: 70vh;
  4908. object-fit: contain;
  4909. }
  4910. .preview-video {
  4911. max-width: 100%;
  4912. max-height: 70vh;
  4913. }
  4914. .doc-preview {
  4915. width: 100%;
  4916. height: 100%;
  4917. min-height: 500px;
  4918. }
  4919. :deep(.docx-wrapper) {
  4920. width: 100%;
  4921. height: 100%;
  4922. .docx{
  4923. width: 100% !important;
  4924. }
  4925. }
  4926. :deep(.excel-wrapper) {
  4927. width: 100%;
  4928. height: 100%;
  4929. overflow: auto;
  4930. .excel-container {
  4931. min-width: 100%;
  4932. min-height: 100%;
  4933. }
  4934. .excel-toolbar {
  4935. position: sticky;
  4936. top: 0;
  4937. z-index: 1;
  4938. background: #fff;
  4939. padding: 8px;
  4940. border-bottom: 1px solid #e8e8e8;
  4941. }
  4942. table {
  4943. width: 100%;
  4944. border-collapse: collapse;
  4945. th, td {
  4946. padding: 8px;
  4947. border: 1px solid #e8e8e8;
  4948. white-space: nowrap;
  4949. overflow: hidden;
  4950. text-overflow: ellipsis;
  4951. }
  4952. }
  4953. }
  4954. .file-preview {
  4955. text-align: center;
  4956. color: var(--primary-text);
  4957. .large-icon {
  4958. font-size: 64px;
  4959. margin-bottom: 16px;
  4960. }
  4961. p {
  4962. margin: 0;
  4963. font-size: 14px;
  4964. }
  4965. }
  4966. // 响应式布局
  4967. @media screen and (max-width: 768px) {
  4968. .preview-container {
  4969. flex-direction: column;
  4970. }
  4971. .document-list {
  4972. width: 100%;
  4973. border-right: none;
  4974. border-bottom: 1px solid var(--border-color);
  4975. }
  4976. }
  4977. // ... existing code ...
  4978. </style>
  4979. <style>
  4980. /* 移动端适配样式 */
  4981. @media screen and (max-width: 768px) {
  4982. .suggestion-section{
  4983. padding: 20px 0 !important;
  4984. }
  4985. .layout {
  4986. flex-direction: column;
  4987. }
  4988. .header {
  4989. /* padding: 10px; */
  4990. }
  4991. .user-profile-bar {
  4992. flex-direction: row;
  4993. align-items: center;
  4994. justify-content: space-between;
  4995. width: 100%;
  4996. padding: 0 10px;
  4997. flex-wrap: nowrap;
  4998. }
  4999. .logo {
  5000. flex-shrink: 0;
  5001. max-width: 120px;
  5002. }
  5003. .user-info-bar {
  5004. display: flex;
  5005. align-items: center;
  5006. gap: 8px;
  5007. flex: 1;
  5008. justify-content: flex-end;
  5009. min-width: 0;
  5010. }
  5011. .theme-switch {
  5012. flex-shrink: 0;
  5013. }
  5014. .user-info {
  5015. display: flex;
  5016. flex-direction: column;
  5017. font-size: 12px;
  5018. min-width: 0;
  5019. flex: 1;
  5020. }
  5021. .user-name {
  5022. overflow: hidden;
  5023. text-overflow: ellipsis;
  5024. white-space: nowrap;
  5025. margin: 0;
  5026. line-height: 1.2;
  5027. }
  5028. .avatar {
  5029. flex-shrink: 0;
  5030. width: 32px;
  5031. height: 32px;
  5032. margin-left: 8px;
  5033. }
  5034. .suggestion-item{
  5035. width: 85%;
  5036. margin: 0 auto;
  5037. }
  5038. @media screen and (max-width: 480px) {
  5039. .user-info-bar {
  5040. gap: 4px;
  5041. }
  5042. .logo {
  5043. max-width: 150px;
  5044. }
  5045. .avatar {
  5046. width: 28px;
  5047. height: 28px;
  5048. margin-left: 4px;
  5049. }
  5050. }
  5051. .logo {
  5052. margin-bottom: 10px;
  5053. }
  5054. .logo-img {
  5055. width: 60px;
  5056. }
  5057. .user-info-bar {
  5058. width: 100%;
  5059. justify-content: space-between;
  5060. }
  5061. .menu {
  5062. position: fixed;
  5063. top: 60px;
  5064. left: -100%;
  5065. width: 80%;
  5066. height: calc(100vh - 60px);
  5067. z-index: 1000;
  5068. transition: left 0.3s ease;
  5069. }
  5070. .menu.collapsed {
  5071. left: 0;
  5072. }
  5073. .chat {
  5074. width: 100%;
  5075. margin-left: 0;
  5076. padding: 0;
  5077. }
  5078. .message-list {
  5079. padding: 10px;
  5080. }
  5081. .message-bubble {
  5082. max-width: 90%;
  5083. }
  5084. .config-container {
  5085. padding: 10px;
  5086. }
  5087. .cards-container {
  5088. flex-direction: column;
  5089. }
  5090. .suggestion-card {
  5091. width: 90% !important;
  5092. padding: 16px 2px !important;
  5093. margin: 10px auto !important;
  5094. }
  5095. .collapse-left-button {
  5096. position: fixed;
  5097. top: 70px;
  5098. left: 10px;
  5099. z-index: 1001;
  5100. }
  5101. }
  5102. /* 针对更小屏幕的优化 */
  5103. @media screen and (max-width: 480px) {
  5104. .user-info {
  5105. font-size: 12px;
  5106. }
  5107. .theme-icon {
  5108. width: 20px;
  5109. height: 20px;
  5110. }
  5111. .avatar img {
  5112. width: 30px;
  5113. height: 30px;
  5114. }
  5115. .message-content {
  5116. font-size: 14px;
  5117. }
  5118. .new-conversation-btn {
  5119. padding: 8px;
  5120. font-size: 14px;
  5121. }
  5122. }
  5123. /* 移动端样式调整 */
  5124. @media screen and (max-width: 768px) {
  5125. .layout {
  5126. height: 100vh; /* 使用视口高度 */
  5127. overflow: hidden; /* 防止页面滚动 */
  5128. display: flex;
  5129. flex-direction: column;
  5130. }
  5131. .header {
  5132. flex-shrink: 0; /* 防止header被压缩 */
  5133. }
  5134. .chat {
  5135. flex: 1; /* 占据剩余空间 */
  5136. height: calc(100vh - 60px); /* 减去header高度 */
  5137. overflow-y: auto; /* 内容过多时在chat区域内滚动 */
  5138. -webkit-overflow-scrolling: touch; /* 优化iOS滚动 */
  5139. }
  5140. .message-list {
  5141. height: calc(100% - 120px); /* 减去输入框高度 */
  5142. overflow-y: auto;
  5143. }
  5144. .input-wrapper {
  5145. position: sticky;
  5146. bottom: 0;
  5147. background: var(--primary-bg);
  5148. padding: 10px;
  5149. border-top: 1px solid var(--border-color);
  5150. }
  5151. .resize-handle {
  5152. display: none;
  5153. }
  5154. .right_menu {
  5155. width: 100% !important;
  5156. }
  5157. }
  5158. /* PC端样式保持不变 */
  5159. @media screen and (min-width: 769px) {
  5160. .layout {
  5161. height: 100vh;
  5162. display: flex;
  5163. flex-direction: column;
  5164. }
  5165. .chat {
  5166. flex: 1;
  5167. display: flex;
  5168. flex-direction: column;
  5169. }
  5170. .message-list {
  5171. flex: 1;
  5172. overflow-y: auto;
  5173. }
  5174. }
  5175. .thinking-steps {
  5176. margin-bottom: 10px;
  5177. font-size: 12px;
  5178. color: #666;
  5179. }
  5180. .thinking-step {
  5181. padding: 4px 8px;
  5182. margin-bottom: 4px;
  5183. border-radius: 4px;
  5184. background: #f5f5f5;
  5185. transition: all 0.3s ease;
  5186. }
  5187. .thinking-step.start {
  5188. background: #e8f5e9;
  5189. }
  5190. .thinking-step.text_analysis {
  5191. background: #e3f2fd;
  5192. }
  5193. .thinking-step.planning {
  5194. background: #fff3e0;
  5195. }
  5196. .thinking-step.execution {
  5197. background: #f3e5f5;
  5198. }
  5199. .thinking-step.result {
  5200. background: #e8eaf6;
  5201. }
  5202. .thinking-step.conclusion {
  5203. background: #e0f7fa;
  5204. font-weight: 500;
  5205. }
  5206. .step-header {
  5207. position: relative;
  5208. display: flex;
  5209. align-items: center;
  5210. gap: 12px;
  5211. margin-bottom: 8px;
  5212. padding-left: 12px;
  5213. }
  5214. .step-header::before {
  5215. content: '';
  5216. position: absolute;
  5217. left: 0;
  5218. top: 50%;
  5219. transform: translateY(-50%);
  5220. width: 4px;
  5221. height: 16px;
  5222. background: var(--highlight-color);
  5223. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  5224. border-radius: 2px;
  5225. }
  5226. .step-icon {
  5227. width: 24px;
  5228. height: 24px;
  5229. border-radius: 50%;
  5230. display: flex;
  5231. align-items: center;
  5232. justify-content: center;
  5233. font-size: 12px;
  5234. font-weight: 600;
  5235. }
  5236. /* .step.pending .step-icon {
  5237. background: #e5e7eb;
  5238. color: #6b7280;
  5239. }
  5240. .step.running .step-icon {
  5241. background: #3b82f6;
  5242. color: white;
  5243. } */
  5244. /* .step.completed .step-icon {
  5245. color: white;
  5246. }
  5247. .step.error .step-icon {
  5248. color: white;
  5249. } */
  5250. .step-name {
  5251. font-weight: 600;
  5252. font-size: 16px;
  5253. }
  5254. .step-details {
  5255. color: #6b7280;
  5256. font-size: 14px;
  5257. }
  5258. /* .progress-bar {
  5259. width: 100%;
  5260. height: 4px;
  5261. background: #e5e7eb;
  5262. border-radius: 2px;
  5263. margin-top: 8px;
  5264. overflow: hidden;
  5265. margin-left: 36px;
  5266. }
  5267. .progress-fill {
  5268. height: 100%;
  5269. background: #10b981;
  5270. transition: width 0.3s ease;
  5271. width: 0%;
  5272. } */
  5273. </style>
  5274. <style scoped>
  5275. .thinking-steps-stream {
  5276. position: sticky;
  5277. top: 0;
  5278. z-index: 100;
  5279. background: rgba(255, 255, 255, 0.95);
  5280. padding: 10px;
  5281. margin: 10px 0;
  5282. border-radius: 8px;
  5283. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  5284. .thinking-step-stream {
  5285. padding: 8px 12px;
  5286. margin: 4px 0;
  5287. border-radius: 6px;
  5288. background: #f5f5f5;
  5289. font-size: 14px;
  5290. line-height: 1.5;
  5291. opacity: 0;
  5292. transform: translateY(-10px);
  5293. &.fade-in {
  5294. animation: fadeInDown 0.3s ease forwards;
  5295. }
  5296. .typing-indicator {
  5297. display: inline-flex;
  5298. align-items: center;
  5299. margin-left: 8px;
  5300. span {
  5301. width: 4px;
  5302. height: 4px;
  5303. margin: 0 2px;
  5304. background: #666;
  5305. border-radius: 50%;
  5306. animation: typing 1s infinite ease-in-out;
  5307. &:nth-child(1) { animation-delay: 0.2s; }
  5308. &:nth-child(2) { animation-delay: 0.3s; }
  5309. &:nth-child(3) { animation-delay: 0.4s; }
  5310. }
  5311. }
  5312. }
  5313. }
  5314. @keyframes fadeInDown {
  5315. from {
  5316. opacity: 0;
  5317. transform: translateY(-10px);
  5318. }
  5319. to {
  5320. opacity: 1;
  5321. transform: translateY(0);
  5322. }
  5323. }
  5324. @keyframes typing {
  5325. 0%, 60%, 100% { transform: translateY(0); }
  5326. 30% { transform: translateY(-4px); }
  5327. }
  5328. </style>