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

fix: correct linewrap think display in generic openai api #13260

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

xhebox
Copy link
Contributor

@xhebox xhebox commented Feb 6, 2025

Summary

Follow up #13234.

I've got keys from deepseek and siliconflow. Thus I tested and removed duplicated code.

I also found two corner cases and one bug:

  1. \n\n..\n may be there. That said you can't just replace \n\n but also \n in the same line. I made a regexp replace.
  2. both reasoning_content and content may be empty sometimes in the thinking phase. the current code will terminate the reasoning phase, append > think_icon again.
  3. delta_content is not assigned correctly in the generic openai api module.

Since official deepseek api does not respond after fixing problem 2, I don't have screen shots for it.

Screenshots

Before After
... Screenshot 2025-02-06 at 10-32-58 test - Dify
... Screenshot 2025-02-06 at 10-34-34 test - Dify
... Screenshot 2025-02-06 at 10-41-53 test - Dify

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🐞 bug Something isn't working labels Feb 6, 2025
@crazywoola crazywoola added this to the deepseek milestone Feb 6, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 6, 2025
@crazywoola crazywoola merged commit da2ee04 into langgenius:main Feb 6, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants