mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 21:44:59 +08:00
feat: close #628 add chat commands
This commit is contained in:
@@ -85,6 +85,7 @@ interface ChatStore {
|
||||
newSession: (mask?: Mask) => void;
|
||||
deleteSession: (index: number) => void;
|
||||
currentSession: () => ChatSession;
|
||||
nextSession: (delta: number) => void;
|
||||
onNewMessage: (message: ChatMessage) => void;
|
||||
onUserInput: (content: string) => Promise<void>;
|
||||
summarizeSession: () => void;
|
||||
@@ -200,6 +201,13 @@ export const useChatStore = create<ChatStore>()(
|
||||
}));
|
||||
},
|
||||
|
||||
nextSession(delta) {
|
||||
const n = get().sessions.length;
|
||||
const limit = (x: number) => (x + n) % n;
|
||||
const i = get().currentSessionIndex;
|
||||
get().selectSession(limit(i + delta));
|
||||
},
|
||||
|
||||
deleteSession(index) {
|
||||
const deletingLastSession = get().sessions.length === 1;
|
||||
const deletedSession = get().sessions.at(index);
|
||||
|
Reference in New Issue
Block a user