mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: restart error
This commit is contained in:
parent
fcc1bd7972
commit
b4c10d5c77
2 changed files with 12 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ import plugin from '../../../lib/plugins/plugin.js'
|
|||
import { Config } from '../utils/config.js'
|
||||
import { BingAIClient } from '@waylaidwanderer/chatgpt-api'
|
||||
import { exec } from 'child_process'
|
||||
import {checkPnpm} from "../utils/common.js";
|
||||
import { checkPnpm } from '../utils/common.js'
|
||||
|
||||
export class ChatgptManagement extends plugin {
|
||||
constructor (e) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// import { remark } from 'remark'
|
||||
// import stripMarkdown from 'strip-markdown'
|
||||
import { exec } from 'child_process'
|
||||
// export function markdownToText (markdown) {
|
||||
// return remark()
|
||||
// .use(stripMarkdown)
|
||||
|
|
@ -183,7 +184,15 @@ function getDOMException (errorMessage) {
|
|||
|
||||
export async function checkPnpm () {
|
||||
let npm = 'npm'
|
||||
let ret = await this.execSync('pnpm -v')
|
||||
let ret = await execSync('pnpm -v')
|
||||
if (ret.stdout) npm = 'pnpm'
|
||||
return npm
|
||||
}
|
||||
}
|
||||
|
||||
async function execSync (cmd) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(cmd, { windowsHide: true }, (error, stdout, stderr) => {
|
||||
resolve({ error, stdout, stderr })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue