Session manager (#4648)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2025-09-26 14:56:45 -04:00
committed by GitHub
parent d0aa14a1ea
commit dc292883b7
61 changed files with 2895 additions and 5572 deletions
+3 -6
View File
@@ -1,6 +1,5 @@
import React, { createContext, useContext, ReactNode } from 'react';
import { ChatType } from '../types/chat';
import { generateSessionId } from '../sessions';
import { Recipe } from '../recipe';
import { useDraftContext } from './DraftContext';
@@ -54,16 +53,14 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
};
const resetChat = () => {
const newSessionId = generateSessionId();
setChat({
sessionId: newSessionId,
sessionId: '',
title: DEFAULT_CHAT_TITLE,
messages: [],
messageHistoryIndex: 0,
recipeConfig: null, // Clear recipe when resetting chat
recipeParameters: null, // Clear when resetting chat
recipeConfig: null,
recipeParameters: null,
});
// Clear draft when resetting chat
clearDraft();
};