@lobehub/chat 0.161.18 → 0.161.20
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 +50 -0
- package/locales/ar/chat.json +1 -0
- package/locales/ar/components.json +2 -1
- package/locales/bg-BG/chat.json +1 -0
- package/locales/bg-BG/components.json +2 -1
- package/locales/de-DE/chat.json +1 -0
- package/locales/de-DE/components.json +2 -1
- package/locales/en-US/chat.json +1 -0
- package/locales/en-US/components.json +2 -1
- package/locales/es-ES/chat.json +1 -0
- package/locales/es-ES/components.json +2 -1
- package/locales/fr-FR/chat.json +1 -0
- package/locales/fr-FR/components.json +2 -1
- package/locales/it-IT/chat.json +1 -0
- package/locales/it-IT/components.json +2 -1
- package/locales/ja-JP/chat.json +1 -0
- package/locales/ja-JP/components.json +2 -1
- package/locales/ko-KR/chat.json +1 -0
- package/locales/ko-KR/components.json +2 -1
- package/locales/nl-NL/chat.json +1 -0
- package/locales/nl-NL/components.json +2 -1
- package/locales/pl-PL/chat.json +1 -0
- package/locales/pl-PL/components.json +2 -1
- package/locales/pt-BR/chat.json +1 -0
- package/locales/pt-BR/components.json +2 -1
- package/locales/ru-RU/chat.json +1 -0
- package/locales/ru-RU/components.json +2 -1
- package/locales/tr-TR/chat.json +1 -0
- package/locales/tr-TR/components.json +2 -1
- package/locales/vi-VN/chat.json +1 -0
- package/locales/vi-VN/components.json +2 -1
- package/locales/zh-CN/chat.json +1 -0
- package/locales/zh-CN/components.json +2 -1
- package/locales/zh-TW/chat.json +1 -0
- package/locales/zh-TW/components.json +2 -1
- package/package.json +22 -22
- package/src/app/(main)/chat/_layout/Desktop/SessionPanel.tsx +2 -0
- package/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx +80 -0
- package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +79 -35
- package/src/locales/default/chat.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.161.20](https://github.com/lobehub/lobe-chat/compare/v0.161.19...v0.161.20)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-05-26**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix vercel build.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix vercel build, closes [#2666](https://github.com/lobehub/lobe-chat/issues/2666) ([cb70e4a](https://github.com/lobehub/lobe-chat/commit/cb70e4a))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.161.19](https://github.com/lobehub/lobe-chat/compare/v0.161.18...v0.161.19)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2024-05-25**</sup>
|
|
33
|
+
|
|
34
|
+
#### 💄 Styles
|
|
35
|
+
|
|
36
|
+
- **misc**: Update token tag popover style.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### Styles
|
|
44
|
+
|
|
45
|
+
- **misc**: Update token tag popover style, closes [#2631](https://github.com/lobehub/lobe-chat/issues/2631) ([7635129](https://github.com/lobehub/lobe-chat/commit/7635129))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.161.18](https://github.com/lobehub/lobe-chat/compare/v0.161.17...v0.161.18)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2024-05-25**</sup>
|
package/locales/ar/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "يدعم هذا النموذج استدعاء الوظائف",
|
|
7
7
|
"tokens": "يدعم هذا النموذج حتى {{tokens}} رمزًا في جلسة واحدة",
|
|
8
8
|
"vision": "يدعم هذا النموذج التعرف البصري"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "هذا النموذج لم يعد متوفر في القائمة، سيتم إزالته تلقائيًا إذا تم إلغاء تحديده"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "لا توجد نماذج ممكن تمكينها، يرجى الانتقال إلى الإعدادات لتمكينها",
|
package/locales/bg-BG/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Този модел поддържа функционални обаждания (Function Call)",
|
|
7
7
|
"tokens": "Този модел поддържа до {{tokens}} токена за една сесия",
|
|
8
8
|
"vision": "Този модел поддържа визуално разпознаване"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Този модел не се намира в списъка. Ако бъде отменен изборът, той ще бъде автоматично премахнат."
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Няма активирани модели, моля, посетете настройките и ги активирайте",
|
package/locales/de-DE/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Dieses Modell unterstützt Funktionsaufrufe.",
|
|
7
7
|
"tokens": "Dieses Modell unterstützt maximal {{tokens}} Tokens pro Sitzung.",
|
|
8
8
|
"vision": "Dieses Modell unterstützt die visuelle Erkennung."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Das Modell wurde aus der Liste entfernt. Wenn Sie die Auswahl aufheben, wird es automatisch entfernt."
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Kein aktiviertes Modell. Bitte gehen Sie zu den Einstellungen, um es zu aktivieren.",
|
package/locales/en-US/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "This model supports function call.",
|
|
7
7
|
"tokens": "This model supports up to {{tokens}} tokens in a single session.",
|
|
8
8
|
"vision": "This model supports visual recognition."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "The model is not in the list. It will be automatically removed if deselected."
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "No enabled model. Please go to settings to enable.",
|
package/locales/es-ES/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Este modelo admite llamadas de función.",
|
|
7
7
|
"tokens": "Este modelo admite un máximo de {{tokens}} tokens por sesión.",
|
|
8
8
|
"vision": "Este modelo admite el reconocimiento visual."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "El modelo no está en la lista, se eliminará automáticamente si se cancela la selección"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "No hay modelos habilitados. Vaya a la configuración para habilitarlos.",
|
package/locales/fr-FR/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Ce modèle prend en charge les appels de fonction.",
|
|
7
7
|
"tokens": "Ce modèle prend en charge jusqu'à {{tokens}} jetons par session.",
|
|
8
8
|
"vision": "Ce modèle prend en charge la reconnaissance visuelle."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Le modèle n'est pas dans la liste, il sera automatiquement supprimé si vous annulez la sélection"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Aucun modèle activé. Veuillez vous rendre dans les paramètres pour l'activer.",
|
package/locales/it-IT/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Questo modello supporta la chiamata di funzioni.",
|
|
7
7
|
"tokens": "Questo modello supporta un massimo di {{tokens}} token per sessione.",
|
|
8
8
|
"vision": "Questo modello supporta il riconoscimento visivo."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Il modello non è più nella lista, verrà rimosso automaticamente se deselezionato"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Nessun modello attivo. Vai alle impostazioni per attivarne uno.",
|
package/locales/ja-JP/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "このモデルは関数呼び出し(Function Call)をサポートしています。",
|
|
7
7
|
"tokens": "このモデルは1つのセッションあたり最大{{tokens}}トークンをサポートしています。",
|
|
8
8
|
"vision": "このモデルはビジョン認識をサポートしています。"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "選択されたモデルはリストから削除されました。選択を解除すると自動的に削除されます。"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "有効なモデルがありません。設定に移動して有効にしてください。",
|
package/locales/ko-KR/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "이 모델은 함수 호출을 지원합니다",
|
|
7
7
|
"tokens": "이 모델은 단일 세션당 최대 {{tokens}} 토큰을 지원합니다",
|
|
8
8
|
"vision": "이 모델은 시각 인식을 지원합니다"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "모델이 목록에서 제거되었습니다. 선택이 취소되면 자동으로 제거됩니다."
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "활성화된 모델이 없습니다. 설정으로 이동하여 활성화하세요",
|
package/locales/nl-NL/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "This model supports function call.",
|
|
7
7
|
"tokens": "This model supports up to {{tokens}} tokens in a single session.",
|
|
8
8
|
"vision": "This model supports visual recognition."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Dit model staat niet meer in de lijst. Als je het deselecteert, wordt het automatisch verwijderd."
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "No enabled model, please go to settings to enable.",
|
package/locales/pl-PL/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Ten model obsługuje wywołania funkcji (Function Call).",
|
|
7
7
|
"tokens": "Ten model obsługuje maksymalnie {{tokens}} tokenów w pojedynczej sesji.",
|
|
8
8
|
"vision": "Ten model obsługuje rozpoznawanie wizualne."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Ten model nie znajduje się na liście, jeśli zostanie odznaczony, zostanie automatycznie usunięty"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Brak włączonych modeli, przejdź do ustawień i włącz je",
|
package/locales/pt-BR/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Este modelo suporta chamadas de função.",
|
|
7
7
|
"tokens": "Este modelo suporta no máximo {{tokens}} tokens por sessão.",
|
|
8
8
|
"vision": "Este modelo suporta reconhecimento visual."
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Este modelo não está na lista, se for desmarcado, será removido automaticamente"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Nenhum modelo habilitado. Por favor, vá para as configurações e habilite um.",
|
package/locales/ru-RU/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Эта модель поддерживает вызов функций",
|
|
7
7
|
"tokens": "Эта модель поддерживает до {{tokens}} токенов в одной сессии",
|
|
8
8
|
"vision": "Эта модель поддерживает распознавание изображений"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Эта модель не находится в списке. Если вы ее отмените, она будет автоматически удалена"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Нет активированных моделей. Пожалуйста, перейдите в настройки и включите модель",
|
package/locales/tr-TR/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Bu model fonksiyon çağrısını destekler",
|
|
7
7
|
"tokens": "Bu model tek bir oturumda en fazla {{tokens}} Token destekler",
|
|
8
8
|
"vision": "Bu model görüntü tanımıyı destekler"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Bu model listeden çıkarıldı, seçiminizi kaldırırsanız otomatik olarak kaldırılacaktır"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Etkinleştirilmiş model bulunmamaktadır, lütfen ayarlara giderek açın",
|
package/locales/vi-VN/chat.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"functionCall": "Mô hình này hỗ trợ cuộc gọi hàm (Function Call)",
|
|
7
7
|
"tokens": "Mỗi phiên của mô hình này hỗ trợ tối đa {{tokens}} Tokens",
|
|
8
8
|
"vision": "Mô hình này hỗ trợ nhận diện hình ảnh"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"removed": "Mô hình này không còn trong danh sách, nếu bỏ chọn sẽ tự động xóa"
|
|
10
11
|
},
|
|
11
12
|
"ModelSwitchPanel": {
|
|
12
13
|
"emptyModel": "Không có mô hình nào được kích hoạt, vui lòng điều chỉnh trong cài đặt",
|
package/locales/zh-CN/chat.json
CHANGED
package/locales/zh-TW/chat.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.161.
|
|
3
|
+
"version": "0.161.20",
|
|
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",
|
|
@@ -84,22 +84,22 @@
|
|
|
84
84
|
"@ant-design/icons": "^5.3.7",
|
|
85
85
|
"@anthropic-ai/sdk": "^0.20.9",
|
|
86
86
|
"@auth/core": "0.28.0",
|
|
87
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
88
|
-
"@aws-sdk/client-s3": "^3.
|
|
89
|
-
"@aws-sdk/s3-request-presigner": "^3.
|
|
87
|
+
"@aws-sdk/client-bedrock-runtime": "^3.583.0",
|
|
88
|
+
"@aws-sdk/client-s3": "^3.583.0",
|
|
89
|
+
"@aws-sdk/s3-request-presigner": "^3.583.0",
|
|
90
90
|
"@azure/openai": "1.0.0-beta.12",
|
|
91
91
|
"@cfworker/json-schema": "^1.12.8",
|
|
92
92
|
"@clerk/localizations": "2.0.0",
|
|
93
|
-
"@clerk/nextjs": "^5.
|
|
94
|
-
"@clerk/themes": "^2.1.
|
|
95
|
-
"@google/generative-ai": "^0.11.
|
|
93
|
+
"@clerk/nextjs": "^5.1.2",
|
|
94
|
+
"@clerk/themes": "^2.1.7",
|
|
95
|
+
"@google/generative-ai": "^0.11.4",
|
|
96
96
|
"@icons-pack/react-simple-icons": "^9.5.0",
|
|
97
97
|
"@khmyznikov/pwa-install": "^0.3.9",
|
|
98
98
|
"@lobehub/chat-plugin-sdk": "^1.32.3",
|
|
99
99
|
"@lobehub/chat-plugins-gateway": "^1.9.0",
|
|
100
|
-
"@lobehub/icons": "^1.22.
|
|
100
|
+
"@lobehub/icons": "^1.22.1",
|
|
101
101
|
"@lobehub/tts": "^1.24.1",
|
|
102
|
-
"@lobehub/ui": "^1.
|
|
102
|
+
"@lobehub/ui": "^1.141.2",
|
|
103
103
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
104
104
|
"@next/third-parties": "^14.2.3",
|
|
105
105
|
"@sentry/nextjs": "^7.116.0",
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
"@trpc/client": "next",
|
|
108
108
|
"@trpc/next": "next",
|
|
109
109
|
"@trpc/server": "next",
|
|
110
|
-
"@vercel/analytics": "^1.
|
|
111
|
-
"@vercel/speed-insights": "^1.0.
|
|
112
|
-
"ahooks": "^3.
|
|
110
|
+
"@vercel/analytics": "^1.3.1",
|
|
111
|
+
"@vercel/speed-insights": "^1.0.11",
|
|
112
|
+
"ahooks": "^3.8.0",
|
|
113
113
|
"ai": "3.0.19",
|
|
114
114
|
"antd": "^5.17.3",
|
|
115
115
|
"antd-style": "^3.6.2",
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
"immer": "^10.1.1",
|
|
129
129
|
"ip": "^2.0.1",
|
|
130
130
|
"jose": "^5.3.0",
|
|
131
|
-
"langfuse": "^3.11.
|
|
132
|
-
"langfuse-core": "^3.11.
|
|
131
|
+
"langfuse": "^3.11.1",
|
|
132
|
+
"langfuse-core": "^3.11.1",
|
|
133
133
|
"lodash-es": "^4.17.21",
|
|
134
134
|
"lucide-react": "latest",
|
|
135
135
|
"modern-screenshot": "^4.4.39",
|
|
@@ -143,18 +143,18 @@
|
|
|
143
143
|
"openai": "^4.47.1",
|
|
144
144
|
"pino": "^9.1.0",
|
|
145
145
|
"polished": "^4.3.1",
|
|
146
|
-
"posthog-js": "^1.
|
|
146
|
+
"posthog-js": "^1.135.2",
|
|
147
147
|
"pwa-install-handler": "^2.6.0",
|
|
148
148
|
"query-string": "^9.0.0",
|
|
149
149
|
"random-words": "^2.0.1",
|
|
150
150
|
"react": "^18.3.1",
|
|
151
151
|
"react-dom": "^18.3.1",
|
|
152
152
|
"react-hotkeys-hook": "^4.5.0",
|
|
153
|
-
"react-i18next": "^14.1.
|
|
153
|
+
"react-i18next": "^14.1.2",
|
|
154
154
|
"react-layout-kit": "^1.9.0",
|
|
155
155
|
"react-lazy-load": "^4.0.1",
|
|
156
|
-
"react-virtuoso": "^4.7.
|
|
157
|
-
"react-wrap-balancer": "^1.1.
|
|
156
|
+
"react-virtuoso": "^4.7.11",
|
|
157
|
+
"react-wrap-balancer": "^1.1.1",
|
|
158
158
|
"remark": "^14.0.3",
|
|
159
159
|
"remark-gfm": "^3.0.1",
|
|
160
160
|
"remark-html": "^15.0.2",
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
"@types/lodash-es": "^4.17.12",
|
|
201
201
|
"@types/node": "^20.12.12",
|
|
202
202
|
"@types/numeral": "^2.0.5",
|
|
203
|
-
"@types/react": "^18.3.
|
|
203
|
+
"@types/react": "^18.3.3",
|
|
204
204
|
"@types/react-dom": "^18.3.0",
|
|
205
205
|
"@types/rtl-detect": "^1.0.3",
|
|
206
206
|
"@types/semver": "^7.5.8",
|
|
@@ -216,12 +216,12 @@
|
|
|
216
216
|
"eslint": "^8.57.0",
|
|
217
217
|
"eslint-plugin-mdx": "^2.3.4",
|
|
218
218
|
"fake-indexeddb": "^5.0.2",
|
|
219
|
-
"glob": "^10.
|
|
219
|
+
"glob": "^10.4.1",
|
|
220
220
|
"gray-matter": "^4.0.3",
|
|
221
221
|
"happy-dom": "^14.11.0",
|
|
222
222
|
"husky": "^9.0.11",
|
|
223
223
|
"just-diff": "^6.0.2",
|
|
224
|
-
"lint-staged": "^15.2.
|
|
224
|
+
"lint-staged": "^15.2.5",
|
|
225
225
|
"lodash": "^4.17.21",
|
|
226
226
|
"markdown-table": "^3.0.3",
|
|
227
227
|
"node-fetch": "^3.3.2",
|
|
@@ -232,7 +232,7 @@
|
|
|
232
232
|
"remark-parse": "^10.0.2",
|
|
233
233
|
"semantic-release": "^21.1.2",
|
|
234
234
|
"stylelint": "^15.11.0",
|
|
235
|
-
"tsx": "^4.
|
|
235
|
+
"tsx": "^4.11.0",
|
|
236
236
|
"typescript": "^5.4.5",
|
|
237
237
|
"unified": "^11.0.4",
|
|
238
238
|
"unist-util-visit": "^5.0.0",
|
|
@@ -40,6 +40,8 @@ const SessionPanel = memo<PropsWithChildren>(({ children }) => {
|
|
|
40
40
|
const handleSizeChange: DraggablePanelProps['onSizeChange'] = (_, size) => {
|
|
41
41
|
if (!size) return;
|
|
42
42
|
const nextWidth = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
|
|
43
|
+
if (!nextWidth) return;
|
|
44
|
+
|
|
43
45
|
if (isEqual(nextWidth, sessionsWidth)) return;
|
|
44
46
|
setWidth(nextWidth);
|
|
45
47
|
updatePreference({ sessionsWidth: nextWidth });
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Divider } from 'antd';
|
|
2
|
+
import { useTheme } from 'antd-style';
|
|
3
|
+
import numeral from 'numeral';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Flexbox } from 'react-layout-kit';
|
|
6
|
+
|
|
7
|
+
interface TokenProgressItem {
|
|
8
|
+
color: string;
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
value: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface TokenProgressProps {
|
|
15
|
+
data: TokenProgressItem[];
|
|
16
|
+
showIcon?: boolean;
|
|
17
|
+
showTotal?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const format = (number: number) => numeral(number).format('0,0');
|
|
21
|
+
|
|
22
|
+
const TokenProgress = memo<TokenProgressProps>(({ data, showIcon, showTotal }) => {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const total = data.reduce((acc, item) => acc + item.value, 0);
|
|
25
|
+
return (
|
|
26
|
+
<Flexbox gap={8} style={{ position: 'relative' }} width={'100%'}>
|
|
27
|
+
<Flexbox
|
|
28
|
+
height={6}
|
|
29
|
+
horizontal
|
|
30
|
+
style={{
|
|
31
|
+
background: total === 0 ? theme.colorFill : undefined,
|
|
32
|
+
borderRadius: 3,
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
position: 'relative',
|
|
35
|
+
}}
|
|
36
|
+
width={'100%'}
|
|
37
|
+
>
|
|
38
|
+
{data.map((item) => (
|
|
39
|
+
<Flexbox
|
|
40
|
+
height={'100%'}
|
|
41
|
+
key={item.id}
|
|
42
|
+
style={{ background: item.color, flex: item.value }}
|
|
43
|
+
/>
|
|
44
|
+
))}
|
|
45
|
+
</Flexbox>
|
|
46
|
+
<Flexbox>
|
|
47
|
+
{data.map((item) => (
|
|
48
|
+
<Flexbox align={'center'} gap={4} horizontal justify={'space-between'} key={item.id}>
|
|
49
|
+
<Flexbox align={'center'} gap={4} horizontal>
|
|
50
|
+
{showIcon && (
|
|
51
|
+
<div
|
|
52
|
+
style={{
|
|
53
|
+
background: item.color,
|
|
54
|
+
borderRadius: '50%',
|
|
55
|
+
flex: 'none',
|
|
56
|
+
height: 6,
|
|
57
|
+
width: 6,
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
<div style={{ color: theme.colorTextSecondary }}>{item.title}</div>
|
|
62
|
+
</Flexbox>
|
|
63
|
+
<div style={{ fontWeight: 500 }}>{format(item.value)}</div>
|
|
64
|
+
</Flexbox>
|
|
65
|
+
))}
|
|
66
|
+
{showTotal && (
|
|
67
|
+
<>
|
|
68
|
+
<Divider style={{ marginBlock: 8 }} />
|
|
69
|
+
<Flexbox align={'center'} gap={4} horizontal justify={'space-between'}>
|
|
70
|
+
<div style={{ color: theme.colorTextSecondary }}>{showTotal}</div>
|
|
71
|
+
<div style={{ fontWeight: 500 }}>{format(total)}</div>
|
|
72
|
+
</Flexbox>
|
|
73
|
+
</>
|
|
74
|
+
)}
|
|
75
|
+
</Flexbox>
|
|
76
|
+
</Flexbox>
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export default TokenProgress;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { TokenTag, Tooltip } from '@lobehub/ui';
|
|
2
|
+
import { Popover } from 'antd';
|
|
3
|
+
import { useTheme } from 'antd-style';
|
|
2
4
|
import numeral from 'numeral';
|
|
3
5
|
import { memo } from 'react';
|
|
4
6
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
import { Center, Flexbox } from 'react-layout-kit';
|
|
6
8
|
|
|
7
9
|
import { useTokenCount } from '@/hooks/useTokenCount';
|
|
8
10
|
import { useAgentStore } from '@/store/agent';
|
|
@@ -14,10 +16,11 @@ import { toolSelectors } from '@/store/tool/selectors';
|
|
|
14
16
|
import { useUserStore } from '@/store/user';
|
|
15
17
|
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
import TokenProgress from './TokenProgress';
|
|
18
20
|
|
|
19
21
|
const Token = memo(() => {
|
|
20
|
-
const { t } = useTranslation('chat');
|
|
22
|
+
const { t } = useTranslation(['chat', 'components']);
|
|
23
|
+
const theme = useTheme();
|
|
21
24
|
|
|
22
25
|
const [input, messageString] = useChatStore((s) => [
|
|
23
26
|
s.inputMessage,
|
|
@@ -55,38 +58,79 @@ const Token = memo(() => {
|
|
|
55
58
|
|
|
56
59
|
// Total token
|
|
57
60
|
const totalToken = systemRoleToken + toolsToken + chatsToken;
|
|
61
|
+
|
|
62
|
+
const content = (
|
|
63
|
+
<Flexbox gap={12} style={{ minWidth: 200 }}>
|
|
64
|
+
<Flexbox align={'center'} gap={4} horizontal justify={'space-between'} width={'100%'}>
|
|
65
|
+
<div style={{ color: theme.colorTextDescription }}>{t('tokenDetails.title')}</div>
|
|
66
|
+
<Tooltip
|
|
67
|
+
overlayStyle={{ maxWidth: 'unset', pointerEvents: 'none' }}
|
|
68
|
+
title={t('ModelSelect.featureTag.tokens', {
|
|
69
|
+
ns: 'components',
|
|
70
|
+
tokens: numeral(maxTokens).format('0,0'),
|
|
71
|
+
})}
|
|
72
|
+
>
|
|
73
|
+
<Center
|
|
74
|
+
height={20}
|
|
75
|
+
paddingInline={4}
|
|
76
|
+
style={{
|
|
77
|
+
background: theme.colorFillTertiary,
|
|
78
|
+
borderRadius: 4,
|
|
79
|
+
color: theme.colorTextSecondary,
|
|
80
|
+
fontFamily: theme.fontFamilyCode,
|
|
81
|
+
fontSize: 11,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
TOKEN
|
|
85
|
+
</Center>
|
|
86
|
+
</Tooltip>
|
|
87
|
+
</Flexbox>
|
|
88
|
+
<TokenProgress
|
|
89
|
+
data={[
|
|
90
|
+
{
|
|
91
|
+
color: theme.magenta,
|
|
92
|
+
id: 'systemRole',
|
|
93
|
+
title: t('tokenDetails.systemRole'),
|
|
94
|
+
value: systemRoleToken,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
color: theme.geekblue,
|
|
98
|
+
id: 'tools',
|
|
99
|
+
title: t('tokenDetails.tools'),
|
|
100
|
+
value: toolsToken,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
color: theme.gold,
|
|
104
|
+
id: 'chats',
|
|
105
|
+
title: t('tokenDetails.chats'),
|
|
106
|
+
value: chatsToken,
|
|
107
|
+
},
|
|
108
|
+
]}
|
|
109
|
+
showIcon
|
|
110
|
+
/>
|
|
111
|
+
<TokenProgress
|
|
112
|
+
data={[
|
|
113
|
+
{
|
|
114
|
+
color: theme.colorSuccess,
|
|
115
|
+
id: 'used',
|
|
116
|
+
title: t('tokenDetails.used'),
|
|
117
|
+
value: totalToken,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
color: theme.colorFill,
|
|
121
|
+
id: 'rest',
|
|
122
|
+
title: t('tokenDetails.rest'),
|
|
123
|
+
value: maxTokens - totalToken,
|
|
124
|
+
},
|
|
125
|
+
]}
|
|
126
|
+
showIcon
|
|
127
|
+
showTotal={t('tokenDetails.total')}
|
|
128
|
+
/>
|
|
129
|
+
</Flexbox>
|
|
130
|
+
);
|
|
131
|
+
|
|
58
132
|
return (
|
|
59
|
-
<
|
|
60
|
-
placement={'bottom'}
|
|
61
|
-
title={
|
|
62
|
-
<Flexbox width={150}>
|
|
63
|
-
<Flexbox horizontal justify={'space-between'}>
|
|
64
|
-
<span>{t('tokenDetails.systemRole')}</span>
|
|
65
|
-
<span>{format(systemRoleToken)}</span>
|
|
66
|
-
</Flexbox>
|
|
67
|
-
<Flexbox horizontal justify={'space-between'}>
|
|
68
|
-
<span>{t('tokenDetails.tools')}</span>
|
|
69
|
-
<span>{format(toolsToken)}</span>
|
|
70
|
-
</Flexbox>
|
|
71
|
-
<Flexbox horizontal justify={'space-between'}>
|
|
72
|
-
<span>{t('tokenDetails.chats')}</span>
|
|
73
|
-
<span>{format(chatsToken)}</span>
|
|
74
|
-
</Flexbox>
|
|
75
|
-
<Flexbox horizontal justify={'space-between'}>
|
|
76
|
-
<span>{t('tokenDetails.used')}</span>
|
|
77
|
-
<span>{format(totalToken)}</span>
|
|
78
|
-
</Flexbox>
|
|
79
|
-
<Flexbox horizontal justify={'space-between'} style={{ marginTop: 8 }}>
|
|
80
|
-
<span>{t('tokenDetails.total')}</span>
|
|
81
|
-
<span>{format(maxTokens)}</span>
|
|
82
|
-
</Flexbox>
|
|
83
|
-
<Flexbox horizontal justify={'space-between'}>
|
|
84
|
-
<span>{t('tokenDetails.rest')}</span>
|
|
85
|
-
<span>{format(maxTokens - totalToken)}</span>
|
|
86
|
-
</Flexbox>
|
|
87
|
-
</Flexbox>
|
|
88
|
-
}
|
|
89
|
-
>
|
|
133
|
+
<Popover arrow={false} content={content} placement={'top'} trigger={['hover', 'click']}>
|
|
90
134
|
<TokenTag
|
|
91
135
|
displayMode={'used'}
|
|
92
136
|
maxValue={maxTokens}
|
|
@@ -98,7 +142,7 @@ const Token = memo(() => {
|
|
|
98
142
|
}}
|
|
99
143
|
value={totalToken}
|
|
100
144
|
/>
|
|
101
|
-
</
|
|
145
|
+
</Popover>
|
|
102
146
|
);
|
|
103
147
|
});
|
|
104
148
|
|