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: filter out sse comments #243

Closed
wants to merge 1 commit into from
Closed

Conversation

tisfeng
Copy link

@tisfeng tisfeng commented Jan 21, 2025

What

Filter out comments, like ": OPENROUTER PROCESSING"

Why

FIX OpenRouter error: tisfeng/Easydict#743

Affected Areas

.trimmingCharacters(in: .whitespacesAndNewlines)
.components(separatedBy: .newlines)
.filter { !$0.hasPrefix(":") } // Filter out comments, like ": OPENROUTER PROCESSING"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @tisfeng!
Is there any documentation on OpenRouter API about this line? We'd like to be sure we don't get a regression here and do not break any other providers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what do you think about writing unit tests that cover both cases (with and without comments)

@nezhyborets
Copy link
Collaborator

Implemented in #259

@nezhyborets nezhyborets closed this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants