Skip to content

Commit

Permalink
refactor: follow new ai-script
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Aug 9, 2024
1 parent 9ac0630 commit 50127cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/run-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export async function runScript(filename: string, options: IRunScriptOptions) {

let script
try {
script = AIScriptEx.loadFile(filename, {chatsDir: options.chatsDir})
script = await AIScriptEx.loadFile(filename, {chatsDir: options.chatsDir})
} catch(err) {
console.error('Load script error:',err)
process.exit(1)
Expand Down Expand Up @@ -128,11 +128,11 @@ export async function runScript(filename: string, options: IRunScriptOptions) {
}

const interrupted = async () => {
if (runtime.isAborted()) {
if (runtime.isToolAborted()) {
await saveChatHistory()
process.exit(0)
} else {
runtime.abort()
runtime.abortTool()
}
}
process.on('SIGINT', interrupted)
Expand All @@ -147,7 +147,7 @@ export async function runScript(filename: string, options: IRunScriptOptions) {
let s = llmResult.content

if (quit) {
runtime.abort('quit')
runtime.abortTool('quit')
process.emit('SIGINT')
}
if (count !== retryCount) {
Expand Down

0 comments on commit 50127cb

Please sign in to comment.