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:5528,currentPage:1,targetPage:1,total:12,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:59,url:'/t/3613550e6a045c7269770b181038',name:'Claude',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:63300,num:0,uid:693,content:'\u003Cp\u003E昨天下午摸鱼时看到 Cursor 0.47 版本上线了 Claude 3.7 Max ,虽然是按次收费(钱包瑟瑟发抖),但还是忍不住想试一把。正好手头有个被我折腾了好几天的问题,想着反正也是死马当活马医,就让它帮我看看。\u003C/p\u003E实际踩坑:目录树加载慢到怀疑人生问题描述\u003Cp\u003E我有个文档管理系统(就是自己写着玩的小项目),最近文档越来越多(网上爬了 3w 多篇付费文档),导航树卡的要命:\u003C/p\u003E后端傻乎乎地一次性加载整棵树前端界面像死机一样等待文档一多直接卡 30 多秒,我都能煮个泡面了用户(其实就是我自己)体验极差,没有任何反馈,还以为程序崩了前几天用 Claude 3.7 搞过\u003Cp\u003E之前试着用 Claude 3.7 Sonnet 搞这个问题,感觉像是在带着一个实习生干活:\u003C/p\u003E\u003Cp\u003E只改半边天:它理解我想做渐进加载,但老是改了后端不改前端,或者只告诉我大体思路,具体实现永远差那么一点\u003C/p\u003E\u003Cp\u003E前后端配合混乱:后端加了参数,前端组件改不对,接口对不上,跑起来各种报错\u003C/p\u003E\u003Cp\u003E死盯着一个文件:我项目好几个文件都需要一起改,但它老是只顾一个地方,其他地方全忘了\u003C/p\u003E\u003Cp\u003E有 bug 修不明白:出了问题给的修复方案不是太复杂就是漏东西,搞得我比自己写还折腾\u003C/p\u003E\u003Cp\u003E每次都是改了前端报后端错,改了后端又报前端错,反反复复,搞得我怀疑自己的智商。\u003C/p\u003EMax 帮我一把搞定\u003Cp\u003E今天用 Claude 3.7 Max 试着弄这个问题,效果真的惊到我了:\u003C/p\u003E\u003Cp\u003E整体思路清晰:\u003C/p\u003E几分钟就看出问题在那个递归加载算法上提了个渐进式加载的完整方案连加载提示这种细节都想到了(确实是我容易忽略的)\u003Cp\u003E代码实现贼准:\u003C/p\u003E后端:加了个子树加载的功能,还能控制加载深度前端:把组件的数据获取和渲染都改了接口:加了需要的参数和标记,前后端一次对接就通了\u003Cp\u003E全局理解超强:\u003C/p\u003E不管是类型定义还是状态管理都没落下之前不敢改的几个复杂组件,它一次就改对了连潜在的 bug 都提前给我规避掉了\u003Cp\u003E调试能力长进不少:\u003C/p\u003E第一次有个方法不存在的错误,立马找到原因修好了主动加了日志方便我排查代码前后几个部分改完一提交,居然基本能跑了!\u003Cp\u003E最终在两次回答花费 0.25 刀完成所有修改,整体感觉就像是从实习生升级到了中级开发,方案一次成型,改完基本能跑,还需要我微调的地方也就两三处。\u003C/p\u003E最终方案\u003Cp\u003E最后实现的效果还挺满意:\u003C/p\u003E\u003Cp\u003E后端改了:\u003C/p\u003E默认只给第一层目录点开再加载下一层给树节点加了标记表示\u0026#34;有内容但还没加载\u0026#34;\u003Cp\u003E前端也跟着改:\u003C/p\u003E树组件支持动态加载展开时才去请求内容加了个小菊花转起来,用户体验好多了\u003Cp\u003E速度提升明显:\u003C/p\u003E从 30 多秒变成秒开按需加载省了不少带宽用户不用死等,可以边看边加载网站地址: https://ailibrary.space/源码地址: https://github.com/Ly-GGboy/AI-Library唠唠叨叨\u003Cp\u003EMax 在处理这种多文件、前后端交互的复杂改动上,确实比 Sonnet 强不少。主要是:\u003C/p\u003E能看透整个架构的关系改代码改得更全面少犯低级错误出了问题能快速定位修复\u003Cp\u003E作为一个经常 996 的码农,这种能力的提升让我可以把更多时间花在摸鱼(不是)、设计和创意上,而不是拿着显微镜找 bug 。\u003C/p\u003E\u003Cp\u003E如果以后 Max 能加入 Cursor 会员免费调用,那绝对是神器,一天能多出不少时间来刷刷 B 站什么的。就算按次付费,解决那些卡脖子问题时,也值得花这个钱,毕竟时间比金钱珍贵多了。\u003C/p\u003E絮叨\u003Cp\u003EAI 辅助编程发展是真快啊,从最早的代码补全,到现在能实现复杂功能,跟谁进步一样。Max 的表现让我看到更多可能,希望未来各家模型继续卷起来,让我们这些懒程序员的生活更轻松点。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 14:37:43',updatedAt:'2025-03-20 22:34:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:63301,num:1,uid:6946,content:'用 cline 体验过 1 分钟 API 扣出 15 美元,论次收费的你们先体验看看',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 14:59:40',updatedAt:'2025-03-20 22:34:19',mentionNum:0,mentionedBy:[5,],mentionUsers:[],likeUsers:[],},{id:63302,num:2,uid:5639,content:'网站挺好的,但是 PDF 好糊啊,看得难受',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:02:30',updatedAt:'2025-03-20 22:34:19',mentionNum:0,mentionedBy:[3,4,],mentionUsers:[],likeUsers:[],},{id:63303,num:3,uid:693,content:'#2 可能是扫描版本的,你可以反馈下是哪个文档,如果我能找到更好的源就替换上去',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:05:30',updatedAt:'2025-03-20 22:34:19',mentionNum:2,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:63304,num:4,uid:693,content:'#2 后期准备用 pdf 转换 md 的一些开源转换一下这些 pdf ,这格式不是很友好',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:06:21',updatedAt:'2025-03-20 22:34:19',mentionNum:2,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:63305,num:5,uid:693,content:'#1 这么夸张。。cursor 扣起来还行,我限制了 20 刀额度',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:06:49',updatedAt:'2025-03-20 22:34:19',mentionNum:1,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:63306,num:6,uid:256,content:'太贵了,真的用不起啊。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:41:36',updatedAt:'2025-03-20 22:34:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:63307,num:7,uid:7400,content:'想问下 Claude 3.7 Max 是预付费还是后付费呢?是否需要绑定付款方式后才能使用?',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:47:43',updatedAt:'2025-03-20 22:34:19',mentionNum:0,mentionedBy:[9,],mentionUsers:[],likeUsers:[],},{id:63308,num:8,uid:4978,content:'本文使用 AI 润色',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:49:22',updatedAt:'2025-03-20 22:34:19',mentionNum:0,mentionedBy:[10,],mentionUsers:[],likeUsers:[],},{id:63309,num:9,uid:693,content:'#7 需要绑定信用卡,开启按次消耗,会自动扣费',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:57:17',updatedAt:'2025-03-20 22:34:19',mentionNum:7,mentionedBy:[11,],mentionUsers:[],likeUsers:[],},{id:63310,num:10,uid:693,content:'#8 自己写了内容,让 ai 规范化描述,比自己纯手动写表达流畅一些',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 15:59:46',updatedAt:'2025-03-20 22:34:19',mentionNum:8,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:63311,num:11,uid:7400,content:'#9 好的,谢谢',ipRegion:'',updatedByUid:0,createdAt:'2025-03-19 16:17:54',updatedAt:'2025-03-20 22:34:19',mentionNum:9,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[4978,{uid:4978,url:'/u/2c0f5c156a045c73696d5e6f1858182b',avatar:'/a/2c0f5c156a045c73696d5e6f1858182b',username:'cherryas🤖',}],[256,{uid:256,url:'/u/6810610b6a045c77626f506f07133174',avatar:'/a/6810610b6a045c77626f506f07133174',username:'qxmqh🤖',}],[693,{uid:693,url:'/u/112b5b376a045c776663556f1b24677e',avatar:'/a/112b5b376a045c776663556f1b24677e',username:'boxrq🤖',}],[6946,{uid:6946,url:'/u/6c2b7f346a045c71696e506f2f391075',avatar:'/a/6c2b7f346a045c71696e506f2f391075',username:'hash🤖',}],[7400,{uid:7400,url:'/u/0e3f66016a045c70646a566f3358220a',avatar:'/a/0e3f66016a045c70646a566f3358220a',username:'ryougifujino🤖',}],[5639,{uid:5639,url:'/u/0c25503d6a045c7266695f6f39591803',avatar:'/a/0c25503d6a045c7266695f6f39591803',username:'leeggco🤖',}],]),related:[{title:'Claude 依然是编程最强, ChatGPT 跟 Gemini 在 Bash 这种常见语言的最基础的地方依然犯错',url:'/d/35316b0b6a045c77606a56754f5e606a347a0666',},{title:'claude 免费用户和 20 美元付费用户分别一天可以提问 3.7 多少次',url:'/d/3c04762f6a045c77606a56754f5f666a15012119',},{title:'请教一下',url:'/d/62256a2f6a045c77606a567540506a6a5b0e651b',},{title:'第一个完全用 AI 工具生成的工具站',url:'/d/6a18771a6a045c77606a5675475e616a01126104',},{title:'体验了一把 Vibe Coding, 用 Cursor + Claude3.7 sonnet 10 小时 0 代码搞定一个 MCP Servers\u0026amp;Clients 信息导航站',url:'/d/0f3d46216a045c77606a56754758606a2e766b35',},{title:'Claude 的 IP 限制严格了非常多!求指条明路',url:'/d/187d035d6a045c77606a56744059646a2533161e',},{title:'Claude改版后还蛮好看的',url:'/d/6f2e74546a045c77606a56744059606a2f7a2b24',},{title:'在 Claude 的帮助下写了一个局域网内剪贴板同步小工具,支持 Windows macOS',url:'/d/002402596a045c77606a5674445a626a08221a23',},{title:'Claude3 Opus ChatGPT Plus GPT-4o 大模型聚合平台',url:'/d/220179376a045c77606a5674475a6a6a2b083d67',},{title:'有没有claude拼车的',url:'/d/181b5e036a045c77606a5677415d626a5c263f17',},{title:'Claude 合租 ,三人,40/人,差一人pandora面板',url:'/d/2d71563d6a045c77606a5677445e666a017b3a07',},{title:'感觉一些人对 claude 3.7 sonnet 有误解,以为是编程领域最强的模型。',url:'/d/111c411a6a045c77606a56764051676a58743d66',},{title:'🚗论坛福利拼车🚗,不降智GPT Pro可触发深度,限时论坛福利全模型通用免费体验,下方可体验测试~截止晚10点',url:'/d/0f055d0e6a045c77606a56764059676a3c280b16',},{title:'问问老哥们—Cursor的一些问题',url:'/d/0d2d41096a045c77606a5671405e6b6a2d0c6265',},{title:'🚗200刀chatGPT Pro,可触发深度,限时论坛福利全模型通用仅需99r/月,截止日期3.15,福利赠claude pro 3.7与grok3 super,下方可体验测试~',url:'/d/110b5a3d6a045c77606a5671415c6a6a0a302923',},{title:'免费Cluade3.7,DeepL翻译,文生图,文生视频!',url:'/d/0f0c642f6a045c77606a5671415d616a04360536',},{title:'请教老师们,类似百度地图 API 并发峰值上限约束不能超过 100/秒,程序上是不是没法精确控制?(我主要用来获取地图经纬度,我用 Claude 3.7 Sonnet 帮忙写的,似乎无法精确控制)',url:'/d/3b1c46376a045c77606a56714350626a250c3411',},{title:'请教一下各位IOS内购Claude Pro多久可以换绑',url:'/d/19796a3d6a045c77606a56714550616a190b1e20',},{title:'claude3.7感觉不如gpt 4.5啊',url:'/d/3d3b01046a045c77606a5671475d656a5f0d1d6b',},{title:'Claude pro订阅用尼区IOS内购便宜还是google play',url:'/d/113e67266a045c77606a56704459676a20162418',},],} 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")