Unverified Commit 6242e91a authored by Matri's avatar Matri Committed by GitHub

Fix: Install page redirects to signin if Dify finished setup. (#762)

parent cc7b5d12
...@@ -19,15 +19,16 @@ from .wraps import only_edition_self_hosted ...@@ -19,15 +19,16 @@ from .wraps import only_edition_self_hosted
class SetupApi(Resource): class SetupApi(Resource):
@only_edition_self_hosted
def get(self): def get(self):
setup_status = get_setup_status() if current_app.config['EDITION'] == 'SELF_HOSTED':
if setup_status: setup_status = get_setup_status()
return { if setup_status:
'step': 'finished', return {
'setup_at': setup_status.setup_at.isoformat() 'step': 'finished',
} 'setup_at': setup_status.setup_at.isoformat()
return {'step': 'not_start'} }
return {'step': 'not_start'}
return {'step': 'finished'}
@only_edition_self_hosted @only_edition_self_hosted
def post(self): def post(self):
......
This diff is collapsed.
import React from 'react' import React from 'react'
import InstallForm from './installForm' import classNames from 'classnames'
import Header from '../signin/_header' import Header from '../signin/_header'
import style from '../signin/page.module.css' import style from '../signin/page.module.css'
import classNames from 'classnames' import InstallForm from './installForm'
const SignIn = () => {
const Install = () => {
return ( return (
<> <div className={classNames(
<div className={classNames( style.background,
style.background, 'flex w-full min-h-screen',
'flex w-full min-h-screen', 'p-4 lg:p-8',
'p-4 lg:p-8', 'gap-x-20',
'gap-x-20', 'justify-center lg:justify-start',
'justify-center lg:justify-start' )}>
)}> <div className={
<div className={ classNames(
classNames( 'flex w-full flex-col bg-white shadow rounded-2xl shrink-0',
'flex w-full flex-col bg-white shadow rounded-2xl shrink-0', 'md:w-[608px] space-between',
'md:w-[608px] space-between' )
) }>
}> <Header />
<Header /> <InstallForm />
<InstallForm /> <div className='px-8 py-6 text-sm font-normal text-gray-500'>
<div className='px-8 py-6 text-sm font-normal text-gray-500'> © {new Date().getFullYear()} Dify, Inc. All rights reserved.
© {new Date().getFullYear()} Dify, Inc. All rights reserved.
</div>
</div> </div>
</div> </div>
</div>
</>
) )
} }
export default SignIn export default Install
...@@ -6,6 +6,11 @@ export type OauthResponse = { ...@@ -6,6 +6,11 @@ export type OauthResponse = {
redirect_url: string redirect_url: string
} }
export type SetupStatusResponse = {
step: 'finished' | 'not_started'
setup_at?: Date
}
export type UserProfileResponse = { export type UserProfileResponse = {
id: string id: string
name: string name: string
......
...@@ -3,8 +3,8 @@ import { del, get, patch, post, put } from './base' ...@@ -3,8 +3,8 @@ import { del, get, patch, post, put } from './base'
import type { import type {
AccountIntegrate, CommonResponse, DataSourceNotion, AccountIntegrate, CommonResponse, DataSourceNotion,
IWorkspace, LangGeniusVersionResponse, Member, IWorkspace, LangGeniusVersionResponse, Member,
OauthResponse, PluginProvider, Provider, ProviderAnthropicToken, ProviderAzureToken, TenantInfoResponse, OauthResponse, PluginProvider, Provider, ProviderAnthropicToken, ProviderAzureToken,
UserProfileOriginResponse, SetupStatusResponse, TenantInfoResponse, UserProfileOriginResponse,
} from '@/models/common' } from '@/models/common'
import type { import type {
UpdateOpenAIKeyResponse, UpdateOpenAIKeyResponse,
...@@ -19,6 +19,10 @@ export const setup: Fetcher<CommonResponse, { body: Record<string, any> }> = ({ ...@@ -19,6 +19,10 @@ export const setup: Fetcher<CommonResponse, { body: Record<string, any> }> = ({
return post('/setup', { body }) as Promise<CommonResponse> return post('/setup', { body }) as Promise<CommonResponse>
} }
export const fetchSetupStatus = () => {
return get('/setup') as Promise<SetupStatusResponse>
}
export const fetchUserProfile: Fetcher<UserProfileOriginResponse, { url: string; params: Record<string, any> }> = ({ url, params }) => { export const fetchUserProfile: Fetcher<UserProfileOriginResponse, { url: string; params: Record<string, any> }> = ({ url, params }) => {
return get(url, params, { needAllResponseContent: true }) as Promise<UserProfileOriginResponse> return get(url, params, { needAllResponseContent: true }) as Promise<UserProfileOriginResponse>
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment