Changesets · Branches · Tags · Compare
| Changeset | ef0e06d64dae0ba3f1872e91494d943e57a074512129078ad2fdd68d349c1917 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-07-18 02:42 +02:00 |
| Committer | Dallin Romney <dallinromney@gmail.com> · 2025-07-18 02:42 +02:00 |
| Parents | 9f61c1672388 |
4 files changed
modified gui/src/components/mainInput/ContextStatus.tsx +44 −33
| @@ -1,52 +1,63 @@ | ||
| 1 | +import { Tooltip } from "react-tooltip"; | |
| 1 | 2 | import { useAppDispatch, useAppSelector } from "../../redux/hooks"; |
| 2 | 3 | import { saveCurrentSession } from "../../redux/thunks/session"; |
| 3 | -import { ToolTip } from "../gui/Tooltip"; | |
| 4 | 4 | |
| 5 | 5 | const ContextStatus = () => { |
| 6 | 6 | const dispatch = useAppDispatch(); |
| 7 | 7 | const contextPercentage = useAppSelector( |
| 8 | 8 | (state) => state.session.contextPercentage, |
| 9 | 9 | ); |
| 10 | + const history = useAppSelector((state) => state.session.history); | |
| 10 | 11 | const percent = Math.round((contextPercentage ?? 0) * 100); |
| 11 | 12 | const isPruned = useAppSelector((state) => state.session.isPruned); |
| 12 | 13 | if (!isPruned && percent < 60) { |
| 13 | 14 | return null; |
| 14 | 15 | } |
| 16 | + | |
| 17 | + const barColorClass = percent > 80 ? "bg-warning" : "bg-description"; | |
| 18 | + | |
| 15 | 19 | return ( |
| 16 | - <div className="text-description-muted my-0.5 flex flex-row items-center gap-2 text-xs"> | |
| 17 | - <span | |
| 18 | - className="cursor-pointer underline" | |
| 19 | - onClick={() => { | |
| 20 | - dispatch( | |
| 21 | - saveCurrentSession({ | |
| 22 | - openNewSession: true, | |
| 23 | - generateTitle: false, | |
| 24 | - }), | |
| 25 | - ); | |
| 20 | + <div> | |
| 21 | + <Tooltip | |
| 22 | + id="context-status" | |
| 23 | + closeEvents={{ | |
| 24 | + // blur: false, | |
| 25 | + mouseleave: true, | |
| 26 | + click: true, | |
| 27 | + mouseup: false, | |
| 26 | 28 | }} |
| 29 | + clickable | |
| 27 | 30 | > |
| 28 | - New Session | |
| 29 | - </span> | |
| 30 | - {contextPercentage !== undefined && ( | |
| 31 | - <> | |
| 32 | - <span data-tooltip-id="percent-tooltip">{percent}%</span> | |
| 33 | - <ToolTip id="percent-tooltip"> | |
| 34 | - {`${percent}% of context is filled`} | |
| 35 | - </ToolTip> | |
| 36 | - </> | |
| 37 | - )} | |
| 38 | - | |
| 39 | - {isPruned && ( | |
| 40 | - <> | |
| 41 | - <div | |
| 42 | - data-tooltip-id="prune-tooltip" | |
| 43 | - className="bg-warning h-2 w-2 rounded-full" | |
| 44 | - ></div> | |
| 45 | - <ToolTip id="prune-tooltip"> | |
| 46 | - Chat history exceeds context limit, old messages are being removed | |
| 47 | - </ToolTip> | |
| 48 | - </> | |
| 49 | - )} | |
| 31 | + <div className="flex flex-col gap-0"> | |
| 32 | + <span> {`${percent}% of context filled`}</span> | |
| 33 | + {isPruned && <span>Old messages are being removed</span>} | |
| 34 | + {history.length > 0 && ( | |
| 35 | + <span | |
| 36 | + className="cursor-pointer underline" | |
| 37 | + onClick={() => { | |
| 38 | + dispatch( | |
| 39 | + saveCurrentSession({ | |
| 40 | + openNewSession: true, | |
| 41 | + generateTitle: false, | |
| 42 | + }), | |
| 43 | + ); | |
| 44 | + }} | |
| 45 | + > | |
| 46 | + New Session | |
| 47 | + </span> | |
| 48 | + )} | |
| 49 | + </div> | |
| 50 | + </Tooltip> | |
| 51 | + <div | |
| 52 | + data-tooltip-id="context-status" | |
| 53 | + className="border-description-muted relative h-[10px] w-[5px] rounded-[1px] border-[0.5px] border-solid" | |
| 54 | + > | |
| 55 | + {/* <div className="absolute bottom-full left-1/4 h-[1px] w-1/2 border-[0.5px] border-solid" /> */} | |
| 56 | + <div | |
| 57 | + className={`transition-height absolute bottom-0 left-0 w-full duration-300 ease-in-out ${barColorClass}`} | |
| 58 | + style={{ height: `${percent}%` }} | |
| 59 | + ></div> | |
| 60 | + </div> | |
| 50 | 61 | </div> |
| 51 | 62 | ); |
| 52 | 63 | }; |
modified gui/src/components/mainInput/InputToolbar.tsx +2 −1
| @@ -19,6 +19,7 @@ | ||
| 19 | 19 | import { ModeSelect } from "../ModeSelect"; |
| 20 | 20 | import { Button } from "../ui"; |
| 21 | 21 | import { useFontSize } from "../ui/font"; |
| 22 | +import ContextStatus from "./ContextStatus"; | |
| 22 | 23 | import HoverItem from "./InputToolbar/HoverItem"; |
| 23 | 24 | |
| 24 | 25 | export interface ToolbarOptions { |
| @@ -170,6 +171,7 @@ | ||
| 170 | 171 | fontSize: tinyFont, |
| 171 | 172 | }} |
| 172 | 173 | > |
| 174 | + {!isInEdit && <ContextStatus />} | |
| 173 | 175 | {!props.toolbarOptions?.hideUseCodebase && !isInEdit && ( |
| 174 | 176 | <div |
| 175 | 177 | className={`${toolsSupported ? "md:flex" : "int:flex"} hover:underline" hidden transition-colors duration-200`} |
| @@ -209,7 +211,6 @@ | ||
| 209 | 211 | </span> |
| 210 | 212 | </HoverItem> |
| 211 | 213 | )} |
| 212 | - | |
| 213 | 214 | <Button |
| 214 | 215 | data-tooltip-id="enter-tooltip" |
| 215 | 216 | variant={props.isMainInput ? "primary" : "secondary"} |
modified gui/src/components/modelSelection/ModelSelect.tsx +1 −1
| @@ -218,7 +218,7 @@ | ||
| 218 | 218 | {modelSelectTitle(selectedModel) || "Select model"} |
| 219 | 219 | </span> |
| 220 | 220 | <ChevronDownIcon |
| 221 | - className="h-2 w-2 flex-shrink-0 hover:brightness-110" | |
| 221 | + className="hidden h-2 w-2 flex-shrink-0 hover:brightness-110 min-[200px]:flex" | |
| 222 | 222 | aria-hidden="true" |
| 223 | 223 | /> |
| 224 | 224 | </ListboxButton> |
modified gui/src/pages/gui/Chat.tsx +0 −4
| @@ -43,7 +43,6 @@ | ||
| 43 | 43 | import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util"; |
| 44 | 44 | import { ToolCallDiv } from "./ToolCallDiv"; |
| 45 | 45 | |
| 46 | -import ContextStatus from "../../components/mainInput/ContextStatus"; | |
| 47 | 46 | import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage"; |
| 48 | 47 | import { cancelStream } from "../../redux/thunks/cancelStream"; |
| 49 | 48 | import { EmptyChatBody } from "./EmptyChatBody"; |
| @@ -427,9 +426,6 @@ | ||
| 427 | 426 | </NewSessionButton> |
| 428 | 427 | )} |
| 429 | 428 | </div> |
| 430 | - <div> | |
| 431 | - <ContextStatus /> | |
| 432 | - </div> | |
| 433 | 429 | </div> |
| 434 | 430 | {!hasDismissedExploreDialog && <ExploreDialogWatcher />} |
| 435 | 431 | {history.length === 0 && ( |