g2log 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/git-user-log.js +38 -5
- package/package.json +1 -1
package/git-user-log.js
CHANGED
@@ -17,7 +17,13 @@ const fs = require('fs');
|
|
17
17
|
const https = require('https');
|
18
18
|
const os = require('os');
|
19
19
|
const readline = require('readline');
|
20
|
-
|
20
|
+
// 改用动态导入
|
21
|
+
let ora;
|
22
|
+
import('ora').then(module => {
|
23
|
+
ora = module.default;
|
24
|
+
}).catch(err => {
|
25
|
+
console.error('无法加载ora模块:', err);
|
26
|
+
});
|
21
27
|
|
22
28
|
// 检测是否通过npx运行
|
23
29
|
const isRunningWithNpx = process.env.npm_lifecycle_event === 'npx' ||
|
@@ -256,7 +262,36 @@ function listRepositories() {
|
|
256
262
|
|
257
263
|
// 创建一个高级spinner
|
258
264
|
function createSpinner() {
|
259
|
-
|
265
|
+
// 如果ora模块未加载完成或不支持,提供一个简单的替代方案
|
266
|
+
if (!ora) {
|
267
|
+
return {
|
268
|
+
start(text) {
|
269
|
+
console.log(text);
|
270
|
+
return this;
|
271
|
+
},
|
272
|
+
stop(text) {
|
273
|
+
if (text) console.log(text);
|
274
|
+
return this;
|
275
|
+
},
|
276
|
+
fail(text) {
|
277
|
+
console.error(text || '操作失败');
|
278
|
+
return this;
|
279
|
+
},
|
280
|
+
update(text) {
|
281
|
+
console.log(text);
|
282
|
+
return this;
|
283
|
+
}
|
284
|
+
};
|
285
|
+
}
|
286
|
+
|
287
|
+
// 原有的spinner实现
|
288
|
+
const spinner = ora({
|
289
|
+
color: 'cyan',
|
290
|
+
spinner: 'dots',
|
291
|
+
discardStdin: false
|
292
|
+
});
|
293
|
+
|
294
|
+
return {
|
260
295
|
start(text) {
|
261
296
|
if (shouldUseColor) {
|
262
297
|
process.stdout.write(colorize(`⏳ ${text}`, 'cyan'));
|
@@ -296,8 +331,6 @@ function createSpinner() {
|
|
296
331
|
return this;
|
297
332
|
}
|
298
333
|
};
|
299
|
-
|
300
|
-
return spinner;
|
301
334
|
}
|
302
335
|
|
303
336
|
// 修复配置文件
|
@@ -897,7 +930,7 @@ async function getDeepSeekResponse(apiKey, prompt, modelName, apiBaseURL, spinne
|
|
897
930
|
{ role: 'user', content: prompt }
|
898
931
|
],
|
899
932
|
temperature: 0.5,
|
900
|
-
max_tokens:
|
933
|
+
max_tokens: 20480,
|
901
934
|
stream: true // 启用流式传输
|
902
935
|
};
|
903
936
|
|