Skip to content

Commit

Permalink
fix: should expand path for search paths
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Sep 15, 2024
1 parent f8154ee commit 6c18c11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/run-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ConfigFile, countRegexMatches, formatISO, getMultiLevelExtname, parseJs
import { AIScriptServer, LogLevel, LogLevelMap } from '@isdk/ai-tool-agent'
import { detectTextLanguage as detectLang, detectTextLangEx, getLanguageFromIso6391 } from '@isdk/detect-text-language'
import { prompt, setHistoryStore, HistoryStore } from './prompt.js'
import { expandPath } from '@offline-ai/cli-common'
import { expandConfig, expandPath } from '@offline-ai/cli-common'
// import { initTools } from './init-tools.js'

// const endWithSpacesRegEx = /[\s\n\r]+$/
Expand Down Expand Up @@ -163,7 +163,8 @@ export async function runScript(filename: string, options: IRunScriptOptions) {
const scriptExtName = getMultiLevelExtname(filename, 2)
const scriptBasename = path.basename(filename, scriptExtName)

if (Array.isArray(options.agentDirs)) {
if (Array.isArray(options.agentDirs) && options.agentDirs.length) {
options.agentDirs = expandConfig(options.agentDirs, options) as any[]
if (AIScriptEx.searchPaths) {
AIScriptEx.searchPaths.push(...options.agentDirs)
} else {
Expand Down

0 comments on commit 6c18c11

Please sign in to comment.