Skip to content

Commit

Permalink
新增功能点:#reset 重置所有设置
Browse files Browse the repository at this point in the history
  • Loading branch information
akl7777777 committed Nov 23, 2023
1 parent 61fcbd5 commit 1b14056
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ function writeFile({ value, fileName = configFileName }) {
function deleteFile(fileName = historyFileName) {
$file.delete(getFilePath(fileName));
}
function deleteAllFile() {
$file.delete(getFilePath(configFileName));
$file.delete(getFilePath(historyFileName));
}

exports.configFileName = configFileName;
exports.historyFileName = historyFileName;
exports.readFile = readFile;
exports.writeFile = writeFile;
exports.deleteFile = deleteFile;
exports.deleteAllFile = deleteAllFile;
2 changes: 1 addition & 1 deletion src/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"identifier": "com.akl.bob-plugin-akl-chatgpt-free-translate",
"version": "2.0.8",
"version": "2.0.9",
"category": "translate",
"name": "Free ChatGPT",
"summary": "免秘钥免启动任何服务调用ChatGPT",
Expand Down
7 changes: 6 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var config = require('./config.js');
var {configFileName, readFile, writeFile, deleteFile} = require("./file");
var {configFileName, readFile, writeFile, deleteFile,deleteAllFile} = require("./file");

const langMap = new Map(config.supportedLanguages);
const langMapReverse = new Map(config.supportedLanguages.map(([standardLang, lang]) => [lang, standardLang]));
Expand Down Expand Up @@ -47,6 +47,11 @@ function getDirectiveResult(text) {
deleteFile();

return "已清除对话记录,你可以继续聊天。";
case "#重置":
case "#reset":
case "#Reset":
deleteAllFile();
return "已重置所有设置,你可以继续聊天。";
}

writeFile({
Expand Down

0 comments on commit 1b14056

Please sign in to comment.