mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 00:15:23 +02:00
Real time context tracker count
This commit is contained in:
parent
ec7f7908ed
commit
c944cd6074
1 changed files with 4 additions and 2 deletions
|
|
@ -100,10 +100,12 @@ export default function ContextTracker({
|
|||
const prevIsSubmitting = useRef(isSubmitting);
|
||||
useEffect(() => {
|
||||
if (prevIsSubmitting.current && !isSubmitting) {
|
||||
setUsedTokens(getUsedTokens(getMessages()));
|
||||
// Messages from SSE don't include tokenCount (server strips it).
|
||||
// Invalidate to refetch from API which includes tokenCount from DB.
|
||||
queryClient.invalidateQueries({ queryKey: [QueryKeys.messages] });
|
||||
}
|
||||
prevIsSubmitting.current = isSubmitting;
|
||||
}, [isSubmitting, getMessages]);
|
||||
}, [isSubmitting, queryClient]);
|
||||
|
||||
const maxContextTokens =
|
||||
typeof conversation?.maxContextTokens === 'number' &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue