mckaywrigley / chatbot-ui

Come join the best place on the internet to learn AI skills. Use code "chatbotui" for an extra 20% off.
https://JoinTakeoff.com
MIT License
28.86k stars 8.04k forks source link

unexpected EOF - At statement 0: -- Enable HTTP extension #1868

Open ali-adm opened 1 month ago

ali-adm commented 1 month ago

Hi there! I would be grateful if someone could tell me how to solve the following problem: When doing a clean install on a host with Ubuntu 22.04.4 LTS, an error occurs:

Seeding globals from roles.sql.... Applying migration 20240108234540_setup.sql... Stopping containers... unexpected EOF At statement 0: -- Enable HTTP extension create extension http with schema extensions Try rerunning the command with --debug to troubleshoot the error.

When running in debug mode - the terminal hangs, but the containers start. The supabase administration works, but I haven't checked it much, but the chatbot-ui itself on port 3000 crashes immediately after pressing the registration button. Although the user in the database seems to appear. And does not work. I looked at the tables in the database - there are only a third of what is specified in the migration files. In general, it is clear that migration is slowed down almost at the very beginning. Help, kind people! By the way, on the whole Internet - only habr has an open case on this problem. There are no answers.

PS. Some later. So far, it's all coming down to: postgres=> CREATE EXTENSION vector; server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed.

When running Setting up initial schema and migration 20240108234540_setup.sql. - error occurs create extension http: 1 -- Enable HTTP extension 2 create extension http with schema extensions;

If handled created - CREATE EXTENSION http; - see above. 3 4 -- Enable vector extension 5 create extension vector with schema extensions;

M0ns1gn0r commented 3 weeks ago

Looks like I found the reason. The problem is caused by postgres failing to create the vector extension. This seems to be happening on CPUs without the AVX instruction set.

So you have to either change the CPU type or do the following (understanding that you lose some functionality):

  1. in _20240108234540setup.sql comment out create extension vector with schema extensions;
  2. in _in 20240108234540setup.sql comment out

     /*
     local_embedding vector(384), -- 384 works for local w/ Xenova/all-MiniLM-L6-v2
     openai_embedding vector(1536), -- 1536 for OpenAI
    */
    
    ...
    
    /*
    CREATE INDEX file_items_embedding_idx ON file_items
      USING hnsw (openai_embedding vector_cosine_ops);
    
    CREATE INDEX file_items_local_embedding_idx ON file_items
      USING hnsw (local_embedding vector_cosine_ops);
    */
    
    ...
    
    -- FUNCTIONS --
    /*
    ...the entire functions code...
    */
  3. in app\api\retrieval\retrieve\route.ts comment out the code that calls await supabaseAdmin.rpc("match_file_items_openai" and await supabaseAdmin.rpc("match_file_items_local"