From bc76d179425c66055aa8f11f19a41e638f5188aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=A8=E7=BC=A8?= Date: Sat, 30 Nov 2024 15:49:42 +0800 Subject: [PATCH] fix: resolve the infinite redirect issue on the edit page (#546) * style: fix agreement accept model * fix: sovle the rerender of the edit page --- client/app/factory/edit/page.tsx | 64 +++++++++++++++++++------------- server/requirements.txt | 4 +- server/setup_python.sh | 3 +- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/client/app/factory/edit/page.tsx b/client/app/factory/edit/page.tsx index 2923faae..beef4fcb 100644 --- a/client/app/factory/edit/page.tsx +++ b/client/app/factory/edit/page.tsx @@ -47,6 +47,9 @@ import DeployBotModal from './components/DeployBotModal'; import Markdown from '@/components/Markdown'; import AgreementZhCN from '../../../.kiwi/zh-CN/agreement.md'; import AgreementEN from '../../../.kiwi/en/agreement.md'; +import AgreementJA from '../../../.kiwi/ja/agreement.md'; +import AgreementKO from '../../../.kiwi/ko/agreement.md'; +import AgreementZhTW from '../../../.kiwi/zh-TW/agreement.md'; const API_HOST = process.env.NEXT_PUBLIC_API_DOMAIN; enum VisibleTypeEnum { @@ -81,6 +84,12 @@ export default function Edit() { switch (language) { case 'zh-CN': return AgreementZhCN; + case 'zh-TW': + return AgreementZhTW; + case 'ja': + return AgreementJA; + case 'ko': + return AgreementKO; case 'en': return AgreementEN; default: @@ -89,7 +98,10 @@ export default function Edit() { }, [language]); useEffect(() => { - if (!user || status !== 'success' || user.id.startsWith('client|')) { + if (status === 'pending') { + return; + } + if (!user || user.id.startsWith('client|')) { router.push(`${apiDomain}/api/auth/login`); } else { if (!user?.agreement_accepted) { @@ -631,30 +643,32 @@ export default function Edit() { {I18N.app.page.agreementLabel} -
- - +
+
+ + +
diff --git a/server/requirements.txt b/server/requirements.txt index f8ba4458..a1791e31 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -7,8 +7,8 @@ langserve langchain_community>=0.2.11 langchain>=0.2.12 langchain_google_genai -PyGithub -GitPython +PyGithub==2.3.0 +GitPython>=3.1.43 python-multipart httpx[socks] supabase diff --git a/server/setup_python.sh b/server/setup_python.sh index de31c50c..a5ed6127 100755 --- a/server/setup_python.sh +++ b/server/setup_python.sh @@ -1,3 +1,4 @@ python3 -m venv venv source venv/bin/activate -pip3 install -r requirements.txt +python3 -m pip install --upgrade pip +pip3 install --no-cache-dir -r requirements.txt