dust-tt / dust

Amplify your team's potential with customizable and secure AI assistants.
https://dust.tt
MIT License
957 stars 109 forks source link

Got TypeError when try to run a simple [chat] block #5591

Closed WaysonWei closed 4 months ago

WaysonWei commented 5 months ago

Hi, I am running Dust locally, when trying to run a simple app, got this error:

Error inmessages_code: TypeError: Error parsing args at position 0: serde_v8 error: invalid type; expected: object, got: string at code_block.js:9:19 at code_block.js:10:6

Here is the screenshot: Screenshot 2024-06-12 at 8 19 23 AM

Not sure it is a bug or I did something wrong.

spolu commented 5 months ago

Hi hi! We don't officially support local deployment of Dust. But no problem with you attempting it of course.

This looks like an error coming from the core service. Anything more useful in the logs?

WaysonWei commented 5 months ago

Hi, @spolu. Thank you for getting back to me.

Yes, I think something to do with the javascript we passed into deno core, I didn't change any line of that, but I did print json_args and js_code from core/src/deno/script.rs as follow:

{"timestamp":"2024-06-12T19:12:26.233102+00:00","level":"INFO","message":"Starting run run_id=517588c3573197f46ed192eb0dba9ff0fa4322d54f6e6e3b73d1a44b08b62829 project_id=6","target":"dust::app"} JSON_ARGS_VALUE: {"config":{"blocks":{"MODEL":{"type":"chat","provider_id":"openai","model_id":"gpt-3.5-turbo","function_call":null,"use_cache":false}}},"state":{},"input":{"value":null,"index":0},"map":null,"secrets":{}} JS_CODE_PRINT: (async () => { let __rust_result = _fun.constructor.name === 'AsyncFunction' ? await _fun({"config":{"blocks":{"MODEL":{"type":"chat","provider_id":"openai","model_id":"gpt-3.5-turbo","function_call":null,"use_cache":false}}},"state":{},"input":{"value":null,"index":0},"map":null,"secrets":{}}) : _fun({"config":{"blocks":{"MODEL":{"type":"chat","provider_id":"openai","model_id":"gpt-3.5-turbo","function_call":null,"use_cache":false}}},"state":{},"input":{"value":null,"index":0},"map":null,"secrets":{}});

                            if (typeof __rust_result === 'undefined')
                                    __rust_result = null;

                            Deno.core.ops.op_return({value: __rust_result, logs: __rust_logs});
                    })()

{"timestamp":"2024-06-12T19:12:26.298021+00:00","level":"INFO","message":"Execution block successes=0 duration=64 errors=1 block_type=chat block_name=MODEL","target":"dust::app"} {"timestamp":"2024-06-12T19:12:26.302834+00:00","level":"ERROR","message":"Run error error=Error in messages_code: TypeError: Error parsing args at position 0: serde_v8 error: invalid type; expected: object, got: string\n at code_block.js:9:19\n at code_block.js:10:6","target":"dust::app"} {"timestamp":"2024-06-12T19:12:26.302913+00:00","level":"INFO","message":"Run stored app_version=36c22f197dab942684d1ce7acd82f866d51066f25f5cf8e4ae394fc6fab3322d run=517588c3573197f46ed192eb0dba9ff0fa4322d54f6e6e3b73d1a44b08b62829","target":"dust::app"} {"timestamp":"2024-06-12T19:12:26.302991+00:00","level":"ERROR","message":"Run error error=Run 517588c3573197f46ed192eb0dba9ff0fa4322d54f6e6e3b73d1a44b08b62829 for app version 36c22f197dab942684d1ce7acd82f866d51066f25f5cf8e4ae394fc6fab3322d interrupted due to failed execution of block chat MODEL with 1 error(s)","target":"dust_api"}

But these seem to be fine, json_args shouldn't be a problem here, not sure where goes wrong. I ran core with this command in my terminal: cargo run --release --bin dust-api

spolu commented 4 months ago

mmmh the command looks fine and the error is surprising indeed. What version of Rust are you using?

WaysonWei commented 4 months ago

I am running this version in mac m1: rustc 1.78.0 (9b00956e5 2024-04-29)

spolu commented 4 months ago

We're building with 1.76 even if I don't expect this to be the issue. Just out of curiosity.

WaysonWei commented 4 months ago

Seem to be a problem of rust version, but not 100% sure, use rust 1.76 to build the docker image then working fine. Thanks.