Skip to content

Commit 021a7d5

Browse files
Enhance site-adapters built-in prompts
1 parent f3a7000 commit 021a7d5

File tree

12 files changed

+97
-45
lines changed

12 files changed

+97
-45
lines changed

src/content-script/site-adapters/arxiv/index.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ export default {
88
const abstract = document.querySelector('blockquote.abstract')?.textContent.trim()
99

1010
return await cropText(
11-
`Below is the paper abstract from a preprint site, summarize the key findings, methodology, and conclusions, especially highlight the contributions.` +
12-
`\n${title}\n${authors}\n${abstract}`,
11+
`You are a research assistant skilled in academic paper analysis. ` +
12+
`Based on the provided paper abstract from a preprint site, generate a structured summary. ` +
13+
`The summary should clearly outline: key findings, methodology, and conclusions. ` +
14+
`Pay special attention to highlighting the main contributions of the paper. ` +
15+
`Ensure the summary is concise and maintains an academic tone.\n` +
16+
`Title: ${title}\n` +
17+
`Authors: ${authors}\n` +
18+
`Abstract: ${abstract}`,
1319
)
1420
} catch (e) {
1521
console.log(e)

src/content-script/site-adapters/bilibili/index.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ export default {
5858
}
5959

6060
return await cropText(
61-
`用尽量简练的语言,联系视频标题,对视频进行内容摘要,同时仍要保留重要细节和标题信息,如果可能的话,使用markdown语法将视频内容总结为结构化信息,视频标题为:"${title}",字幕内容为:\n${subtitleContent}`,
61+
`You are an expert video summarizer. Create a comprehensive summary of the following Bilibili video in markdown format, ` +
62+
`highlighting key takeaways, crucial information, and main topics. Include the video title.\n` +
63+
`Video Title: "${title}"\n` +
64+
`Subtitle content:\n${subtitleContent}`,
6265
)
6366
} catch (e) {
6467
console.log(e)

src/content-script/site-adapters/followin/index.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ export default {
1111
const title = document.querySelector('main article h1')?.textContent
1212
if (title) {
1313
return await cropText(
14-
`以下是一篇文章,请给出文章的结论和3到5个要点.标题是:"${title}",作者是:"${author}",内容是:\n"${description}".
15-
`,
14+
`You are an expert content summarizer. Please carefully read the following article. ` +
15+
`Provide a conclusion and 3 to 5 main points, presented as a markdown list. ` +
16+
`The summary should be concise, clear, and accurately reflect the core content.\n` +
17+
`Title: "${title}"\n` +
18+
`Author: "${author}"\n` +
19+
`Content:\n"${description}"`,
1620
)
1721
} else {
1822
return await cropText(
19-
`以下是一篇长推文,请给出文章的结论和3到5个要点.作者是:"${author}",内容是:\n"${description}".
20-
`,
23+
`You are an expert content summarizer. Please carefully read the following long tweet. ` +
24+
`Provide a conclusion and 3 to 5 main points, presented as a markdown list. ` +
25+
`The summary should be concise, clear, and accurately reflect the core content.\n` +
26+
`Author: "${author}"\n` +
27+
`Content:\n"${description}"`,
2128
)
2229
}
2330
}

src/content-script/site-adapters/github/index.mjs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,16 @@ function createChatGPtSummaryPrompt(issueData, isIssue = true) {
8989

9090
if (isIssue) {
9191
prompt =
92-
'Please summarize the following GitHub issue thread.\nWhat is the main issue and key points discussed in this thread?\n\n'
92+
`You are an expert in analyzing GitHub discussions. ` +
93+
`Please provide a concise summary of the following GitHub issue thread. ` +
94+
`Identify the main problem reported, key points discussed by participants, proposed solutions (if any), and the current status or next steps. ` +
95+
`Present the summary in a structured markdown format.\n\n`
9396
} else {
9497
prompt =
95-
'Please summarize the following GitHub pull request thread.\nWhat is the main issue this pull request is trying to solve?\n\n'
98+
`You are an expert in analyzing GitHub discussions and code reviews. ` +
99+
`Please provide a concise summary of the following GitHub pull request thread. ` +
100+
`Identify the main problem this pull request aims to solve, the proposed changes, key discussion points from the review, and the overall status of the PR (e.g., approved, needs changes, merged). ` +
101+
`Present the summary in a structured markdown format.\n\n`
96102
}
97103

98104
prompt += '---\n\n'
@@ -153,8 +159,12 @@ export default {
153159
if (!patchData) return
154160

155161
return await cropText(
156-
`Analyze the contents of a git commit,provide a suitable commit message,and summarize the contents of the commit.` +
157-
`The patch contents of this commit are as follows:\n${patchData}`,
162+
`You are an expert in analyzing git commits and crafting clear, concise commit messages. ` +
163+
`Based on the following git patch, please perform two tasks:\n` +
164+
`1. Generate a suitable commit message. It should follow standard conventions: a short imperative subject line (max 50 chars), ` +
165+
`followed by a blank line and a more detailed body if necessary, explaining the "what" and "why" of the changes.\n` +
166+
`2. Provide a brief summary of the changes introduced in this commit, highlighting the main purpose and impact.\n\n` +
167+
`The patch contents are as follows:\n${patchData}`,
158168
)
159169
} catch (e) {
160170
console.log(e)

src/content-script/site-adapters/gitlab/index.mjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,25 @@ export default {
2323
if (!fileData) return
2424

2525
return await cropText(
26-
`Analyze the following file content and explain it. Use markdown syntax to make your answer more readable, such as code blocks, bold, list:` +
27-
`\n\`\`\`\n${fileData}\n\`\`\``,
26+
`You are a senior software engineer and code reviewer. ` +
27+
`Analyze the following file content thoroughly. ` +
28+
`Explain its purpose, main functionalities, and how different parts of the code contribute to its overall behavior. ` +
29+
`Identify any potential issues, areas for improvement, or notable design patterns. ` +
30+
`Use markdown syntax (e.g., code blocks, bolding, lists) to structure your explanation for better readability.\n\n` +
31+
`File content:\n\`\`\`\n${fileData}\n\`\`\``,
2832
)
2933
} else {
3034
const patchUrl = await getPatchUrl()
3135
const patchData = await getPatchData(patchUrl)
3236
if (!patchData) return
3337

3438
return await cropText(
35-
`Analyze the contents of a git commit,provide a suitable commit message,and summarize the contents of the commit.` +
36-
`The patch contents of this commit are as follows:\n${patchData}`,
39+
`You are an expert in analyzing git commits and crafting clear, concise commit messages. ` +
40+
`Based on the following git patch, please perform two tasks:\n` +
41+
`1. Generate a suitable commit message. It should follow standard conventions: a short imperative subject line (max 50 chars), ` +
42+
`followed by a blank line and a more detailed body if necessary, explaining the "what" and "why" of the changes.\n` +
43+
`2. Provide a brief summary of the changes introduced in this commit, highlighting the main purpose and impact.\n\n` +
44+
`The patch contents are as follows:\n${patchData}`,
3745
)
3846
}
3947
} catch (e) {

src/content-script/site-adapters/juejin/index.mjs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ export default {
2121
comment += `answer${i}: ${comment[i - 1].textContent}|`
2222
}
2323
return await cropText(
24-
`以下是一篇文章,标题是:"${title}",作者是:"${author}",内容是:\n"${description}".各个评论如下:\n${comment}.请以如下格式输出你的回答:
25-
{文章摘要和文章作者}
26-
======
27-
{文章总结和对文章的看法}
28-
======
29-
{对评论的总结}
30-
`,
24+
`You are an expert content analyst and summarizer. ` +
25+
`Please analyze the following Juejin article and its comments. Provide a summary of the article (including author), your opinion on it, and a summary of the comments.\n` +
26+
`Article Title: "${title}"\n` +
27+
`Author: "${author}"\n` +
28+
`Content:\n"${description}"\n\n` +
29+
`Selected comments:\n${comment}`,
3130
)
3231
}
3332
} catch (e) {

src/content-script/site-adapters/quora/index.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ export default {
1515
}
1616

1717
return await cropText(
18-
`Below is the content from a question and answer platform,giving the corresponding summary and your opinion on it.` +
19-
`The question is:'${title}',` +
20-
`Some answers are as follows:\n${answers}`,
18+
`You are an insightful analyst of Q&A discussions. ` +
19+
`Below is content from a Q&A platform. Please provide a summary of the discussion and your opinion on it.\n` +
20+
`Question: '${title}'\n` +
21+
`Answers:\n${answers}`,
2122
)
2223
} catch (e) {
2324
console.log(e)

src/content-script/site-adapters/reddit/index.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ export default {
1414
}
1515

1616
return await cropText(
17-
`Below is the content from a social forum,giving the corresponding summary and your opinion on it.` +
18-
`The title is:'${title}',and the further description of the title is:'${description}'.` +
19-
`Some answers are as follows:\n${answers}`,
17+
`You are an expert in analyzing online forum discussions. ` +
18+
`Below is content from a social forum (Reddit). Please provide a summary of the discussion and your opinion on it.\n` +
19+
`Title: '${title}'\n` +
20+
`Description: '${description}'\n` +
21+
`Comments:\n${answers}`,
2022
)
2123
} catch (e) {
2224
console.log(e)

src/content-script/site-adapters/stackoverflow/index.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ export default {
1414
}
1515

1616
return await cropText(
17-
`Below is the content from a developer Q&A platform. Analyze answers and provide a brief solution that can solve the question first,` +
18-
`then give an overview of all answers. The question is: "${title}", and the further description of the question is: "${description}".` +
19-
`The answers are as follows:\n${answer}`,
17+
`You are an expert software developer and technical problem solver. ` +
18+
`The following content is from a developer Q&A platform (Stack Overflow).\n\n` +
19+
`Question: "${title}"\n` +
20+
`Question Description: "${description}"\n\n` +
21+
`Provided Answers:\n${answer}\n\n` +
22+
`Please perform the following tasks:\n` +
23+
`1. **Direct Solution:** Based on the provided answers, formulate a concise and effective solution to the question. ` +
24+
`If applicable, include a brief code snippet (using markdown for formatting).\n` +
25+
`2. **Overview of Answers:** Provide an overview of the different approaches or key points mentioned in the provided answers. ` +
26+
`You can highlight any notable variations, pros, or cons if apparent.`,
2027
)
2128
}
2229
} catch (e) {

src/content-script/site-adapters/weixin/index.mjs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ export default {
2020
}
2121

2222
return await cropText(
23-
`以下是一篇文章,标题是:"${title}",文章来源是:"${author}公众号",内容是:\n"${description}".请以如下格式输出你的回答:
24-
{文章来源和文章摘要}
25-
======
26-
{文章总结}
27-
======
28-
{对文章的看法}
29-
`,
23+
`You are an expert article analyst and summarizer. ` +
24+
`Please analyze the following WeChat Official Account article. Provide the source, a summary of the article, its main conclusions, and your opinion on it.\n` +
25+
`Article Title: "${title}"\n` +
26+
`Source: "${author} Official Account"\n` +
27+
`Content:\n"${description}"`,
3028
)
3129
}
3230
} catch (e) {

0 commit comments

Comments
 (0)