Skip to content

Commit

Permalink
fix: do not search current dir!
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Aug 11, 2024
1 parent 810a5c2 commit 7a79464
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ $ npm install -g @offline-ai/cli
$ ai COMMAND
running command...
$ ai (--version)
@offline-ai/cli/0.0.14 linux-x64 node-v20.14.0
@offline-ai/cli/0.0.15 linux-x64 node-v20.14.0
$ ai --help [COMMAND]
USAGE
$ ai COMMAND
Expand Down Expand Up @@ -310,7 +310,7 @@ EXAMPLES
$ ai agent publish <agent-name>
```

_See code: [src/commands/agent/index.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/agent/index.ts)_
_See code: [src/commands/agent/index.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/agent/index.ts)_

## `ai autocomplete [SHELL]`

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

_See code: [src/commands/brain/index.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/brain/index.ts)_
_See code: [src/commands/brain/index.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/brain/index.ts)_

## `ai brain dn [NAME]`

Expand Down Expand Up @@ -516,7 +516,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.14/src/commands/brain/download.ts)_
_See code: [src/commands/brain/download.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/brain/download.ts)_

## `ai brain list [NAME]`

Expand Down Expand Up @@ -549,7 +549,7 @@ ALIASES
$ ai brain search
```

_See code: [src/commands/brain/list.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/brain/list.ts)_
_See code: [src/commands/brain/list.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/brain/list.ts)_

## `ai brain refresh`

Expand All @@ -573,7 +573,7 @@ DESCRIPTION
refresh brain index from huggingface.co
```

_See code: [src/commands/brain/refresh.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/brain/refresh.ts)_
_See code: [src/commands/brain/refresh.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/brain/refresh.ts)_

## `ai brain search [NAME]`

Expand Down Expand Up @@ -641,7 +641,7 @@ EXAMPLES
}
```

_See code: [src/commands/config/index.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/config/index.ts)_
_See code: [src/commands/config/index.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/config/index.ts)_

## `ai config save [DATA]`

Expand Down Expand Up @@ -682,7 +682,7 @@ GLOBAL FLAGS
--json Format output as json.
```

_See code: [src/commands/config/save.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/config/save.ts)_
_See code: [src/commands/config/save.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/config/save.ts)_

## `ai help [COMMAND]`

Expand Down Expand Up @@ -1044,7 +1044,7 @@ EXAMPLES
│[info]:Start Script: ...
```

_See code: [src/commands/run/index.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/run/index.ts)_
_See code: [src/commands/run/index.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/run/index.ts)_

## `ai test`

Expand Down Expand Up @@ -1092,7 +1092,7 @@ EXAMPLES
$ ai test -f ./fixture.yaml -l info
```

_See code: [src/commands/test/index.ts](https://github.com/offline-ai/cli/blob/v0.0.14/src/commands/test/index.ts)_
_See code: [src/commands/test/index.ts](https://github.com/offline-ai/cli/blob/v0.0.15/src/commands/test/index.ts)_

## `ai version`

Expand Down
7 changes: 5 additions & 2 deletions src/lib/run-script.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ux } from '@oclif/core'
import util from 'util'
import fs from 'fs'
import path from 'path'
Expand All @@ -11,7 +12,7 @@ import { AIScriptServer, LogLevel, LogLevelMap } from '@isdk/ai-tool-agent'
import { detectTextLanguage as detectLang } from '@isdk/detect-text-language'
import { prompt, setHistoryStore, HistoryStore } from './prompt.js'
// import { initTools } from './init-tools.js'
import { ux } from '@oclif/core'
import { expandPath } from './load-config.js'

class AIScriptEx extends AIScriptServer {
$detectLang(text: string) {
Expand Down Expand Up @@ -91,7 +92,9 @@ export async function runScript(filename: string, options: IRunScriptOptions) {
const scriptExtName = getMultiLevelExtname(filename, 2)
const scriptBasename = path.basename(filename, scriptExtName)

AIScriptEx.searchPaths = Array.isArray(options.agentDirs) ? options.agentDirs : ['.']
if (Array.isArray(options.agentDirs)) {
AIScriptEx.searchPaths = options.agentDirs
}

let script
try {
Expand Down

0 comments on commit 7a79464

Please sign in to comment.