π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix(market-auth): skip auth flow when LobeChat session is missing (#15532)
Innei337e7f244c35
diff --git a/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx b/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsxindex eac08f1545d..ca6d53dbb79 100644--- a/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx+++ b/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx@@ -392,6 +392,9 @@ export const MarketAuthProvider = ({ children, isDesktop }: MarketAuthProviderPr* Sign-in method (shows confirmation dialog first)*/const signIn = useCallback(async (): Promise<number | null> => {+ if (!useUserStore.getState().isSignedIn) {+ throw new Error('LobeChat session required');+ }return new Promise<number | null>((resolve, reject) => {setPendingSignInResolve(() => resolve);setPendingSignInReject(() => reject);diff --git a/src/libs/trpc/client/lambda.ts b/src/libs/trpc/client/lambda.tsindex d8555573f8d..dac103edd73 100644--- a/src/libs/trpc/client/lambda.ts+++ b/src/libs/trpc/client/lambda.ts@@ -43,6 +43,10 @@ const errorHandlingLink: TRPCLink<LambdaRouter> = () => {if (isMarketApi) {// Market API 401: emit event for MarketAuthProvider to handle// Don't trigger LobeChat logout for market auth issues+ const { getUserStoreState } = await import('@/store/user/store');+ // Without a LobeChat session a market.* 401 is not a Market auth+ // issue β let it bubble instead of triggering the auth modal+ if (!getUserStoreState().isSignedIn) break;const now = Date.now();if (now - lastMarket401Time > MIN_401_INTERVAL) {lastMarket401Time = now;diff --git a/src/libs/trpc/client/tools.ts b/src/libs/trpc/client/tools.tsindex 31006a8fc83..f0b879311cb 100644--- a/src/libs/trpc/client/tools.ts+++ b/src/libs/trpc/client/tools.ts@@ -29,16 +29,22 @@ const errorHandlingLink: TRPCLink<ToolsRouter> = () => {// UNAUTHORIZED tRPC code maps to HTTP 401const is401 = status === 401 || code === 'UNAUTHORIZED';if (is401 && op.path.startsWith('market.')) {- const now = Date.now();- if (now - lastMarket401Time > MIN_401_INTERVAL) {- lastMarket401Time = now;- console.info('[toolsClient] Emitting market-unauthorized event for path:', op.path);- // Emit event for MarketAuthProvider to handle- const { marketAuthEvents } = await import('@/layout/AuthProvider/MarketAuth/events');- marketAuthEvents.emit('market-unauthorized', {- path: op.path,- timestamp: now,- });+ const { getUserStoreState } = await import('@/store/user/store');+ // Without a LobeChat session a market.* 401 is not a Market auth+ // issue β let it bubble instead of triggering the auth modal+ if (getUserStoreState().isSignedIn) {+ const now = Date.now();+ if (now - lastMarket401Time > MIN_401_INTERVAL) {+ lastMarket401Time = now;+ console.info('[toolsClient] Emitting market-unauthorized event for path:', op.path);+ // Emit event for MarketAuthProvider to handle+ const { marketAuthEvents } =+ await import('@/layout/AuthProvider/MarketAuth/events');+ marketAuthEvents.emit('market-unauthorized', {+ path: op.path,+ timestamp: now,+ });+ }}}