Tasks page implementation (#120)
This commit is contained in:
12
skyvern-frontend/src/api/AxiosClient.ts
Normal file
12
skyvern-frontend/src/api/AxiosClient.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { apiBaseUrl, credential } from "@/util/env";
|
||||
import axios from "axios";
|
||||
|
||||
const client = axios.create({
|
||||
baseURL: apiBaseUrl,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": credential,
|
||||
},
|
||||
});
|
||||
|
||||
export { client };
|
||||
11
skyvern-frontend/src/api/QueryClient.ts
Normal file
11
skyvern-frontend/src/api/QueryClient.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { QueryClient } from "@tanstack/react-query";
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
staleTime: 1000 * 60 * 5, // 5 minutes
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export { queryClient };
|
||||
69
skyvern-frontend/src/api/types.ts
Normal file
69
skyvern-frontend/src/api/types.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
export const ArtifactType = {
|
||||
Recording: "recording",
|
||||
ActionScreenshot: "screenshot_action",
|
||||
} as const;
|
||||
|
||||
export const Status = {
|
||||
Created: "created",
|
||||
Running: "running",
|
||||
Failed: "failed",
|
||||
Terminated: "terminated",
|
||||
Completed: "completed",
|
||||
} as const;
|
||||
|
||||
export type Status = (typeof Status)[keyof typeof Status];
|
||||
|
||||
export type ArtifactType = (typeof ArtifactType)[keyof typeof ArtifactType];
|
||||
|
||||
export type ArtifactApiResponse = {
|
||||
created_at: string;
|
||||
modified_at: string;
|
||||
artifact_id: string;
|
||||
task_id: string;
|
||||
step_id: string;
|
||||
artifact_type: ArtifactType;
|
||||
uri: string;
|
||||
organization_id: string;
|
||||
};
|
||||
|
||||
export type StepApiResponse = {
|
||||
step_id: string;
|
||||
task_id: string;
|
||||
created_at: string;
|
||||
modified_at: string;
|
||||
input_token_count: number;
|
||||
is_last: boolean;
|
||||
order: number;
|
||||
organization_id: string;
|
||||
output: {
|
||||
action_results: unknown[];
|
||||
actions_and_results: unknown[];
|
||||
errors: unknown[];
|
||||
};
|
||||
retry_index: number;
|
||||
status: Status;
|
||||
step_cost: number;
|
||||
};
|
||||
|
||||
export type TaskApiResponse = {
|
||||
request: {
|
||||
title: string | null;
|
||||
url: string;
|
||||
webhook_callback_url: string;
|
||||
navigation_goal: string;
|
||||
data_extraction_goal: string;
|
||||
navigation_payload: string; // stringified JSON
|
||||
error_code_mapping: null;
|
||||
proxy_location: string;
|
||||
extracted_information_schema: string;
|
||||
};
|
||||
task_id: string;
|
||||
status: Status;
|
||||
created_at: string; // ISO 8601
|
||||
modified_at: string; // ISO 8601
|
||||
extracted_information: unknown;
|
||||
screenshot_url: string | null;
|
||||
recording_url: string | null;
|
||||
failure_reason: string | null;
|
||||
errors: unknown[];
|
||||
};
|
||||
Reference in New Issue
Block a user