openchatai / copilot

🤖 🔥 Language-to-actions engine
https://open.cx
MIT License
5.08k stars 400 forks source link

"Failed to create copilot" after tutorial walk through - 502 Bad Gateway #735

Open mr-sk opened 7 months ago

mr-sk commented 7 months ago

Describe the bug Hello, I walked through the tutorial and setup the docker containers w/out any issues. I have the nginx server running and I am able to resolve http://localhost:8888/create/copilot. However, when asked for my copilot name and I hit "lets do this" it errors out with "Failed to create copilot".

To Reproduce Steps to reproduce the behavior:

  1. Follow local installation instructions
  2. Goto localhost:8888/create/copilot and attempt to create a copilot
  3. Get error "Failed to create copilot"
  4. In browser inspect you can see a call to: XHRPOST http://localhost:8888/backend/copilot/ [HTTP/1.1 502 Bad Gateway 7ms]
  5. The error thrown is likely from dashboard/app/(authenticated)/(main)/create/copilot/SetCopilotNameStep.tsx L33

Expected behavior It creates a copilot and progresses through the wizard.

Screenshots Screenshot 2024-04-08 at 9 03 36 AM

Desktop (please complete the following information):

JuergenCornely commented 7 months ago

i have the same behavior after upgrade with git pull to the latest Version. Installed Copiots cant be found and in the log file i see error from llmserver : image

tpmccallum commented 7 months ago

I have that same behaviour:

nginx-1       | 172.25.0.1 - - [12/Apr/2024:03:45:29 +0000] "GET /backend/copilot/ HTTP/1.1" 500 90 "http://localhost:8888/create/copilot" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
tpmccallum commented 7 months ago

Tried restarting nginx:

docker compose restart nginx
WARN[0000] The "TARGET" variable is not set. Defaulting to a blank string. 
[+] Restarting 1/1
 ✔ Container opencopilot-nginx-1  Started

Still the same error (500)

tpmccallum commented 6 months ago

Updated to the latest code and tried again today, same issue:

nginx-1       | 2024/05/21 01:42:49 [error] 29#29: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.20.0.1, server: , request: "POST /backend/copilot/ HTTP/1.1", upstream: "http://172.20.0.5:8002/backend/copilot/", host: "localhost:8888", referrer: "http://localhost:8888/create/copilot"
nginx-1       | 172.20.0.1 - - [21/May/2024:01:42:49 +0000] "POST /backend/copilot/ HTTP/1.1" 502 559 "http://localhost:8888/create/copilot" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
tpmccallum commented 6 months ago

Here is how to replicate it.

git clone https://github.com/openchatai/OpenCopilot.git
cd OpenCopilot

Config:

vi llm-server/.env

Paste in the following (note the sk-your-api-key):

# For local development environment

# OpenAI Configuration
OPENAI_API_TYPE=openai
OPENAI_API_KEY='sk-your-api-key'

# Pinecone Configuration
PINECONE_API_KEY=  # Your Pinecone API Key
PINECONE_ENV=  # Your Pinecone Environment

# MongoDB Configuration
MONGODB_URL=mongodb://dbuser:dbpass@mongodb:27017  # Your MongoDB Connection URL

# QDRANT Configuration
QDRANT_URL=http://qdrant:6333  # QDRANT Server URL
SCORE_THRESHOLD=0.91  # Score Threshold
STORE=QDRANT  # Default Store

# Langchain Configuration
LANGCHAIN_TRACING_V2=false  # Enable Langchain Tracing V2
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"  # Langchain API Endpoint
LANGCHAIN_API_KEY="TOKEN_GOES_HERE"  # Your Langchain API Key
LANGCHAIN_PROJECT="PROJECT_NAME_GOES_HERE"  # Your Langchain Project Name

# CoPilot Configuration
COPILOT_MODE=interactive  # CoPilot Mode

# MySQL Configuration
MYSQL_URI=mysql+pymysql://dbuser:dbpass@mysql:3306/opencopilot  # MySQL Connection URI

# Celery Configuration
CELERY_BROKER=redis://redis:6379/0  # Celery Broker URL
CELERY_BACKEND=redis://redis:6379/1  # Celery Backend URL

# Local IP Configuration
LOCAL_IP=host.docker.internal  # Local IP for Docker

# Shared Folder Configuration
SHARED_FOLDER=/app/shared_data/  # Path to Shared Data Folder

# Selenium Configuration
SELENIUM_GRID_URL=http://selenium:4444/wd/hub  # URL of the Selenium Grid for web scraping

Make and run:

cd ../../OpenCopilot
make install
tpmccallum commented 6 months ago

cc: @codebanesr @ah7255703 @gharbat :arrow_up:

tpmccallum commented 6 months ago

Hi @mr-sk @JuergenCornely I managed to get this working but probably won't explain it very well ...here goes:

OPENAI_API_KEY='sk-proj-NJ...........................Vv'

At this point I also like to go in and update the number of pages that the data source is allowed to index by updating the value of 15 up to 150 in the llm-server/utils/llm_consts.py file i.e. (max_pages_to_crawl = int(os.getenv("MAX_PAGES_TO_CRAWL", "150")))

At this point it should work. I am not sure what part of that did the trick - but that is precisely what I did and it works!

codebanesr commented 6 months ago

@tpmccallum probably some environment variable was messing it up! Thanks for the answer

tpmccallum commented 6 months ago

Thanks @codebanesr I wonder if you can help me understand this related error:

$ docker compose up -d --build --no-deps worker
WARN[0000] The "TARGET" variable is not set. Defaulting to a blank string. 
no such service: worker

Is this what you mean by some environmental variable not being set?

JuergenCornely commented 6 months ago

Türe is a missing. Try workers inständig of Wirkerei Von meinem iPad gesendet

Am 31.05.2024 um 03:09 schrieb Timothy McCallum @.***>:



Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.

Thanks @codebanesrhttps://github.com/codebanesr I wonder if you can help me understand this related error:

$ docker compose up -d --build --no-deps worker WARN[0000] The "TARGET" variable is not set. Defaulting to a blank string. no such service: worker

Is this what you mean by some environmental variable not being set?

— Reply to this email directly, view it on GitHubhttps://github.com/openchatai/OpenCopilot/issues/735#issuecomment-2141069912, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4BVVZPRO4KVVRYADBMEK53ZE7EUPAVCNFSM6AAAAABF4VUGWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRGA3DSOJRGI. You are receiving this because you were mentioned.Message ID: @.***>

IMPORTANT NOTE: Since 30 September 2023, the Unify business has joined the Mitel Group and hence is no longer part of Atos Group. For a limited period, the Unify companies will continue to use the @atos.net domain. Atos Group is not liable for any content in this email. This e-mail (including any attachments) is for the sole use of the intended recipient(s) and may contain information that is confidential and/or protected by legal privilege. Any unauthorized review, use, copy, disclosure, or distribution of this e-mail is strictly prohibited. If you are not the intended recipient, please notify Mitel immediately and destroy all copies of this e-mail. Mitel does not accept any liability for breach of security, error or virus that may result from the transmission of this message.