Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
first-storm opened this issue Dec 26, 2024 · 2 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@first-storm
Copy link

📦 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

Screencast.From.2024-12-26.22-32-24.mp4

📷 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 first-storm added the 🐛 Bug Something isn't working | 缺陷 label Dec 26, 2024
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Dec 26, 2024
@lobehubbot
Copy link
Member

👀 @first-storm

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Copy link

dosubot bot commented Dec 26, 2024

Hello, @first-storm!

I'm here to help you with any bugs, questions, or contributions you might have. Let's work together to resolve the issue you're facing.

The issue you're experiencing with the mode switch between "Document Mode" and "Conversation Mode" not functioning in the database version of LobeChat could be related to recent changes or specific dependencies in the system. Here are a few points to consider:

  1. Recent Changes: There have been recent changes in the LobeChat codebase related to mode switching functionality. Specifically, there was a refactoring to align client mode upload with server mode, and a fix for the fallback behavior of the default mode in AgentRuntime [1].

  2. Dependencies: The mode switch functionality in the database version relies on several dependencies, including a Postgres database with the pgvector plugin, an authentication service (such as Clerk or NextAuth), and an S3-compatible storage service for file storage [2][3][4][5].

  3. UI Update Mechanism: The UI update mechanism for mode switching involves functions like switchThemeMode and switchLocale, which update the general configuration settings. If the settings are not different from the previous ones, the UI will not update, as the function exits early [6].

Given these points, you might want to check if the recent changes have been correctly integrated into your setup and ensure that all dependencies are properly configured. Additionally, verify that the UI update mechanism is functioning as expected and that there are no discrepancies in the settings that could prevent the UI from reflecting changes.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

2 participants