Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

LaTeX not rendered correctly in some cases (with Chinese) #3577

Closed
2 of 4 tasks
AnotiaWang opened this issue Jul 1, 2024 · 0 comments
Closed
2 of 4 tasks

LaTeX not rendered correctly in some cases (with Chinese) #3577

AnotiaWang opened this issue Jul 1, 2024 · 0 comments

Comments

@AnotiaWang
Copy link

AnotiaWang commented Jul 1, 2024

Bug Report

Description

Bug Summary:
The UI cannot render LaTeX correctly when using LLM with Chinese. An expression can be shown only when it is enclosed with [], like:

[ \mathbf{\hat{a}} = \frac{\mathbf{a}}{|\mathbf{a}|} ]

It won't work when [ and ] are on separate lines, also when expressions are enclosed with $.

Steps to Reproduce:
Ask a model to answer or explain a math problem in Chinese. You can also use the following output (edit a model's response and replace it):

Click to expand
平面、曲面和空间曲线是三维空间几何中的核心概念,它们的方程和性质是理解更复杂几何结构的基础。下面将逐一介绍这些概念及其相关知识点。

### 平面方程

平面的一般方程为:

[
Ax   By   Cz   D = 0
]

其中,$A$, $B$, $C$ 是平面的法向量的分量,$D$ 是常数项。

### 平面的夹角

两个平面的夹角由它们的法向量的夹角给出,设两个平面的法向量分别为 $\mathbf{n_1} = (A_1, B_1, C_1)$ 和 $\mathbf{n_2} = (A_2, B_2, C_2)$,则夹角 $\theta$ 由点积公式给出:

[ \cos \theta = \frac{\mathbf{n_1} \cdot \mathbf{n_2}}{\|\mathbf{n_1}\| \|\mathbf{n_2}\|} = \frac{A_1A_2   B_1B_2   C_1C_2}{\sqrt{A_1^2   B_1^2   C_1^2} \sqrt{A_2^2   B_2^2   C_2^2}} ]

### 曲面方程

曲面方程通常表示为 $F(x, y, z) = 0$ 的形式,其中 $F$ 是 $x$, $y$, $z$ 的函数。

### 二次曲面

二次曲面是 $F(x, y, z) = ax^2   by^2   cz^2   dxy   exz   fyz   gx   hy   iz   j = 0$ 的形式,其中 $a$, $b$, $c$, $d$, $e$, $f$, $g$, $h$, $i$, $j$ 是常数。

常见的二次曲面包括椭球面、双曲面、抛物面等。

### 空间曲线

空间曲线可以由参数方程表示,如 $x = x(t)$, $y = y(t)$, $z = z(t)$,其中 $t$ 是参数。

### 解题思路:确定空间图形

1. **识别方程类型**:首先判断方程是平面方程、二次曲面方程还是空间曲线的参数方程。
2. **分析系数**:对于二次曲面方程,分析系数可以确定曲面的类型(如椭球面、双曲面等)。
3. **利用几何性质**:利用平面的法向量、曲面的对称性、曲线的参数范围等几何性质来进一步分析图形的特征。
4. **图形可视化**:使用数学软件或图形计算器可视化方程,帮助理解图形的形状和位置。

通过上述步骤,可以系统地分析和确定给定方程组描述的空间图形的性质和形状。

Expected Behavior:
The LaTeX in the response should be rendered. For example, here are two LaTeX expressions:
image

Actual Behavior:
For the example above, the renderer takes Chinese characters between two $ as LaTeX.
image

Environment

  • Open WebUI Version: 0.3.7

  • Ollama (if applicable): None

  • Operating System: macOS Sequoia

  • Browser (if applicable): Vivaldi 6.8.3381.46 (Stable channel) (arm64)

Reproduction Details

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.

Logs and Screenshots

Screenshots (if applicable):
Rendered output for the example response:
截屏2024-07-01 22 00 20

Installation Method

Docker

Additional Information

None

Note

If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!

@open-webui open-webui locked and limited conversation to collaborators Jul 1, 2024
@tjbck tjbck converted this issue into discussion #3581 Jul 1, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant