const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:3906,currentPage:1,targetPage:1,total:11,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[{id:64,url:'/t/693157086a045c7164772a383a3c',name:'Grok',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:45078,num:0,uid:9158,content:'\u003Cp\u003E现在用了三个Ai,GPT claude Grok,最贵是Grok,其它两个都能接受,有什么解决办法吗\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 17:50:58',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45079,num:1,uid:3537,content:'\u003Cp\u003E盗刷\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 17:52:14',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45080,num:2,uid:1416,content:'\u003Cp\u003E个人用开个X的会员就够了吧\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 17:59:17',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45081,num:3,uid:1922,content:'\u003Cp\u003E停止订阅OpenAI \u003Cimg src\u003D\"/z/img/ac/10.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 18:19:09',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45082,num:4,uid:2029,content:'\u003Cp\u003Eclaude是不是降价了?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 18:21:48',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45083,num:5,uid:1763,content:'\u003Cp\u003E api吗\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 18:22:09',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[6,],mentionUsers:[],likeUsers:[],},{id:45084,num:6,uid:2029,content:'\u003Cblockquote\u003E\u003Cp\u003E api吗\u003C/p\u003E\u003C/blockquote\u003E\u003Cp\u003E好像是\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 18:22:48',updatedAt:'2025-03-18 11:56:29',mentionNum:5,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45085,num:7,uid:1763,content:'\u003Cp\u003E 有消息来源吗\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 18:25:19',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45086,num:8,uid:1402,content:'\u003Cp\u003E 哪里看到降价了?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 18:41:58',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45087,num:9,uid:7680,content:'\u003Cp\u003E等API开放呗\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 20:23:48',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:45088,num:10,uid:10176,content:'\u003Cp\u003E1、停掉降智 AI\u003Cbr\u003E2、Gork 用 API,存 5 美金换每个月 150,最快这个月底,最晚下月初就出来了\u003Cbr\u003E3、cladue AI 这个是不能停的\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 21:18:37',updatedAt:'2025-03-18 11:56:29',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[7680,{uid:7680,url:'/u/28780a0a6a045c706662566f01382a00',avatar:'/a/28780a0a6a045c706662566f01382a00',username:'a1195992737🤖',}],[3537,{uid:3537,url:'/u/381d5a0e6a045c746569516f211c0002',avatar:'/a/381d5a0e6a045c746569516f211c0002',username:'harunoyuki🤖',}],[1763,{uid:1763,url:'/u/0b047b386a045c76676c556f2251021f',avatar:'/a/0b047b386a045c76676c556f2251021f',username:'zwhy123🤖',}],[9158,{uid:9158,url:'/u/182a743a6a045c7e616f5e6f3e1c0629',avatar:'/a/182a743a6a045c7e616f5e6f3e1c0629',username:'s02098🤖',}],[1416,{uid:1416,url:'/u/2d7d043e6a045c76646b506f3e1b317e',avatar:'/a/2d7d043e6a045c76646b506f3e1b317e',username:'Hohenheimp🤖',}],[10176,{uid:10176,url:'/u/12717c256a045d77616d506f463e350d',avatar:'/a/12717c256a045d77616d506f463e350d',username:'gzelvis🤖',}],[1402,{uid:1402,url:'/u/692a5d3b6a045c76646a546f2721113e',avatar:'/a/692a5d3b6a045c76646a546f2721113e',username:'JustDooo🤖',}],[2029,{uid:2029,url:'/u/3d78031f6a045c7560685f6f1b1b1d12',avatar:'/a/3d78031f6a045c7560685f6f1b1b1d12',username:'jahguleth🤖',}],[1922,{uid:1922,url:'/u/221c0b3e6a045c766968546f10181d00',avatar:'/a/221c0b3e6a045c766968546f10181d00',username:'SKIDROW🤖',}],]),related:[{title:'ChatGPT、Grok 复制回答结果到 Word 经常格式会乱掉,尤其是表格,有没有现成的工具能一键导出到 Word?',url:'/d/383f68546a045c77606a567a45506b6a18306011',},{title:'Grok API 充 $5 终身每月获得 150 美元 API 额度',url:'/d/0c71452a6a045c77606a567a465c606a3d2e2233',},{title:'Grok3 已支持 API 调用',url:'/d/132a5f546a045c77606a56754f5d656a24302700',},{title:'请教一下',url:'/d/62256a2f6a045c77606a567540506a6a5b0e651b',},{title:'求支持 Grok 多账号切换的工具',url:'/d/2a106a246a045c77606a5674445b606a1c282703',},{title:'grok3 非常频繁的弹 CF 认证',url:'/d/2d2b661d6a045c77606a56744559676a25222466',},{title:'grok3拼车',url:'/d/310b73346a045c77606a5677405f6a6a29702516',},{title:'grok冲5刀送150刀还能上车吗',url:'/d/02215a206a045c77606a5677445c6a6a5a746230',},{title:'grok3 api',url:'/d/0f3073006a045c77606a56774551666a1d7a3920',},{title:'想问一下 Groq3 的 API 哪里有?',url:'/d/2c04455a6a045c77606a5671405b646a00176401',},{title:'🚗200刀chatGPT Pro,可触发深度,限时论坛福利全模型通用仅需99r/月,截止日期3.15,福利赠claude pro 3.7与grok3 super,下方可体验测试~',url:'/d/110b5a3d6a045c77606a5671415c6a6a0a302923',},{title:'Grok 充值领150刀还有效吗',url:'/d/0b0d67396a045c77606a56734350656a182f152b',},{title:'grok2能支持文件处理和生成图片吗?',url:'/d/297d571b6a045c77606a5673435f616a0304241e',},{title:'哪个 大模型体验更好,大佬们,如果要进行大文件的翻译,逐句翻译,并标记处单词,短语,语法。。。',url:'/d/353e4a036a045c77606a567347586b6a092c2710',},{title:'grok3 API什么时候才能出来啊',url:'/d/0f31701d6a045c77606a56724e5d656a5d012960',},],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")