fix(webui): improve automation management
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
AutomationsPayload,
|
||||
AutomationUpdatePayload,
|
||||
ChatSummary,
|
||||
CliAppsPayload,
|
||||
FilePreviewPayload,
|
||||
@@ -213,6 +214,26 @@ export async function runAutomationAction(
|
||||
);
|
||||
}
|
||||
|
||||
export async function updateAutomation(
|
||||
token: string,
|
||||
id: string,
|
||||
values: AutomationUpdatePayload,
|
||||
base: string = "",
|
||||
): Promise<AutomationsPayload> {
|
||||
const query = new URLSearchParams();
|
||||
query.set("id", id);
|
||||
return request<AutomationsPayload>(
|
||||
`${base}/api/webui/automations/update?${query}`,
|
||||
token,
|
||||
{
|
||||
headers: {
|
||||
"X-Nanobot-Automation-Values": JSON.stringify(values),
|
||||
},
|
||||
},
|
||||
API_READ_TIMEOUT_MS,
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchSkills(
|
||||
token: string,
|
||||
base: string = "",
|
||||
|
||||
@@ -142,6 +142,17 @@ export interface SessionAutomationJob {
|
||||
|
||||
export interface SessionAutomationsPayload { jobs: SessionAutomationJob[]; }
|
||||
export interface AutomationsPayload { jobs: SessionAutomationJob[]; }
|
||||
export interface AutomationUpdatePayload {
|
||||
name?: string;
|
||||
message?: string;
|
||||
schedule?: {
|
||||
kind: "at" | "every" | "cron";
|
||||
at_ms?: number;
|
||||
every_ms?: number;
|
||||
expr?: string;
|
||||
tz?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SessionDeleteResult {
|
||||
deleted: boolean;
|
||||
|
||||
Reference in New Issue
Block a user