This commit is contained in:
xiongxiao
2026-03-11 16:15:48 +08:00
committed by cnb
parent 4e4f54b4cd
commit ef38fc0596
6 changed files with 81 additions and 21 deletions

View File

@@ -3,8 +3,6 @@ import { useContextKey } from '@kevisual/context'
import { useKey } from '@kevisual/use-config'
import { CNB } from '../src/index.ts';
import { CNBManager } from './modules/cnb-manager.ts'
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
export const cnbManager = new CNBManager()
@@ -21,9 +19,11 @@ try {
cnb: new CNB({ token: token, cookie: cookie })
})
} catch (error) {
process.exit(1)
}
export const cnb = (await cnbManager.getCNB({ username: 'default' })).cnb
await new Promise(resolve => setTimeout(resolve, 1000))
export const cnbItem = await cnbManager.getCNB({ username: 'default' });
export const cnb = cnbItem?.cnb;
export const app = await useContextKey<App>('app', () => {
return new App({})
})

View File

@@ -30,9 +30,14 @@ const main = async () => {
payload: {
messages
}
})
}, { appId: app.appId })
if (result.code === 200) {
console.log('执行完成')
let _message = result.data.message || []
console.log('执行完成', JSON.stringify(_message, null, 2))
process.exit(0)
} else {
console.log(result.message || '执行错误')
process.exit(1)
}
}