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: change value 'response' by value 'result' of event name when socket client is registered #347

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mauroalderete
Copy link

I have been working with the Dalai API to connect it with a simple client to run on node.js, following the example redacted in the readme

const Dalai = require('dalai')
new Dalai().request({
  model: "7B",
  prompt: "The following is a conversation between a boy and a girl:",
}, (token) => {
  process.stdout.write(token)
})

The connection is established successfully, and the request launches the model to process the prompt, but the callback isn't called. However, the client connected and ready to listen from the web page receives the tokens series.

This occurs because the Dalai's request method has a typo. Currently, the event name expected is the response instead of the result string value.

socket.on('response', cb)

This 'result' string value is used in the javascript script on the web page when the socket client registers a callback to listen to the tokens received via WebSocket.

socket.on('result',..

       socket.on('result', async({
            request,
            response
        })

I fix this issue by changing the event name used to register the callback of the API Dalai client, for that match with the event emitted from the server side and consumed by the view.

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.

1 participant