From 8805c60e98015b38ccbdd0052a56155e56d9126f Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 25 Apr 2025 13:50:29 +0800 Subject: [PATCH] =?UTF-8?q?ai=E8=BF=94=E5=9B=9E=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- constants/aiModels.js | 29 ----------------------------- constants/path.js | 26 -------------------------- constants/relativelyPath.js | 5 ----- index.js | 2 +- lib/config/configControl.js | 4 ++-- lib/system/updater.js | 14 ++++++++++---- 6 files changed, 13 insertions(+), 67 deletions(-) delete mode 100644 constants/aiModels.js delete mode 100644 constants/path.js delete mode 100644 constants/relativelyPath.js diff --git a/constants/aiModels.js b/constants/aiModels.js deleted file mode 100644 index dac23f5..0000000 --- a/constants/aiModels.js +++ /dev/null @@ -1,29 +0,0 @@ -const aiModels = { - openai: { - gpt3: 'text-davinci-003', - gpt4: 'gpt-4', - gpt35_turbo: 'gpt-3.5-turbo', - }, - - deepseek: { - r1: 'deepseek-ai/DeepSeek-R1', - v3: 'deepseek-ai/DeepSeek-V3', - r1_distill_Qwen_32b: 'deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', //1.26 - r1_distill_Qwen_14b: 'deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', //0.7 - }, - - THUDM: { - GLM4_32b: 'THUDM/GLM-4-32B-0414', // 1.89 tokens - GLMZ1_32b: 'THUDM/GLM-Z1-32B-0414', // 4 tokens - GLM4_9b: 'THUDM/GLM-4-9B-0414', //free - }, - - Qwen: { - Qwen25VL_32b: 'Qwen/Qwen2.5-VL-32B-Instruct', // 4.13 视觉 - QwenQ_32b: 'Qwen/QwQ-32B', //4/M tokens - Qwen25_72b: 'Qwen/Qwen2.5-72B-Instruct-128K', //4.13 - QwenQVQ_72b_preview: 'Qwen/QVQ-72B-Preview', //9.9 视觉 - }, -}; - -export default aiModels; diff --git a/constants/path.js b/constants/path.js deleted file mode 100644 index 2ac80bb..0000000 --- a/constants/path.js +++ /dev/null @@ -1,26 +0,0 @@ -import path from 'path'; -import url from 'url'; -import fs from 'fs'; - -const __filename = url.fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const rootDir = path.join(__dirname, '..'); - -const Path = { - root: rootDir, - apps: path.join(rootDir, 'apps'), - components: path.join(rootDir, 'components'), - defaultConfig: path.join(rootDir, 'config/default.json'), - config: path.resolve(rootDir, '../../data/crystelf'), - constants: path.join(rootDir, 'constants'), - lib: path.join(rootDir, 'lib'), - models: path.join(rootDir, 'models'), - index: path.join(rootDir, 'index.js'), - pkg: path.join(rootDir, 'package.json'), - yunzai: path.join(rootDir, '../../'), -}; - -const configFile = fs.readFileSync(Path.defaultConfig, 'utf8'); -export const defaultConfig = JSON.parse(configFile); - -export default Path; diff --git a/constants/relativelyPath.js b/constants/relativelyPath.js deleted file mode 100644 index 19564c5..0000000 --- a/constants/relativelyPath.js +++ /dev/null @@ -1,5 +0,0 @@ -const relativelyPath = { - config: '/data/crystelf/config.json', -}; - -export default relativelyPath; diff --git a/index.js b/index.js index 7b9da6b..6c45e5e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ import chalk from 'chalk'; import Version from './lib/system/version.js'; import fc from './components/json.js'; -import Path from './constants/path.js'; +import Path from './constants/path/path.js'; import { crystelfInit } from './lib/system/init.js'; import updater from './lib/system/updater.js'; diff --git a/lib/config/configControl.js b/lib/config/configControl.js index ec1f815..466cc73 100644 --- a/lib/config/configControl.js +++ b/lib/config/configControl.js @@ -1,8 +1,8 @@ -import Path, { defaultConfig } from '../../constants/path.js'; +import Path, { defaultConfig } from '../../constants/path/path.js'; import fc from '../../components/json.js'; import path from 'path'; import fs from 'fs'; -import relativelyPath from '../../constants/relativelyPath.js'; +import relativelyPath from '../../constants/path/relativelyPath.js'; const configPath = Path.config; const configFile = path.join(configPath, 'config.json'); diff --git a/lib/system/updater.js b/lib/system/updater.js index 2a4ed48..5ce7a30 100644 --- a/lib/system/updater.js +++ b/lib/system/updater.js @@ -2,7 +2,7 @@ import child_process from 'child_process'; import fs from 'fs'; import path from 'path'; import chalk from 'chalk'; -import Path from '../../constants/path.js'; +import Path from '../../constants/path/path.js'; const GIT_DIR = path.join(Path.root, '.git'); @@ -31,8 +31,11 @@ const Updater = { await new Promise((resolve, reject) => { child_process.exec('git fetch', { cwd: Path.root }, (err) => { - if (err) reject(err); - else resolve(); + if (err) { + reject(err); + } else { + resolve(); + } }); }); @@ -48,7 +51,10 @@ const Updater = { async update() { logger.mark(chalk.cyan('[crystelf-plugin] 检测到插件有更新,自动执行 git pull')); - child_process.execSync('git pull', { cwd: Path.root, stdio: 'inherit' }); + child_process.execSync('git pull', { + cwd: Path.root, + stdio: 'inherit', + }); logger.mark(chalk.green('[crystelf-plugin] 插件已自动更新完成')); },