Skip to content

Commit cf1ed27

Browse files
author
linyuan.yang
committed
指定workPath 不存在则回退到默认
1 parent f434493 commit cf1ed27

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,11 @@ export class AgentRunner {
101101
// 隔离在 assets/threadId;Memory 则统一绑定固定的 ~/.sbot/workspace,避免普通
102102
// Web 对话没有 workspace scope、所有新记忆都被迫落进 global。
103103
const configuredWorkPath = options.workPath?.trim() || undefined;
104-
const memoryWorkPath = configuredWorkPath ?? config.getConfigPath('workspace', true);
105-
const workPath = configuredWorkPath ?? path.join(assetsDir, threadId);
104+
const existingWorkPath = configuredWorkPath && existsSync(configuredWorkPath)
105+
? configuredWorkPath
106+
: undefined;
107+
const memoryWorkPath = existingWorkPath ?? config.getConfigPath('workspace', true);
108+
const workPath = existingWorkPath ?? path.join(assetsDir, threadId);
106109
if (!existsSync(workPath)) mkdirSync(workPath, { recursive: true });
107110

108111
/** 静态 system prompts(可缓存):instruction → environment → channel */

0 commit comments

Comments
 (0)