alfredapp / openai-workflow

OpenAI integrations
BSD 3-Clause "New" or "Revised" License
67 stars 33 forks source link

fix: text bug in commit #11 #12

Closed HuaDeity closed 8 months ago

HuaDeity commented 8 months ago

Fix #11.

vitorgalvao commented 8 months ago

This is considerably more complex than it needs to be. A simpler approach is to add ?. before the delta, so it becomes:

const responseText = chunks.map(item => item["choices"][0]?.["delta"]["content"]).join("")

Please try that in your local set up and report back. If it works, no need to change anything in this PR, as I already have the change locally.

HuaDeity commented 8 months ago

This is considerably more complex than it needs to be. A simpler approach is to add ?. before the delta, so it becomes:

const responseText = chunks.map(item => item["choices"][0]?.["delta"]["content"]).join("")

Please try that in your local set up and report back. If it works, no need to change anything in this PR, as I already have the change locally.

Yes, the simple approach successfully fix the issue, thank you.

vitorgalvao commented 8 months ago

Thank you for checking and for identifying the issues and submitting the pull requests. The changes will be in the next release.

vitorgalvao commented 8 months ago

@HuaDeity Until the next release is officially out, you can use this one which already has the changes.

HuaDeity commented 8 months ago

@vitorgalvao

Thank you for kindly fixing this issue.