g2log 1.3.0 → 1.4.1
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/README.md +14 -6
- package/git-user-log.js +175 -115
- package/package.json +4 -2
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Git
|
1
|
+
# AI-Git 用户日报生成工具
|
2
2
|
|
3
3
|
这是一个基于 Node.js 开发的命令行工具,用于获取指定用户在特定时间范围内的 Git 提交记录,并通过 AI 自动生成工作总结。
|
4
4
|
|
@@ -66,13 +66,20 @@ npx g2log [--since="2023-01-01"] [--until="2023-12-31"] [选项]
|
|
66
66
|
|
67
67
|
### 命令行参数
|
68
68
|
|
69
|
+
时间参数:
|
69
70
|
- `--since="YYYY-MM-DD"` - 起始日期(如未指定,使用配置中的默认值)
|
70
71
|
- `--until="YYYY-MM-DD"` - 结束日期(如未指定,使用配置中的默认值)
|
71
|
-
- `--
|
72
|
-
- `--output="文件路径"` - 将输出保存到指定文件
|
72
|
+
- `--days=N` - 查询最近N天的记录
|
73
73
|
|
74
|
-
|
74
|
+
显示设置:
|
75
|
+
- `--no-color` - 禁用彩色输出
|
76
|
+
- `--save` 或 `--output="文件路径"` - 将输出保存到文件
|
77
|
+
- `--debug` - 显示调试信息
|
78
|
+
- `--show-prompt` - 显示完整的prompt内容
|
79
|
+
- `--version` - 显示当前版本号
|
75
80
|
|
81
|
+
配置管理命令:
|
82
|
+
- `--config` - 启动交互式配置向导
|
76
83
|
- `--set-api-key="KEY"` - 设置API密钥
|
77
84
|
- `--set-ai-model="MODEL"` - 设置AI模型(默认: deepseek-chat)
|
78
85
|
- `--set-api-provider="PROVIDER"` - 设置API提供商(deepseek或openai)
|
@@ -85,6 +92,7 @@ npx g2log [--since="2023-01-01"] [--until="2023-12-31"] [选项]
|
|
85
92
|
- `--set-prompt-template="file.txt"` - 从文件设置AI总结的prompt模板
|
86
93
|
- `--reset-prompt-template` - 重置AI总结的prompt模板为默认值
|
87
94
|
- `--fix-config` - 修复配置文件格式问题
|
95
|
+
- `--uninstall` - 删除g2log配置文件
|
88
96
|
- `--help` - 显示帮助信息
|
89
97
|
|
90
98
|
### 配置文件
|
@@ -95,7 +103,7 @@ npx g2log [--since="2023-01-01"] [--until="2023-12-31"] [选项]
|
|
95
103
|
{
|
96
104
|
"api_key": "your-api-key-here",
|
97
105
|
"default_author": "张三",
|
98
|
-
"default_since": "
|
106
|
+
"default_since": "7 days ago",
|
99
107
|
"default_until": "today",
|
100
108
|
"model": "deepseek-chat",
|
101
109
|
"api_base_url": "https://api.deepseek.com",
|
@@ -104,7 +112,7 @@ npx g2log [--since="2023-01-01"] [--until="2023-12-31"] [选项]
|
|
104
112
|
"前端": "/path/to/frontend-project",
|
105
113
|
"后端": "/path/to/backend-project"
|
106
114
|
},
|
107
|
-
"prompt_template": "请根据下面的Git提交记录,用3-5
|
115
|
+
"prompt_template": "请根据下面的Git提交记录,用3-5句话简洁地总结一天的工作内容。\n\n以下是Git提交记录:\n\n{{GIT_LOGS}}\n\n要求:\n1. 按项目和日期组织内容\n2. 每个项目每天的工作内容用3-5句话概括\n3. 使用清晰、专业但不晦涩的语言\n4. 突出重要的功能开发、问题修复和优化改进\n5. 适合放入工作日报的简洁描述\n6. 输出格式为:【日期】:\n 【项目名称】- 【工作内容概述】\n 【项目名称】- 【工作内容概述】\n7. 回复不要出现多余的内容,非必要不要用markdown格式"
|
108
116
|
}
|
109
117
|
```
|
110
118
|
|
package/git-user-log.js
CHANGED
@@ -17,6 +17,7 @@ const fs = require('fs');
|
|
17
17
|
const https = require('https');
|
18
18
|
const os = require('os');
|
19
19
|
const readline = require('readline');
|
20
|
+
const ora = require('ora');
|
20
21
|
|
21
22
|
// 检测是否通过npx运行
|
22
23
|
const isRunningWithNpx = process.env.npm_lifecycle_event === 'npx' ||
|
@@ -375,62 +376,41 @@ function fixConfigFile() {
|
|
375
376
|
// 显示帮助
|
376
377
|
function showHelp() {
|
377
378
|
console.log(`
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
--
|
387
|
-
|
388
|
-
|
389
|
-
--
|
390
|
-
--
|
391
|
-
|
392
|
-
|
393
|
-
--
|
394
|
-
|
395
|
-
|
396
|
-
--
|
397
|
-
--
|
398
|
-
--set-
|
399
|
-
--
|
400
|
-
--
|
401
|
-
--
|
402
|
-
--
|
403
|
-
|
404
|
-
|
405
|
-
--
|
406
|
-
--
|
407
|
-
--set-prompt-template="file.txt" 从文件设置AI总结的prompt模板
|
408
|
-
--reset-prompt-template 重置AI总结的prompt模板为默认值
|
409
|
-
--fix-config 修复配置文件格式问题
|
410
|
-
--help 显示帮助信息
|
411
|
-
|
412
|
-
${colorize('📝 示例:', 'cyan')}
|
413
|
-
# 使用配置的默认值生成今日工作总结 (处理配置中的所有仓库)
|
414
|
-
g2log
|
415
|
-
|
416
|
-
# 指定时间范围
|
417
|
-
g2log --since="2023-01-01" --until="2023-12-31"
|
418
|
-
|
419
|
-
# 使用本地仓库
|
420
|
-
g2log --local
|
421
|
-
|
422
|
-
# 强制启用颜色显示(在使用管道或重定向时有用)
|
423
|
-
g2log --color | less -R
|
424
|
-
|
425
|
-
# 启动交互式配置向导
|
379
|
+
使用方法: g2log [选项]
|
380
|
+
|
381
|
+
时间参数:
|
382
|
+
--since <date> 开始日期 (默认: 7天前)
|
383
|
+
--until <date> 结束日期 (默认: 今天)
|
384
|
+
--days <number> 查询最近n天的记录 (默认: 7)
|
385
|
+
|
386
|
+
显示设置:
|
387
|
+
--no-color 禁用彩色输出
|
388
|
+
--save 保存结果到文件
|
389
|
+
--debug 显示调试信息
|
390
|
+
--show-prompt 显示完整的prompt内容
|
391
|
+
--version 显示当前版本号
|
392
|
+
|
393
|
+
配置管理:
|
394
|
+
--config 启动交互式配置向导
|
395
|
+
--set-api-key 设置API密钥
|
396
|
+
--set-api-provider 设置API提供商 (OpenAI/DeepSeek)
|
397
|
+
--set-api-base-url 设置API基础URL
|
398
|
+
--set-ai-model 设置AI模型
|
399
|
+
--set-default-author 设置默认作者
|
400
|
+
--add-repo 添加仓库配置
|
401
|
+
--remove-repo 移除仓库配置
|
402
|
+
--list-repos 列出所有配置的仓库
|
403
|
+
--uninstall 删除g2log配置文件 (~/.git-user-log-config.json)
|
404
|
+
|
405
|
+
示例:
|
406
|
+
g2log --since "2024-01-01" --until "2024-01-31"
|
407
|
+
g2log --days 30
|
426
408
|
g2log --config
|
427
|
-
|
428
|
-
|
429
|
-
g2log --
|
430
|
-
g2log --
|
431
|
-
g2log --
|
432
|
-
g2log --set-api-url="https://api.openai.com"
|
433
|
-
g2log --add-repo="frontend" --path="/path/to/frontend-project"
|
409
|
+
g2log --set-api-key "your-api-key"
|
410
|
+
g2log --add-repo "alias" "path/to/repo"
|
411
|
+
g2log --remove-repo "alias"
|
412
|
+
g2log --list-repos
|
413
|
+
g2log --version
|
434
414
|
`);
|
435
415
|
process.exit(0);
|
436
416
|
}
|
@@ -804,54 +784,54 @@ async function getOpenAIResponse(apiKey, prompt, modelName, apiBaseURL, spinner
|
|
804
784
|
|
805
785
|
// 确定使用http还是https
|
806
786
|
const protocol = urlObj.protocol === 'https:' ? require('https') : require('http');
|
807
|
-
|
808
|
-
|
809
|
-
|
787
|
+
|
788
|
+
// 创建请求
|
789
|
+
const req = protocol.request(options, (res) => {
|
810
790
|
// 检查状态码
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
791
|
+
if (res.statusCode !== 200) {
|
792
|
+
let errorData = '';
|
793
|
+
res.on('data', chunk => {
|
794
|
+
errorData += chunk.toString();
|
795
|
+
});
|
796
|
+
res.on('end', () => {
|
817
797
|
let errorMessage = `OpenAI API请求失败 (${res.statusCode})`;
|
818
|
-
|
819
|
-
|
798
|
+
try {
|
799
|
+
const parsedError = JSON.parse(errorData);
|
820
800
|
errorMessage += `: ${JSON.stringify(parsedError)}`;
|
821
|
-
|
801
|
+
} catch (e) {
|
822
802
|
errorMessage += `: ${errorData}`;
|
823
803
|
}
|
824
804
|
if (spinner) spinner.fail(`❌ ${errorMessage}`);
|
825
805
|
reject(new Error(errorMessage));
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
806
|
+
});
|
807
|
+
return;
|
808
|
+
}
|
809
|
+
|
830
810
|
let fullContent = '';
|
831
|
-
|
832
|
-
|
811
|
+
let buffer = '';
|
812
|
+
|
833
813
|
// 处理数据
|
834
|
-
|
835
|
-
|
836
|
-
|
814
|
+
res.on('data', (chunk) => {
|
815
|
+
// 将新的数据添加到缓冲区
|
816
|
+
buffer += chunk.toString();
|
817
|
+
|
818
|
+
// 尝试从缓冲区中提取完整的SSE消息
|
819
|
+
let match;
|
820
|
+
const dataRegex = /data: (.*?)\n\n/gs;
|
821
|
+
|
822
|
+
while ((match = dataRegex.exec(buffer)) !== null) {
|
823
|
+
const data = match[1];
|
837
824
|
|
838
|
-
//
|
839
|
-
|
840
|
-
const dataRegex = /data: (.*?)\n\n/gs;
|
825
|
+
// 跳过 [DONE] 消息
|
826
|
+
if (data === '[DONE]') continue;
|
841
827
|
|
842
|
-
|
843
|
-
const
|
828
|
+
try {
|
829
|
+
const parsedData = JSON.parse(data);
|
844
830
|
|
845
|
-
// 跳过 [DONE] 消息
|
846
|
-
if (data === '[DONE]') continue;
|
847
|
-
|
848
|
-
try {
|
849
|
-
const parsedData = JSON.parse(data);
|
850
|
-
|
851
831
|
// 获取内容增量
|
852
832
|
if (parsedData.choices &&
|
853
|
-
|
854
|
-
|
833
|
+
parsedData.choices[0] &&
|
834
|
+
parsedData.choices[0].delta &&
|
855
835
|
parsedData.choices[0].delta.content) {
|
856
836
|
const content = parsedData.choices[0].delta.content;
|
857
837
|
fullContent += content;
|
@@ -1002,27 +982,27 @@ async function getDeepSeekResponse(apiKey, prompt, modelName, apiBaseURL, spinne
|
|
1002
982
|
|
1003
983
|
// 直接输出内容增量到控制台
|
1004
984
|
process.stdout.write(content);
|
1005
|
-
}
|
1006
|
-
} catch (err) {
|
1007
|
-
// 忽略解析错误
|
1008
985
|
}
|
986
|
+
} catch (err) {
|
987
|
+
// 忽略解析错误
|
1009
988
|
}
|
1010
|
-
|
1011
|
-
// 保留可能不完整的最后一部分
|
1012
|
-
const lastIndex = buffer.lastIndexOf('\n\n');
|
1013
|
-
if (lastIndex !== -1) {
|
1014
|
-
buffer = buffer.substring(lastIndex + 2);
|
1015
|
-
}
|
1016
|
-
});
|
989
|
+
}
|
1017
990
|
|
991
|
+
// 保留可能不完整的最后一部分
|
992
|
+
const lastIndex = buffer.lastIndexOf('\n\n');
|
993
|
+
if (lastIndex !== -1) {
|
994
|
+
buffer = buffer.substring(lastIndex + 2);
|
995
|
+
}
|
996
|
+
});
|
997
|
+
|
1018
998
|
// 处理结束
|
1019
|
-
|
1020
|
-
if (spinner) spinner.stop('✅
|
999
|
+
res.on('end', () => {
|
1000
|
+
if (spinner) spinner.stop('✅ AI响应已接收');
|
1021
1001
|
console.log(); // 添加换行符
|
1022
1002
|
resolve(fullContent);
|
1023
|
-
});
|
1024
1003
|
});
|
1025
|
-
|
1004
|
+
});
|
1005
|
+
|
1026
1006
|
// 处理请求错误
|
1027
1007
|
req.on('error', (error) => {
|
1028
1008
|
if (spinner) spinner.fail(`❌ DeepSeek API网络错误: ${error.message}`);
|
@@ -1031,7 +1011,7 @@ async function getDeepSeekResponse(apiKey, prompt, modelName, apiBaseURL, spinne
|
|
1031
1011
|
|
1032
1012
|
// 发送请求体
|
1033
1013
|
req.write(JSON.stringify(data));
|
1034
|
-
|
1014
|
+
req.end();
|
1035
1015
|
} catch (error) {
|
1036
1016
|
if (spinner) spinner.fail(`❌ DeepSeek API错误: ${error.message}`);
|
1037
1017
|
reject(error);
|
@@ -1314,9 +1294,10 @@ async function setupConfigInteractive() {
|
|
1314
1294
|
|
1315
1295
|
// 步骤1: 设置API提供商
|
1316
1296
|
console.log(colorize('\n📡 步骤1: 设置API提供商', 'yellow'));
|
1297
|
+
console.log(colorize(' (仅作为一个备注,示例:openai, deepseek, xxx)', 'cyan'));
|
1317
1298
|
let apiProvider = config.api_provider || '';
|
1318
1299
|
|
1319
|
-
const providerInput = await question(colorize(` 请选择API提供商 [${apiProvider ? apiProvider : '
|
1300
|
+
const providerInput = await question(colorize(` 请选择API提供商 [${apiProvider ? apiProvider : 'openai'}]: `, 'green'));
|
1320
1301
|
if (providerInput.trim() !== '') {
|
1321
1302
|
apiProvider = providerInput.trim();
|
1322
1303
|
} else if (apiProvider === '') {
|
@@ -1329,6 +1310,7 @@ async function setupConfigInteractive() {
|
|
1329
1310
|
|
1330
1311
|
// 步骤2: 设置API基础URL
|
1331
1312
|
console.log(colorize('\n🔗 步骤2: 设置API基础URL', 'yellow'));
|
1313
|
+
console.log(colorize(' (示例: https://api.openai.com, https://api.deepseek.com 或其他API服务地址)', 'cyan'));
|
1332
1314
|
|
1333
1315
|
// 根据提供商设置默认值
|
1334
1316
|
let defaultBaseURL = config.api_base_url || '';
|
@@ -1347,6 +1329,12 @@ async function setupConfigInteractive() {
|
|
1347
1329
|
// 步骤3: 设置AI模型
|
1348
1330
|
console.log(colorize('\n🤖 步骤3: 设置AI模型', 'yellow'));
|
1349
1331
|
|
1332
|
+
// 根据提供商显示不同的模型示例
|
1333
|
+
const modelExamples = config.api_provider === 'openai' ?
|
1334
|
+
'gpt-3.5-turbo, gpt-4, gpt-4-turbo' :
|
1335
|
+
'deepseek-chat, deepseek-coder, deepseek-v3';
|
1336
|
+
console.log(colorize(` (常用模型示例: ${modelExamples})`, 'cyan'));
|
1337
|
+
|
1350
1338
|
// 根据提供商设置默认模型
|
1351
1339
|
let defaultModel = config.ai_model || '';
|
1352
1340
|
if (!defaultModel) {
|
@@ -1363,6 +1351,7 @@ async function setupConfigInteractive() {
|
|
1363
1351
|
|
1364
1352
|
// 步骤4: 设置API密钥
|
1365
1353
|
console.log(colorize('\n🔑 步骤4: 设置API密钥', 'yellow'));
|
1354
|
+
console.log(colorize(' (格式示例: sk-abcdefg123456789... 密钥会安全存储在本地配置文件中)', 'cyan'));
|
1366
1355
|
const existingKey = config.api_key || '';
|
1367
1356
|
const keyInput = await question(colorize(` 请输入API密钥${existingKey ? ' [已配置,按Enter保留]' : ''}: `, 'green'));
|
1368
1357
|
if (keyInput.trim() !== '') {
|
@@ -1376,6 +1365,7 @@ async function setupConfigInteractive() {
|
|
1376
1365
|
|
1377
1366
|
// 步骤5: 设置默认作者
|
1378
1367
|
console.log(colorize('\n👤 步骤5: 设置默认作者', 'yellow'));
|
1368
|
+
console.log(colorize(' (示例: 张三, user@example.com, 或Git提交时使用的用户名)', 'cyan'));
|
1379
1369
|
const existingAuthor = config.default_author || '';
|
1380
1370
|
const authorInput = await question(colorize(` 请输入默认作者名称 [${existingAuthor}]: `, 'green'));
|
1381
1371
|
config.default_author = authorInput.trim() || existingAuthor;
|
@@ -1383,6 +1373,7 @@ async function setupConfigInteractive() {
|
|
1383
1373
|
|
1384
1374
|
// 步骤6: 设置默认时间范围(可选)
|
1385
1375
|
console.log(colorize('\n🕒 步骤6: 设置默认时间范围(可选)', 'yellow'));
|
1376
|
+
console.log(colorize(' (支持格式: "7 days ago", "1 week ago", "yesterday", "2023-01-01", "last monday")', 'cyan'));
|
1386
1377
|
|
1387
1378
|
// 获取当前的默认值
|
1388
1379
|
const defaultSince = config.default_since || '7 days ago';
|
@@ -1398,6 +1389,13 @@ async function setupConfigInteractive() {
|
|
1398
1389
|
|
1399
1390
|
// 步骤7: 仓库配置(可选)
|
1400
1391
|
console.log(colorize('\n📂 步骤7: 仓库配置(可选)', 'yellow'));
|
1392
|
+
console.log(colorize(' (仓库别名示例: frontend, backend, main-project)', 'cyan'));
|
1393
|
+
|
1394
|
+
// 根据操作系统提供路径示例
|
1395
|
+
const repoPathExample = process.platform === 'win32' ?
|
1396
|
+
'C:\\项目\\前端仓库' :
|
1397
|
+
'/Users/用户名/projects/前端仓库';
|
1398
|
+
console.log(colorize(` (仓库路径示例: ${repoPathExample})`, 'cyan'));
|
1401
1399
|
|
1402
1400
|
// 显示当前配置的仓库
|
1403
1401
|
const repos = config.repositories || {};
|
@@ -1423,7 +1421,8 @@ async function setupConfigInteractive() {
|
|
1423
1421
|
continue;
|
1424
1422
|
}
|
1425
1423
|
|
1426
|
-
//
|
1424
|
+
// 获取仓库路径,添加示例提示
|
1425
|
+
console.log(colorize(` (请输入Git仓库的绝对路径,示例: ${repoPathExample})`, 'cyan'));
|
1427
1426
|
const repoPath = await question(colorize(' 请输入仓库路径(绝对路径): ', 'green'));
|
1428
1427
|
if (!repoPath.trim()) {
|
1429
1428
|
console.log(colorize(' ❌ 仓库路径不能为空', 'red'));
|
@@ -1468,15 +1467,35 @@ async function setupConfigInteractive() {
|
|
1468
1467
|
|
1469
1468
|
// 主函数
|
1470
1469
|
async function getGitLogs() {
|
1470
|
+
const args = parseArgs();
|
1471
|
+
|
1472
|
+
// 显示帮助信息
|
1473
|
+
if (args['help']) {
|
1474
|
+
showHelp();
|
1475
|
+
return;
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
// 显示版本信息
|
1479
|
+
if (args['version']) {
|
1480
|
+
const packageJson = require('./package.json');
|
1481
|
+
console.log(`g2log version ${packageJson.version}`);
|
1482
|
+
return;
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
// 删除配置文件
|
1486
|
+
if (args['uninstall']) {
|
1487
|
+
const spinner = ora('正在删除配置文件...').start();
|
1488
|
+
const success = removeConfigFile();
|
1489
|
+
if (success) {
|
1490
|
+
spinner.succeed('配置文件已删除,如需完全卸载请运行: npm uninstall -g g2log');
|
1491
|
+
} else {
|
1492
|
+
spinner.fail('配置文件删除失败,可能文件不存在或无权限访问');
|
1493
|
+
}
|
1494
|
+
return;
|
1495
|
+
}
|
1496
|
+
|
1471
1497
|
try {
|
1472
1498
|
const spinner = createSpinner();
|
1473
|
-
const args = parseArgs();
|
1474
|
-
|
1475
|
-
// 显示帮助信息
|
1476
|
-
if (args.help) {
|
1477
|
-
showHelp();
|
1478
|
-
return;
|
1479
|
-
}
|
1480
1499
|
|
1481
1500
|
// 检查是否要显示自定义配置向导
|
1482
1501
|
if (args.config) {
|
@@ -1489,7 +1508,7 @@ async function getGitLogs() {
|
|
1489
1508
|
if (!args['set-api-key'] && !args['set-default-author'] && !args['add-repo'] &&
|
1490
1509
|
!args['fix-config'] && !args['remove-repo'] && !args['list-repos'] &&
|
1491
1510
|
!args['set-prompt-template'] && !args['reset-prompt-template'] &&
|
1492
|
-
!args['skip-config-check']) {
|
1511
|
+
!args['skip-config-check'] && !args['uninstall']) {
|
1493
1512
|
|
1494
1513
|
// 检查配置状态
|
1495
1514
|
const configStatus = checkConfig();
|
@@ -1814,4 +1833,45 @@ getGitLogs();
|
|
1814
1833
|
// .then(() => console.log('配置测试已完成'));
|
1815
1834
|
|
1816
1835
|
// 如果需要测试checkConfig(需要注释掉主函数调用)
|
1817
|
-
// console.log(checkConfig());
|
1836
|
+
// console.log(checkConfig());
|
1837
|
+
|
1838
|
+
// 重置prompt模板为默认值
|
1839
|
+
function resetPromptTemplate() {
|
1840
|
+
try {
|
1841
|
+
const config = loadConfig();
|
1842
|
+
if (config.prompt_template) {
|
1843
|
+
delete config.prompt_template;
|
1844
|
+
return saveConfig(config);
|
1845
|
+
}
|
1846
|
+
return true; // 如果没有设置自定义模板,则视为重置成功
|
1847
|
+
} catch (error) {
|
1848
|
+
console.error(`❌ 重置prompt模板失败: ${error.message}`);
|
1849
|
+
return false;
|
1850
|
+
}
|
1851
|
+
}
|
1852
|
+
|
1853
|
+
// 删除配置文件
|
1854
|
+
function removeConfigFile() {
|
1855
|
+
try {
|
1856
|
+
if (fs.existsSync(CONFIG_PATH)) {
|
1857
|
+
fs.unlinkSync(CONFIG_PATH);
|
1858
|
+
return true;
|
1859
|
+
}
|
1860
|
+
return false; // 文件不存在
|
1861
|
+
} catch (error) {
|
1862
|
+
console.error(`❌ 删除配置文件失败: ${error.message}`);
|
1863
|
+
return false;
|
1864
|
+
}
|
1865
|
+
}
|
1866
|
+
|
1867
|
+
// 设置API提供商
|
1868
|
+
function setAPIProvider(provider) {
|
1869
|
+
try {
|
1870
|
+
const config = loadConfig();
|
1871
|
+
config.api_provider = provider;
|
1872
|
+
return saveConfig(config);
|
1873
|
+
} catch (error) {
|
1874
|
+
console.error(`❌ 设置API提供商失败: ${error.message}`);
|
1875
|
+
return false;
|
1876
|
+
}
|
1877
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "g2log",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.4.1",
|
4
4
|
"description": "查询特定用户和时间范围的Git提交记录并通过AI进行总结,可通过npx直接运行",
|
5
5
|
"main": "git-user-log.js",
|
6
6
|
"bin": {
|
@@ -35,5 +35,7 @@
|
|
35
35
|
"url": "https://github.com/chenxiangcai/git-user-log/issues"
|
36
36
|
},
|
37
37
|
"homepage": "https://github.com/chenxiangcai/git-user-log#readme",
|
38
|
-
"dependencies": {
|
38
|
+
"dependencies": {
|
39
|
+
"ora": "^8.2.0"
|
40
|
+
}
|
39
41
|
}
|