mckaywrigley / chatbot-ui

AI chat for every model.
https://chatbotui.com
MIT License
27.57k stars 7.65k forks source link

Failed to Build :Type Error/[locale]/[workspaceid]/layout.tsx #1484

Open seabite opened 4 months ago

seabite commented 4 months ago
./app/[locale]/[workspaceid]/layout.tsx:97:19
Type error: Argument of type '{}[]' is not assignable to parameter of type 'SetStateAction<never[]>'.
  Type '{}[]' is not assignable to type 'never[]'.
    Type '{}' is not assignable to type 'never'.

   95 |
   96 |     const assistantData = await getAssistantWorkspacesByWorkspaceId(workspaceId)
>  97 |     setAssistants(assistantData.assistants)
      |                   ^
   98 |
   99 |     for (const assistant of assistantData.assistants) {
  100 |       let url = ""

This problem occurs when doing npm run build or Deploy to Vercel.

GraysonQuartech commented 4 months ago

@seabite did u figure this out?

when i build i get

'Type error: Object literal may only specify known properties, and 'assistant_id' does not exist in type '{ chat_id: string; content: string; created_at: string; id: string; image_paths: string[]; model: string; role: string; sequence_number: number; updated_at: string | null; user_id: string; }'.'

jponline77 commented 4 months ago

I get the same issue

Edit: The root of the issue is that the supabase type libraries are not up to date. This is because when you run the npm run update it will regenerate the supabase libraries from the database but the database was created on an olderversion that doesn't have the proper tables. I needed to rebuild the database and then regenerate the libraries in order for this to work.

faraday commented 4 months ago

You can mitigate this for your existing Supabase messages table by executing:

ALTER TABLE messages ADD assistant_id uuid

through your Supabase client dashboard: http://localhost:54323/project/default/sql/1

Note that the problem happens at write time (handleCreateMessages) so you can't actually get data for your past conversations with this problem experienced already. For these cases, you don't have data at Supabase, so you can't read these past conversations again.

However, you just fixed the conversations to happen from now on.