-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
将AI返回内容中的markdown代码块转换为普通json #160
Merged
Merged
Conversation
This file contains 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
多谢 PR,这里没有严格校验 AI 输出的内容格式,考虑到 LLM 返回的格式可能多种多样,解析失败默认按异常处理。 |
idootop
reviewed
Jul 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ 感谢 PR,你的 fix 很有效,但仍有一些可优化的空间,暂时就先不合并了哈。
这个问题的本质是怎样尽可能多的兼容 LLM 输出的各种异常 case,
也欢迎你继续提出一些建议和改进方法,咱们一起讨论。
感谢您的 code review!
另外这个 pr 用不用 close? 还是我继续优化一下? |
refactor: 将json编解码操作放入/utils/parse
这次修改我把jsonDecode jsonEncode放到了/utils/parse, 并且将清洗json代码封装为一个函数 |
已合并 |
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.
在生成记忆时,部分LLM有概率返回markdown代码块格式而非单纯地json格式,导致无法解析并创建记忆.
这个pr尝试移除掉代码块标记,并在生成记忆错误时打印log