chatbot-ui icon indicating copy to clipboard operation
chatbot-ui copied to clipboard

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

Open seabite opened this issue 1 year ago • 3 comments

./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.

seabite avatar Feb 25 '24 14:02 seabite

@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; }'.'

GraysonQuartech avatar Mar 01 '24 22:03 GraysonQuartech

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.

jponline77 avatar Mar 09 '24 17:03 jponline77

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.

faraday avatar Mar 23 '24 12:03 faraday