lxfater / BilibiliSummary

A chrome extension helps you summary video on bilibili.
BSD 3-Clause "New" or "Revised" License
713 stars 54 forks source link

关于getSmallSizeTranscripts的疑问或bug? #17

Open lightfate opened 1 year ago

lightfate commented 1 year ago

https://github.com/lxfater/BilibiliSummary/blob/3d1a67cbe8e96adba60672b778ce89644a43280d/src/prompt.ts#L84C95-L84C95 这行代码有个地方没想通,这段代码我的理解是将旧字幕项添加到结果中,但同时需要确保总字节长度不超过限制。如果添加旧字幕项会导致超出限制,则只添加该字幕项的一部分;如果不会超出限制,则完整添加该字幕项。 比如我们假设以下参数: lastByteLength: 1000 nextTextByteLength: 300 byteLimit: 1000 也就是说这时候文本正好达到限制长度,应该不截取任何长度到resultData中 但实际计算确是 计算超出的字节数: 1000+300−1000=300 计算超出比率: overRate=300/300=1 const chunkedText = obj.text.substring(0, Math.floor(obj.text.length * overRate)); 这不就变成了把这一段文本都放到resultdata中吗 不知道是否是哪里理解错了

lxfater commented 1 year ago

为什么不用让chatgpt解答你的问题呢?

lightfate commented 1 year ago

image 已经问过chatgpt说有问题,才在这里问的,

lightfate commented 1 year ago

image image image image 以上是我和chatgpt的完整对话