forked from XiaoMo/ChatGPT-Next-Web
fix: #1363 session index after deleting
This commit is contained in:
parent
7e8def50aa
commit
6d9abf11b8
@ -11,10 +11,11 @@ import CloseIcon from "../icons/close.svg";
|
|||||||
import DeleteIcon from "../icons/delete.svg";
|
import DeleteIcon from "../icons/delete.svg";
|
||||||
import EyeIcon from "../icons/eye.svg";
|
import EyeIcon from "../icons/eye.svg";
|
||||||
import CopyIcon from "../icons/copy.svg";
|
import CopyIcon from "../icons/copy.svg";
|
||||||
|
import ShareIcon from "../icons/share.svg";
|
||||||
|
|
||||||
import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask";
|
import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask";
|
||||||
import { Message, ModelConfig, ROLES, useChatStore } from "../store";
|
import { Message, ModelConfig, ROLES, useChatStore } from "../store";
|
||||||
import { Input, List, ListItem, Modal, Popover, showToast } from "./ui-lib";
|
import { Input, List, ListItem, Modal, Popover } from "./ui-lib";
|
||||||
import { Avatar, AvatarPicker } from "./emoji";
|
import { Avatar, AvatarPicker } from "./emoji";
|
||||||
import Locale, { AllLangs, Lang } from "../locales";
|
import Locale, { AllLangs, Lang } from "../locales";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
@ -358,6 +359,14 @@ export function MaskPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["mask-actions"]}>
|
<div className={styles["mask-actions"]}>
|
||||||
|
<IconButton
|
||||||
|
icon={<ShareIcon />}
|
||||||
|
text={Locale.Mask.Item.Chat}
|
||||||
|
onClick={() => {
|
||||||
|
chatStore.newSession(m);
|
||||||
|
navigate(Path.Chat);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={<AddIcon />}
|
icon={<AddIcon />}
|
||||||
text={Locale.Mask.Item.Chat}
|
text={Locale.Mask.Item.Chat}
|
||||||
|
@ -31,7 +31,7 @@ export const EN_MASKS: BuiltinMask[] = [
|
|||||||
],
|
],
|
||||||
modelConfig: {
|
modelConfig: {
|
||||||
model: "gpt-4",
|
model: "gpt-4",
|
||||||
temperature: 1,
|
temperature: 0.5,
|
||||||
max_tokens: 2000,
|
max_tokens: 2000,
|
||||||
presence_penalty: 0,
|
presence_penalty: 0,
|
||||||
sendMemory: true,
|
sendMemory: true,
|
||||||
|
@ -180,8 +180,9 @@ export const useChatStore = create<ChatStore>()(
|
|||||||
const sessions = get().sessions.slice();
|
const sessions = get().sessions.slice();
|
||||||
sessions.splice(index, 1);
|
sessions.splice(index, 1);
|
||||||
|
|
||||||
|
const currentIndex = get().currentSessionIndex;
|
||||||
let nextIndex = Math.min(
|
let nextIndex = Math.min(
|
||||||
get().currentSessionIndex,
|
currentIndex - Number(index < currentIndex),
|
||||||
sessions.length - 1,
|
sessions.length - 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user