feat: Initialize core application structure with backend configuration, database, API, and a comprehensive frontend UI for account pooling and management.
This commit is contained in:
@@ -15,6 +15,7 @@ interface ConfigContextValue {
|
||||
testConnection: () => Promise<boolean>
|
||||
s2aClient: S2AClient | null
|
||||
refreshConfig: () => Promise<void>
|
||||
siteName: string
|
||||
}
|
||||
|
||||
const ConfigContext = createContext<ConfigContextValue | null>(null)
|
||||
@@ -23,6 +24,7 @@ export function ConfigProvider({ children }: { children: ReactNode }) {
|
||||
const [config, setConfig] = useState<AppConfig>(defaultConfig)
|
||||
const [isConnected, setIsConnected] = useState(false)
|
||||
const [s2aClient, setS2aClient] = useState<S2AClient | null>(null)
|
||||
const [siteName, setSiteName] = useState('Codex Pool')
|
||||
|
||||
// Load config from server on mount
|
||||
const refreshConfig = useCallback(async () => {
|
||||
@@ -45,6 +47,10 @@ export function ConfigProvider({ children }: { children: ReactNode }) {
|
||||
groupIds: serverConfig.group_ids || [],
|
||||
},
|
||||
}))
|
||||
// 更新站点名称
|
||||
if (serverConfig.site_name) {
|
||||
setSiteName(serverConfig.site_name)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load config from server:', error)
|
||||
@@ -158,6 +164,7 @@ export function ConfigProvider({ children }: { children: ReactNode }) {
|
||||
testConnection,
|
||||
s2aClient,
|
||||
refreshConfig,
|
||||
siteName,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user