Skip to content

Commit

Permalink
task execution flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oceania2018 committed Feb 5, 2024
1 parent 7cbc0cc commit ab0e50a
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 235 deletions.
3 changes: 2 additions & 1 deletion src/lib/helpers/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
*/

/**
* @typedef {Object} AgentTaskViewModel
* @typedef {Object} AgentTaskModel
* @property {string} id - Task id.
* @property {string} name - Task name.
* @property {string} description - Description.
Expand All @@ -141,6 +141,7 @@
* @property {Date} updated_datetime
* @property {string} agent_id - Description.
* @property {string} agent_name - Task detail.
* @property {string} direct_agent_id - Run task directly in this agent.
*/


Expand Down
1 change: 1 addition & 0 deletions src/lib/services/api-endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const endpoints = {

// agent task
agentTaskListUrl: `${host}/agent/tasks`,
agentTaskDetailUrl: `${host}/agent/{agentId}/task/{taskId}`,

// agent instruct
instructCompletionUrl: `${host}/instruct/{agentId}`,
Expand Down
12 changes: 12 additions & 0 deletions src/lib/services/task-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,16 @@ export async function getAgentTasks(filter) {
}
});
return response.data;
}

/**
* Get task detail
* @param {string} agentId
* @param {string} taskid
* @returns {Promise<import('$types').AgentTaskModel>}
*/
export async function getAgentTaskDetail(agentId, taskid) {
const url = replaceUrl(endpoints.agentTaskDetailUrl, { agentId: agentId, taskId: taskid });
var response = await axios.get(url);
return response.data;
}
46 changes: 0 additions & 46 deletions src/routes/page/agent/[agentId]/task/+page.svelte

This file was deleted.

21 changes: 0 additions & 21 deletions src/routes/page/agent/[agentId]/task/[template]/+page.svelte

This file was deleted.

165 changes: 0 additions & 165 deletions src/routes/page/agent/[agentId]/task/task-flow.svelte

This file was deleted.

9 changes: 7 additions & 2 deletions src/routes/page/task/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
const firstPage = 1;
const pageSize = 10;
/** @type {import('$types').PagedItems<import('$types').AgentTaskViewModel>} */
/** @type {import('$types').PagedItems<import('$types').AgentTaskModel>} */
let tasks = { count: 0, items: [] };
/** @type {import('$types').AgentTaskFilter} */
Expand Down Expand Up @@ -198,7 +198,7 @@
<th scope="col">Name</th>
<th scope="col">Description</th>
<th scope="col">Agent</th>
<th scope="col">Content</th>
<th scope="col">Details</th>
<th scope="col">Updated Date</th>
<th scope="col">Status</th>
<th scope="col">Action</th>
Expand All @@ -217,6 +217,11 @@
<td><span class="badge bg-success">{task.enabled ? "Enabled" : "Disabled"}</span></td>
<td>
<ul class="list-unstyled hstack gap-1 mb-0">
<li data-bs-toggle="tooltip" data-bs-placement="top" title="Execute">
<a href="page/task/{task.id}?agentId={task.agent_id}" target="_blank" class="btn btn-sm btn-soft-danger">
<i class="mdi mdi-eye-outline" />
</a>
</li>
<li data-bs-toggle="tooltip" data-bs-placement="top" title="Delete">
<Button on:click={() => openDeleteModal(task.id)} class="btn btn-sm btn-soft-danger">
<i class="mdi mdi-delete-outline" />
Expand Down
18 changes: 18 additions & 0 deletions src/routes/page/task/[taskId]/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script>
import { onMount } from 'svelte';
import ExecutionFlow from './execution-flow.svelte';
import { page } from '$app/stores';
const params = $page.params;
const agentId = $page.url.searchParams.get('agentId')
const taskId = params.taskId;
onMount(async () => {
const container = document.getElementById("drawflow");
if (container) {
}
});
</script>

<ExecutionFlow />
Loading

0 comments on commit ab0e50a

Please sign in to comment.