zen-gitsync 2.12.3 → 2.12.4
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/package.json +17 -4
- package/src/ui/public/assets/{EditorView-GS5cmh99.js → EditorView-BZaOzahT.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-_YRtzmZZ.js → SourceMapView-D_8mnVt2.js} +1 -1
- package/src/ui/public/assets/{index-yky0Sd13.js → index-BgFwmXzV.js} +6 -6
- package/src/ui/public/assets/{index-ML5Y-5lO.css → index-Dsi6tg7k.css} +1 -1
- package/src/ui/public/index.html +2 -2
- package/src/ui/server/routes/config.js +22 -4
package/src/ui/public/index.html
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
11
11
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
12
12
|
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-BgFwmXzV.js"></script>
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-BM3Ffeng.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/vendor-DITsiaGj.js">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/vendor-q83wvJns.css">
|
|
17
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
17
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dsi6tg7k.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|
|
20
20
|
<div id="app"></div>
|
|
@@ -1073,9 +1073,10 @@ export function registerConfigRoutes({
|
|
|
1073
1073
|
|
|
1074
1074
|
// AI 生成提交信息
|
|
1075
1075
|
app.post('/api/config/generate-commit-message', express.json(), async (req, res) => {
|
|
1076
|
-
const { fileList } = req.body || {}
|
|
1076
|
+
const { fileList, locale: reqLocale } = req.body || {}
|
|
1077
1077
|
try {
|
|
1078
1078
|
const rawConfig = await configManager.readRawConfigFile()
|
|
1079
|
+
const userLocale = reqLocale || rawConfig.locale || 'zh-CN'
|
|
1079
1080
|
const models = Array.isArray(rawConfig.models) ? rawConfig.models : []
|
|
1080
1081
|
const defaultModel = models.find(m => m.isDefault) || models[0]
|
|
1081
1082
|
if (!defaultModel) {
|
|
@@ -1087,7 +1088,8 @@ export function registerConfigRoutes({
|
|
|
1087
1088
|
const safeFileList = Array.isArray(fileList) && fileList.length > 0 ? fileList : serverFileList
|
|
1088
1089
|
const diffText = prepareDiffForPrompt(rawDiff, safeFileList)
|
|
1089
1090
|
const filesText = safeFileList.slice(0, 30).join('\n')
|
|
1090
|
-
|
|
1091
|
+
|
|
1092
|
+
const promptZh = `你是一个 Git 提交信息生成助手。根据以下 git diff 信息,生成一条符合 Conventional Commits 规范的提交信息。
|
|
1091
1093
|
|
|
1092
1094
|
要求:
|
|
1093
1095
|
1. type 只能是:feat/fix/docs/style/refactor/test/chore 之一
|
|
@@ -1101,10 +1103,26 @@ ${filesText}
|
|
|
1101
1103
|
git diff --staged:
|
|
1102
1104
|
${diffText || '(无 staged 内容,请根据文件列表推断)'}`
|
|
1103
1105
|
|
|
1104
|
-
|
|
1106
|
+
const promptEn = `You are a Git commit message generation assistant. Based on the following git diff, generate a commit message that follows the Conventional Commits specification.
|
|
1107
|
+
|
|
1108
|
+
Requirements:
|
|
1109
|
+
1. type must be one of: feat/fix/docs/style/refactor/test/chore
|
|
1110
|
+
2. scope is optional; use a short English word or short noun phrase to indicate the affected area. Leave empty if unclear.
|
|
1111
|
+
3. description must be a concise English summary of the change (no more than 50 characters). Use the imperative mood (e.g. "add login button", not "added" or "adding").
|
|
1112
|
+
4. Return ONLY a JSON object in the format: {"type":"feat","scope":"","description":"xxx"}
|
|
1113
|
+
|
|
1114
|
+
Changed files:
|
|
1115
|
+
${filesText}
|
|
1116
|
+
|
|
1117
|
+
git diff --staged:
|
|
1118
|
+
${diffText || '(no staged content, please infer from the file list)'}`
|
|
1119
|
+
|
|
1120
|
+
const prompt = userLocale.startsWith('en') ? promptEn : promptZh
|
|
1121
|
+
|
|
1122
|
+
console.log('[generate-commit] locale:', userLocale, '| prompt length:', prompt.length)
|
|
1123
|
+
console.log('[generate-commit] ===== PROMPT START =====')
|
|
1105
1124
|
console.log(prompt)
|
|
1106
1125
|
console.log('[generate-commit] ===== PROMPT END =====')
|
|
1107
|
-
|
|
1108
1126
|
const { default: fetch } = await import('node-fetch').catch(() => ({ default: globalThis.fetch }))
|
|
1109
1127
|
const url = `${defaultModel.baseURL.replace(/\/$/, '')}/chat/completions`
|
|
1110
1128
|
const headers = { 'Content-Type': 'application/json' }
|