mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Restore Checkpoint Feature (#934)
This commit is contained in:
@@ -20,6 +20,7 @@ export interface UseHistoryManagerReturn {
|
||||
updates: Partial<Omit<HistoryItem, 'id'>> | HistoryItemUpdater,
|
||||
) => void;
|
||||
clearItems: () => void;
|
||||
loadHistory: (newHistory: HistoryItem[]) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,6 +39,10 @@ export function useHistory(): UseHistoryManagerReturn {
|
||||
return baseTimestamp + messageIdCounterRef.current;
|
||||
}, []);
|
||||
|
||||
const loadHistory = useCallback((newHistory: HistoryItem[]) => {
|
||||
setHistory(newHistory);
|
||||
}, []);
|
||||
|
||||
// Adds a new item to the history state with a unique ID.
|
||||
const addItem = useCallback(
|
||||
(itemData: Omit<HistoryItem, 'id'>, baseTimestamp: number): number => {
|
||||
@@ -101,5 +106,6 @@ export function useHistory(): UseHistoryManagerReturn {
|
||||
addItem,
|
||||
updateItem,
|
||||
clearItems,
|
||||
loadHistory,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user