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:
2026-01-31 01:48:07 +08:00
parent 74bdcae836
commit 92383f2f20
14 changed files with 776 additions and 47 deletions

View File

@@ -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}