chatgpt-web: address PR #1593 review round 2 (#1596)

Integrated into release/v3.7.0. Thank you for the contribution @trader-payne!
This commit is contained in:
Payne
2026-04-25 17:54:23 +03:00
committed by GitHub
parent d403186e6e
commit 35a1f6a529
5 changed files with 537 additions and 110 deletions

View File

@@ -148,6 +148,10 @@ export async function executeChatWithBreaker({
expiresIn: newCreds.expiresIn,
expiresAt: newCreds.expiresAt,
providerSpecificData: newCreds.providerSpecificData,
// Cookie/session providers (chatgpt-web) rotate the stored
// apiKey blob mid-request — forward it so the DB credential
// doesn't go stale after Set-Cookie rotation.
apiKey: newCreds.apiKey,
testStatus: "active",
});
},

View File

@@ -106,6 +106,15 @@ export async function updateProviderCredentials(connectionId: string, newCredent
if (newCredentials.providerSpecificData) {
updates.providerSpecificData = newCredentials.providerSpecificData;
}
// Cookie/session providers (chatgpt-web, ...) refresh by rotating the
// stored apiKey blob — propagate that here too so DB credentials don't
// go stale after Set-Cookie rotation.
if (newCredentials.apiKey) {
updates.apiKey = newCredentials.apiKey;
}
if (newCredentials.testStatus) {
updates.testStatus = newCredentials.testStatus;
}
const result = await updateProviderConnection(connectionId, updates);
log.info("TOKEN_REFRESH", "Credentials updated in localDb", {