53 lines
1.2 KiB
Plaintext
53 lines
1.2 KiB
Plaintext
import request from "@/servers/useRequest";
|
|
import { RequestResponse } from "@/types/interfaces/request";
|
|
import { SandboxListResponse } from "@/types/interfaces/sandbox";
|
|
|
|
/**
|
|
* 获取沙盒列表
|
|
*/
|
|
export const apiGetSandboxList = (): Promise<
|
|
RequestResponse<SandboxListResponse>
|
|
> => {
|
|
return request<RequestResponse<SandboxListResponse>>({
|
|
url: "/api/sandbox/config/select/list",
|
|
method: "GET",
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 更新选中的沙盒
|
|
*/
|
|
export const apiUpdateSelectedSandbox = (
|
|
agentId: string,
|
|
sandboxId: string,
|
|
): Promise<RequestResponse<null>> => {
|
|
return request<RequestResponse<null>>({
|
|
url: `/api/sandbox/config/selected/${agentId}/${sandboxId}`,
|
|
method: "POST",
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 重启智能体
|
|
*/
|
|
export const apiRestartAgent = (
|
|
conversationId: number,
|
|
): Promise<RequestResponse<null>> => {
|
|
return request<RequestResponse<null>>({
|
|
url: `/api/computer/agent/stop/${conversationId}`,
|
|
method: "POST",
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 重启容器
|
|
*/
|
|
export const apiRestartSandbox = (
|
|
conversationId: number,
|
|
): Promise<RequestResponse<null>> => {
|
|
return request<RequestResponse<null>>({
|
|
url: `/api/computer/pod/restart?cId=${conversationId}`,
|
|
method: "POST",
|
|
});
|
|
};
|