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

chore: remote models error handling #4059

Merged
merged 5 commits into from
Nov 20, 2024
Merged

Conversation

louis-menlo
Copy link
Contributor

@louis-menlo louis-menlo commented Nov 20, 2024

Describe Your Changes

This press release aims to enhance the error handling of remote models, which previously returned a generic error message indicating something was wrong. Now, it displays a more detailed error message from the provider.

It was also an additional request that caused the confusion, so I removed it.

This also fixed Cohere & O1 models stream mode issue

Screenshot 2024-11-20 at 21 14 06

Fixes Issues

Changes made

  1. sse.ts:

    • The error handling logic was modified to check for an additional data.message field when constructing error messages. This change ensures the error message falls back to data.message if data.error?.message is not available.
  2. ErrorMessage/index.tsx:

    • The ErrorCode.Unknown case was removed from the error title handling, meaning no specific title is provided for unknown errors.
    • Minor refactoring within the default case to wrap the content in a <p> tag for better semantic HTML.
    • Styled the <div> containing the error message with a centering and maximum width using classes mx-auto and max-w-[700px].
  3. EventHandler.tsx:

    • An additional condition was added to the error message handling logic, checking whether the activeModelRef.current.engine is local using isLocalEngine method. This conditional change aims to ensure that only errors related to local engines trigger the following asynchronous operation.

These updates improve error handling, layout styling, and specific conditional checks in error scenarios.

@louis-menlo louis-menlo requested a review from urmauur November 20, 2024 14:17
@github-actions github-actions bot added the type: chore Maintenance, operational label Nov 20, 2024
Copy link
Contributor

Barecheck - Code coverage report

Total: 69.28%

Your code coverage diff: 0.00% ▴

Uncovered files and lines
FileLines
core/src/browser/extensions/engines/helpers/sse.ts37-38, 74-75, 82, 88, 95
web/containers/ErrorMessage/index.tsx39, 41-42, 45

@louis-menlo louis-menlo merged commit 3602483 into dev Nov 20, 2024
9 checks passed
@louis-menlo louis-menlo deleted the fix/remote-models-error-handling branch November 20, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: chore Maintenance, operational
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants