diff --git a/src/components/ConnectionSidebar.tsx b/src/components/ConnectionSidebar.tsx index b7aca7fc..e3da7398 100644 --- a/src/components/ConnectionSidebar.tsx +++ b/src/components/ConnectionSidebar.tsx @@ -9,7 +9,7 @@ import Icon from "./Icon"; import DarkModeSwitch from "./DarkModeSwitch"; import ConnectionList from "./Sidebar/ConnectionList"; import QuotaView from "./QuotaView"; -import { countTextTokens, hasFeature } from "../utils"; +import { countTextTokens, getModel, hasFeature } from "../utils"; import SettingAvatarIcon from "./SettingAvatarIcon"; import Checkbox from "./kit/Checkbox"; @@ -33,6 +33,7 @@ const ConnectionSidebar = () => { conversationStore.getConversationById(conversationStore.currentConversationId)?.selectedSchemaName || ""; const tableSchemaLoadingState = useLoading(); const currentConversation = conversationStore.getConversationById(conversationStore.currentConversationId); + const maxToken = getModel(settingStore.setting.openAIApiConfig?.model || "").max_token; const [totalToken, setTotalToken] = useState(0); useEffect(() => { updateHasSchemaProperty( @@ -193,7 +194,7 @@ const ConnectionSidebar = () => { {databaseList.length > 0 && (
{ return { @@ -243,10 +244,15 @@ const ConnectionSidebar = () => { ))}
-
-
- {t("connection.total-token")} {totalToken} -
+
+ {currentConnectionCtx && ( +
+
{t("connection.total-token")}
+
+ {totalToken}/{maxToken} +
+
+ )} {!settingStore.setting.openAIApiConfig?.key && hasFeature("quota") && (
diff --git a/src/components/kit/Checkbox.tsx b/src/components/kit/Checkbox.tsx index d292b8e6..f64abe63 100644 --- a/src/components/kit/Checkbox.tsx +++ b/src/components/kit/Checkbox.tsx @@ -11,7 +11,7 @@ const Checkbox = (props: CheckboxProps & { children?: ReactNode }) => { const { value, label, onValueChange, children } = props; return (
-
+
onValueChange(label, value)} @@ -22,7 +22,7 @@ const Checkbox = (props: CheckboxProps & { children?: ReactNode }) => { -