-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat: Use StarSearchPayload from API #3424
Conversation
✅ Deploy Preview for design-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for oss-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Looks good! Just needs a fix on the text break.
9f6a5d7
to
87a1062
Compare
Force pushed to set the markdown class as |
Yeah, I was hoping the github flavored markdown plugin would fix this :( but it's till messed up. Any ideas? |
f66ba64
to
672c4a5
Compare
Also added some additional comments and a check that |
*/ | ||
|
||
const matched = v.match(/data:\s?(?<result>.*)/); | ||
const matched = v.match(/data:\s(?<result>.*)/); |
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.
I made the regex just abit more strict: now, there has to be a space between data:
and the json object flowing in. We can always expect the same result now from the API: the data
key, a :
, a space
, and then the json object. So, for example, data: { id: "abc123" }
will get captured. But data:
or data:{ ... }
will be rejected.
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.
always one space or can it be \s+
? I'd assume just \s
since the API is handling the formatting?
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.
Yes, correct, the payload from the API should always be data: { ... }
with one space and we should reject anything that is malformed. It's probably a moot point to make the regex more strict, but it at least makes the client have to do alot less heavy lifting since the API is doing it now
91d545e
to
e055e39
Compare
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.
Nice work! 🤝
e055e39
to
2a5f6ee
Compare
Looking good with the chat bubbles!! cc @nickytonline would love to get this in a release today so we can play around with everything before thursday! |
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.
Nothing blocking, just some comments. Great work @jpmcb!
🚢
*/ | ||
|
||
const matched = v.match(/data:\s?(?<result>.*)/); | ||
const matched = v.match(/data:\s(?<result>.*)/); |
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.
always one space or can it be \s+
? I'd assume just \s
since the API is handling the formatting?
Makes the Markdown class use "break-word" and "prose" classes for styling Co-authored-by: John McBride <john@opensauced.pizza> Co-authored-by: Zeu Capua <zeu@opensauced.pizza> Signed-off-by: John McBride <john@opensauced.pizza>
2a5f6ee
to
0c76073
Compare
if (!payload || !payload.content || payload.content.parts.length === 0) { | ||
Sentry.captureException( | ||
new Error(`Parsed and rejected malformed JSON for StarSearch. JSON payload: ${v}`) | ||
); |
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.
Sends Sentry an error if we get some weird malformed JSON for some reason.
Not sure why you're loader is blue. 🤔 Here it is on beta. |
Not sure what's going on your local, but on your deploy preview the loader animation is orange. 🙃 |
## [2.30.0-beta.2](v2.30.0-beta.1...v2.30.0-beta.2) (2024-05-21) ### 🍕 Features * Use StarSearchPayload from API ([#3424](#3424)) ([a8b01f7](a8b01f7))
## [2.30.0](v2.29.0...v2.30.0) (2024-05-21) ### 🍕 Features * add workspaces intro video to welcome modal ([#3432](#3432)) ([d4bce9a](d4bce9a)) * added a loader for StarSearch responses ([#3422](#3422)) ([8972760](8972760)) * open up access to StarSearch and show modal/drawer for login ([#3442](#3442)) ([d228949](d228949)) * Small update to copy for suggested starsearch queries ([#3438](#3438)) ([012db59](012db59)) * update to lunch week card ([#3439](#3439)) ([d41f8fa](d41f8fa)) * Use StarSearchPayload from API ([#3424](#3424)) ([a8b01f7](a8b01f7)) ### 🐛 Bug Fixes * add mobile drawer for `InsightUpgradeModal` ([#3429](#3429)) ([d081980](d081980)) * add support for clipboard copy in Safari and use utility function ([#3433](#3433)) ([2d1b74f](2d1b74f)) * disable search for workspace dropdown if not logged in ([#3414](#3414)) ([b242e92](b242e92)) * fix to avoid StarSearch UI breaking when long words are outputted ([#3420](#3420)) ([4d6bb23](4d6bb23)) * fixed rendering of lottery chart when less than 4 contributors ([#3415](#3415)) ([3888ecb](3888ecb)) * fixed scrolling issues with StarSearch ([#3444](#3444)) ([2c46494](2c46494)) * history chart using correct data for `StarsChart` ([#3443](#3443)) ([f85f1fd](f85f1fd)) * now sauced-orange colour defaults to 1 for opacity ([#3437](#3437)) ([aa9f67f](aa9f67f)) * remove reactions from issues table ([#3435](#3435)) ([e15c6b6](e15c6b6)) * swap out css module prompt with lottery factor ([#3413](#3413)) ([2c9def0](2c9def0)) * updated StarSearch copy ([#3440](#3440)) ([abe33f1](abe33f1))
Description
This is a followup to https://github.com/open-sauced/api/pull/818 which introduces a well defined, strongly typed object for sending in the StarSearch
data:
stream. This should make parsing the incoming content much, much easier. This method is heavily inspired by ChatGPT and the data object they send back in their stream.This also introduces the remark github style markdown plugin. I'm not sure if it's making a difference, but maybe worth playing around with.
Related Tickets & Documents
Followup to: https://github.com/open-sauced/api/pull/818
Mobile & Desktop Screenshots/Recordings
Overall, this seems to fix alot of the messy line breaking that was going on:
Steps to QA
Tier (staff will fill in)