Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于getSmallSizeTranscripts的疑问或bug? #17

Open
lightfate opened this issue Aug 10, 2023 · 3 comments
Open

关于getSmallSizeTranscripts的疑问或bug? #17

lightfate opened this issue Aug 10, 2023 · 3 comments

Comments

@lightfate
Copy link

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中吗
不知道是否是哪里理解错了

@lightfate lightfate changed the title 关于getSmallSizeTranscripts的困惑 关于getSmallSizeTranscripts的疑问或bug? Aug 10, 2023
@lxfater
Copy link
Owner

lxfater commented Aug 10, 2023

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

@lightfate
Copy link
Author

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

@lightfate
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants