From 76351296a1acda50afea72508b5f09ac85c073be Mon Sep 17 00:00:00 2001 From: CanisMinor Date: Sat, 25 May 2024 21:44:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20Update=20token=20tag=20?= =?UTF-8?q?popover=20style=20(#2631)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 💄 style: Update token tag popover style * 💄 style: Fix empty status * 💄 style: Fix width * 💄 style: Change num font family * 💄 style: Add title * 💄 style: Change fontfamily --- locales/ar/chat.json | 1 + locales/ar/components.json | 3 +- locales/bg-BG/chat.json | 1 + locales/bg-BG/components.json | 3 +- locales/de-DE/chat.json | 1 + locales/de-DE/components.json | 3 +- locales/en-US/chat.json | 1 + locales/en-US/components.json | 3 +- locales/es-ES/chat.json | 1 + locales/es-ES/components.json | 3 +- locales/fr-FR/chat.json | 1 + locales/fr-FR/components.json | 3 +- locales/it-IT/chat.json | 1 + locales/it-IT/components.json | 3 +- locales/ja-JP/chat.json | 1 + locales/ja-JP/components.json | 3 +- locales/ko-KR/chat.json | 1 + locales/ko-KR/components.json | 3 +- locales/nl-NL/chat.json | 1 + locales/nl-NL/components.json | 3 +- locales/pl-PL/chat.json | 1 + locales/pl-PL/components.json | 3 +- locales/pt-BR/chat.json | 1 + locales/pt-BR/components.json | 3 +- locales/ru-RU/chat.json | 1 + locales/ru-RU/components.json | 3 +- locales/tr-TR/chat.json | 1 + locales/tr-TR/components.json | 3 +- locales/vi-VN/chat.json | 1 + locales/vi-VN/components.json | 3 +- locales/zh-CN/chat.json | 1 + locales/zh-CN/components.json | 3 +- locales/zh-TW/chat.json | 1 + locales/zh-TW/components.json | 3 +- .../ActionBar/Token/TokenProgress.tsx | 80 ++++++++++++ .../ChatInput/ActionBar/Token/TokenTag.tsx | 114 ++++++++++++------ src/locales/default/chat.ts | 1 + 37 files changed, 211 insertions(+), 52 deletions(-) create mode 100644 src/features/ChatInput/ActionBar/Token/TokenProgress.tsx diff --git a/locales/ar/chat.json b/locales/ar/chat.json index 2b97e2e878e0..131b51244c72 100644 --- a/locales/ar/chat.json +++ b/locales/ar/chat.json @@ -84,6 +84,7 @@ "chats": "رسائل المحادثة", "rest": "المتبقي", "systemRole": "تعيين الدور", + "title": "تفاصيل الرمز", "tools": "تعيين الإضافات", "total": "الإجمالي", "used": "المستخدم" diff --git a/locales/ar/components.json b/locales/ar/components.json index 2460ce666cd7..d487f86aac98 100644 --- a/locales/ar/components.json +++ b/locales/ar/components.json @@ -6,7 +6,8 @@ "functionCall": "يدعم هذا النموذج استدعاء الوظائف", "tokens": "يدعم هذا النموذج حتى {{tokens}} رمزًا في جلسة واحدة", "vision": "يدعم هذا النموذج التعرف البصري" - } + }, + "removed": "هذا النموذج لم يعد متوفر في القائمة، سيتم إزالته تلقائيًا إذا تم إلغاء تحديده" }, "ModelSwitchPanel": { "emptyModel": "لا توجد نماذج ممكن تمكينها، يرجى الانتقال إلى الإعدادات لتمكينها", diff --git a/locales/bg-BG/chat.json b/locales/bg-BG/chat.json index f5adf866453c..02108a7bc78c 100644 --- a/locales/bg-BG/chat.json +++ b/locales/bg-BG/chat.json @@ -84,6 +84,7 @@ "chats": "Чат съобщения", "rest": "Оставащи", "systemRole": "Настройки на ролята", + "title": "Детайли на токена", "tools": "Настройки на плъгина", "total": "Общо налични", "used": "Общо използвани" diff --git a/locales/bg-BG/components.json b/locales/bg-BG/components.json index af0c1803fb91..e8941dc8716d 100644 --- a/locales/bg-BG/components.json +++ b/locales/bg-BG/components.json @@ -6,7 +6,8 @@ "functionCall": "Този модел поддържа функционални обаждания (Function Call)", "tokens": "Този модел поддържа до {{tokens}} токена за една сесия", "vision": "Този модел поддържа визуално разпознаване" - } + }, + "removed": "Този модел не се намира в списъка. Ако бъде отменен изборът, той ще бъде автоматично премахнат." }, "ModelSwitchPanel": { "emptyModel": "Няма активирани модели, моля, посетете настройките и ги активирайте", diff --git a/locales/de-DE/chat.json b/locales/de-DE/chat.json index afb64db6f6e2..364244a0b63f 100644 --- a/locales/de-DE/chat.json +++ b/locales/de-DE/chat.json @@ -84,6 +84,7 @@ "chats": "Chats", "rest": "Verbleibend", "systemRole": "Systemrolle", + "title": "Kontextdetails", "tools": "Werkzeuge", "total": "Insgesamt", "used": "Verwendet" diff --git a/locales/de-DE/components.json b/locales/de-DE/components.json index 800f50455452..9b191cc794ee 100644 --- a/locales/de-DE/components.json +++ b/locales/de-DE/components.json @@ -6,7 +6,8 @@ "functionCall": "Dieses Modell unterstützt Funktionsaufrufe.", "tokens": "Dieses Modell unterstützt maximal {{tokens}} Tokens pro Sitzung.", "vision": "Dieses Modell unterstützt die visuelle Erkennung." - } + }, + "removed": "Das Modell wurde aus der Liste entfernt. Wenn Sie die Auswahl aufheben, wird es automatisch entfernt." }, "ModelSwitchPanel": { "emptyModel": "Kein aktiviertes Modell. Bitte gehen Sie zu den Einstellungen, um es zu aktivieren.", diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json index 7b55ecf7d48b..0d67fcbacd2b 100644 --- a/locales/en-US/chat.json +++ b/locales/en-US/chat.json @@ -84,6 +84,7 @@ "chats": "Chat Messages", "rest": "Remaining", "systemRole": "Role Settings", + "title": "Context Details", "tools": "Plugin Settings", "total": "Total Available", "used": "Total Used" diff --git a/locales/en-US/components.json b/locales/en-US/components.json index 81d811b2b1a7..039be80fa7f3 100644 --- a/locales/en-US/components.json +++ b/locales/en-US/components.json @@ -6,7 +6,8 @@ "functionCall": "This model supports function call.", "tokens": "This model supports up to {{tokens}} tokens in a single session.", "vision": "This model supports visual recognition." - } + }, + "removed": "The model is not in the list. It will be automatically removed if deselected." }, "ModelSwitchPanel": { "emptyModel": "No enabled model. Please go to settings to enable.", diff --git a/locales/es-ES/chat.json b/locales/es-ES/chat.json index eb26ac16a145..4e6f8800c8a3 100644 --- a/locales/es-ES/chat.json +++ b/locales/es-ES/chat.json @@ -84,6 +84,7 @@ "chats": "Mensajes de chat", "rest": "Restante", "systemRole": "Rol del sistema", + "title": "Detalles del token", "tools": "Herramientas", "total": "Total", "used": "Utilizado" diff --git a/locales/es-ES/components.json b/locales/es-ES/components.json index 9100ef1a7e0f..333448d1c251 100644 --- a/locales/es-ES/components.json +++ b/locales/es-ES/components.json @@ -6,7 +6,8 @@ "functionCall": "Este modelo admite llamadas de función.", "tokens": "Este modelo admite un máximo de {{tokens}} tokens por sesión.", "vision": "Este modelo admite el reconocimiento visual." - } + }, + "removed": "El modelo no está en la lista, se eliminará automáticamente si se cancela la selección" }, "ModelSwitchPanel": { "emptyModel": "No hay modelos habilitados. Vaya a la configuración para habilitarlos.", diff --git a/locales/fr-FR/chat.json b/locales/fr-FR/chat.json index 2bd211d418bc..bfe5026b4de4 100644 --- a/locales/fr-FR/chat.json +++ b/locales/fr-FR/chat.json @@ -84,6 +84,7 @@ "chats": "Messages de discussion", "rest": "Restant disponible", "systemRole": "Rôle système", + "title": "Détails du jeton", "tools": "Paramètres du plugin", "total": "Total disponible", "used": "Total utilisé" diff --git a/locales/fr-FR/components.json b/locales/fr-FR/components.json index c68aca4af7a0..3a031a26939d 100644 --- a/locales/fr-FR/components.json +++ b/locales/fr-FR/components.json @@ -6,7 +6,8 @@ "functionCall": "Ce modèle prend en charge les appels de fonction.", "tokens": "Ce modèle prend en charge jusqu'à {{tokens}} jetons par session.", "vision": "Ce modèle prend en charge la reconnaissance visuelle." - } + }, + "removed": "Le modèle n'est pas dans la liste, il sera automatiquement supprimé si vous annulez la sélection" }, "ModelSwitchPanel": { "emptyModel": "Aucun modèle activé. Veuillez vous rendre dans les paramètres pour l'activer.", diff --git a/locales/it-IT/chat.json b/locales/it-IT/chat.json index 02f6e813ea60..55ba9727925a 100644 --- a/locales/it-IT/chat.json +++ b/locales/it-IT/chat.json @@ -84,6 +84,7 @@ "chats": "Chat", "rest": "Rimanenti", "systemRole": "Ruolo di sistema", + "title": "Dettagli del Token", "tools": "Strumenti", "total": "Totale", "used": "Utilizzati" diff --git a/locales/it-IT/components.json b/locales/it-IT/components.json index c118c0f71c70..59dc611e29ca 100644 --- a/locales/it-IT/components.json +++ b/locales/it-IT/components.json @@ -6,7 +6,8 @@ "functionCall": "Questo modello supporta la chiamata di funzioni.", "tokens": "Questo modello supporta un massimo di {{tokens}} token per sessione.", "vision": "Questo modello supporta il riconoscimento visivo." - } + }, + "removed": "Il modello non è più nella lista, verrà rimosso automaticamente se deselezionato" }, "ModelSwitchPanel": { "emptyModel": "Nessun modello attivo. Vai alle impostazioni per attivarne uno.", diff --git a/locales/ja-JP/chat.json b/locales/ja-JP/chat.json index b355ade3ac5b..ea6f16256e61 100644 --- a/locales/ja-JP/chat.json +++ b/locales/ja-JP/chat.json @@ -84,6 +84,7 @@ "chats": "チャットメッセージ", "rest": "残り利用可能", "systemRole": "システムロール設定", + "title": "コンテキストの詳細", "tools": "ツール設定", "total": "合計利用可能", "used": "合計使用" diff --git a/locales/ja-JP/components.json b/locales/ja-JP/components.json index ca36296ac429..e6239545c4ef 100644 --- a/locales/ja-JP/components.json +++ b/locales/ja-JP/components.json @@ -6,7 +6,8 @@ "functionCall": "このモデルは関数呼び出し(Function Call)をサポートしています。", "tokens": "このモデルは1つのセッションあたり最大{{tokens}}トークンをサポートしています。", "vision": "このモデルはビジョン認識をサポートしています。" - } + }, + "removed": "選択されたモデルはリストから削除されました。選択を解除すると自動的に削除されます。" }, "ModelSwitchPanel": { "emptyModel": "有効なモデルがありません。設定に移動して有効にしてください。", diff --git a/locales/ko-KR/chat.json b/locales/ko-KR/chat.json index d041fe9abe80..d7defb8c1d43 100644 --- a/locales/ko-KR/chat.json +++ b/locales/ko-KR/chat.json @@ -84,6 +84,7 @@ "chats": "채팅 메시지", "rest": "남은 사용량", "systemRole": "시스템 역할", + "title": "컨텍스트 세부 정보", "tools": "도구 설정", "total": "총 사용량", "used": "총 사용" diff --git a/locales/ko-KR/components.json b/locales/ko-KR/components.json index bd4213e1a045..1183bb946b0c 100644 --- a/locales/ko-KR/components.json +++ b/locales/ko-KR/components.json @@ -6,7 +6,8 @@ "functionCall": "이 모델은 함수 호출을 지원합니다", "tokens": "이 모델은 단일 세션당 최대 {{tokens}} 토큰을 지원합니다", "vision": "이 모델은 시각 인식을 지원합니다" - } + }, + "removed": "모델이 목록에서 제거되었습니다. 선택이 취소되면 자동으로 제거됩니다." }, "ModelSwitchPanel": { "emptyModel": "활성화된 모델이 없습니다. 설정으로 이동하여 활성화하세요", diff --git a/locales/nl-NL/chat.json b/locales/nl-NL/chat.json index a497c34dec51..f1ed9e6e1ea7 100644 --- a/locales/nl-NL/chat.json +++ b/locales/nl-NL/chat.json @@ -84,6 +84,7 @@ "chats": "Chats", "rest": "Rust", "systemRole": "Systeemrol", + "title": "Contextuele details", "tools": "Tools", "total": "Totaal", "used": "Gebruikt" diff --git a/locales/nl-NL/components.json b/locales/nl-NL/components.json index b1a2cb874327..a96f2d92c00d 100644 --- a/locales/nl-NL/components.json +++ b/locales/nl-NL/components.json @@ -6,7 +6,8 @@ "functionCall": "This model supports function call.", "tokens": "This model supports up to {{tokens}} tokens in a single session.", "vision": "This model supports visual recognition." - } + }, + "removed": "Dit model staat niet meer in de lijst. Als je het deselecteert, wordt het automatisch verwijderd." }, "ModelSwitchPanel": { "emptyModel": "No enabled model, please go to settings to enable.", diff --git a/locales/pl-PL/chat.json b/locales/pl-PL/chat.json index ac58833d19c7..199401d9241f 100644 --- a/locales/pl-PL/chat.json +++ b/locales/pl-PL/chat.json @@ -84,6 +84,7 @@ "chats": "Rozmowy", "rest": "Pozostałe", "systemRole": "Rola systemowa", + "title": "Szczegóły tokena", "tools": "Narzędzia", "total": "Razem", "used": "Wykorzystane" diff --git a/locales/pl-PL/components.json b/locales/pl-PL/components.json index ead9a2de3a44..0191e3767eae 100644 --- a/locales/pl-PL/components.json +++ b/locales/pl-PL/components.json @@ -6,7 +6,8 @@ "functionCall": "Ten model obsługuje wywołania funkcji (Function Call).", "tokens": "Ten model obsługuje maksymalnie {{tokens}} tokenów w pojedynczej sesji.", "vision": "Ten model obsługuje rozpoznawanie wizualne." - } + }, + "removed": "Ten model nie znajduje się na liście, jeśli zostanie odznaczony, zostanie automatycznie usunięty" }, "ModelSwitchPanel": { "emptyModel": "Brak włączonych modeli, przejdź do ustawień i włącz je", diff --git a/locales/pt-BR/chat.json b/locales/pt-BR/chat.json index 3d2da42cf1c1..946632a5a98d 100644 --- a/locales/pt-BR/chat.json +++ b/locales/pt-BR/chat.json @@ -84,6 +84,7 @@ "chats": "Mensagens de bate-papo", "rest": "Restante disponível", "systemRole": "Configuração de papel do sistema", + "title": "Detalhes do Token", "tools": "Configuração de plug-ins", "total": "Total disponível", "used": "Total utilizado" diff --git a/locales/pt-BR/components.json b/locales/pt-BR/components.json index cc35a341689a..48b1edcd3770 100644 --- a/locales/pt-BR/components.json +++ b/locales/pt-BR/components.json @@ -6,7 +6,8 @@ "functionCall": "Este modelo suporta chamadas de função.", "tokens": "Este modelo suporta no máximo {{tokens}} tokens por sessão.", "vision": "Este modelo suporta reconhecimento visual." - } + }, + "removed": "Este modelo não está na lista, se for desmarcado, será removido automaticamente" }, "ModelSwitchPanel": { "emptyModel": "Nenhum modelo habilitado. Por favor, vá para as configurações e habilite um.", diff --git a/locales/ru-RU/chat.json b/locales/ru-RU/chat.json index 69ef59df9fef..176f194f6885 100644 --- a/locales/ru-RU/chat.json +++ b/locales/ru-RU/chat.json @@ -84,6 +84,7 @@ "chats": "Чаты", "rest": "Остаток", "systemRole": "Роль системы", + "title": "Детали контекста", "tools": "Инструменты", "total": "Всего", "used": "Использовано" diff --git a/locales/ru-RU/components.json b/locales/ru-RU/components.json index 21d35c3c86b9..9b80b2a82faf 100644 --- a/locales/ru-RU/components.json +++ b/locales/ru-RU/components.json @@ -6,7 +6,8 @@ "functionCall": "Эта модель поддерживает вызов функций", "tokens": "Эта модель поддерживает до {{tokens}} токенов в одной сессии", "vision": "Эта модель поддерживает распознавание изображений" - } + }, + "removed": "Эта модель не находится в списке. Если вы ее отмените, она будет автоматически удалена" }, "ModelSwitchPanel": { "emptyModel": "Нет активированных моделей. Пожалуйста, перейдите в настройки и включите модель", diff --git a/locales/tr-TR/chat.json b/locales/tr-TR/chat.json index b817a8e69d0b..71ee475e4dcf 100644 --- a/locales/tr-TR/chat.json +++ b/locales/tr-TR/chat.json @@ -84,6 +84,7 @@ "chats": "Sohbetler", "rest": "Kalan", "systemRole": "Sistem Rolü", + "title": "Bağlam Detayları", "tools": "Araçlar", "total": "Toplam", "used": "Kullanılan" diff --git a/locales/tr-TR/components.json b/locales/tr-TR/components.json index 755db5663169..56cf2244fe3c 100644 --- a/locales/tr-TR/components.json +++ b/locales/tr-TR/components.json @@ -6,7 +6,8 @@ "functionCall": "Bu model fonksiyon çağrısını destekler", "tokens": "Bu model tek bir oturumda en fazla {{tokens}} Token destekler", "vision": "Bu model görüntü tanımıyı destekler" - } + }, + "removed": "Bu model listeden çıkarıldı, seçiminizi kaldırırsanız otomatik olarak kaldırılacaktır" }, "ModelSwitchPanel": { "emptyModel": "Etkinleştirilmiş model bulunmamaktadır, lütfen ayarlara giderek açın", diff --git a/locales/vi-VN/chat.json b/locales/vi-VN/chat.json index b9f2ac55228d..48867185a192 100644 --- a/locales/vi-VN/chat.json +++ b/locales/vi-VN/chat.json @@ -84,6 +84,7 @@ "chats": "Tin nhắn trò chuyện", "rest": "Còn lại", "systemRole": "Vai trò hệ thống", + "title": "Chi tiết Ngữ cảnh", "tools": "Công cụ", "total": "Tổng cộng", "used": "Đã sử dụng" diff --git a/locales/vi-VN/components.json b/locales/vi-VN/components.json index 1f0fb5919979..648d69c69313 100644 --- a/locales/vi-VN/components.json +++ b/locales/vi-VN/components.json @@ -6,7 +6,8 @@ "functionCall": "Mô hình này hỗ trợ cuộc gọi hàm (Function Call)", "tokens": "Mỗi phiên của mô hình này hỗ trợ tối đa {{tokens}} Tokens", "vision": "Mô hình này hỗ trợ nhận diện hình ảnh" - } + }, + "removed": "Mô hình này không còn trong danh sách, nếu bỏ chọn sẽ tự động xóa" }, "ModelSwitchPanel": { "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", diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json index c07b9f01f3c9..f640e86407cc 100644 --- a/locales/zh-CN/chat.json +++ b/locales/zh-CN/chat.json @@ -84,6 +84,7 @@ "chats": "会话消息", "rest": "剩余可用", "systemRole": "角色设定", + "title": "上下文明细", "tools": "插件设定", "total": "总共可用", "used": "总计使用" diff --git a/locales/zh-CN/components.json b/locales/zh-CN/components.json index c431ba382188..b38762c584ea 100644 --- a/locales/zh-CN/components.json +++ b/locales/zh-CN/components.json @@ -6,7 +6,8 @@ "functionCall": "该模型支持函数调用(Function Call)", "tokens": "该模型单个会话最多支持 {{tokens}} Tokens", "vision": "该模型支持视觉识别" - } + }, + "removed": "该模型不在列表中,若取消选中将会自动移除" }, "ModelSwitchPanel": { "emptyModel": "没有启用的模型,请前往设置开启", diff --git a/locales/zh-TW/chat.json b/locales/zh-TW/chat.json index 5fc9bfc2915e..e2e6c4c1dec2 100644 --- a/locales/zh-TW/chat.json +++ b/locales/zh-TW/chat.json @@ -84,6 +84,7 @@ "chats": "聊天訊息", "rest": "剩餘可用", "systemRole": "角色設定", + "title": "上下文詳細資訊", "tools": "外掛程式設定", "total": "總共可用", "used": "總計使用" diff --git a/locales/zh-TW/components.json b/locales/zh-TW/components.json index 303c926477bf..5aaf85e96c6b 100644 --- a/locales/zh-TW/components.json +++ b/locales/zh-TW/components.json @@ -6,7 +6,8 @@ "functionCall": "該模型支援函式呼叫(Function Call)", "tokens": "該模型單一會話最多支援 {{tokens}} Tokens", "vision": "該模型支援視覺辨識" - } + }, + "removed": "該模型不在清單中,若取消選取將會自動移除" }, "ModelSwitchPanel": { "emptyModel": "沒有啟用的模型,請前往設定開啟", diff --git a/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx b/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx new file mode 100644 index 000000000000..0e1d93a6dd07 --- /dev/null +++ b/src/features/ChatInput/ActionBar/Token/TokenProgress.tsx @@ -0,0 +1,80 @@ +import { Divider } from 'antd'; +import { useTheme } from 'antd-style'; +import numeral from 'numeral'; +import { memo } from 'react'; +import { Flexbox } from 'react-layout-kit'; + +interface TokenProgressItem { + color: string; + id: string; + title: string; + value: number; +} + +interface TokenProgressProps { + data: TokenProgressItem[]; + showIcon?: boolean; + showTotal?: string; +} + +const format = (number: number) => numeral(number).format('0,0'); + +const TokenProgress = memo(({ data, showIcon, showTotal }) => { + const theme = useTheme(); + const total = data.reduce((acc, item) => acc + item.value, 0); + return ( + + + {data.map((item) => ( + + ))} + + + {data.map((item) => ( + + + {showIcon && ( +
+ )} +
{item.title}
+ +
{format(item.value)}
+ + ))} + {showTotal && ( + <> + + +
{showTotal}
+
{format(total)}
+
+ + )} + + + ); +}); + +export default TokenProgress; diff --git a/src/features/ChatInput/ActionBar/Token/TokenTag.tsx b/src/features/ChatInput/ActionBar/Token/TokenTag.tsx index ebcfb26dcdc9..5f9d56834e07 100644 --- a/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +++ b/src/features/ChatInput/ActionBar/Token/TokenTag.tsx @@ -1,8 +1,10 @@ import { TokenTag, Tooltip } from '@lobehub/ui'; +import { Popover } from 'antd'; +import { useTheme } from 'antd-style'; import numeral from 'numeral'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import { Flexbox } from 'react-layout-kit'; +import { Center, Flexbox } from 'react-layout-kit'; import { useTokenCount } from '@/hooks/useTokenCount'; import { useAgentStore } from '@/store/agent'; @@ -14,10 +16,11 @@ import { toolSelectors } from '@/store/tool/selectors'; import { useUserStore } from '@/store/user'; import { modelProviderSelectors } from '@/store/user/selectors'; -const format = (number: number) => numeral(number).format('0,0'); +import TokenProgress from './TokenProgress'; const Token = memo(() => { - const { t } = useTranslation('chat'); + const { t } = useTranslation(['chat', 'components']); + const theme = useTheme(); const [input, messageString] = useChatStore((s) => [ s.inputMessage, @@ -55,38 +58,79 @@ const Token = memo(() => { // Total token const totalToken = systemRoleToken + toolsToken + chatsToken; + + const content = ( + + +
{t('tokenDetails.title')}
+ +
+ TOKEN +
+
+
+ + +
+ ); + return ( - - - {t('tokenDetails.systemRole')} - {format(systemRoleToken)} - - - {t('tokenDetails.tools')} - {format(toolsToken)} - - - {t('tokenDetails.chats')} - {format(chatsToken)} - - - {t('tokenDetails.used')} - {format(totalToken)} - - - {t('tokenDetails.total')} - {format(maxTokens)} - - - {t('tokenDetails.rest')} - {format(maxTokens - totalToken)} - - - } - > + { }} value={totalToken} /> - + ); }); diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts index 90c4feb512e6..ca9940a83821 100644 --- a/src/locales/default/chat.ts +++ b/src/locales/default/chat.ts @@ -85,6 +85,7 @@ export default { chats: '会话消息', rest: '剩余可用', systemRole: '角色设定', + title: '上下文明细', tools: '插件设定', total: '总共可用', used: '总计使用',