@unifan/pi-unifan-zh 1.0.43 → 1.0.44
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.
|
@@ -69,9 +69,14 @@ export async function generateCommitMessage(
|
|
|
69
69
|
const model = resolved.auth.baseUrl ? { ...ctx.model, baseUrl: resolved.auth.baseUrl } : ctx.model;
|
|
70
70
|
let formatFeedback = "";
|
|
71
71
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
72
|
+
// pi-ai 1.x 的提供方接口只接受已归一化的消息,context.systemPrompt 会被静默丢弃;
|
|
73
|
+
// 缺少格式约束时思考型模型会耗尽 maxTokens 却不出结果(停止原因 length),因此约束并入用户消息。
|
|
72
74
|
const response = await provider.streamSimple(model, {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
messages: [{
|
|
76
|
+
role: "user",
|
|
77
|
+
content: [{ type: "text", text: `${COMMIT_SYSTEM_PROMPT}\n\n${userPrompt}${formatFeedback}` }],
|
|
78
|
+
timestamp: Date.now(),
|
|
79
|
+
}],
|
|
75
80
|
}, {
|
|
76
81
|
maxTokens: 4096,
|
|
77
82
|
signal: ctx.signal,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifan/pi-commit-zh",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "Pi 智能 Git 提交助手(规范化 Conventional Commits 纯中文版,支持一键提审与推流)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"chinese"
|
|
20
20
|
],
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@earendil-works/pi-ai": ">=0.74.0 <
|
|
23
|
-
"@earendil-works/pi-coding-agent": ">=0.74.0 <
|
|
22
|
+
"@earendil-works/pi-ai": ">=0.74.0 <2.0.0",
|
|
23
|
+
"@earendil-works/pi-coding-agent": ">=0.74.0 <2.0.0"
|
|
24
24
|
},
|
|
25
25
|
"pi": {
|
|
26
26
|
"extensions": [
|
|
@@ -38,6 +38,9 @@ test('通过宿主统一接口继承当前模型并返回业务日志', async ()
|
|
|
38
38
|
const ctx = context(async (actualModel, prompt, options) => {
|
|
39
39
|
assert.equal(actualModel, model);
|
|
40
40
|
assert.match(prompt.messages[0].content[0].text, /修复冲线残留/);
|
|
41
|
+
// 提交规范必须随消息发送,不能依赖会被新版 pi-ai 静默丢弃的 context.systemPrompt。
|
|
42
|
+
assert.match(prompt.messages[0].content[0].text, /Conventional Commits/);
|
|
43
|
+
assert.equal(prompt.systemPrompt, undefined);
|
|
41
44
|
assert.equal(options.maxTokens, 4096);
|
|
42
45
|
assert.equal(options.reasoning, 'high');
|
|
43
46
|
return response('```text\nfix(racing): 清理冲线特效残留\n```');
|