lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.4k stars 9.95k forks source link

使用图片加文字的方式提问或者纯图片就卡死,单纯文字,或者文件加文字都没问题[Bug] #3817

Closed H-TTTTT closed 2 months ago

H-TTTTT commented 2 months ago

📦 Environment

Docker

📌 Version

1.15.18 数据库版本

💻 Operating System

Other Linux

🌐 Browser

Edge

🐛 Bug Description

image image 报错细节

{
  "name": "TypeError",
  "stack": "TypeError: Failed to fetch\n    at http://192.168.31.11:3210/_next/static/chunks/85471-98fadabd001ef649.js:1:46388\n    at http://192.168.31.11:3210/_next/static/chunks/85471-98fadabd001ef649.js:1:47220\n    at new Promise (<anonymous>)\n    at body (http://192.168.31.11:3210/_next/static/chunks/85471-98fadabd001ef649.js:1:46237)\n    at tN (http://192.168.31.11:3210/_next/static/chunks/85471-98fadabd001ef649.js:1:47225)\n    at push.41159.constructor.getChatCompletion (http://192.168.31.11:3210/_next/static/chunks/85471-98fadabd001ef649.js:1:51995)\n    at async push.41159.constructor.createAssistantMessageStream (http://192.168.31.11:3210/_next/static/chunks/85471-98fadabd001ef649.js:1:51000)\n    at async internal_fetchAIChatMessage (http://192.168.31.11:3210/_next/static/chunks/56966-f2f4e95ac3870a09.js:1:27798)\n    at async internal_coreProcessMessage (http://192.168.31.11:3210/_next/static/chunks/56966-f2f4e95ac3870a09.js:1:26761)\n    at async Object.internal_resendMessage (http://192.168.31.11:3210/_next/static/chunks/56966-f2f4e95ac3870a09.js:1:29057)",
  "message": "Failed to fetch"
}

搭建方式,使用官网的方法,数据库搭建方式就出现这个问题 https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose 如果使用这个非数据库版本,就不会出现这个问题 https://lobehub.com/zh/docs/self-hosting/platform/docker-compose

📷 Recurrence Steps

文件加文字是不影响的 image 单纯图片就不行

🚦 Expected Behavior

No response

📝 Additional Information

No response

lobehubbot commented 2 months ago

👀 @H-TTTTT

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

dosubot[bot] commented 2 months ago

I found a similar closed issue that might be relevant to your problem: [Bug] 显示ConnectTimeoutError,应该如何解决. The suggested solution was to check if the issue was due to a slow first token [1].

To resolve the "Headers Timeout Error" (UND_ERR_HEADERS_TIMEOUT) encountered when using the database version of LobeChat with Docker, you should ensure that all services are correctly configured and running. Specifically, check the following:

  1. Service Dependencies: Ensure that all dependent services (PostgreSQL, MinIO, Logto) are up and running before starting the LobeChat service. The depends_on configuration in your docker-compose.yml should handle this, but you can verify by checking the logs of each service.

  2. Network Configuration: Ensure that the network configuration allows proper communication between services. The network_mode: 'service:network-service' should be correctly set for all services.

  3. Environment Variables: Verify that all required environment variables are correctly set in your .env file. This includes database URLs, S3 configurations, and authentication service URLs.

  4. CORS Configuration: Ensure that CORS settings are correctly configured for MinIO and any other services that require it.

Here is a snippet of the docker-compose.yml and .env files for reference:

docker-compose.yml:

minio:
  image: minio/minio
  container_name: lobe-minio
  network_mode: 'service:network-service'
  volumes:
    - './s3_data:/etc/minio/data'
  environment:
    - 'MINIO_ROOT_USER=${MINIO_ROOT_USER}'
    - 'MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}'
    - 'MINIO_API_CORS_ALLOW_ORIGIN=http://localhost:${LOBE_PORT}'
  restart: always
  command: >
    server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"

logto:
  image: svhd/logto
  container_name: lobe-logto
  network_mode: 'service:network-service'
  depends_on:
    postgresql:
      condition: service_healthy
  environment:
    - 'TRUST_PROXY_HEADER=1'
    - 'PORT=${LOGTO_PORT}'
    - 'DB_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/logto'
    - 'ENDPOINT=http://localhost:${LOGTO_PORT}'
    - 'ADMIN_ENDPOINT=http://localhost:3002'
  entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']

lobe:
  image: lobehub/lobe-chat-database
  container_name: lobe-database
  network_mode: 'service:network-service'
  depends_on:
    postgresql:
      condition: service_healthy
    network-service:
      condition: service_started
    minio:
      condition: service_started
    logto:
      condition: service_started
  environment:
    - 'APP_URL=http://localhost:3210'
    - 'NEXT_AUTH_SSO_PROVIDERS=logto'
    - 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
    - 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
    - 'NEXTAUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
    - 'LOGTO_ISSUER=http://localhost:${LOGTO_PORT}/oidc'
    - 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
    - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
    - 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
    - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
    - 'S3_ENABLE_PATH_STYLE=1'
  env_file:
    - .env
  restart: always

.env:

APP_URL=http://localhost:3210
POSTGRES_PASSWORD=your_postgres_password
LOBE_DB_NAME=your_db_name
MINIO_ROOT_USER=your_minio_user
MINIO_ROOT_PASSWORD=your_minio_password
MINIO_PORT=9000
LOBE_PORT=3210
LOGTO_PORT=3001
MINIO_LOBE_BUCKET=lobe

After verifying and correcting these configurations, restart your Docker services:

docker compose down
docker compose up -d

If the issue persists, check the Docker logs for more detailed error messages:

docker logs -f lobe-database

Additionally, ensure that you have created a Postgres database instance with the PGVector plugin, as it is an important component for LobeChat to implement RAG. Here is an example command to create a PG instance:

docker network create pg

docker run --name my-postgres --network pg -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d pgvector/pgvector:pg16

Make sure to configure persistent storage for production environments. Create a file named lobe-chat.env to store environment variables and start the lobe-chat-database Docker image:

docker run -it -d -p 3210:3210 --network pg --env-file lobe-chat.env --name lobe-chat-database lobehub/lobe-chat-database

Check the logs to ensure the container has started successfully:

docker logs -f lobe-chat-database

If you see the following logs, it indicates a successful start:

[Database] Start to migration...
✅ database migration pass.
-------------------------------------
  ▲ Next.js 14.x.x
  - Local:        http://localhost:3210
  - Network:      http://0.0.0.0:3210

 ✓ Starting...
 ✓ Ready in 95ms

This should help you identify and resolve the "Headers Timeout Error" [2][3][4].

To continue talking to Dosu, mention @dosu.

BiFangKNT commented 2 months ago

我感觉我的议题和你的是同一个bug #3814

lobehubbot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I feel like my issue is the same bug as yours #3814

H-TTTTT commented 2 months ago

我感觉我的议题和你的是同一个bug #3814

我看了下,应该是一样的

lobehubbot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I feel like my issue is the same bug as yours #3814

I took a look, it should be the same

lobehubbot commented 2 months ago

✅ @H-TTTTT

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。

lobehubbot commented 2 months ago

:tada: This issue has been resolved in version 1.15.25 :tada:

The release is available on:

Your semantic-release bot :package::rocket: