Skip to content

Commit a150af9

Browse files
authored
fix: incorrect login state check (#176)
1 parent f057b0b commit a150af9

File tree

6 files changed

+219
-209
lines changed

6 files changed

+219
-209
lines changed

.changeset/lovely-dots-vanish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": patch
3+
---
4+
5+
chore(deps): bump `openai` for `api-key` header compatibility support

.changeset/spicy-trees-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": patch
3+
---
4+
5+
fix: incorrect login state check

packages/doom/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
"dependencies": {
4343
"@alauda/doom-export": "^0.1.0",
4444
"@cspell/eslint-plugin": "^8.19.4 || ^9.2.1",
45-
"@eslint-react/eslint-plugin": "^1.52.9",
45+
"@eslint-react/eslint-plugin": "^1.53.0",
4646
"@inquirer/prompts": "^7.8.4",
4747
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
4848
"@playwright/browser-chromium": "^1.55.0",
4949
"@rsbuild/plugin-react": "^1.4.0",
5050
"@rsbuild/plugin-sass": "^1.4.0",
5151
"@rsbuild/plugin-svgr": "^1.2.2",
5252
"@rsbuild/plugin-yaml": "^1.0.3",
53-
"@rspress/core": "2.0.0-beta.30",
54-
"@rspress/plugin-algolia": "2.0.0-beta.30",
55-
"@rspress/plugin-llms": "2.0.0-beta.30",
56-
"@rspress/plugin-sitemap": "2.0.0-beta.30",
57-
"@rspress/shared": "2.0.0-beta.30",
53+
"@rspress/core": "2.0.0-beta.31",
54+
"@rspress/plugin-algolia": "2.0.0-beta.31",
55+
"@rspress/plugin-llms": "2.0.0-beta.31",
56+
"@rspress/plugin-sitemap": "2.0.0-beta.31",
57+
"@rspress/shared": "2.0.0-beta.31",
5858
"@shikijs/transformers": "^3.12.2",
5959
"@total-typescript/ts-reset": "^0.6.1",
6060
"ab64": "^0.1.6",
@@ -75,7 +75,7 @@
7575
"mdast-util-to-markdown": "^2.1.2",
7676
"mdast-util-to-string": "^4.0.0",
7777
"mermaid": "^11.10.1",
78-
"openai": "~5.17.0",
78+
"openai": "^5.19.1",
7979
"openapi-types": "^12.1.3",
8080
"p-ratelimit": "^1.0.1",
8181
"picomatch": "^4.0.3",

packages/doom/src/global/Intelligence/AIAssistant/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
type ApiInterceptor,
1010
} from 'x-fetch'
1111

12-
import { type CloudAuth, useCloudAuth } from '../context.tsx'
12+
import { type CloudAuth, getCloudAuth, useCloudAuth } from '../context.tsx'
1313
import type { AuthInfo } from '../types.ts'
1414

1515
import { Chat } from './Chat/index.tsx'
@@ -187,7 +187,7 @@ export const AIAssistant = ({ open, onOpenChange }: AIAssistantProps) => {
187187
try {
188188
await onSend_(content)
189189
} catch {
190-
if (!sessionIdRef.current) {
190+
if (!isLoggedIn(getCloudAuth())) {
191191
return
192192
}
193193
flushMessages((messages) => {

packages/doom/src/global/Intelligence/context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const CloudAuthContext = createContext<CloudAuthContext>(null!)
1919

2020
export const useCloudAuth = () => use(CloudAuthContext)
2121

22-
const getCloudAuth = (): CloudAuth | null => {
22+
export const getCloudAuth = (): CloudAuth | null => {
2323
const origin = localStorage.getItem(CLOUD_AUTH_ORIGIN_KEY)
2424
const token = localStorage.getItem(CLOUD_AUTH_TOKEN_KEY)
2525

0 commit comments

Comments
 (0)