Open
Conversation
Author
|
不知道是不是会出现类似错误,但是还是保险一点好,毕竟也存在一些用户会不知道怎么用改出了问题。 |
Collaborator
|
hi! @liuanping 这个修复有对应真实场景下的bug吗? |
Author
还没有,代码看到感觉有可能有问题,所以建议保护下。 |
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.
_apply_cache_control 方法中处理 system 消息 content 非字符串的逻辑:
else:
new_content = list(content)
new_content[-1] = {**new_content[-1], "cache_control": {"type": "ephemeral"}}
system 消息的 content 是空列表([]),new_content[-1] 会直接抛出 IndexError: list index out of range 异常,导致整个 LLM 请求崩溃。