[GH-ISSUE #22641] issue: OWUI sometimes fails to parse math formulas from markdown #106770

Closed
opened 2026-05-18 05:15:08 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @ccdv-ai on GitHub (Mar 13, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22641

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.8.10

Ollama Version (if applicable)

No response

Operating System

ubuntu 24.04 lts

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

OWUI sometimes fails to parse math formulas from markdown.
Works fine when no math is involved.

Actual Behavior

Example of an answer & a screenshot :

Excellent ! Voici les calculs détaillés pour la variance et l'écart-type. Ces notions sont essentielles pour comprendre le risque de chaque actif individuellement.

---

## 📊 Calcul de la Variance et de l'Écart-Type

Reprenons les données de l'exemple précédent :

| Année | Rendement Action A ($R_A$) | Rendement Action B ($R_B$) |
|-------|---------------------------|---------------------------|
| 2021  | +12% (0,12)               | +8% (0,08)                |
| 2022  | -5% (-0,05)               | -3% (-0,03)               |
| 2023  | +18% (0,18)               | +15% (0,15)               |

**Rendements moyens déjà calculés :**
- $\bar{R}_A = +8,33\%$ (0,0833)
- $\bar{R}_B = +6,67\%$ (0,0667)

---

## 🔹 Pour l'Action A (LVMH)

### Étape 1 : Écarts à la moyenne au carré

| Année | $R_{A,i}$ | $R_{A,i} - \bar{R}_A$ | $(R_{A,i} - \bar{R}_A)^2$ |
|-------|-----------|----------------------|---------------------------|
| 2021  | 0,12      | 0,12 - 0,0833 = **+0,0367** | 0,001347 |
| 2022  | -0,05     | -0,05 - 0,0833 = **-0,1333** | 0,017769 |
| 2023  | 0,18      | 0,18 - 0,0833 = **+0,0967** | 0,009351 |

### Étape 2 : Variance de l'Action A

$$\sigma_A^2 = \frac{0,001347 + 0,017769 + 0,009351}{3} = \frac{0,028467}{3} = \mathbf{0,009489}$$

### Étape 3 : Écart-type de l'Action A

$$\sigma_A = \sqrt{0,009489} = \mathbf{0,0974} \approx \mathbf{+9,74\%}$$

---

## 🔹 Pour l'Action B (Schneider Electric)

### Étape 1 : Écarts à la moyenne au carré

| Année | $R_{B,i}$ | $R_{B,i} - \bar{R}_B$ | $(R_{B,i} - \bar{R}_B)^2$ |
|-------|-----------|----------------------|---------------------------|
| 2021  | 0,08      | 0,08 - 0,0667 = **+0,0133** | 0,000177 |
| 2022  | -0,03     | -0,03 - 0,0667 = **-0,0967** | 0,009351 |
| 2023  | 0,15      | 0,15 - 0,0667 = **+0,0833** | 0,006939 |

### Étape 2 : Variance de l'Action B

$$\sigma_B^2 = \frac{0,000177 + 0,009351 + 0,006939}{3} = \frac{0,016467}{3} = \mathbf{0,005489}$$

### Étape 3 : Écart-type de l'Action B

$$\sigma_B = \sqrt{0,005489} = \mathbf{0,0741} \approx \mathbf{+7,41\%}$$

---

## 📋 Résumé des résultats

| Action | Rendement moyen | Variance ($\sigma^2$) | Écart-type ($\sigma$) |
|--------|-----------------|----------------------|----------------------|
| **A (LVMH)** | +8,33% | 0,009489 | **+9,74%** |
| **B (Schneider)** | +6,67% | 0,005489 | **+7,41%** |

---

## 🔍 Interprétation

### 1. Comparaison du risque individuel

| Action | Risque (écart-type) | Interprétation |
|--------|---------------------|----------------|
| LVMH | 9,74% | **Plus volatile** (rendements plus dispersés) |
| Schneider | 7,41% | **Plus stable** (rendements plus concentrés autour de la moyenne) |

### 2. Pour le portefeuille Markowitz

Ces écart-types sont nécessaires pour calculer :

$$\sigma_p^2 = p_A^2\sigma_A^2 + p_B^2\sigma_B^2 + 2p_Ap_B\text{Cov}(R_A,R_B)$$

**Si tu construis un portefeuille équipondéré (50% A, 50% B) :**

$$\sigma_p^2 = (0,5)^2(0,009489) + (0,5)^2(0,005489) + 2(0,5)(0,5)(0,007145)$$

$$\sigma_p^2 = 0,002372 + 0,001372 + 0,003573 = \mathbf{0,007317}$$

$$\sigma_p = \sqrt{0,007317} = \mathbf{0,0855} \approx \mathbf{+8,55\%}$$

### 3. Le miracle de la diversification

| Scénario | Risque |
|----------|--------|
| Action A seule | 9,74% |
| Action B seule | 7,41% |
| **Portefeuille A+B** | **8,55%** |

✅ **Le risque du portefeuille (8,55%) est inférieur à la moyenne des risques individuels (8,58%)**, même si les covariances sont positives !

---

## 🧠 Vérification de compréhension

**Question :** Si la covariance était égale à 0 (les deux actions évoluent indépendamment), que deviendrait le risque du portefeuille ?

A) Il resterait identique (8,55%)
B) Il diminuerait encore (diversification maximale)
C) Il augmenterait (plus de risque)

Réfléchis-y ! 🤔

Screenshot of chat:
Image

Steps to Reproduce

Generate some maths

Logs & Screenshots

Image

Additional Information

No response

Originally created by @ccdv-ai on GitHub (Mar 13, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/22641 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.8.10 ### Ollama Version (if applicable) _No response_ ### Operating System ubuntu 24.04 lts ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior OWUI sometimes fails to parse math formulas from markdown. Works fine when no math is involved. ### Actual Behavior Example of an answer & a screenshot : ```md Excellent ! Voici les calculs détaillés pour la variance et l'écart-type. Ces notions sont essentielles pour comprendre le risque de chaque actif individuellement. --- ## 📊 Calcul de la Variance et de l'Écart-Type Reprenons les données de l'exemple précédent : | Année | Rendement Action A ($R_A$) | Rendement Action B ($R_B$) | |-------|---------------------------|---------------------------| | 2021 | +12% (0,12) | +8% (0,08) | | 2022 | -5% (-0,05) | -3% (-0,03) | | 2023 | +18% (0,18) | +15% (0,15) | **Rendements moyens déjà calculés :** - $\bar{R}_A = +8,33\%$ (0,0833) - $\bar{R}_B = +6,67\%$ (0,0667) --- ## 🔹 Pour l'Action A (LVMH) ### Étape 1 : Écarts à la moyenne au carré | Année | $R_{A,i}$ | $R_{A,i} - \bar{R}_A$ | $(R_{A,i} - \bar{R}_A)^2$ | |-------|-----------|----------------------|---------------------------| | 2021 | 0,12 | 0,12 - 0,0833 = **+0,0367** | 0,001347 | | 2022 | -0,05 | -0,05 - 0,0833 = **-0,1333** | 0,017769 | | 2023 | 0,18 | 0,18 - 0,0833 = **+0,0967** | 0,009351 | ### Étape 2 : Variance de l'Action A $$\sigma_A^2 = \frac{0,001347 + 0,017769 + 0,009351}{3} = \frac{0,028467}{3} = \mathbf{0,009489}$$ ### Étape 3 : Écart-type de l'Action A $$\sigma_A = \sqrt{0,009489} = \mathbf{0,0974} \approx \mathbf{+9,74\%}$$ --- ## 🔹 Pour l'Action B (Schneider Electric) ### Étape 1 : Écarts à la moyenne au carré | Année | $R_{B,i}$ | $R_{B,i} - \bar{R}_B$ | $(R_{B,i} - \bar{R}_B)^2$ | |-------|-----------|----------------------|---------------------------| | 2021 | 0,08 | 0,08 - 0,0667 = **+0,0133** | 0,000177 | | 2022 | -0,03 | -0,03 - 0,0667 = **-0,0967** | 0,009351 | | 2023 | 0,15 | 0,15 - 0,0667 = **+0,0833** | 0,006939 | ### Étape 2 : Variance de l'Action B $$\sigma_B^2 = \frac{0,000177 + 0,009351 + 0,006939}{3} = \frac{0,016467}{3} = \mathbf{0,005489}$$ ### Étape 3 : Écart-type de l'Action B $$\sigma_B = \sqrt{0,005489} = \mathbf{0,0741} \approx \mathbf{+7,41\%}$$ --- ## 📋 Résumé des résultats | Action | Rendement moyen | Variance ($\sigma^2$) | Écart-type ($\sigma$) | |--------|-----------------|----------------------|----------------------| | **A (LVMH)** | +8,33% | 0,009489 | **+9,74%** | | **B (Schneider)** | +6,67% | 0,005489 | **+7,41%** | --- ## 🔍 Interprétation ### 1. Comparaison du risque individuel | Action | Risque (écart-type) | Interprétation | |--------|---------------------|----------------| | LVMH | 9,74% | **Plus volatile** (rendements plus dispersés) | | Schneider | 7,41% | **Plus stable** (rendements plus concentrés autour de la moyenne) | ### 2. Pour le portefeuille Markowitz Ces écart-types sont nécessaires pour calculer : $$\sigma_p^2 = p_A^2\sigma_A^2 + p_B^2\sigma_B^2 + 2p_Ap_B\text{Cov}(R_A,R_B)$$ **Si tu construis un portefeuille équipondéré (50% A, 50% B) :** $$\sigma_p^2 = (0,5)^2(0,009489) + (0,5)^2(0,005489) + 2(0,5)(0,5)(0,007145)$$ $$\sigma_p^2 = 0,002372 + 0,001372 + 0,003573 = \mathbf{0,007317}$$ $$\sigma_p = \sqrt{0,007317} = \mathbf{0,0855} \approx \mathbf{+8,55\%}$$ ### 3. Le miracle de la diversification | Scénario | Risque | |----------|--------| | Action A seule | 9,74% | | Action B seule | 7,41% | | **Portefeuille A+B** | **8,55%** | ✅ **Le risque du portefeuille (8,55%) est inférieur à la moyenne des risques individuels (8,58%)**, même si les covariances sont positives ! --- ## 🧠 Vérification de compréhension **Question :** Si la covariance était égale à 0 (les deux actions évoluent indépendamment), que deviendrait le risque du portefeuille ? A) Il resterait identique (8,55%) B) Il diminuerait encore (diversification maximale) C) Il augmenterait (plus de risque) Réfléchis-y ! 🤔 ``` Screenshot of chat: <img width="1071" height="733" alt="Image" src="https://github.com/user-attachments/assets/6c95ff95-6668-4d49-a727-e652599950f3" /> ### Steps to Reproduce Generate some maths ### Logs & Screenshots <img width="1071" height="733" alt="Image" src="https://github.com/user-attachments/assets/6c95ff95-6668-4d49-a727-e652599950f3" /> ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-18 05:15:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#106770