Merge branch 'feat/back-to-front' into feat/front-end

This commit is contained in:
Roe-xin
2026-01-13 16:24:17 +08:00
5 changed files with 73 additions and 22 deletions

View File

@ -1016,7 +1016,7 @@ export class DialogSession {
if (selection === "去充值") {
// 打开充值页面
vscode.env.openExternal(
vscode.Uri.parse("https://iccoder.com/memberCenter")
vscode.Uri.parse("https://iccoder.com/recharge")
);
}
});

View File

@ -238,6 +238,25 @@ export async function startStreamDialog(
res.on('data', (chunk: string) => {
if (!controller.aborted) {
console.log('[SSE] 收到原始数据块:', chunk.substring(0, 200));
// 检查是否是业务错误码Gateway 返回 HTTP 200 但响应体是错误 JSON
try {
const trimmed = chunk.trim();
if (trimmed.startsWith('{') && trimmed.includes('"code"')) {
const json = JSON.parse(trimmed);
if (json.code === 401 || json.msg?.includes('登录状态已过期')) {
console.log('[SSE] 检测到登录过期业务错误');
const error = new Error('LOGIN_EXPIRED:登录状态已过期,请重新登录');
callbacks.onError?.({ message: error.message });
controller.abort();
reject(error);
return;
}
}
} catch {
// 不是 JSON 格式,继续正常处理
}
parser.feed(chunk);
}
});