Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: first time to select kimi,wihch results a loop because of 401 #759

Merged
merged 2 commits into from Mar 19, 2024

Conversation

hwwgh555
Copy link
Contributor

@hwwgh555 hwwgh555 commented Mar 18, 2024

Reason

When you first select kimi,https://kimi.moonshot.cn/api/user and https://kimi.moonshot.cn/api/auth/token/refresh both will return 401.
In _checkAvailability function,it will revoke itself again because of 401.

Result

Before

before

After

after

Copy link

vercel bot commented Mar 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chatall ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2024 9:55am

@sunner
Copy link
Owner

sunner commented Mar 19, 2024

Thank you for figuring out this problem. But I have another idea to fix it.

Since the _checkAvailability() is not called frequently, it can always refreshToken() first. How about this solution?

@hwwgh555
Copy link
Contributor Author

Thank you for figuring out this problem. But I have another idea to fix it.

Since the _checkAvailability() is not called frequently, it can always refreshToken() first. How about this solution?

Just refreshToken() is a good way. It seems that /api/user request is not necessary.

@sunner
Copy link
Owner

sunner commented Mar 19, 2024

Ok. Could you modify your code?

@hwwgh555
Copy link
Contributor Author

Ok. Could you modify your code?

No Problem. I have modified it.

@sunner sunner merged commit 6659758 into sunner:main Mar 19, 2024
1 check passed
@sunner
Copy link
Owner

sunner commented Mar 19, 2024

Thank you very much. The PR will be included in next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants