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:7873,currentPage:1,targetPage:1,total:7,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:46,url:'/t/1605781d6a045c73667750031923',name:'GPT',color:'#66BB6A',icon:'mdi-tag-heart',},{id:59,url:'/t/3613550e6a045c7269770b181038',name:'Claude',color:'#66BB6A',icon:'mdi-tag-heart',},{id:63,url:'/t/3005791a6a045c71637723113e02',name:'Gemini',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:101185,num:0,uid:8854,content:'\u003Cp\u003E在 Bash 里面比较反直觉的一点是,\u003Ccode\u003E\u0026amp;\u0026amp;\u003C/code\u003E 跟 \u003Ccode\u003E||\u003C/code\u003E 的优先级是相同的,所以会有:\u003C/p\u003E\u003Ccode\u003E$ true \u0026amp;\u0026amp; { echo \u0026#34;foo\u0026#34;; true; } || echo \u0026#34;bar\u0026#34; \u0026amp;\u0026amp; echo \u0026#34;baz\u0026#34;foobaz\u003C/code\u003E\u003Ccode\u003E$ true \u0026amp;\u0026amp; { echo \u0026#34;foo\u0026#34;; false; } || echo \u0026#34;bar\u0026#34; \u0026amp;\u0026amp; echo \u0026#34;baz\u0026#34;foobarbaz\u003C/code\u003E\u003Cp\u003E这不是什么八股,而是日常工作中会出现的基本用法,然而只有 Claude 3.7 答对了,GPT 4o 跟 Gemini 2.5 pro 还在那 \u003Ccode\u003E\u0026amp;\u0026amp;\u003C/code\u003E 的优先级高于 \u003Ccode\u003E||\u003C/code\u003E 且有短路,即 \u003Ccode\u003EA \u0026amp;\u0026amp; B || C \u0026amp;\u0026amp; D\u003C/code\u003E 等价于 \u003Ccode\u003E(A \u0026amp;\u0026amp; B) || (C \u0026amp;\u0026amp; D)\u003C/code\u003E,所以给出第一个的结果是 \u003Ccode\u003Efoo\u003C/code\u003E。\u003C/p\u003E\u003Cp\u003E冷门技术就不提了,本以为发展到今天 LLM 已经不会在 Bash 这种常见技术上出现低级的事实错误了,看来还是会有。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 11:27:36',updatedAt:'2025-04-11 17:48:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:101186,num:1,uid:262,content:'GPT 你不能拿 4o 写代码,用 o1 或者 o3-mini-high',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 11:41:30',updatedAt:'2025-04-11 17:48:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:101187,num:2,uid:17330,content:'试了一下 Gemini 2.5 pro 两个都回答对了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 12:41:39',updatedAt:'2025-04-11 17:48:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:101188,num:3,uid:1304,content:'\u003Cimg src\u003D\"https://i.imgur.com/caOMUaS.png\"\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 12:46:39',updatedAt:'2025-04-11 17:48:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:101189,num:4,uid:17331,content:'又不是面试,没事问这些问题其实没多大意义。\u003Cbr\u003E与其让 ai 执行 code ,不如找个 bash 自己跑下。\u003Cbr\u003E\u003Cbr\u003E vibing code 都要求生成可读性的 code ,如果出现这类 code ,直接重新生成就行了。目前 vibing code 的意义还是在于提升了生产效率。\u003Cbr\u003E\u003Cbr\u003E以前写个 bash 脚本 不得 10 分钟起步吧,复杂一点的一个小时没了,现在 vibing code 提升效率 10 倍以上。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 13:05:38',updatedAt:'2025-04-11 17:48:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:101190,num:5,uid:436,content:'o3 中思路写的是 \u003Cimg src\u003D\"https://i.imgur.com/lDo2sSF.png\"\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 13:12:48',updatedAt:'2025-04-11 17:48:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:101191,num:6,uid:8854,content:'\u003Cbr\u003E\u003Cbr\u003E确实 o3-mini 会好些,4o 还是不行\u003Cbr\u003E\u003Cbr\u003E我新开了一个重新试了一下,这回对了,有点不稳定\u003Cbr\u003E\u003Cbr\u003E是因为我在看别人代码的时候也有点记不清了,想用 LLM 确认一下,结果发现三个模型答案不一致,又专门翻了一下手册。用来生成代码处理简单任务确实好用,但如果在这种程度的问题上都能发生事实错误,还需要对比及二次确认的话,整个过程并没有提效很多',ipRegion:'',updatedByUid:0,createdAt:'2025-04-10 14:28:31',updatedAt:'2025-04-11 17:48:43',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[262,{uid:262,url:'/u/363b7c036a045c77626c546f123d2116',avatar:'/a/363b7c036a045c77626c546f123d2116',username:'MonikaCeng🤖',}],[8854,{uid:8854,url:'/u/112f660e6a045c7f686f526f3f066273',avatar:'/a/112f660e6a045c7f686f526f3f066273',username:'superhot🤖',}],[436,{uid:436,url:'/u/282b64356a045c776469506f05006a0f',avatar:'/a/282b64356a045c776469506f05006a0f',username:'FlorentinoAriza🤖',}],[17330,{uid:17330,url:'/u/3279553d6a045d706369566f0f0f0932',avatar:'/a/3279553d6a045d706369566f0f0f0932',username:'doraemonki🤖',}],[1304,{uid:1304,url:'/u/6f1a41076a045c76636a526f391a1e21',avatar:'/a/6f1a41076a045c76636a526f391a1e21',username:'deplives🤖',}],[17331,{uid:17331,url:'/u/1e2e773a6a045d706369576f1a1e171f',avatar:'/a/1e2e773a6a045d706369576f1a1e171f',username:'tywtyw2002🤖',}],]),related:[{title:'用了 2 个月的 gemini,今天发现开始限速限额了?你们有这种情况吗?',url:'/d/1f05763e6a045c77606a567a445d676a26131731',},{title:'基于 GPT 4o 开发完成了具有吉卜力、3D 版等多风格图片生成器,之前太忙改程序,才来分享',url:'/d/630e77046a045c77606a567a4458646a1e103560',},{title:'ChatGPT、Grok 复制回答结果到 Word 经常格式会乱掉,尤其是表格,有没有现成的工具能一键导出到 Word?',url:'/d/383f68546a045c77606a567a45506b6a18306011',},{title:'整理了一份《GPT-4o 生图大全》',url:'/d/0e267b0f6a045c77606a567a4650666a39193007',},{title:'chatgpt 安卓无法使用',url:'/d/332d762c6a045c77606a567a475d676a2f0c1815',},{title:'claude 免费用户和 20 美元付费用户分别一天可以提问 3.7 多少次',url:'/d/3c04762f6a045c77606a56754f5f666a15012119',},{title:'GPT-4o 多模态生图有按次收费的不?',url:'/d/287079286a045c77606a56754f5a616a047b1105',},{title:'请教一下',url:'/d/62256a2f6a045c77606a567540506a6a5b0e651b',},{title:'悲!Gemini 2.5 pro exp 消失了',url:'/d/1f705d376a045c77606a5675405e676a0d35376a',},{title:'基于 GPT-4o 搓了一个的图片生成器,帮助自己实现嘴图自由',url:'/d/021a431a6a045c77606a56754550606a14213e18',},{title:'职业焦虑发作以后找 ChatGPT 谈心,发现 4o 的回答比之前更有人情味了',url:'/d/6b13765b6a045c77606a5675455d636a3e006033',},{title:'gpt pro感觉还没用就没4.5了。',url:'/d/0d3d7c5d6a045c77606a56754658656a3d2b1408',},{title:'第一个完全用 AI 工具生成的工具站',url:'/d/6a18771a6a045c77606a5675475e616a01126104',},{title:'Apple Intelligence 无法绑定 ChatGPT',url:'/d/631e613e6a045c77606a5675475d606a3f221a31',},{title:'体验了一把 Vibe Coding, 用 Cursor + Claude3.7 sonnet 10 小时 0 代码搞定一个 MCP Servers\u0026amp;Clients 信息导航站',url:'/d/0f3d46216a045c77606a56754758606a2e766b35',},{title:'GPT-4o 生成吉卜力风格漫画',url:'/d/1c074a546a045c77606a56744e506b6a3e122a3f',},{title:'ChatGPT 要支持 MCP 了',url:'/d/621c61066a045c77606a5674405e6a6a2f112418',},{title:'ChatGPT 设计?',url:'/d/221f47146a045c77606a5674405e636a001a621e',},{title:'【已解决】CHATGPT APP 提示 PlayIntegrity verification failed,有大佬知道咋解决吗',url:'/d/1c78070e6a045c77606a5674405b626a3e171a66',},{title:'Claude 的 IP 限制严格了非常多!求指条明路',url:'/d/187d035d6a045c77606a56744059646a2533161e',},],} 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")