Skip to content

Commit 88f1068

Browse files
committed
refactor: 简化 package.json 并更新环境变量配置
1 parent a72b3bb commit 88f1068

File tree

3 files changed

+29
-56
lines changed

3 files changed

+29
-56
lines changed

package.json

+23-53
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,24 @@
11
{
2-
"name": "aicommits",
3-
"version": "0.0.0-semantic-release",
4-
"description": "Writes your git commit messages for you with AI",
5-
"keywords": [
6-
"ai",
7-
"git",
8-
"commit"
9-
],
10-
"license": "MIT",
11-
"repository": "Nutlope/aicommits",
12-
"author": "Hassan El Mghari (@nutlope)",
13-
"type": "module",
14-
"files": [
15-
"dist"
16-
],
17-
"bin": {
18-
"aicommits": "./dist/cli.mjs",
19-
"aic": "./dist/cli.mjs"
20-
},
21-
"scripts": {
22-
"build": "pkgroll --minify",
23-
"lint": "",
24-
"type-check": "tsc",
25-
"test": "tsx tests",
26-
"prepack": "pnpm build && clean-pkg-json"
27-
},
28-
"dependencies": {
29-
"@dqbd/tiktoken": "^1.0.2"
30-
},
31-
"devDependencies": {
32-
"@clack/prompts": "^0.7.0",
33-
"@types/ini": "^1.3.31",
34-
"@types/inquirer": "^9.0.3",
35-
"@types/node": "^18.14.2",
36-
"clean-pkg-json": "^1.2.0",
37-
"cleye": "^1.3.2",
38-
"execa": "^7.0.0",
39-
"fs-fixture": "^1.2.0",
40-
"https-proxy-agent": "^5.0.1",
41-
"ini": "^3.0.1",
42-
"kolorist": "^1.7.0",
43-
"manten": "^0.7.0",
44-
"openai": "^3.2.1",
45-
"pkgroll": "^1.9.0",
46-
"tsx": "^3.12.3",
47-
"typescript": "^4.9.5"
48-
},
49-
"release": {
50-
"branches": [
51-
"main"
52-
]
53-
}
54-
}
2+
"name": "aicommits",
3+
"version": "0.0.0-semantic-release",
4+
"description": "Writes your git commit messages for you with AI",
5+
"keywords": [
6+
"ai",
7+
"git",
8+
"commit"
9+
],
10+
"license": "MIT",
11+
"repository": "Nutlope/aicommits",
12+
"author": "Hassan El Mghari (@nutlope)",
13+
"type": "module",
14+
"files": [
15+
"dist"
16+
],
17+
"bin": {
18+
"aicommits": "./dist/cli.mjs",
19+
"aic": "./dist/cli.mjs"
20+
},
21+
"dependencies": {
22+
"@dqbd/tiktoken": "^1.0.2"
23+
}
24+
}

src/commands/aicommits.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export default async (
5454

5555
const { env } = process;
5656
const config = await getConfig({
57-
OPENAI_KEY: env.DEEPSEEK_KEY || env.OPENAI_API_KEY,
57+
OPENAI_KEY: env.AI_COMMIT_KEY,
58+
model: env.AI_COMMIT_MODEL || 'deepseek-chat',
5859
proxy:
5960
env.https_proxy || env.HTTPS_PROXY || env.http_proxy || env.HTTP_PROXY,
6061
generate: generate?.toString(),

src/utils/openai.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ const createChatCompletion = async (
8080
onStream?: (chunk: string) => void
8181
) => {
8282
if (json.stream && onStream) {
83+
const { env } = process;
8384
const { response } = await httpsPost(
84-
'api.siliconflow.cn',
85+
env.AI_COMMIT_HOST || 'api.deepseek.com',
8586
'/v1/chat/completions',
8687
{
8788
Authorization: `Bearer ${apiKey}`,
@@ -126,8 +127,9 @@ const createChatCompletion = async (
126127
return {} as CreateChatCompletionResponse;
127128
}
128129

130+
const { env } = process;
129131
const { response, data } = await httpsPost(
130-
'api.siliconflow.cn',
132+
env.AI_COMMIT_HOST || 'api.deepseek.com',
131133
'/v1/chat/completions',
132134
{
133135
Authorization: `Bearer ${apiKey}`,

0 commit comments

Comments
 (0)