@lobehub/chat 0.151.6 → 0.151.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/locales/ar/error.json +11 -0
- package/locales/bg-BG/error.json +11 -0
- package/locales/de-DE/error.json +11 -0
- package/locales/en-US/error.json +11 -0
- package/locales/es-ES/error.json +11 -0
- package/locales/fr-FR/error.json +11 -0
- package/locales/it-IT/error.json +11 -0
- package/locales/ja-JP/error.json +11 -0
- package/locales/ko-KR/error.json +11 -0
- package/locales/nl-NL/error.json +11 -0
- package/locales/pl-PL/error.json +11 -0
- package/locales/pt-BR/error.json +11 -0
- package/locales/ru-RU/error.json +11 -0
- package/locales/tr-TR/error.json +11 -0
- package/locales/vi-VN/error.json +11 -0
- package/locales/zh-CN/error.json +11 -0
- package/locales/zh-TW/error.json +11 -0
- package/package.json +1 -1
- package/src/app/error.tsx +5 -0
- package/src/app/global-error.tsx +20 -0
- package/src/app/not-found.tsx +3 -0
- package/src/components/404/index.tsx +41 -0
- package/src/components/Error/index.tsx +56 -0
- package/src/components/Error/sentryCaptureException.ts +11 -0
- package/src/config/client.ts +3 -0
- package/src/locales/default/error.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.151.7](https://github.com/lobehub/lobe-chat/compare/v0.151.6...v0.151.7)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-04-30**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: Add 404 and Error page.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: Add 404 and Error page, closes [#2299](https://github.com/lobehub/lobe-chat/issues/2299) ([938a3e9](https://github.com/lobehub/lobe-chat/commit/938a3e9))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.151.6](https://github.com/lobehub/lobe-chat/compare/v0.151.5...v0.151.6)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-04-30**</sup>
|
package/locales/ar/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "العودة إلى الصفحة الرئيسية",
|
|
4
|
+
"desc": "حاول مرة أخرى في وقت لاحق، أو عد إلى العالم المألوف",
|
|
5
|
+
"retry": "إعادة التحميل",
|
|
6
|
+
"title": "واجهت الصفحة مشكلة ما.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "العودة إلى الصفحة الرئيسية",
|
|
10
|
+
"desc": "لم نتمكن من العثور على الصفحة التي تبحث عنها، يرجى التحقق مما إذا كان الرابط صحيحًا",
|
|
11
|
+
"title": "هل دخلت إلى مجال غير معروف؟"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "أكمل الإعدادات التالية لبدء استخدام هذا المكون الإضافي",
|
|
4
15
|
"title": "تكوين مكون الإضافة {{name}}"
|
package/locales/bg-BG/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Върни се в началото",
|
|
4
|
+
"desc": "Опитайте отново по-късно или се върнете в познатия свят",
|
|
5
|
+
"retry": "Опитай отново",
|
|
6
|
+
"title": "Страницата се е сблъскала с проблем.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Върни се в началото",
|
|
10
|
+
"desc": "Не можем да намерим страницата, която търсите. Моля, проверете дали връзката е правилна.",
|
|
11
|
+
"title": "Влезли сте в неизвестна територия?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Попълнете следната конфигурация, за да започнете да използвате този плъгин",
|
|
4
15
|
"title": "Настройки на плъгина {{name}}"
|
package/locales/de-DE/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Zurück zur Startseite",
|
|
4
|
+
"desc": "Versuchen Sie es später erneut oder kehren Sie in die bekannte Welt zurück",
|
|
5
|
+
"retry": "Erneut laden",
|
|
6
|
+
"title": "Ein Problem ist aufgetreten auf der Seite.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Zurück zur Startseite",
|
|
10
|
+
"desc": "Die von Ihnen gesuchte Seite konnte nicht gefunden werden. Bitte überprüfen Sie, ob der Link korrekt ist.",
|
|
11
|
+
"title": "In unbekanntes Gebiet geraten?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Führen Sie die folgende Konfiguration durch, um das Plugin zu verwenden",
|
|
4
15
|
"title": "{{name}} Plugin-Konfiguration"
|
package/locales/en-US/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Back to Home",
|
|
4
|
+
"desc": "Give it a try later, or go back to the known world.",
|
|
5
|
+
"retry": "Reload",
|
|
6
|
+
"title": "Oops, something went wrong.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Back to Home",
|
|
10
|
+
"desc": "We couldn't find the page you're looking for, please check if the link is correct",
|
|
11
|
+
"title": "Entered Unknown Territory?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Complete the following configuration to start using this plugin",
|
|
4
15
|
"title": "{{name}} Plugin Settings"
|
package/locales/es-ES/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Volver a la página de inicio",
|
|
4
|
+
"desc": "Inténtalo de nuevo más tarde, o regresa al mundo conocido",
|
|
5
|
+
"retry": "Reintentar",
|
|
6
|
+
"title": "Se ha producido un problema en la página.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Volver a la página de inicio",
|
|
10
|
+
"desc": "No podemos encontrar la página que estás buscando, por favor verifica si el enlace es correcto",
|
|
11
|
+
"title": "¿Has entrado en un área desconocida?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Complete la siguiente configuración para comenzar a usar este complemento",
|
|
4
15
|
"title": "Configuración del complemento {{name}}"
|
package/locales/fr-FR/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Retour à la page d'accueil",
|
|
4
|
+
"desc": "Réessayez plus tard, ou retournez au monde connu",
|
|
5
|
+
"retry": "Recharger",
|
|
6
|
+
"title": "Un problème est survenu sur la page.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Retour à la page d'accueil",
|
|
10
|
+
"desc": "La page que vous recherchez est introuvable. Veuillez vérifier si le lien est correct.",
|
|
11
|
+
"title": "Êtes-vous entré dans un domaine inconnu ?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Completez la configuration suivante pour commencer à utiliser ce plugin",
|
|
4
15
|
"title": "Configuration du plugin {{name}}"
|
package/locales/it-IT/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Torna alla homepage",
|
|
4
|
+
"desc": "Prova di nuovo più tardi, o torna al mondo conosciuto",
|
|
5
|
+
"retry": "Ricarica",
|
|
6
|
+
"title": "La pagina ha riscontrato un problema.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Torna alla homepage",
|
|
10
|
+
"desc": "Non riusciamo a trovare la pagina che stai cercando, controlla che il link sia corretto",
|
|
11
|
+
"title": "Hai raggiunto un territorio sconosciuto?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Completa la seguente configurazione per iniziare a utilizzare il plugin",
|
|
4
15
|
"title": "Configurazione del plugin {{name}}"
|
package/locales/ja-JP/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "ホームに戻る",
|
|
4
|
+
"desc": "後で試してみるか、既知の世界に戻る",
|
|
5
|
+
"retry": "再読み込み",
|
|
6
|
+
"title": "ページに問題が発生しました.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "ホームに戻る",
|
|
10
|
+
"desc": "お探しのページが見つかりません。リンクが正しいかどうかをご確認ください",
|
|
11
|
+
"title": "未知の領域に入りましたか?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "以下の設定を完了すると、プラグインを使用することができます",
|
|
4
15
|
"title": "{{name}} プラグイン設定"
|
package/locales/ko-KR/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "홈페이지로 돌아가기",
|
|
4
|
+
"desc": "잠시 후 다시 시도하거나 익숙한 세계로 돌아가세요",
|
|
5
|
+
"retry": "다시 시도",
|
|
6
|
+
"title": "페이지에서 문제가 발생했습니다."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "홈페이지로 돌아가기",
|
|
10
|
+
"desc": "찾고 있는 페이지를 찾을 수 없습니다. 링크가 올바른지 확인해주세요.",
|
|
11
|
+
"title": "알 수 없는 영역에 들어갔나요?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "다음 구성을 완료하면 플러그인을 사용할 수 있습니다.",
|
|
4
15
|
"title": "{{name}} 플러그인 설정"
|
package/locales/nl-NL/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Terug naar startpagina",
|
|
4
|
+
"desc": "Probeer het later opnieuw of keer terug naar de bekende wereld",
|
|
5
|
+
"retry": "Opnieuw proberen",
|
|
6
|
+
"title": "Er is een probleem opgetreden op de pagina.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Terug naar startpagina",
|
|
10
|
+
"desc": "We kunnen de pagina die je zoekt niet vinden, controleer of de link juist is",
|
|
11
|
+
"title": "Betreden onbekend terrein?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Voltooi de volgende instellingen om de plugin te gebruiken",
|
|
4
15
|
"title": "{{name}} Plugin Instellingen"
|
package/locales/pl-PL/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Powrót do strony głównej",
|
|
4
|
+
"desc": "Spróbuj ponownie później lub wróć do znanego świata",
|
|
5
|
+
"retry": "Ponów próbę",
|
|
6
|
+
"title": "Napotkano problem na stronie.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Powrót do strony głównej",
|
|
10
|
+
"desc": "Nie możemy odnaleźć strony, której szukasz. Sprawdź, czy link jest poprawny.",
|
|
11
|
+
"title": "Wkraczasz w nieznane terytorium?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Wykonaj poniższą konfigurację, aby rozpocząć korzystanie z tego wtyczki",
|
|
4
15
|
"title": "Konfiguracja wtyczki {{name}}"
|
package/locales/pt-BR/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Voltar para a página inicial",
|
|
4
|
+
"desc": "Tente novamente mais tarde, ou retorne ao mundo conhecido",
|
|
5
|
+
"retry": "Tentar novamente",
|
|
6
|
+
"title": "Ocorreu um problema na página.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Voltar para a página inicial",
|
|
10
|
+
"desc": "Não conseguimos encontrar a página que você está procurando, por favor, verifique se o link está correto",
|
|
11
|
+
"title": "Entrou em um território desconhecido?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Complete a seguinte configuração para começar a usar este plugin",
|
|
4
15
|
"title": "Configuração do plugin {{name}}"
|
package/locales/ru-RU/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Вернуться на главную",
|
|
4
|
+
"desc": "Попробуйте позже или вернитесь в знакомый мир",
|
|
5
|
+
"retry": "Повторить попытку",
|
|
6
|
+
"title": "Произошла проблема на странице.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Вернуться на главную",
|
|
10
|
+
"desc": "Мы не можем найти страницу, которую вы ищете. Пожалуйста, проверьте правильность ссылки",
|
|
11
|
+
"title": "Заблудились в неизведанных местах?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Чтобы начать использовать этот плагин, выполните следующую конфигурацию",
|
|
4
15
|
"title": "{{name}} Настройки плагина"
|
package/locales/tr-TR/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Ana Sayfaya Dön",
|
|
4
|
+
"desc": "Biraz sonra tekrar deneyin veya bilinen dünyaya geri dönün",
|
|
5
|
+
"retry": "Yeniden Yükle",
|
|
6
|
+
"title": "Sayfa bir sorunla karşılaştı.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Ana Sayfaya Dön",
|
|
10
|
+
"desc": "Aradığınız sayfayı bulamadık, lütfen bağlantının doğru olduğundan emin olun",
|
|
11
|
+
"title": "Bilinmeyen bir alana mı girdiniz?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Bu eklentiyi kullanmaya başlamak için aşağıdaki yapılandırmayı tamamlayın",
|
|
4
15
|
"title": "{{name}} Eklenti Ayarları"
|
package/locales/vi-VN/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "Quay về Trang chủ",
|
|
4
|
+
"desc": "Hãy thử lại sau, hoặc quay về thế giới đã biết",
|
|
5
|
+
"retry": "Thử lại",
|
|
6
|
+
"title": "Trang gặp một chút vấn đề.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "Quay về Trang chủ",
|
|
10
|
+
"desc": "Chúng tôi không thể tìm thấy trang bạn đang tìm, vui lòng kiểm tra xem liên kết có đúng không",
|
|
11
|
+
"title": "Bước vào vùng đất chưa biết?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "Hoàn thành cấu hình sau để bắt đầu sử dụng plugin này",
|
|
4
15
|
"title": "Cấu hình Plugin {{name}}"
|
package/locales/zh-CN/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "返回首页",
|
|
4
|
+
"desc": "待会来试试,或者回到已知的世界",
|
|
5
|
+
"retry": "重新加载",
|
|
6
|
+
"title": "页面遇到一点问题.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "返回首页",
|
|
10
|
+
"desc": "我们找不到你正在寻找的页面,请检查链接是否正确",
|
|
11
|
+
"title": "进入了未知领域?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "完成以下配置,即可开始使用该插件",
|
|
4
15
|
"title": "{{name}} 插件配置"
|
package/locales/zh-TW/error.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"error": {
|
|
3
|
+
"backHome": "返回首頁",
|
|
4
|
+
"desc": "待會再試試,或者回到已知的世界",
|
|
5
|
+
"retry": "重新加載",
|
|
6
|
+
"title": "頁面遇到一點問題.."
|
|
7
|
+
},
|
|
8
|
+
"notFound": {
|
|
9
|
+
"backHome": "返回首頁",
|
|
10
|
+
"desc": "我們找不到您正在尋找的頁面,請檢查連結是否正確",
|
|
11
|
+
"title": "進入了未知領域?"
|
|
12
|
+
},
|
|
2
13
|
"pluginSettings": {
|
|
3
14
|
"desc": "完成以下設定後,即可開始使用此外掛",
|
|
4
15
|
"title": "{{name}} 插件設定"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.151.
|
|
3
|
+
"version": "0.151.7",
|
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import Error from 'next/error';
|
|
4
|
+
import { useLayoutEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
import { type ErrorType, sentryCaptureException } from '@/components/Error/sentryCaptureException';
|
|
7
|
+
|
|
8
|
+
export default function GlobalError({ error }: { error: ErrorType; reset: () => void }) {
|
|
9
|
+
useLayoutEffect(() => {
|
|
10
|
+
sentryCaptureException(error);
|
|
11
|
+
}, [error]);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<html>
|
|
15
|
+
<body>
|
|
16
|
+
<Error statusCode={undefined as any} />
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { FluentEmoji } from '@lobehub/ui';
|
|
4
|
+
import { Button } from 'antd';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { Flexbox } from 'react-layout-kit';
|
|
9
|
+
|
|
10
|
+
import { MAX_WIDTH } from '@/const/layoutTokens';
|
|
11
|
+
|
|
12
|
+
const Page404 = memo(() => {
|
|
13
|
+
const { t } = useTranslation('error');
|
|
14
|
+
return (
|
|
15
|
+
<Flexbox align={'center'} justify={'center'} style={{ height: '100%', width: '100%' }}>
|
|
16
|
+
<h1
|
|
17
|
+
style={{
|
|
18
|
+
filter: 'blur(8px)',
|
|
19
|
+
fontSize: `min(${MAX_WIDTH / 3}px, 50vw)`,
|
|
20
|
+
fontWeight: 'bolder',
|
|
21
|
+
margin: 0,
|
|
22
|
+
opacity: 0.12,
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
zIndex: 0,
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
404
|
|
28
|
+
</h1>
|
|
29
|
+
<FluentEmoji emoji={'👀'} size={64} />
|
|
30
|
+
<h2 style={{ fontWeight: 'bold', marginTop: '1em', textAlign: 'center' }}>
|
|
31
|
+
{t('notFound.title')}
|
|
32
|
+
</h2>
|
|
33
|
+
<p style={{ marginBottom: '2em' }}>{t('notFound.desc')}</p>
|
|
34
|
+
<Link href="/">
|
|
35
|
+
<Button type={'primary'}>{t('notFound.backHome')}</Button>
|
|
36
|
+
</Link>
|
|
37
|
+
</Flexbox>
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export default Page404;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { FluentEmoji } from '@lobehub/ui';
|
|
4
|
+
import { Button } from 'antd';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { memo, useLayoutEffect } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { Flexbox } from 'react-layout-kit';
|
|
9
|
+
|
|
10
|
+
import { MAX_WIDTH } from '@/const/layoutTokens';
|
|
11
|
+
|
|
12
|
+
import { type ErrorType, sentryCaptureException } from './sentryCaptureException';
|
|
13
|
+
|
|
14
|
+
interface PageErrorProps {
|
|
15
|
+
error: ErrorType;
|
|
16
|
+
reset: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const PageError = memo<PageErrorProps>(({ reset, error }) => {
|
|
20
|
+
const { t } = useTranslation('error');
|
|
21
|
+
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
sentryCaptureException(error);
|
|
24
|
+
}, [error]);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Flexbox align={'center'} justify={'center'} style={{ height: '100%', width: '100%' }}>
|
|
28
|
+
<h1
|
|
29
|
+
style={{
|
|
30
|
+
filter: 'blur(8px)',
|
|
31
|
+
fontSize: `min(${MAX_WIDTH / 6}px, 25vw)`,
|
|
32
|
+
fontWeight: 900,
|
|
33
|
+
margin: 0,
|
|
34
|
+
opacity: 0.12,
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
zIndex: 0,
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
ERROR
|
|
40
|
+
</h1>
|
|
41
|
+
<FluentEmoji emoji={'🤧'} size={64} />
|
|
42
|
+
<h2 style={{ fontWeight: 'bold', marginTop: '1em', textAlign: 'center' }}>
|
|
43
|
+
{t('error.title')}
|
|
44
|
+
</h2>
|
|
45
|
+
<p style={{ marginBottom: '2em' }}>{t('error.desc')}</p>
|
|
46
|
+
<Flexbox gap={12} horizontal style={{ marginBottom: '1em' }}>
|
|
47
|
+
<Button onClick={() => reset()}>{t('error.retry')}</Button>
|
|
48
|
+
<Link href="/">
|
|
49
|
+
<Button type={'primary'}>{t('error.backHome')}</Button>
|
|
50
|
+
</Link>
|
|
51
|
+
</Flexbox>
|
|
52
|
+
</Flexbox>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export default PageError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getClientConfig } from '@/config/client';
|
|
2
|
+
|
|
3
|
+
const { ENABLE_SENTRY } = getClientConfig();
|
|
4
|
+
|
|
5
|
+
export type ErrorType = Error & { digest?: string };
|
|
6
|
+
|
|
7
|
+
export const sentryCaptureException = async (error: Error & { digest?: string }) => {
|
|
8
|
+
if (!ENABLE_SENTRY) return;
|
|
9
|
+
const { captureException } = await import('@sentry/nextjs');
|
|
10
|
+
return captureException(error);
|
|
11
|
+
};
|
package/src/config/client.ts
CHANGED
|
@@ -55,6 +55,9 @@ export const getClientConfig = () => ({
|
|
|
55
55
|
process.env.NEXT_PUBLIC_UMAMI_SCRIPT_URL || 'https://analytics.umami.is/script.js',
|
|
56
56
|
UMAMI_WEBSITE_ID: process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID,
|
|
57
57
|
|
|
58
|
+
// Sentry
|
|
59
|
+
ENABLE_SENTRY: !!process.env.NEXT_PUBLIC_SENTRY_DSN,
|
|
60
|
+
|
|
58
61
|
// i18n debug mode
|
|
59
62
|
I18N_DEBUG: process.env.NEXT_PUBLIC_I18N_DEBUG === '1',
|
|
60
63
|
I18N_DEBUG_BROWSER: process.env.NEXT_PUBLIC_I18N_DEBUG_BROWSER === '1',
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
export default {
|
|
2
|
+
error: {
|
|
3
|
+
backHome: '返回首页',
|
|
4
|
+
desc: '待会来试试,或者回到已知的世界',
|
|
5
|
+
retry: '重新加载',
|
|
6
|
+
title: '页面遇到一点问题..',
|
|
7
|
+
},
|
|
8
|
+
notFound: {
|
|
9
|
+
backHome: '返回首页',
|
|
10
|
+
desc: '我们找不到你正在寻找的页面,请检查链接是否正确',
|
|
11
|
+
title: '进入了未知领域?',
|
|
12
|
+
},
|
|
2
13
|
pluginSettings: {
|
|
3
14
|
desc: '完成以下配置,即可开始使用该插件',
|
|
4
15
|
title: '{{name}} 插件配置',
|
|
@@ -115,6 +126,7 @@ export default {
|
|
|
115
126
|
addProxyUrl: '添加 OpenAI 代理地址(可选)',
|
|
116
127
|
closeMessage: '关闭提示',
|
|
117
128
|
confirm: '确认并重试',
|
|
129
|
+
|
|
118
130
|
oauth: {
|
|
119
131
|
description: '管理员已开启统一登录认证,点击下方按钮登录,即可解锁应用',
|
|
120
132
|
success: '登录成功',
|