Skip to content

Commit

Permalink
chore: 结果样式优化,更适合复制粘贴
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed May 24, 2024
1 parent cfdbea1 commit c237d97
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<title>周报生成</title>
<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css" rel="stylesheet"></head>
<style>
ul {
li {
list-style-type: none;
}
</style>
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function handleSummaryRequest(req, env, ctx) {
}
if (AI_ENDPOINT && AI_API_KEY && AI_API_MODEL) {
const prompt = `根据最近一周的工作记录,总结一下本周的工作内容不要超过100字,不要引用原文。下面是最近一周的工作记录:\n${html}`;
const summary = await sendOpenAIRequest(AI_API_KEY, AI_ENDPOINT, AI_API_MODEL, prompt).then(e => `<p>${e}</p>`).catch(e => '');
const summary = await sendOpenAIRequest(AI_API_KEY, AI_ENDPOINT, AI_API_MODEL, prompt).then(e => `<p style="font-size: 1.5rem;">${e}</p>`).catch(e => '');
if (summary) {
html += summary;
}
Expand Down
17 changes: 9 additions & 8 deletions src/redmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,28 +184,29 @@ function timeEntriesToGroup(list) {
export function renderWeeklyHTML(list) {
let html = '';
const typeGroup = timeEntriesToGroup(list);

const space = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
for (const type in typeGroup) {
html += `<h4>${type}</h4>\n`;
html += `<ul>\n`;
html += `<h1>${type}</h1><br/>\n`;
html += `<div>\n`;
const entries = typeGroup[type]
entries.sort((a, b) => a.issue_id - b.issue_id);
for (let i = 0; i < entries.length; i++) {
const item = entries[i];
html += `<li><h5>${numberToChinese(i + 1)}. ${item.subject} (issue: ${item.issue_id})</h5></li>\n`;
html += `<li><h3>${numberToChinese(i + 1)}. ${item.subject} (issue: ${item.issue_id})</h3></li>\n`;
if (item.entries && item.entries.length > 0) {
html += `<ul>\n`;
html += `<div>\n`;
let j = 0;
for (const entry of item.entries) {
if (entry.comment) {
j += 1;
html += `<li>${j}. ${entry.comment}</li>\n`;
html += `<li style="font-size: 1rem;">${space}${j}. ${entry.comment} (${entry.hours} 小时)</li>\n`;
}
}
html += `</ul>\n`;
html += `</div>\n`;
}
html += `<br/>\n`
}
html += `</ul>\n`;
html += `</div><br/>\n`;
}
return html;
}

0 comments on commit c237d97

Please sign in to comment.