Skip to content

Commit

Permalink
- fix(job): _job
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisGray0626 committed Jun 28, 2024
1 parent 4174d2a commit f5e028b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/store/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Task} from "@/type.ts";
// import axios from "@/api";

export const useJobStore = defineStore("job", () => {
let _job;
let _job: Task;

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

const job = computed(() => {
if (!_job) {
return new Task();
return null;
} else {
return _job;
}
Expand Down
3 changes: 2 additions & 1 deletion src/store/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export const useSessionStore = defineStore("session", () => {
});
const graphShow = ref(false);

// TODO chatted?
async function chatted() {
if (!dataStore.job.name) {
if (!dataStore.job) {
await dataStore.fetchData(session.question);
}
// session.question = "";
Expand Down
8 changes: 3 additions & 5 deletions src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ export class Task {

constructor(task: string, toolId: string, toolName: string) {
this.name = task;
this.initTool(toolId, toolName);
this.children = [] as Task[];
}

initTool(toolId: string, toolName: string) {
this.tool = new Tool(toolId, toolName);
this.children = [] as Task[];
}

addChild(task: Task) {
Expand All @@ -31,6 +27,8 @@ export class Tool {
constructor(id: string, name: string) {
this.id = id;
this.name = name;
this.description = "";
this.args = [];
}
}

Expand Down

0 comments on commit f5e028b

Please sign in to comment.