Skip to content

Commit

Permalink
fix: can not save chat history for special id
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jun 11, 2024
1 parent 75fa91a commit e4df600
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -293,7 +293,7 @@ EXAMPLES
$ ai agent publish <agent-name>
```

_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]`

Expand Down Expand Up @@ -366,7 +366,7 @@ EXAMPLES
$ ai brain download <brain-name>
```

_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]`

Expand Down Expand Up @@ -494,7 +494,7 @@ EXAMPLES
$ ai brain download <brain-name> [-q <QUANT>]
```

_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]`

Expand Down Expand Up @@ -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]`

Expand Down Expand Up @@ -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]`

Expand Down Expand Up @@ -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]`

Expand Down Expand Up @@ -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`

Expand Down
5 changes: 3 additions & 2 deletions src/lib/run-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e4df600

Please sign in to comment.