mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-01 07:58:23 +00:00
forgot to commit these changes
This commit is contained in:
1 parent
3838cc3f21
commit
cd40edb5f9
2 files changed
+24
-2
No files matched your search
@@ -21,6 +21,7 @@ export * from "./lib/openai/SetOpenAIApiKey.js";
|
||||
export * from "./lib/providers/GetProviderOrder.js";
|
||||
export * from "./lib/providers/Provider.js";
|
||||
export * from "./lib/artcraft/task_queue/GetTaskQueue.js";
|
||||
export * from "./lib/artcraft/task_queue/MarkTaskAsDismissed.js";
|
||||
export * from "./lib/providers/SetProviderOrder.js";
|
||||
export * from "./lib/settings/GetAppPreferences.js";
|
||||
export * from "./lib/settings/UpdateAppPreference.js";
|
||||
|
||||
@@ -24,11 +24,32 @@ interface GetTaskQueueSuccess extends CommandResult {
|
||||
|
||||
export const GetTaskQueue = async () : Promise<GetTaskQueueResponse> => {
|
||||
try {
|
||||
let result = await invoke("get_task_queue_command") as GetTaskQueueSuccess;
|
||||
return result.payload;
|
||||
const result = await invoke("get_task_queue_command") as GetTaskQueueSuccess;
|
||||
|
||||
const tasks = result?.payload?.tasks || [];
|
||||
|
||||
// Convert timestamps to Date objects
|
||||
const newTasks : TaskQueueItem[] = tasks.map((task) => {
|
||||
return {
|
||||
id: task.id,
|
||||
task_status: task.task_status,
|
||||
task_type: task.task_type,
|
||||
model_type: task.model_type,
|
||||
provider: task.provider,
|
||||
provider_job_id: task.provider_job_id,
|
||||
created_at: new Date(task.created_at),
|
||||
updated_at: new Date(task.updated_at),
|
||||
completed_at: task.completed_at ? new Date(task.completed_at) : undefined,
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
tasks: newTasks,
|
||||
};
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary just for testing -
|
||||
(window as any).test_get_task_queue = GetTaskQueue;
|
||||
Reference in new issue
Block a user