Skip to content

Commit f5e028b

Browse files
committed
- fix(job): _job
1 parent 4174d2a commit f5e028b

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/store/job.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Task} from "@/type.ts";
66
// import axios from "@/api";
77

88
export const useJobStore = defineStore("job", () => {
9-
let _job;
9+
let _job: Task;
1010

1111
async function fetchData(task: string) {
1212
const res = ((await mockFetchJob(task)) as { data: any }).data;
@@ -33,7 +33,7 @@ export const useJobStore = defineStore("job", () => {
3333

3434
const job = computed(() => {
3535
if (!_job) {
36-
return new Task();
36+
return null;
3737
} else {
3838
return _job;
3939
}

src/store/session.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export const useSessionStore = defineStore("session", () => {
1919
});
2020
const graphShow = ref(false);
2121

22+
// TODO chatted?
2223
async function chatted() {
23-
if (!dataStore.job.name) {
24+
if (!dataStore.job) {
2425
await dataStore.fetchData(session.question);
2526
}
2627
// session.question = "";

src/type.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ export class Task {
55

66
constructor(task: string, toolId: string, toolName: string) {
77
this.name = task;
8-
this.initTool(toolId, toolName);
9-
this.children = [] as Task[];
10-
}
11-
12-
initTool(toolId: string, toolName: string) {
138
this.tool = new Tool(toolId, toolName);
9+
this.children = [] as Task[];
1410
}
1511

1612
addChild(task: Task) {
@@ -31,6 +27,8 @@ export class Tool {
3127
constructor(id: string, name: string) {
3228
this.id = id;
3329
this.name = name;
30+
this.description = "";
31+
this.args = [];
3432
}
3533
}
3634

0 commit comments

Comments
 (0)