fix: address code review feedback — improve error messages and clipboard handling

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/f22ed4e7-70d7-426e-ac6d-63925ec2b843
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 12:41:15 +00:00
parent 83b80fdc50
commit 84dacd41e4
10 changed files with 17 additions and 10 deletions

View File

@ -20,5 +20,5 @@
"warnings": [] "warnings": []
}, },
"notion_page_urls": {}, "notion_page_urls": {},
"last_synced": "2026-03-24T12:32:22.811Z" "last_synced": "2026-03-24T12:41:05.805Z"
} }

View File

@ -20,5 +20,5 @@
"warnings": [] "warnings": []
}, },
"notion_page_urls": {}, "notion_page_urls": {},
"last_synced": "2026-03-24T12:32:22.812Z" "last_synced": "2026-03-24T12:41:05.805Z"
} }

View File

@ -20,5 +20,5 @@
"warnings": [] "warnings": []
}, },
"notion_page_urls": {}, "notion_page_urls": {},
"last_synced": "2026-03-24T12:32:22.812Z" "last_synced": "2026-03-24T12:41:05.805Z"
} }

View File

@ -20,5 +20,5 @@
"warnings": [] "warnings": []
}, },
"notion_page_urls": {}, "notion_page_urls": {},
"last_synced": "2026-03-24T12:32:22.812Z" "last_synced": "2026-03-24T12:41:05.806Z"
} }

View File

@ -20,5 +20,5 @@
"warnings": [] "warnings": []
}, },
"notion_page_urls": {}, "notion_page_urls": {},
"last_synced": "2026-03-24T12:32:22.813Z" "last_synced": "2026-03-24T12:41:05.806Z"
} }

View File

@ -20,5 +20,5 @@
"warnings": [] "warnings": []
}, },
"notion_page_urls": {}, "notion_page_urls": {},
"last_synced": "2026-03-24T12:32:22.813Z" "last_synced": "2026-03-24T12:41:05.806Z"
} }

View File

@ -20,5 +20,5 @@
"warnings": [] "warnings": []
}, },
"notion_page_urls": {}, "notion_page_urls": {},
"last_synced": "2026-03-24T12:32:22.813Z" "last_synced": "2026-03-24T12:41:05.806Z"
} }

View File

@ -41,6 +41,9 @@ jobs:
git config user.name "铸渊 (ZhùYuān)" git config user.name "铸渊 (ZhùYuān)"
git config user.email "zhuyuan@guanghulab.com" git config user.email "zhuyuan@guanghulab.com"
git add .github/notion-cache/ git add .github/notion-cache/
git diff --cached --quiet && echo "无变更" && exit 0 if git diff --cached --quiet; then
echo "📡 Notion 画像无变更,跳过提交"
exit 0
fi
git commit -m "📡 同步 Notion 开发者画像 · $(TZ='Asia/Shanghai' date '+%Y-%m-%d %H:%M')" git commit -m "📡 同步 Notion 开发者画像 · $(TZ='Asia/Shanghai' date '+%Y-%m-%d %H:%M')"
git push origin main git push origin main

View File

@ -1818,7 +1818,7 @@ async function submitToZhuyuan(instructionText, instructionId, moduleName) {
const err = await res.json().catch(function() { return {}; }); const err = await res.json().catch(function() { return {}; });
console.warn('[铸渊] Issue 创建失败:', res.status, err.message); console.warn('[铸渊] Issue 创建失败:', res.status, err.message);
alert('Issue 创建失败:' + (err.message || res.status) + '\n\n可能需要有仓库写权限的 Token。指令已复制到剪贴板,可手动提交。'); alert('Issue 创建失败:' + (err.message || res.status) + '\n\n可能需要有仓库写权限的 Token。指令已复制到剪贴板,可手动提交。');
navigator.clipboard.writeText(instructionText).catch(function() {}); navigator.clipboard.writeText(instructionText).catch(function() { console.warn('[铸渊] 复制到剪贴板失败'); });
return null; return null;
} }
} catch (e) { } catch (e) {

View File

@ -34,6 +34,7 @@ const DEV_REGISTRY = {
function notionRequest(method, apiPath, body) { function notionRequest(method, apiPath, body) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!NOTION_TOKEN) { if (!NOTION_TOKEN) {
console.warn('⚠️ NOTION_TOKEN 未配置,跳过 Notion API 调用');
resolve({ error: 'NOTION_TOKEN not configured' }); resolve({ error: 'NOTION_TOKEN not configured' });
return; return;
} }
@ -52,7 +53,10 @@ function notionRequest(method, apiPath, body) {
res.on('data', chunk => data += chunk); res.on('data', chunk => data += chunk);
res.on('end', () => { res.on('end', () => {
try { resolve(JSON.parse(data)); } try { resolve(JSON.parse(data)); }
catch (_) { resolve({ raw: data }); } catch (parseErr) {
console.warn('⚠️ Notion API 响应解析失败:', parseErr.message);
resolve({ error: 'JSON parse failed', raw: data });
}
}); });
}); });
req.on('error', reject); req.on('error', reject);