refactor(api)!: remove the standalone API server (#6614)
This commit is contained in:
1 parent
5c72ced2fe
commit
220d5e6970
99 files changed
+240
-4133
No files matched your search
@@ -2,7 +2,6 @@ import type { Dispatch, SetStateAction } from "react";
|
||||
import type { TFunction } from "i18next";
|
||||
|
||||
import type {
|
||||
ApplySettingsPayload,
|
||||
MaybeRestartHostEngine,
|
||||
PendingRestartSections,
|
||||
} from "@/components/settings/contracts";
|
||||
@@ -15,8 +14,6 @@ import {
|
||||
completeMcpOAuth,
|
||||
disableNanobotFeature,
|
||||
enableNanobotFeature,
|
||||
fetchNanobotFeatures,
|
||||
fetchSettings,
|
||||
fetchMcpOAuthStatus,
|
||||
fetchMcpPresets,
|
||||
importMcpConfig,
|
||||
@@ -25,8 +22,6 @@ import {
|
||||
runMcpPresetAction,
|
||||
saveCustomMcpServer,
|
||||
startMcpOAuth,
|
||||
startApiService,
|
||||
stopApiService,
|
||||
updateAutomation,
|
||||
updateMcpServerTools,
|
||||
} from "@/lib/api";
|
||||
@@ -71,10 +66,8 @@ interface SystemSettingsActionsOptions {
|
||||
state: SystemSettingsState;
|
||||
featureCatalog: NanobotFeatureInfo[];
|
||||
client: NanobotClient;
|
||||
token: string;
|
||||
getToken: () => string;
|
||||
t: TFunction;
|
||||
applyPayload: ApplySettingsPayload;
|
||||
maybeRestartHostEngine: MaybeRestartHostEngine;
|
||||
setPendingRestartSections: Dispatch<SetStateAction<PendingRestartSections>>;
|
||||
refreshAutomations: (showLoading?: boolean) => Promise<void>;
|
||||
@@ -84,16 +77,13 @@ export function createSystemSettingsActions({
|
||||
state,
|
||||
featureCatalog,
|
||||
client,
|
||||
token,
|
||||
getToken,
|
||||
t,
|
||||
applyPayload,
|
||||
maybeRestartHostEngine,
|
||||
setPendingRestartSections,
|
||||
refreshAutomations,
|
||||
}: SystemSettingsActionsOptions) {
|
||||
const {
|
||||
apiServiceAction,
|
||||
customMcpForm,
|
||||
mcpConfigImport,
|
||||
mcpOAuthCallbackUrl,
|
||||
@@ -102,9 +92,6 @@ export function createSystemSettingsActions({
|
||||
mcpOAuthPopupRef,
|
||||
nanobotFeatureActionRef,
|
||||
nanobotFeatures,
|
||||
setApiService,
|
||||
setApiServiceAction,
|
||||
setApiServiceError,
|
||||
setAutomationAction,
|
||||
setAutomationPendingDelete,
|
||||
setAutomationPendingEdit,
|
||||
@@ -172,29 +159,6 @@ export function createSystemSettingsActions({
|
||||
}
|
||||
};
|
||||
|
||||
const handleApiServiceAction = async (
|
||||
action: "start" | "stop",
|
||||
values?: { host: string; port: number; timeout: number; apiKey?: string },
|
||||
) => {
|
||||
if (apiServiceAction) return;
|
||||
setApiServiceAction(action);
|
||||
setApiServiceError(null);
|
||||
try {
|
||||
const payload = action === "start"
|
||||
? await startApiService(client, values!)
|
||||
: await stopApiService(client);
|
||||
setApiService(payload);
|
||||
const refreshed = await fetchNanobotFeatures(token);
|
||||
setNanobotFeatures(refreshed);
|
||||
const nextSettings = await fetchSettings(token);
|
||||
applyPayload(nextSettings);
|
||||
} catch (err) {
|
||||
setApiServiceError((err as Error).message);
|
||||
} finally {
|
||||
setApiServiceAction(null);
|
||||
}
|
||||
};
|
||||
|
||||
const handleCliAppAction = async (
|
||||
action: "install" | "update" | "uninstall" | "test",
|
||||
name: string,
|
||||
@@ -709,7 +673,6 @@ export function createSystemSettingsActions({
|
||||
};
|
||||
|
||||
return {
|
||||
handleApiServiceAction,
|
||||
handleAutomationAction,
|
||||
handleAutomationEdit,
|
||||
handleAutomationChat,
|
||||
|
||||
Reference in new issue
Block a user