Skip to content

Commit

Permalink
update prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
AIboy996 committed May 23, 2024
1 parent aea1594 commit 2598bc7
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ include:
ai-summary-config:
api: "tongyi"
model: "qwen-turbo"
prompt: "帮我把下面的内容总结为200字以内的摘要:"
---
# title
Expand Down
1 change: 1 addition & 0 deletions docs/withouth1.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include:
ai-summary-config:
api: "tongyi"
model: "qwen-turbo"
prompt: "帮我把下面的内容总结为200字以内的摘要:"
---

> copy from <https://yangzhang.site/Python/BasicSyntax/builtin_keyword/>
Expand Down
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ theme:
plugins:
- ai-summary:
api: "chatgpt"
model: "gpt-3.5-turbo"
model: "gpt-4o"
ignore_code: true
cache: true
cache_dir: "./"
prompt: "Please help me summarize the following content into an abstract within 200 words: "
prompt: "Please help me summarize the following content into an abstract within 200 words in source language. Must within 200 words. Do not use linebreak.: "
- tags

markdown_extensions:
Expand Down
3 changes: 2 additions & 1 deletion mkdocs_ai_summary/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class AiSummaryPlugin(BasePlugin):
"prompt",
config_options.Type(
str,
default="Please help me summarize the following content into an abstract within 200 words: ",
default="Please help me summarize the following content into an"
"abstract within 200 words: ",
),
),
)
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ include:
ai-summary-config:
api: "tongyi"
model: "qwen-turbo"
prompt: "帮我把下面的内容总结为200字以内的摘要:"
---
# title
Expand Down
7 changes: 3 additions & 4 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,8 @@
<h1 id="mkdocs-ai-summary">mkdocs-ai-summary</h1>
<div class="admonition chatgpt-summary">
<p class="admonition-title">AI Summary powered by <a href="https://chat.openai.com/">ChatGPT</a></p>
<p>The <strong>mkdocs-ai-summary</strong> package allows users to generate an AI-powered summary for web pages. It supports integration with <a href="https://chat.openai.com/">ChatGPT</a> and <a href="https://tongyi.aliyun.com/">tongyi ai</a>. To use ChatGPT (default), an environmental variable for the API key needs to be set. Similarly, for tongyi ai, a separate API key environmental variable must be configured. Users can include an optional <strong>ai-summary.css</strong> file for custom AI summary admonition styles.</p>
<p>The <code>mkdocs-ai-summary</code> is a Python package available on PyPI that generates AI-based summaries for MkDocs pages. It supports two AI platforms: ChatGPT and Tongyi AI. Users must set an environmental variable for the API key of the chosen platform. For ChatGPT, the <code>OPENAI_API_KEY</code> is required, while for Tongyi AI, the <code>DASHSCOPE_API_KEY</code> is necessary. The package allows customization through several configuration options such as the AI model, caching preferences, and prompt settings. Configuration can be either global in the <code>mkdocs.yml</code> file or page-specific via meta tags. The caching mechanism ensures that repetitive API calls are avoided by storing previously generated summaries. Optional CSS for custom summary styles can also be included. For a minimal demo, visit <a href="https://aiboy996.github.io/mkdocs-ai-summary">aiboy996.github.io/mkdocs-ai-summary</a>, and for a live example, check <a href="https://yangzhang.site">yangzhang.site</a>. Enjoy efficient documentation summarization with <code>mkdocs-ai-summary</code>.</p>
</div>
<p>Configuration options include setting the AI provider (ChatGPT or tongyi), model, ignoring code blocks, cache settings, cache directory, and the default prompt for summarization. Specific pages can be configured for AI summary generation by setting up meta tags or individual page configurations in the <code>mkdocs.yml</code> file. The package utilizes caching to avoid duplicate API calls for unchanged content.</p>
<p>The package's minimal demo is available at <a href="https://aiboy996.github.io/mkdocs-ai-summary">aiboy996.github.io/mkdocs-ai-summary</a>, while a live demo is showcased on <a href="https://yangzhang.site">yangzhang.site</a>. Users can leverage this tool to quickly summarize content within a specified word limit, enhancing webpage accessibility and readability.</p>
<p><a href="https://pypi.org/project/mkdocs-ai-summary/"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/mkdocs-ai-summary" /></a>
<img alt="PyPI - Implementation" src="https://img.shields.io/pypi/implementation/mkdocs-ai-summary" />
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/mkdocs-ai-summary" /></p>
Expand Down Expand Up @@ -512,7 +510,8 @@ <h3 id="setup-ai-summary-for-specific-page">Setup ai-summary for specific page</
<span class="k">-</span><span class="w"> </span>ai-summary
ai-summary-config:
api: &quot;tongyi&quot;
<span class="gu"> model: &quot;qwen-turbo&quot;</span>
model: &quot;qwen-turbo&quot;
<span class="gu"> prompt: &quot;帮我把下面的内容总结为200字以内的摘要:&quot;</span>
<span class="gu">---</span>

<span class="gh"># title</span>
Expand Down
8 changes: 1 addition & 7 deletions site/withh1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -713,14 +713,8 @@
<h1 id="with-h1-chatgpt-summary">内置关键字(with h1, ChatGPT summary)</h1>
<div class="admonition chatgpt-summary">
<p class="admonition-title">AI Summary powered by <a href="https://chat.openai.com/">ChatGPT</a></p>
<p>The content discusses various key aspects of Python programming, focusing on built-in keywords and syntax. It starts by emphasizing the importance of proper indentation to define code blocks and then delves into concepts like custom functions and classes.</p>
<p>本文章详细介绍了Python中的基础语法与关键字使用,包括缩进规则、自定义函数、类和条件语句等内容。Python通过严格的缩进规范区分代码块,推荐使用4个空格来表示一级缩进。定义函数使用<code>def</code>关键字,函数内的变量和外部命名空间相互独立,返回值用<code>return</code>关键字。匿名函数由<code>lambda</code>创建,常用于简洁性需求。自定义类通过<code>class</code>关键字,并利用<code>__new__</code><code>__init__</code>方法控制对象创建与初始化。类继承使子类能继承父类全部属性,自定义初始化函数以实现额外逻辑。条件语句中的布尔表达式返回<code>True</code><code>False</code>,逻辑运算中含有<code>is</code><code>not</code><code>in</code>等;紧凑型<code>if</code>语句和<code>match</code>语句提供灵活条件判断。循环由<code>for</code><code>while</code>实现,<code>range</code>类常用于计数,<code>iterable</code>类定义迭代对象。<code>continue</code><code>break</code><code>pass</code>控制循环执行,循环的<code>else</code>子句在正常结束时触发。通过<code>import</code>引入外部库,异常通过<code>try</code>语句处理,自定义异常类可扩展错误信息。<code>assert</code>用于断言条件为真。理解并熟练运用这些关键字是掌握Python的基础。</p>
</div>
<p>For indentation, it explains the significance of consistent indentation levels to define code structure. The common indentation methods, such as using spaces (especially 4 spaces as recommended by PEP8), are discussed.</p>
<p>Custom functions and classes are then explored. The format for defining custom functions with the <code>def</code> keyword, passing parameters, and utilizing the <code>return</code> keyword for returning values are covered. Lambda functions are introduced as anonymous functions.</p>
<p>The discussion extends to custom classes, including the process from defining classes to objects, inheritance, and the role of methods like <code>__init__</code> and <code>__new__</code>. The usage of operators like <code>+=</code> and unpacking techniques to handle multiple values are demonstrated.</p>
<p>Control flow statements like <code>if</code>, <code>for</code>, <code>while</code>, and their variations are explained, along with loop control keywords like <code>continue</code>, <code>break</code>, and <code>pass. The use of</code>else` clauses in loops is highlighted.</p>
<p>The <code>import</code> statement is discussed for importing libraries, and error handling mechanisms using <code>try</code>, <code>except</code>, <code>else</code>, and <code>finally</code> for managing exceptions are detailed. Custom exceptions are shown as a way to create specific error messages. Additionally, the <code>assert</code> statement for verifying conditions is introduced.</p>
<p>The importance of practicing and mastering these concepts to become proficient in Python programming is emphasized. This detailed abstract provides an overview of the breadth and depth of the covered topics.</p>
<blockquote>
<p>copy from <a href="https://yangzhang.site/Python/BasicSyntax/builtin_keyword/">https://yangzhang.site/Python/BasicSyntax/builtin_keyword/</a></p>
</blockquote>
Expand Down
7 changes: 1 addition & 6 deletions site/withouth1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,8 @@ <h1>内置关键字(without h1, tongyi ai summary)</h1>

<div class="admonition tongyiai-summary">
<p class="admonition-title">AI Summary powered by <a href="https://tongyi.aliyun.com/">通义千问</a></p>
<p>This text discusses the transition from single-line commands to multi-line logic blocks in Python, emphasizing the importance of indentation, a key feature of the language. Python uses consistent indentation to define code structure, with indented lines indicating higher-level code blocks. The text introduces two common indentation methods: tab-based and space-based (with PEP8 recommending four spaces per level).</p>
<p>Python的语法学习包含单行逻辑处理和多行逻辑块,如缩进表示代码结构,4个空格为推荐缩进。自定义函数通过<code>def</code>声明,接受参数,可返回值,支持按位置、名或混合方式传递。<code>lambda</code>用于定义匿名函数。类定义涉及<code>__new__</code><code>__init__</code>方法,用于对象创建和初始化,支持类的继承。条件语句如<code>if</code><code>elif</code>用于基于布尔表达式的逻辑判断,<code>input</code>函数获取用户输入。<code>for</code>循环遍历可迭代对象,<code>range</code><code>iterable</code>是关键。<code>while</code>循环在条件为真时持续执行。循环控制关键字包括<code>continue</code>跳过当前循环,<code>break</code>退出循环,<code>pass</code>无操作。循环的<code>else</code>子句在正常结束时执行。Python 3.10引入了<code>match</code>语句。<code>for</code><code>while</code>循环有不同的适用场景和控制结构。</p>
</div>
<p>The content then covers self-defined functions, using the 'def' keyword, which includes parameters, function body, and the return statement. Anonymous functions (lambdas) are also introduced, allowing quick, inline function creation. Functions can accept parameters by position, name, or a mix, with the latter discouraged.</p>
<p>Next, custom classes are discussed, focusing on object creation through the '<strong>new</strong>' method, the distinction between 'self' and 'cls' parameters, and class inheritance. The example shows a Teacher class inheriting from Person, with a specific initialization process.</p>
<p>Moving on, the text explains 'if' condition statements, including Boolean expressions, operators, and their usage. 'if', 'elif', and 'else' constructs are detailed, along with the 'input' function for user input and the introduction of 'match' statement in Python 3.10.</p>
<p>The article also delves into loops, starting with 'for' loops and the 'range' function, which generates a sequence for iteration. It explains iterables and the concept of 'for' loop structure. 'While' loops are briefly discussed, followed by control flow keywords like 'continue', 'break', and 'pass'.</p>
<p>Lastly, the text mentions the use of 'else' clauses in loops, which execute when the loop completes normally, unlike 'break'. The examples showcase practical applications of these concepts, demonstrating how to manipulate logic and control the flow of programs in Python.</p>
<blockquote>
<p>copy from <a href="https://yangzhang.site/Python/BasicSyntax/builtin_keyword/">https://yangzhang.site/Python/BasicSyntax/builtin_keyword/</a></p>
</blockquote>
Expand Down

0 comments on commit 2598bc7

Please sign in to comment.