fix hide inline error and position
This commit is contained in:
parent
9ad19f9a56
commit
6177ba3fc4
4 changed files with 11 additions and 14 deletions
|
|
@ -444,13 +444,6 @@ function compileChatMessages({
|
|||
|
||||
msgsCopy = addSpaceToAnyEmptyMessages(msgsCopy);
|
||||
|
||||
while (msgsCopy.length > 1) {
|
||||
if (isUserOrToolMsg(msgsCopy.at(-1))) {
|
||||
break;
|
||||
}
|
||||
msgsCopy.pop();
|
||||
}
|
||||
|
||||
// Extract the tool sequence from the end of the message array
|
||||
const toolSequence = extractToolSequence(msgsCopy);
|
||||
|
||||
|
|
@ -531,7 +524,11 @@ function compileChatMessages({
|
|||
reassembled.push(...historyWithTokens.map(({ tokens, ...rest }) => rest));
|
||||
reassembled.push(...toolSequence);
|
||||
|
||||
const contextPercentage = currentTotal / contextLength;
|
||||
const inputTokens =
|
||||
currentTotal + systemMsgTokens + toolTokens + lastMessagesTokens;
|
||||
const availableTokens =
|
||||
contextLength - countingSafetyBuffer - minOutputTokens;
|
||||
const contextPercentage = inputTokens / availableTokens;
|
||||
return {
|
||||
compiledChatMessages: reassembled,
|
||||
didPrune,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import { selectSlashCommandComboBoxInputs } from "../../redux/selectors";
|
|||
import { ContextItemsPeek } from "./belowMainInput/ContextItemsPeek";
|
||||
import { RulesPeek } from "./belowMainInput/RulesPeek";
|
||||
import { GradientBorder } from "./GradientBorder";
|
||||
import InlineErrorMessage from "./InlineErrorMessage";
|
||||
import { ToolbarOptions } from "./InputToolbar";
|
||||
import { Lump } from "./Lump";
|
||||
import { TipTapEditor } from "./TipTapEditor";
|
||||
|
|
@ -120,7 +119,6 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
|
|||
/>
|
||||
</div>
|
||||
)}
|
||||
{props.isLastUserInput && <InlineErrorMessage />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { setInlineErrorMessage } from "../../redux/slices/sessionSlice";
|
||||
|
||||
export type InlineErrorMessageType = "out-of-context";
|
||||
|
||||
export default function InlineErrorMessage() {
|
||||
const dispatch = useAppDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const inlineErrorMessage = useAppSelector(
|
||||
(state) => state.session.inlineErrorMessage,
|
||||
|
|
@ -33,9 +35,7 @@ export default function InlineErrorMessage() {
|
|||
<span
|
||||
className="cursor-pointer text-xs hover:underline"
|
||||
onClick={() => {
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
});
|
||||
dispatch(setInlineErrorMessage(undefined));
|
||||
}}
|
||||
>
|
||||
Hide
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util";
|
|||
import { ToolCallDiv } from "./ToolCallDiv";
|
||||
|
||||
import ContextStatus from "../../components/mainInput/ContextStatus";
|
||||
import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage";
|
||||
import { cancelStream } from "../../redux/thunks/cancelStream";
|
||||
import { EmptyChatBody } from "./EmptyChatBody";
|
||||
import { ExploreDialogWatcher } from "./ExploreDialogWatcher";
|
||||
|
|
@ -389,6 +390,7 @@ export function Chat() {
|
|||
>
|
||||
{renderChatHistoryItem(item, index)}
|
||||
</ErrorBoundary>
|
||||
{index === history.length - 1 && <InlineErrorMessage />}
|
||||
</div>
|
||||
))}
|
||||
</StepsDiv>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue