OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.27k stars 176 forks source link

How to use assistant api with deep chat #66

Closed humuhimi closed 6 months ago

humuhimi commented 6 months ago

Hi @OvidijusParsiunas

Description: I want to chat via assistant api but it doesn't work. Is this feature still under development?

My code:

  const DeepChat = dynamic(
    () => import('deep-chat-react').then((mod) => mod.DeepChat),
    {
      ssr: false,
    },
  );
        <DeepChat
          directConnection={{
            openAI: {
              assistant: {
                assistant_id: process.env.ASSISTANT_ID as string,
                // function_handler:
              },
            },
          }}
          request={{
            headers: { 'OpenAI-Beta': 'assistants=v1' },
            // url: '/api/openai/chat-stream',
            // additionalBodyProps: { model: 'gpt-3.5-turbo' },
          }}
          introMessage={{
            text: t('Site.botMessage'),
          }}
          stream={true}
          requestBodyLimits={requestBodyLimits}
          errorMessages={{ displayServiceErrorMessages: true }}
          style={style}
          messageStyles={messageStyles}
          textInput={textInput}
          submitButtonStyles={submitButtonStyles}
          avatars={avatars}
        />

Result display:

Environment: Browser: Chrome version 119.0.6045.200 nextjs version: 14.0.2 Node.js version: v19.1.0

please check it when you have time! thank!

OvidijusParsiunas commented 6 months ago

Hi @humuhimi! Thankyou for informing me about this issue.

This is a bug and I will try to fix it.

I will report on the progress in this thread.

OvidijusParsiunas commented 6 months ago

This issue has now been fixed in the deep-chat-dev and deep-chat-react-dev packages version 9.0.95. These packages work exactly the same except their names are different.

The changes will be moved to the main package later this week or early next week.

OvidijusParsiunas commented 6 months ago

This bug fix has now been released in deep-chat and deep-chat-react package version 1.4.6.