mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: dalle cooldown time
This commit is contained in:
parent
8c9c098e25
commit
3073ca91cf
3 changed files with 25 additions and 15 deletions
|
|
@ -13,6 +13,7 @@ const defaultConfig = {
|
|||
cacheUrl: 'https://content.alcedogroup.com',
|
||||
cacheEntry: false,
|
||||
apiKey: '',
|
||||
drawCD: 30,
|
||||
model: '',
|
||||
api: 'https://chatgpt.duti.tech/api/conversation',
|
||||
apiBaseUrl: 'https://chatgpt.duti.tech/api',
|
||||
|
|
@ -35,28 +36,28 @@ const defaultConfig = {
|
|||
const _path = process.cwd()
|
||||
let config = {}
|
||||
if (fs.existsSync(`${_path}/plugins/chatgpt-plugin/config/config.js`)) {
|
||||
const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/config.js`);
|
||||
config = (await import(`file://${fullPath}`)).default;
|
||||
const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/config.js`)
|
||||
config = (await import(`file://${fullPath}`)).default
|
||||
} else if (fs.existsSync(`${_path}/plugins/chatgpt-plugin/config/index.js`)) {
|
||||
// 兼容旧版本
|
||||
const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/index.js`);
|
||||
config = (await import(`file://${fullPath}`)).Config;
|
||||
const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/index.js`)
|
||||
config = (await import(`file://${fullPath}`)).Config
|
||||
}
|
||||
config = Object.assign({}, defaultConfig, config)
|
||||
export const Config = new Proxy(config, {
|
||||
set(target, property, value) {
|
||||
target[property] = value;
|
||||
const change = lodash.transform(target, function(result, value, key) {
|
||||
if (!lodash.isEqual(value, defaultConfig[key])) {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
set (target, property, value) {
|
||||
target[property] = value
|
||||
const change = lodash.transform(target, function (result, value, key) {
|
||||
if (!lodash.isEqual(value, defaultConfig[key])) {
|
||||
result[key] = value
|
||||
}
|
||||
})
|
||||
try {
|
||||
fs.writeFileSync(`${_path}/plugins/chatgpt-plugin/config/config.js`, `export default ${JSON.stringify(change, '', '\t')}`, { flag: 'w' })
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
},
|
||||
});
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue