lobe-chat icon indicating copy to clipboard operation
lobe-chat copied to clipboard

[Bug] Document/Conversation Mode Switch Not Functional in Just Chat Agent (Database Version)

Open first-storm opened this issue 1 month ago • 2 comments

📦 Environment

Docker

📌 Version

v1.40.3

💻 Operating System

Other Linux

🌐 Browser

Chrome, Firefox

🐛 Bug Description

Summary: The mode switch between "Document Mode" and "Conversation Mode" within the "Just Chat" assistant is not functioning correctly in the database version of LobeChat. The UI does not reflect changes when toggling between these modes, and the behavior of the agent remains consistent regardless of the selected mode. This issue does not occur in the client-side database mode.

Environment:

  • LobeChat Version: (Please fill this in if available, e.g., latest, a specific release tag)
  • Deployment: Database version, deployed using Docker Compose.
  • Database: PostgreSQL (pgvector/pgvector:pg16).
  • .env Configurations: As provided in the original report (see details below).
  • docker-compose.yml: As provided in the original report (see details below).

Additional Notes:

  • This issue is not reproducible in the client-side database mode.
  • There are no errors observed in the LobeChat container logs or PostgreSQL logs concerning this issue.
  • No log records related to the mode switching action are generated in the container logs when the switch is used.
  • The .env file is correctly configured as all basic functions are usable.

Relevant Configurations:

Here's the provided .env configuration:

# 必填,LobeChat 域名,用于 tRPC 调用
# 请保证此域名在你的 NextAuth 鉴权服务提供商、S3 服务商的 CORS 白名单中
APP_URL=https://lobe.example.com/

# Postgres 相关,也即 DB 必需的环境变量
# 必填,用于加密敏感信息的密钥,可以使用 openssl rand -base64 32 生成
KEY_VAULTS_SECRET='YOUR_KEY_VAULTS_SECRET' # 需要替换为你生成的 KEY_VAULTS_SECRET 密钥
# 必填,Postgres 数据库连接字符串,用于连接到数据库
# 格式:postgresql://username:password@host:port/dbname,如果你的 pg 实例为 Docker 容器且位于同一 docker-compose 文件中,亦可使用容器名作为 host
DATABASE_URL=postgresql://postgres:YOUR_POSTGRES_PASSWORD@postgresql:5432/lobe  # 需要替换为你实际的 PostgreSQL 数据库密码

# NEXT_AUTH 相关,也即鉴权服务必需的环境变量
# 可以使用 auth0、Azure AD、GitHub、Authentik、Zitadel、Logto 等,如有其他接入诉求欢迎提 PR
# 目前支持的鉴权服务提供商请参考:https://lobehub.com/zh/docs/self-hosting/advanced/auth#next-auth
# 如果你有 ACCESS_CODE,请务必清空,我们以 NEXT_AUTH 作为唯一鉴权来源
# 必填,用于 NextAuth 的密钥,可以使用 openssl rand -base64 32 生成
NEXT_AUTH_SECRET='YOUR_NEXT_AUTH_SECRET' # 需要替换为你生成的 NEXT_AUTH_SECRET 密钥
# 必填,指定鉴权服务提供商,这里以 GitHub 为例
NEXT_AUTH_SSO_PROVIDERS=github
# 必填,NextAuth 的 URL,用于 NextAuth 的回调
NEXTAUTH_URL=https://lobe.example.com

# NextAuth 鉴权服务提供商部分,以 GitHub 为例
# 其他鉴权服务提供商所需的环境变量,请参考:https://lobehub.com/zh/docs/self-hosting/environment-variables/auth
AUTH_GITHUB_ID=YOUR_GITHUB_CLIENT_ID # 需要替换为你 GitHub OAuth 应用的 Client ID
AUTH_GITHUB_SECRET=YOUR_GITHUB_CLIENT_SECRET # 需要替换为你 GitHub OAuth 应用的 Client Secret

# 代理相关,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890

# 必填,S3 的 Access Key ID
S3_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY_ID

# 必填,S3 的 Secret Access Key
S3_SECRET_ACCESS_KEY=YOUR_S3_SECRET_ACCESS_KEY

# 必填,S3 的 Endpoint,用于服务端/客户端连接到 S3 API
S3_ENDPOINT=YOUR_S3_ENDPOINT

# 必填,S3 的 Bucket
S3_BUCKET=lobe-chat

# 必填,S3 的 Public Domain,用于客户端通过公开连接访问非结构化数据
S3_PUBLIC_DOMAIN=https://r2-lobe.example.com
# 请替换为实际的 Public Domain,如果没有可以留空

# 选填,S3 的 Enable Path Style。对于 Cloudflare R2, 设置为 0
S3_ENABLE_PATH_STYLE=0

Here's the provided docker-compose.yml:

name: lobe-chat-database
services:
  postgresql:
    image: pgvector/pgvector:pg16
    container_name: lobe-postgres
    ports:
      - '5432:5432'
    volumes:
      - './data:/var/lib/postgresql/data'
    environment:
      - 'POSTGRES_DB=lobe'
      - 'POSTGRES_PASSWORD=YOUR_POSTGRES_PASSWORD' # 需要替换为你的 PostgreSQL 数据库密码
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 5s
      timeout: 5s
      retries: 5
    restart: always

  lobe:
    image: lobehub/lobe-chat-database
    container_name: lobe-database
    ports:
      - '3210:3210'
    depends_on:
      - postgresql
    env_file:
      - .env
    restart: always

volumes:
  data:
    driver: local

Video

https://github.com/user-attachments/assets/ae900c86-0966-4768-87a1-5040204ed335

📷 Recurrence Steps

  1. Start a fresh instance of LobeChat using the database version (docker-compose setup).
  2. Access the "Just Chat" assistant.
  3. Attempt to switch between "Document Mode" and "Conversation Mode" using the mode toggle switch within the chat interface.
  4. Observe: the UI does not visibly update to reflect the chosen mode, and interaction with the agent remains consistent regardless of which mode was selected.
  5. (Optional) Confirm that the same UI element renders correctly in Client-Side DB mode of LobeChat.

🚦 Expected Behavior

When switching between "Document Mode" and "Conversation Mode," the chat UI should visibly indicate the selected mode, and the agent should behave differently depending on the selected mode.

📝 Additional Information

No response

first-storm avatar Dec 26 '24 14:12 first-storm