Skip to content

Commit 3fc2c45

Browse files
author
linyuan.yang
committed
workpath 处理
1 parent 6e998f7 commit 3fc2c45

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

‎packages/sbot/src/Agent/AgentRunner.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os from 'os';
2+
import { existsSync, mkdirSync } from 'fs';
23
import { type StructuredToolInterface } from '@langchain/core/tools';
34
import {
45
ServiceContainer,
@@ -75,6 +76,7 @@ export class AgentRunner {
7576
const assetsDir = config.getConfigPath('assets', true);
7677
const httpUrl = config.getHttpUrl();
7778
const workPath = options.workPath ?? `${assetsDir}/${threadId}`;
79+
if (!existsSync(workPath)) mkdirSync(workPath, { recursive: true });
7880

7981
/** 静态 system prompts(可缓存):instruction → environment */
8082
const extraPrompts: string[] = [

‎packages/scorpio.ai/src/Agents/ACP/ACPAgentServiceBase.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ChildProcess, spawn } from "child_process";
2-
import { existsSync, mkdirSync } from "fs";
32
import { Readable, Writable } from "stream";
43
import { ClientSideConnection, ndJsonStream } from "@agentclientprotocol/sdk";
54
import type * as schema from "@agentclientprotocol/sdk";
@@ -54,9 +53,6 @@ export abstract class ACPAgentServiceBase extends AgentServiceBase {
5453
this.env = env ?? {};
5554
this.workPath = workPath;
5655
this.initTimeoutMs = initTimeoutMs;
57-
if (workPath && !existsSync(workPath)) {
58-
mkdirSync(workPath, { recursive: true });
59-
}
6056
}
6157

6258
// ── stream ───────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)