feat: implement Hybrid AI architecture for admin norm builder
This commit is contained in:
@@ -19,6 +19,8 @@ const App: React.FC = () => {
|
||||
const [endpoint, setEndpoint] = useState<string>('');
|
||||
const [provider, setProvider] = useState<AIProvider>('gemini');
|
||||
const [model, setModel] = useState<string>('gemini-2.5-flash');
|
||||
const [adminApiKey, setAdminApiKey] = useState<string>('');
|
||||
const [adminModel, setAdminModel] = useState<string>('claude-3.5-sonnet-20241022');
|
||||
const [hasKey, setHasKey] = useState<boolean>(false);
|
||||
const [reportsData, setReportsData] = useState<ReportData[] | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -50,6 +52,9 @@ const App: React.FC = () => {
|
||||
fetch('/api/config')
|
||||
.then(res => res.json())
|
||||
.then(config => {
|
||||
if (config.adminApiKey) setAdminApiKey(config.adminApiKey);
|
||||
if (config.adminModel) setAdminModel(config.adminModel);
|
||||
|
||||
if (config.provider) {
|
||||
setProvider(config.provider);
|
||||
if (config.apiKey) setApiKey(config.apiKey);
|
||||
@@ -224,6 +229,20 @@ const App: React.FC = () => {
|
||||
apiKey={apiKey}
|
||||
model={model}
|
||||
endpoint={endpoint}
|
||||
adminApiKey={adminApiKey}
|
||||
adminModel={adminModel}
|
||||
onAdminConfigSave={(key, mdl) => {
|
||||
setAdminApiKey(key);
|
||||
setAdminModel(mdl);
|
||||
fetch('/api/config', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
provider, apiKey, model, endpoint,
|
||||
adminApiKey: key, adminModel: mdl
|
||||
})
|
||||
});
|
||||
}}
|
||||
/>
|
||||
) : (!hasKey || showSetup) ? (
|
||||
<ApiKeySetup onKeySave={handleKeySave} onCancel={hasKey ? () => setShowSetup(false) : undefined} />
|
||||
|
||||
Reference in New Issue
Block a user