diff --git a/gui/src/components/mainInput/ContextStatus.tsx b/gui/src/components/mainInput/ContextStatus.tsx
index 3ee97cbab..2d5c1f5cb 100644
--- a/gui/src/components/mainInput/ContextStatus.tsx
+++ b/gui/src/components/mainInput/ContextStatus.tsx
@@ -1,52 +1,63 @@
+import { Tooltip } from "react-tooltip";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { saveCurrentSession } from "../../redux/thunks/session";
-import { ToolTip } from "../gui/Tooltip";
const ContextStatus = () => {
const dispatch = useAppDispatch();
const contextPercentage = useAppSelector(
(state) => state.session.contextPercentage,
);
+ const history = useAppSelector((state) => state.session.history);
const percent = Math.round((contextPercentage ?? 0) * 100);
const isPruned = useAppSelector((state) => state.session.isPruned);
if (!isPruned && percent < 60) {
return null;
}
- return (
-
-
{
- dispatch(
- saveCurrentSession({
- openNewSession: true,
- generateTitle: false,
- }),
- );
- }}
- >
- New Session
-
- {contextPercentage !== undefined && (
- <>
-
{percent}%
-
- {`${percent}% of context is filled`}
-
- >
- )}
- {isPruned && (
- <>
-
-
- Chat history exceeds context limit, old messages are being removed
-
- >
- )}
+ const barColorClass = percent > 80 ? "bg-warning" : "bg-description";
+
+ return (
+
+
+
+ {`${percent}% of context filled`}
+ {isPruned && Old messages are being removed}
+ {history.length > 0 && (
+ {
+ dispatch(
+ saveCurrentSession({
+ openNewSession: true,
+ generateTitle: false,
+ }),
+ );
+ }}
+ >
+ New Session
+
+ )}
+
+
+
);
};
diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx
index 4967c9d90..9be9f25d9 100644
--- a/gui/src/components/mainInput/InputToolbar.tsx
+++ b/gui/src/components/mainInput/InputToolbar.tsx
@@ -19,6 +19,7 @@ import ModelSelect from "../modelSelection/ModelSelect";
import { ModeSelect } from "../ModeSelect";
import { Button } from "../ui";
import { useFontSize } from "../ui/font";
+import ContextStatus from "./ContextStatus";
import HoverItem from "./InputToolbar/HoverItem";
export interface ToolbarOptions {
@@ -170,6 +171,7 @@ function InputToolbar(props: InputToolbarProps) {
fontSize: tinyFont,
}}
>
+ {!isInEdit &&
}
{!props.toolbarOptions?.hideUseCodebase && !isInEdit && (
)}
-
-
-
-
{!hasDismissedExploreDialog &&