From e4df600e6ab74f4a03bec8efe13a6666458cca50 Mon Sep 17 00:00:00 2001 From: Riceball LEE Date: Tue, 11 Jun 2024 18:27:52 +0800 Subject: [PATCH] fix: can not save chat history for special id --- README.md | 16 ++++++++-------- src/lib/run-script.ts | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 87e101b..189eeab 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ $ npm install -g @offline-ai/cli $ ai COMMAND running command... $ ai (--version) -@offline-ai/cli/0.0.7 linux-x64 node-v20.14.0 +@offline-ai/cli/0.0.8 linux-x64 node-v20.14.0 $ ai --help [COMMAND] USAGE $ ai COMMAND @@ -293,7 +293,7 @@ EXAMPLES $ ai agent publish ``` -_See code: [src/commands/agent/index.ts](https://github.com/offline-ai/cli/blob/v0.0.7/src/commands/agent/index.ts)_ +_See code: [src/commands/agent/index.ts](https://github.com/offline-ai/cli/blob/v0.0.8/src/commands/agent/index.ts)_ ## `ai autocomplete [SHELL]` @@ -366,7 +366,7 @@ EXAMPLES $ ai brain download ``` -_See code: [src/commands/brain/index.ts](https://github.com/offline-ai/cli/blob/v0.0.7/src/commands/brain/index.ts)_ +_See code: [src/commands/brain/index.ts](https://github.com/offline-ai/cli/blob/v0.0.8/src/commands/brain/index.ts)_ ## `ai brain dn [NAME]` @@ -494,7 +494,7 @@ EXAMPLES $ ai brain download [-q ] ``` -_See code: [src/commands/brain/download.ts](https://github.com/offline-ai/cli/blob/v0.0.7/src/commands/brain/download.ts)_ +_See code: [src/commands/brain/download.ts](https://github.com/offline-ai/cli/blob/v0.0.8/src/commands/brain/download.ts)_ ## `ai brain list [NAME]` @@ -523,7 +523,7 @@ GLOBAL FLAGS --json Format output as json. ``` -_See code: [src/commands/brain/list.ts](https://github.com/offline-ai/cli/blob/v0.0.7/src/commands/brain/list.ts)_ +_See code: [src/commands/brain/list.ts](https://github.com/offline-ai/cli/blob/v0.0.8/src/commands/brain/list.ts)_ ## `ai config [ITEM_NAME]` @@ -560,7 +560,7 @@ EXAMPLES } ``` -_See code: [src/commands/config/index.ts](https://github.com/offline-ai/cli/blob/v0.0.7/src/commands/config/index.ts)_ +_See code: [src/commands/config/index.ts](https://github.com/offline-ai/cli/blob/v0.0.8/src/commands/config/index.ts)_ ## `ai config save [DATA]` @@ -600,7 +600,7 @@ GLOBAL FLAGS --json Format output as json. ``` -_See code: [src/commands/config/save.ts](https://github.com/offline-ai/cli/blob/v0.0.7/src/commands/config/save.ts)_ +_See code: [src/commands/config/save.ts](https://github.com/offline-ai/cli/blob/v0.0.8/src/commands/config/save.ts)_ ## `ai help [COMMAND]` @@ -960,7 +960,7 @@ EXAMPLES │[info]:Start Script: ... ``` -_See code: [src/commands/run/index.ts](https://github.com/offline-ai/cli/blob/v0.0.7/src/commands/run/index.ts)_ +_See code: [src/commands/run/index.ts](https://github.com/offline-ai/cli/blob/v0.0.8/src/commands/run/index.ts)_ ## `ai version` diff --git a/src/lib/run-script.ts b/src/lib/run-script.ts index 65517f3..ddf0900 100644 --- a/src/lib/run-script.ts +++ b/src/lib/run-script.ts @@ -76,12 +76,13 @@ export async function runScript(filename: string, options: IRunScriptOptions) { const scriptExtName = getMultiLevelExtname(filename, 2) const scriptBasename = path.basename(filename, scriptExtName) - const chatsFilename = options.chatsDir ? path.join(options.chatsDir, scriptBasename, 'history.yaml') : undefined - if (options.newChat && chatsFilename) { renameOldFile(chatsFilename) } AIScriptEx.searchPaths = Array.isArray(options.agentDirs) ? options.agentDirs : ['.'] const script = AIScriptEx.load(filename, {chatsDir: options.chatsDir}) + const chatsFilename = script.getChatsFilename() + if (options.newChat && chatsFilename) { renameOldFile(chatsFilename) } + let isSilence = false if (level !== undefined) {