Repository navigation
fix(translation): 必应发送原文,并为百度请求补上 1 秒间隔 - #52
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
必应不再把 &、<、> 转成实体后再请求,避免尖括号正文被截断;响应仍只解码一次实体。 百度串行队列在相邻请求开始前至少等待 1 秒,减少标准版 1 QPS 下的 54003。 Co-authored-by: zilorn <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解决的问题 / Problem
跟进 #51 的审阅记录:
&、<、>转成 HTML 实体。服务端不会总是还原,含尖括号的正文会被截断(例如<b>bold</b>被吞成b)。必应免费接口非公开、可能失效,界面与文档已有说明;本次不改这一点。没有百度 APP ID / 密钥,未做真实账号请求。
改动后的行为 / Resulting behavior
验证 / Validation
pnpm exec tsc --noEmit通过pnpm run i18n:check通过pnpm build通过node scripts/translation-test.mjs通过,覆盖必应原文请求体、实体只解码一次、百度分片间隔与间隔内取消。未打开界面:设置页无改动。未直连必应或百度。数据与兼容性 / Data and compatibility
不改持久化格式。缓存键仍按原文计算;若已用旧必应请求把含尖括号的段落译错并写入缓存,需要重新翻译才会更新。
提交前检查 / Checklist