Skip to content

Commit 4f98298

Browse files
committed
修改文件匹配表达式 && 增加调试信息输出
1 parent 2786cd3 commit 4f98298

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ dist/
1414

1515
# 忽略操作系统生成的文件
1616
.DS_Store
17-
Thumbs.db
17+
Thumbs.db
18+
tmp/*
19+
.CodeReDesignWorkSpace/*

src/cvbManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ export function parseCvb(cvbContent: string): {
173173
files: Record<string, string>;
174174
} {
175175
// 匹配## BEGIN_CVB在行首的位置
176-
const cvbStartRegex = /^## BEGIN_CVB/m;
176+
const cvbStartRegex = /^## BEGIN_CVB(\s|$)/m;
177177
const cvbStartMatch = cvbStartRegex.exec(cvbContent);
178178
if (!cvbStartMatch) {
179179
throw new Error('Invalid CVB format: missing BEGIN_CVB marker.');
180180
}
181181
const cvbStartIndex = cvbStartMatch.index;
182182

183183
// 匹配## END_CVB在行首的位置
184-
const cvbEndRegex = /^## END_CVB/m;
184+
const cvbEndRegex = /^## END_CVB(\s|$)/m;
185185
const cvbEndMatch = cvbEndRegex.exec(cvbContent);
186186
if (!cvbEndMatch) {
187187
throw new Error('Invalid CVB format: missing END_CVB marker.');
@@ -192,7 +192,7 @@ export function parseCvb(cvbContent: string): {
192192
const cvbContentStr = cvbContent.slice(cvbStartIndex, cvbEndIndex + cvbEndMatch[0].length);
193193

194194
// 提取元数据部分
195-
const metaRegex = /^## META\n([\s\S]*?)^## END_META/m;
195+
const metaRegex = /^## META\n([\s\S]*?)^## END_META(\s|$)/m;
196196
const metaMatch = metaRegex.exec(cvbContentStr);
197197
if (!metaMatch) {
198198
throw new Error('Invalid CVB format: missing META section.');

src/deepseekApi.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ async function callDeepSeekApi(
4343
): Promise<string | null> {
4444
const apiKey = getDeepSeekApiKey();
4545
if (!apiKey) {
46+
vscode.window.showWarningMessage('请先设置DeepSeek API Key');
4647
return null;
4748
}
4849

@@ -65,6 +66,8 @@ async function callDeepSeekApi(
6566
let maxAttempts = 5;
6667
let attempts = 0;
6768

69+
vscode.window.showInformationMessage('开始上传DeepSeek API');
70+
6871
while (attempts < maxAttempts) {
6972
attempts++;
7073
const response = await openai.chat.completions.create({
@@ -75,6 +78,8 @@ async function callDeepSeekApi(
7578
temperature: 0
7679
});
7780

81+
vscode.window.showInformationMessage('DeepSeek API 正在处理...');
82+
7883
let chunkResponse = '';
7984
let finishReason: string | null = null;
8085

@@ -106,6 +111,8 @@ async function callDeepSeekApi(
106111

107112
if (!shouldContinue) {break};
108113

114+
vscode.window.showWarningMessage('超过最大Token数,正在重试...');
115+
109116
// 准备下一次请求
110117
messages_body.push(
111118
{ role: 'assistant', content: fullResponse },

0 commit comments

Comments
 (0)