-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add methods for shaping response events #3
Comments
I started some dreamcoding. It doesn't answer the questions of how yet, but it helps me understand if this is the direction we want to go. I'd love to hear your thoughts: In terms of shaping responses, I'm thinking to have set of methods matching our types, like The low-level methods could work two fold. For one, we have methods for each type that creates respond objects, e.g. const confirmationObject = confirmation({
title: "Would you like to hear a joke?",
message: "I have a joke about construction, but I'm still working on it.",
id: "joke",
// optional
meta: {
other: "data",
},
}); Where {
"event": "copilot_confirmation",
"data": {
"type": "action",
"title": "Would you like to hear a joke?",
"message": "I have a joke about construction, but I'm still working on it.",
"confirmation": {
"id": "joke",
"other": "data"
}
}
} and then a separate method which takes these objects that we support and turn them into an SSE-compatible line const line = toServerSideEventLine(confirmationObject) where
The line could then be directly passed into a standard node response object response.write(line) This is really just me thinking out loud, usually I'd think more before bothering folks with notifications. But given the short timeline there is no time for such niceties 🙇 |
Had a chat with @alexisabril and he suggested to add a const confirmationObject = confirmation({
title: "Would you like to hear a joke?",
message: "I have a joke about construction, but I'm still working on it.",
id: "joke",
});
const line = toServerSideEventLine(confirmationObject)
response.write(toServerSideEventLine) we could do const confirmationObject = confirmation({
title: "Would you like to hear a joke?",
message: "I have a joke about construction, but I'm still working on it.",
id: "joke",
});
response.write(confirmationObject) // calls `confirmationObject.toString()` I like it!! |
I added the list of methods I want to build as sub issues. The list as of now is
I thought Any thoughts? |
This is something I struggle with myself and I could lean either way. Do we have any precedence in Octokit today for these types of methods? Thoughts that occur to me:
The above are my raw thoughts, but tldr; I'm leaning towards the proposed API unless this would introduce inconsistency with an existing Octokit API. |
🎉 This issue has been resolved in version 2.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Helper method(s) could be defined to assist in the shaping of a Copilot Chat response or the streaming of the response. Response shapes are a common issue, with inconsistencies from developers around:
The text was updated successfully, but these errors were encountered: