Mintplex-Labs / anything-llm

The all-in-one Desktop & Docker AI application with full RAG and AI Agent capabilities.
https://useanything.com
MIT License
16.8k stars 1.8k forks source link

[FEAT]: Add network proxy settings to route all network requests through the proxy. #1228

Open ilxqx opened 2 months ago

ilxqx commented 2 months ago

What would you like to see?

As is well known, there are some restrictions on the internet in certain countries, which lead to the inability to directly access some well-known websites such as Github, Google and so on. Accessing these sites requires the use of a proxy. I wonder if this app can add network proxy configuration options to meet this need?

timothycarambat commented 2 months ago

Proxy for which features in particular?

ilxqx commented 2 months ago

Thank you for your reply.

image image

And access to the LLM providers server... In short, whenever there is a need to send network requests in the application, there should be an opportunity to proxy them.

lineg-it commented 1 month ago

+1

I also have the following errors in log when trying to start AnythingLLM behind a proxy:

npm ERR! code ECONNRESET
npm ERR! network Client network socket disconnected before secure TLS connection was established
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! A complete log of this run can be found in: /app/.npm/_logs/2024-05-10T11_50_06_115Z-debug-0.log

Working without a proxy, I'm trying to get it to work by using the same, following docker config:

networks:
  llm-network:
    external: true

services:
  anything-llm:
    container_name: anything-llm
    image: mintplexlabs/anythingllm:latest
    restart: unless-stopped
    #user: "${UID:-1000}:${GID:-1000}"
    cap_add:
      - SYS_ADMIN
    environment:
      - SERVER_PORT
      - STORAGE_DIR
      - GENERATE_SOURCEMAP
      - VITE_API_BASE
      - LLM_PROVIDER
      - OLLAMA_BASE_PATH
      - OLLAMA_MODEL_PREF
      - OLLAMA_MODEL_TOKEN_LIMIT
      - VECTOR_DB
      - CHROMA_ENDPOINT
      - DISABLE_TELEMETRY
      - PASSWORDMINCHAR
      - PASSWORDMAXCHAR
      - PASSWORDLOWERCASE
      - PASSWORDUPPERCASE
      - PASSWORDNUMERIC
      - PASSWORDSYMBOL
      - PASSWORDREQUIREMENTS
      #- NODE_TLS_REJECT_UNAUTHORIZED
      - HTTPS_PROXY
      - HTTP_PROXY
      - https_proxy
      - http_proxy
    volumes:
      - /srv/docker/anything-llm/storage:/app/server/storage
      - /srv/docker/anything-llm/.env:/app/server/.env
      - /srv/certs/LINEG-Fullchain.pem:/etc/ssl/certs/LINEG-Fullchain.pem
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
      - "com.centurylinklabs.watchtower.monitor-only=true"
    networks:
      - llm-network
    #ports:
    #  - 127.0.0.1:1337:${SERVER_PORT-3000}
    extra_hosts:
      - host.docker.internal:host-gateway
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:3000/api/ping" ]
      interval: 10s
      timeout: 10s
      retries: 10
      start_period: 5s
  chromadb:
    image: chromadb/chroma:latest
    container_name: chromadb
    volumes:
      - /srv/docker/chromadb:/chroma/chroma
    environment:
      - IS_PERSISTENT=TRUE
      - ANONYMIZED_TELEMETRY=False
    restart: unless-stopped
    ports:
      - 8000:${CHROMA_PORT}
    networks:
      - llm-network
    extra_hosts:
      - host.docker.internal:host-gateway
    # healthcheck not working for chromadb...
    #healthcheck:
    #  # Adjust below to match your container port
    #  test: [ "CMD", "curl", "-f", "http://localhost:8000/api/v1/heartbeat" ]
    #  interval: 30s
    #  timeout: 10s
    #  retries: 3

I would love to have a setting within AnythingLLM to make npm use the proxy for its traffic towards the internet .. Otherwise, what can we do to properly setup a proxy for AnythingLLM to use successfully?

chapterv commented 1 month ago

+1 and a check whether the agent is working using search or scrape webpage. mine doesn't work, thinking maybe network problem

timothycarambat commented 1 month ago

@chapterv That is unrelated to this issue. Also the agent says what tool it is calling so it is not a mystery. it will explicitly say if it is using web-scraping or web-browsing

jorgeorchilles commented 3 weeks ago

+1 can't test AnythingLLM in an environment that has outbound network proxy I need to configure in the app.