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

[JS] Please throw error on function calling #810

Open
zerolethanh opened this issue Aug 22, 2024 · 0 comments
Open

[JS] Please throw error on function calling #810

zerolethanh opened this issue Aug 22, 2024 · 0 comments
Labels
bug Something isn't working js

Comments

@zerolethanh
Copy link

Describe the bug
Screenshot 2024-08-22 at 13 59 01

To Reproduce

        try {
            let r;
            if (streamingCallback) {
                const {response, stream} = await generateStream(
                    generateOptions
                )
                for await (const chunk of stream()) {
                    const fContent = chunk.content
                    const buildChunk = {
                        name: undefined,
                        done: false,
                        result: {
                            response: fContent.at(-1)
                        }
                    }
                    console.log("-🤖- ", JSON.stringify(buildChunk), "\n")
                    streamingCallback(buildChunk)
                }
                r = await response()
            } else {
                r = await generate(generateOptions)
            }

            return r.toJSON()

        } catch (e) {
            return {
                error: (e as Error).message
            }
        }

Expected behavior

  • try catch can be catch error normally

Runtime:

  • OS: MacOS
  • Version: 15.0 Beta (24A5327a)

** Node version **
v20.13.1


@zerolethanh zerolethanh added bug Something isn't working js labels Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js
Projects
Status: No status
Development

No branches or pull requests

1 participant