kolbytn / mindcraft

MIT License
2.22k stars 267 forks source link

Missing this. on gpt.js #306

Open pansutodeus opened 2 weeks ago

pansutodeus commented 2 weeks ago

In the following line this. is missing. https://github.com/kolbytn/mindcraft/blob/a6edd8fc44813e01c4decfda3d6b6ee018671620/src/models/gpt.js#L47

making the code to throw the following message:

SES_UNHANDLED_REJECTION: [ReferenceError: sendRequest is not defined
  at GPT.sendRequest (file:///media/pansutodeus/Data/repos/mindcraft/src/models/gpt.js:47:17)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async Prompter.promptConvo (file:///media/pansutodeus/Data/repos/mindcraft/src/agent/prompter.js:198:16)
  at async Agent.handleMessage (file:///media/pansutodeus/Data/repos/mindcraft/src/agent/agent.js:186:23)]

this only happens if the following condition is met and throws the exception https://github.com/kolbytn/mindcraft/blob/a6edd8fc44813e01c4decfda3d6b6ee018671620/src/models/gpt.js#L39-L40

fix:

return await this.sendRequest(turns.slice(1), systemMessage, stop_seq); 
keneo commented 2 weeks ago

you're right