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: empty response on some generation attempts #4454

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

louis-menlo
Copy link
Contributor

Describe Your Changes

This pull request aims to resolve the issue of including the latest assistant response in the resend of recent chat messages, which disrupts the context. There are two main problems with this:

  1. Some remote providers do not accept two consecutive assistant messages.
  2. The models would be misled by the incorrect context of the user prompt.

CleanShot 2025-01-15 at 16 59 13

Fixes Issues

Changes

This pull request includes changes to the useSendChatMessage function in the web/hooks/useSendChatMessage.ts file to enhance the message sending process. The most important changes include adding new conversation data to the sendChatMessage call and refactoring the message request building logic.

Enhancements to message sending:

Refactoring:

  • web/hooks/useSendChatMessage.ts: Moved the condition if (!isResend) to a later point in the function to ensure that the message request is always built before checking if it is a resend. [1] [2]

@louis-menlo louis-menlo requested a review from urmauur January 15, 2025 10:13
@github-actions github-actions bot added the type: bug Something isn't working label Jan 15, 2025
Copy link
Contributor

Barecheck - Code coverage report

Total: 69.26%

Your code coverage diff: 0.00% ▴

Uncovered files and lines
FileLines
web/hooks/useSendChatMessage.ts100-101, 103-104, 108-109, 112-113, 121, 123-125, 128-130, 133-134, 136-137, 139, 141-143, 145, 147, 149, 153, 156-157, 163-164, 168, 179, 182, 186, 189, 197, 199, 201, 204, 206, 209, 214, 216-217, 220-224, 227, 230, 236, 239-240

@louis-menlo louis-menlo merged commit 9579e86 into dev Jan 15, 2025
15 of 16 checks passed
@louis-menlo louis-menlo deleted the fix/empty-response-on-regenerate branch January 15, 2025 12:26
@github-actions github-actions bot added this to the v0.5.14 milestone Jan 15, 2025
@imtuyethan imtuyethan modified the milestones: v0.5.14, v0.5.15 Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
3 participants