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

Use a callback function table to handle streaming response messages #51

Merged
merged 4 commits into from
Jul 31, 2023

Conversation

pjlast
Copy link
Collaborator

@pjlast pjlast commented Jul 28, 2023

Dependent on sourcegraph/cody#438

Allows specifying a callback function when invoking a chat with a streamed response.

The callback is cleaned up when the streamed response ends.

This gives us a lot of flexibility in how we handle streamed responses.

@pjlast pjlast requested a review from tjdevries July 28, 2023 12:00

M.message_callbacks[message_id] = callback

return M.request("recipes/execute", { id = "chat-question", humanChatInput = message, data = message_id })
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make the data be { id = message_id }?

return string.format("%x", v)
end)
end

Copy link
Contributor

Choose a reason for hiding this comment

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

can also just add a rust dep for this if you want to generate one.

@tjdevries
Copy link
Contributor

(also, did you do build-minify to build the agent?)

@pjlast pjlast merged commit 2be8a63 into master Jul 31, 2023
6 checks passed
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.

2 participants