prop in the DeepChat
component does not support assistant parameters like the Direct Connection for OpenAI. Desired Behavior:
I would like to request support for passing assistant details in the request prop. Additional Information
If an update is not feasible, it would be greatly appreciated if you could provide guidance on how to achieve the requested functionality manually using custom headers and what it would look like on the nextjs example server. The text was updated successfully, but these errors were encountered:

@OvidijusParsiunas OvidijusParsiunas self-assigned this Nov 27, 2023 @OvidijusParsiunas OvidijusParsiunas added the advice Information how to use/implement the component label Nov 27, 2023 Owner ### OvidijusParsiunas commented Nov 27, 2023 Hi. When connecting Deep Chat to your own backend (like a NextJs function), the specific code for calling another service such as OpenAI Assistants API should be written in the backend and not in Deep Chat. We try to keep the backend examples as simple as possible so that developers can tailor them to their use-cases, hence we would prefer not to expand our examples for this reason. In regards to your specific problem, connecting to OpenAI Assistants API is a quite complex task as it requires the use of the Assistants, Threads, Messages and Runs APIs. If you want to do this manually in your own backend, you can use the code that I will paste below.

+1 2 7h360df47h3r and myfypersonal reacted with thumbs up emoji

+1 1 7h360df47h3r reacted with thumbs up emoji

+1 1 7h360df47h3r reacted with thumbs up emoji

heart 1 7h360df47h3r reacted with heart emoji

Owner ### OvidijusParsiunas commented Nov 28, 2023 • edited Edited 2 times

+1 2 7h360df47h3r and techpeace reacted with thumbs up emoji

Owner ### OvidijusParsiunas commented Nov 28, 2023 • edited Edited 6 times

heart 2 7h360df47h3r and techpeace reacted with heart emoji

@OvidijusParsiunas OvidijusParsiunas changed the title Support Passing Assistant Details in the Custom Requests OpenAI Assistant in a proxy server Dec 29, 2023 @OvidijusParsiunas OvidijusParsiunas mentioned this issue Dec 29, 2023 OpenAI Assistant through a proxy #82 Closed ### AhmeedBen commented Jan 13, 2024 thanks, this works fine with text messages, what about files upload ?

Owner ### OvidijusParsiunas commented Jan 13, 2024 • edited Edited 3 times

### AhmeedBen commented Jan 13, 2024 I tried the code but still get the error:
API Error: [SyntaxError: Unexpected token ‘o’, “[object File]” is not valid JSON]
text messages works fine

Owner ### OvidijusParsiunas commented Jan 13, 2024 It could be that your assistant is not configured to work with files, does uploading files work for you in OpenAI Playground?

### AhmeedBen commented Jan 14, 2024 yes the assistant works with files in the playground.

Owner ### OvidijusParsiunas commented Jan 14, 2024 I just tested the code I commented above and it works fine for me. It is hard say what is causing your issue, but if you have copied the code exactly as described then it is definitely something else. I would recommend to make sure that the API_KEY and the ASSISTANT_ID have been set correctly. Could you perhaps share the prompt you are using, what kind of files you are uploading and what kind of response you expect to get? Other than this, the amount of support I can provide is limited, however if you try to debug your app and find the line that is causing the error that would be helpful. Thanks.

### AhmeedBen commented Jan 14, 2024 the execution stops here: formData.forEach((data) => {
if (data instanceof File) {
files.push(data);
} else {
textRequestBody.messages.push(JSON.parse(data) as MessageContent);
}
}); the first condition is not fulfiled, despite of uploading file

Owner ### OvidijusParsiunas commented Jan 14, 2024 That is very strange, for some reason the data is not recognised as a file.
Is your index.tsx file different than the one in this comment. Ofcourse with the addition of mixedFiles.

### AhmeedBen commented Jan 14, 2024 I changed the condition to typeof data === ‘object’ , and it works fine,
I don’t know this will affect the other types of uploads.

Owner ### OvidijusParsiunas commented Jan 14, 2024 Happy to hear it works for you, I have also updated my example to reflect this. Thankyou!

### AhmeedBen commented Jan 15, 2024 Thank you very much,
Another thing, a new thread is created everytime we add a new file.
I tried to use
const textRequestBody = (await req.json()) as {messages: []; thread_id?: string};
but it doesn’t work.

Owner ### OvidijusParsiunas commented Jan 15, 2024 I have updated the chat.ts and index.tsx examples to help handle the same thread_id (session) form FormData.

### AhmeedBen commented Jan 16, 2024 Thank you very much, everything works fine now.

https://github.com/OvidijusParsiunas/deep-chat/issues/53