mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
fix(ai): forget the remembered working provider when the chain is saved
The in-memory memo of the last provider that answered reorders the chain for up to an hour. Saving a new chain now drops it for that account, so a provider the person removed or disabled no longer leads the chain they just arranged.
This commit is contained in:
1 parent
916f918674
commit
7022b698e7
4 files changed
+24
-1
No files matched your search
@@ -98,6 +98,15 @@ export function getLastWorkingProvider(
|
||||
return entry.providerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop one user's "last working provider" memo. Called when the person saves
|
||||
* a new chain: the memo reorders the chain they just arranged, and a provider
|
||||
* they removed or disabled must not keep leading it for up to an hour.
|
||||
*/
|
||||
export function forgetLastWorkingProvider(userId: string): void {
|
||||
lastWorkingCache.delete(userId);
|
||||
}
|
||||
|
||||
function rememberWorkingProvider(
|
||||
userId: string,
|
||||
providerType: ProviderChainType,
|
||||
|
||||
Reference in new issue
Block a user