Skip to content

Commit

Permalink
fix: can not init error
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jul 8, 2024
1 parent 9faa2dc commit 1f7b695
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 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.13 linux-x64 node-v20.14.0
@offline-ai/cli/0.0.14 linux-x64 node-v20.14.0
$ ai --help [COMMAND]
USAGE
$ ai COMMAND
Expand Down Expand Up @@ -303,7 +303,7 @@ EXAMPLES
$ ai agent publish <agent-name>
```

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

## `ai autocomplete [SHELL]`

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

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

## `ai brain dn [NAME]`

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

## `ai brain list [NAME]`

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

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

## `ai brain search [NAME]`

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

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

## `ai config save [DATA]`

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

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

## `ai help [COMMAND]`

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

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

## `ai version`

Expand Down
7 changes: 5 additions & 2 deletions src/oclif/commands/brain/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class DownloadBrainCommand extends AICommand {
const isJson = this.jsonEnabled()
const {args, flags} = opts
const userConfig = this.loadConfig(flags.config, opts)
this.config.runHook('init_tools', {id: 'brain:download', userConfig})
await this.config.runHook('init_tools', {id: 'brain:download', userConfig})

process.on('SIGINT', ()=>{
process.exit(0)
Expand Down Expand Up @@ -127,7 +127,10 @@ export default class DownloadBrainCommand extends AICommand {
this.log('Downloading to ' + userConfig.brainDir)
let result: any[]
try {
result = await downloadBrain(brain, {quant, onProgress, url: flags.hubUrl, dryRun: flags.dryRun})
result = await downloadBrain(brain, {
quant, onProgress, url: flags.hubUrl, dryRun: flags.dryRun,
logLevel: userConfig.logLevel,
})
} finally {
logUpdate.clear()
}
Expand Down
2 changes: 1 addition & 1 deletion src/oclif/commands/brain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class Brain extends AICommand {
const isJson = this.jsonEnabled()
const {args, flags} = opts
const userConfig = this.loadConfig(flags.config, opts)
this.config.runHook('init_tools', {id: 'brain', userConfig})
await this.config.runHook('init_tools', {id: 'brain', userConfig})

if (flags.refresh) {
upgradeBrains()
Expand Down
2 changes: 1 addition & 1 deletion src/oclif/commands/brain/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class AIBrainListCommand extends AICommand {
const isJson = this.jsonEnabled()
const {args, flags} = opts
const userConfig = this.loadConfig(flags.config, opts)
this.config.runHook('init_tools', {id: 'brain', userConfig})
await this.config.runHook('init_tools', {id: 'brain', userConfig})

if (flags.refresh) {
upgradeBrains()
Expand Down
2 changes: 1 addition & 1 deletion src/oclif/commands/run/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class RunScript extends AICommand {
}

try {
this.config.runHook('init_tools', {id: 'run', userConfig})
await this.config.runHook('init_tools', {id: 'run', userConfig})
let result = await runScript(script, userConfig)
if (LogLevelMap[userConfig.logLevel] >= LogLevelMap.info && result?.content) {
result = result.content
Expand Down
1 change: 1 addition & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['src/**/*.ts'],
format: 'esm',
shims: true,
// splitting: true,
// sourcemap: true,
clean: true,
Expand Down

0 comments on commit 1f7b695

Please sign in to comment.