<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>读书、思考、生活</title>
    <description>识天地本心、教生民立命、为往圣传道学、为万世谋太平。
</description>
    <link>http://www.zhuangbiaowei.com/</link>
    <atom:link href="http://www.zhuangbiaowei.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 31 Oct 2025 02:08:48 +0000</pubDate>
    <lastBuildDate>Fri, 31 Oct 2025 02:08:48 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>SmartResearch的底座 -- RubyRich （纯Ruby编写的终端UI工具包）</title>
        <description>&lt;p&gt;在前三篇文章中，我们介绍了&lt;a href=&quot;/2025/04/06/making-an-ai-app-from-scratch-with-ruby-1.html&quot;&gt;Smart Prompt&lt;/a&gt;、&lt;a href=&quot;/2025/04/23/making-an-ai-app-from-scratch-with-ruby-2.html&quot;&gt;Smart Agent&lt;/a&gt;和&lt;a href=&quot;/2025/10/31/making-an-ai-app-from-scratch-with-ruby-3.html&quot;&gt;SmartResearch&lt;/a&gt;这三个AI应用组件。今天，我们要深入探讨支撑这些应用的核心基础设施——&lt;strong&gt;RubyRich&lt;/strong&gt;，一个纯Ruby编写的终端用户界面（TUI）工具包。&lt;/p&gt;

&lt;p&gt;开源地址：&lt;a href=&quot;https://github.com/zhuangbiaowei/ruby_rich&quot;&gt;ruby_rich&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;什么是rubyrich&quot;&gt;什么是RubyRich？&lt;/h2&gt;

&lt;p&gt;RubyRich是一个受Python &lt;a href=&quot;https://github.com/Textualize/rich&quot;&gt;Rich&lt;/a&gt;库启发的Ruby终端UI工具包，它提供了优雅的格式化、高级布局和专业级的终端输出能力。在Ruby的LLM生态”一穷二白”的背景下，RubyRich填补了终端界面开发的空白。&lt;/p&gt;

&lt;h3 id=&quot;为什么需要rubyrich&quot;&gt;为什么需要RubyRich？&lt;/h3&gt;

&lt;p&gt;在构建SmartResearch这样的AI应用时，我们面临一个关键问题：&lt;strong&gt;如何为用户提供直观、美观的交互界面？&lt;/strong&gt; 传统的命令行界面过于简陋，而Web界面又过于复杂。TUI（终端用户界面）成为了完美的解决方案，但Ruby生态中缺乏成熟的TUI库。&lt;/p&gt;

&lt;p&gt;这就是RubyRich诞生的原因——为Ruby开发者提供构建专业级终端应用的工具。&lt;/p&gt;

&lt;h2 id=&quot;核心特性&quot;&gt;核心特性&lt;/h2&gt;

&lt;h3 id=&quot;-丰富的标记语言&quot;&gt;🎨 丰富的标记语言&lt;/h3&gt;

&lt;p&gt;RubyRich提供直观的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[bold red]text[/bold red]&lt;/code&gt;语法，让文本格式化变得简单优雅：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ruby_rich&apos;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 基础颜色和样式&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[red]错误信息[/red]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[bold]重要文本[/bold]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[italic blue]样式文本[/italic blue]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 组合样式&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[bold red]严重警告！[/bold red]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;️-语法高亮&quot;&gt;🖥️ 语法高亮&lt;/h3&gt;

&lt;p&gt;内置支持200+编程语言的语法高亮：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 自动语言检测&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;syntax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;def hello; puts &apos;world&apos;; end&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 显式指定语言&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;python_code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;def fibonacci(n):&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;    return n if n &amp;lt;= 1 else fibonacci(n-1) + fibonacci(n-2)&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;syntax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;python&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;-markdown渲染&quot;&gt;📄 Markdown渲染&lt;/h3&gt;

&lt;p&gt;完整的Markdown支持，针对终端输出进行优化：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;markdown_text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;~&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;MARKDOWN&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
# 项目文档

## 特性
- **富文本格式化**
- *语法高亮*
- `代码块`

### 代码示例
```ruby
puts &quot;Hello, Ruby Rich!&quot;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;这是一个引用块&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://example.com&quot;&gt;访问我们的网站&lt;/a&gt;
MARKDOWN&lt;/p&gt;

&lt;p&gt;puts RubyRich.markdown(markdown_text)&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
### 🌳 树形结构显示

美观的层次化数据可视化：

```ruby
# 手动构建树
树 = RubyRich.tree(&quot;我的项目&quot;)
源码 = 树.add(&quot;src&quot;)
源码.add(&quot;main.rb&quot;)
源码.add(&quot;utils.rb&quot;)
树.add(&quot;README.md&quot;)

# 从文件路径构建
路径 = [&quot;app/models/user.rb&quot;, &quot;app/views/users/index.html&quot;, &quot;config/routes.rb&quot;]
文件树 = RubyRich::Tree.from_paths(路径, &quot;Rails应用&quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;-增强表格&quot;&gt;📊 增强表格&lt;/h3&gt;

&lt;p&gt;自动扩展的表格，支持丰富的格式化：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 表格中的富内容&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;headers: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;功能&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;状态&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;备注&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[cyan]语法高亮[/cyan]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[green]✅ 完成[/green]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&quot;支持200+语言&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[cyan]Markdown渲染[/cyan]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[yellow]🚧 测试版[/yellow]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&quot;完整CommonMark支持&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;-面板布局&quot;&gt;🧩 面板布局&lt;/h3&gt;

&lt;p&gt;创建嵌套布局，支持边框和样式：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 创建面板布局&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;height: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 添加面板&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;header&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_panel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;header&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;height: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;position: :top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_panel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;height: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;position: :left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sidebar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_panel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sidebar&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;height: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;position: :right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;footer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_panel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;footer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;height: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;position: :bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 设置面板内容&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;RubyRich - 终端UI工具包&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;这里是主要内容区域...&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sidebar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;这里是侧边栏...&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;footer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;底部信息&quot;&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;-多列布局&quot;&gt;📋 多列布局&lt;/h3&gt;

&lt;p&gt;专业的报纸风格列格式化：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;total_width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 添加不同配置的列&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;左列&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;title: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;新闻&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;align: :left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;右列&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;title: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;更新&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;align: :right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;左列&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;突发：Ruby Rich 2.0发布！&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;左列&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;新功能包括高级布局&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;右列&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;性能提升300%&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;右列&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;内存使用减少50%&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;show_headers: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;show_borders: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;-状态指示器&quot;&gt;🚦 状态指示器&lt;/h3&gt;

&lt;p&gt;全面的状态符号和进度跟踪：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 基础状态指示器&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:success&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# ✅ 成功&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# ❌ 错误&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:warning&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# ⚠️ 警告&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;# ℹ️ 信息&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 系统状态&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:online&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# 🟢 在线&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:offline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# 🔴 离线&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:maintenance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 🔧 维护&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 状态面板&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;board&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;StatusBoard&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Web服务器&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:online&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;description: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Nginx运行在80端口&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;数据库&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:warning&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;description: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;高连接数&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;缓存&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;description: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Redis连接失败&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;-高级进度条&quot;&gt;📈 高级进度条&lt;/h3&gt;

&lt;p&gt;多种样式、ETA、速率计算和多进度支持：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 带细节的基础进度条&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ProgressBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;title: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;处理中&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;show_percentage: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;show_rate: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;show_eta: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;start&lt;/span&gt;
&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;advance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.01&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;finish&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;message: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;✅ 处理完成！&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 不同样式&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;styles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:blocks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:arrows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:dots&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;styles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ProgressBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;style: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;title: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to_s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# ... 进度 ...&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 多个进度条&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ProgressBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;MultiProgress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;bar1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;文件1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;bar2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;文件2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;bar3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;文件3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;start&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# ... 分别更新进度条 ...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;finish_all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;在smartresearch中的应用&quot;&gt;在SmartResearch中的应用&lt;/h2&gt;

&lt;p&gt;在SmartResearch中，RubyRich扮演了至关重要的角色：&lt;/p&gt;

&lt;h3 id=&quot;f2模式---交流与探索&quot;&gt;F2模式 - 交流与探索&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 在F2模式下显示AI思考过程&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_reasoning&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;reasoning_content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;finish_reason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;stop&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_content&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;finish_reason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;stop&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;f3模式---知识库管理&quot;&gt;F3模式 - 知识库管理&lt;/h3&gt;

&lt;p&gt;使用RubyRich的表格和树形结构来显示文档列表、标签系统和搜索结果：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 显示研究主题列表&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;headers: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ID&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;主题&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;文档数&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;创建时间&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;ResearchTopic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topic&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;topic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;topic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;topic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;source_documents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;topic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;strftime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%Y-%m-%d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;f4模式---文章创作&quot;&gt;F4模式 - 文章创作&lt;/h3&gt;

&lt;p&gt;使用多列布局来显示大纲和写作进度：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 显示文章大纲&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;total_width: &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;outline_col&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;title: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;大纲&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;align: :left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;progress_col&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;title: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;进度&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;align: :right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;outline_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;section&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;outline_col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;section&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;level&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;. &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;section&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;progress_col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;section&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;progress&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;% 完成&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;技术架构&quot;&gt;技术架构&lt;/h2&gt;

&lt;h3 id=&quot;依赖库&quot;&gt;依赖库&lt;/h3&gt;

&lt;p&gt;RubyRich建立在几个优秀的Ruby库之上：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;rouge&lt;/strong&gt; - 语法高亮引擎&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;tty-cursor&lt;/strong&gt; - 终端光标控制&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;tty-screen&lt;/strong&gt; - 终端屏幕信息&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;redcarpet&lt;/strong&gt; - Markdown解析&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;unicode-display_width&lt;/strong&gt; - Unicode字符宽度计算&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;模块设计&quot;&gt;模块设计&lt;/h3&gt;

&lt;p&gt;RubyRich采用模块化设计，每个功能都有独立的模块：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;lib/ruby_rich/
├── ansi_code.rb      # ANSI转义码处理
├── columns.rb        # 多列布局
├── console.rb        # 控制台主类
├── dialog.rb         # 对话框
├── layout.rb         # 布局系统
├── live.rb           # 实时更新
├── markdown.rb       # Markdown渲染
├── panel.rb          # 面板组件
├── print.rb          # 打印工具
├── progress_bar.rb   # 进度条
├── status.rb         # 状态指示器
├── syntax.rb         # 语法高亮
├── table.rb          # 表格
├── text.rb           # 富文本
├── tree.rb           # 树形结构
└── version.rb        # 版本信息
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;性能优化&quot;&gt;性能优化&lt;/h2&gt;

&lt;p&gt;RubyRich针对性能进行了优化：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;快速处理&lt;/strong&gt; - 每秒处理10,000+标记元素&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;高效渲染&lt;/strong&gt; - 毫秒级渲染大型表格（1000+行）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;内存优化&lt;/strong&gt; - 高效的对象管理，内存占用小&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;线程安全&lt;/strong&gt; - 支持并发操作&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;安装和使用&quot;&gt;安装和使用&lt;/h2&gt;

&lt;h3 id=&quot;安装&quot;&gt;安装&lt;/h3&gt;

&lt;p&gt;添加到Gemfile：&lt;/p&gt;
&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ruby_rich&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或直接安装：&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gem &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;ruby_rich
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;快速开始&quot;&gt;快速开始&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ruby_rich&apos;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 富文本标记语言&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;[bold green]成功！[/bold green] 任务完成。&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 语法高亮&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;def hello&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;  puts &apos;world&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;end&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;syntax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ruby&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Markdown渲染&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;markdown&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;# 标题&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;这是**粗体**文本。&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;markdown&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;markdown&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 树形结构&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;tree&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;tree&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;项目&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;tree&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;src&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;main.rb&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;tree&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;README.md&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tree&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 状态指示器&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:success&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;所有系统运行正常&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:warning&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;检测到高内存使用&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 增强进度条&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ProgressBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;with_progress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;title: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;处理中&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;show_rate: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;advance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.01&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;主题和自定义&quot;&gt;主题和自定义&lt;/h2&gt;

&lt;p&gt;RubyRich支持完全的自定义：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 自定义主题设置&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set_theme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;primary: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;color: :blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;bold: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;secondary: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;color: :cyan&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;accent: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;color: :yellow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;bold: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 使用主题样式&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RichText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;重要消息&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;style: :primary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 自定义进度条样式&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;RubyRich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ProgressBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;STYLES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:custom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;filled: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;▓&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;empty: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;░&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;prefix: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;⟨&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;suffix: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;⟩&apos;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;在ai生态中的价值&quot;&gt;在AI生态中的价值&lt;/h2&gt;

&lt;p&gt;RubyRich不仅仅是一个TUI工具包，它在Ruby的AI生态中扮演着关键角色：&lt;/p&gt;

&lt;h3 id=&quot;填补生态空白&quot;&gt;填补生态空白&lt;/h3&gt;

&lt;p&gt;在Python生态中，有Rich、Textual等成熟的TUI库，而Ruby生态中一直缺乏类似工具。RubyRich填补了这一空白，让Ruby开发者能够构建专业的终端AI应用。&lt;/p&gt;

&lt;h3 id=&quot;提升用户体验&quot;&gt;提升用户体验&lt;/h3&gt;

&lt;p&gt;通过美观的界面、实时更新和丰富的交互元素，RubyRich显著提升了AI应用的用户体验。用户不再需要面对枯燥的命令行输出，而是可以享受流畅、直观的交互过程。&lt;/p&gt;

&lt;h3 id=&quot;促进ai应用开发&quot;&gt;促进AI应用开发&lt;/h3&gt;

&lt;p&gt;有了RubyRich，开发者可以更专注于AI算法的实现，而不需要花费大量时间在界面开发上。这大大降低了构建复杂AI应用的门槛。&lt;/p&gt;

&lt;h2 id=&quot;实际应用案例&quot;&gt;实际应用案例&lt;/h2&gt;

&lt;h3 id=&quot;smartresearch&quot;&gt;SmartResearch&lt;/h3&gt;

&lt;p&gt;如前所述，SmartResearch是RubyRich最典型的应用案例。它展示了如何用RubyRich构建一个功能完整的AI研究助手：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;三模式界面&lt;/strong&gt; - F2交流、F3知识库、F4创作&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;实时显示&lt;/strong&gt; - AI思考过程、工具调用、搜索结果&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;数据可视化&lt;/strong&gt; - 文档树、状态面板、进度跟踪&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;其他潜在应用&quot;&gt;其他潜在应用&lt;/h3&gt;

&lt;p&gt;RubyRich还可以用于：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;AI对话系统&lt;/strong&gt; - 构建类似ChatGPT的终端界面&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;数据监控面板&lt;/strong&gt; - 实时显示系统状态和指标&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;开发工具&lt;/strong&gt; - 代码审查、测试报告、部署监控&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;教育应用&lt;/strong&gt; - 交互式学习工具&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;结语&quot;&gt;结语&lt;/h2&gt;

&lt;p&gt;RubyRich代表了Ruby在AI领域的一个重要里程碑。它证明了：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Ruby可以构建专业的TUI应用&lt;/strong&gt; - 不逊色于Python生态&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;优雅的DSL设计&lt;/strong&gt; - Ruby的元编程能力让代码更简洁&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;完整的组件系统&lt;/strong&gt; - 从基础文本到复杂布局的全覆盖&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;实际应用价值&lt;/strong&gt; - 已经在SmartResearch等项目中验证&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;通过RubyRich，我们看到了Ruby在AI领域的巨大潜力。它不仅仅是”能用”，而是能够构建出&lt;strong&gt;美观、高效、专业&lt;/strong&gt;的AI应用。&lt;/p&gt;

&lt;p&gt;随着Ruby生态的不断完善，我们有理由相信，Ruby将在AI领域占据一席之地。而RubyRich，正是这一征程中的重要基石。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;em&gt;欢迎参与RubyRich的开发，共同推动Ruby在AI领域的发展！&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;相关链接：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/zhuangbiaowei/SmartResearch&quot;&gt;SmartResearch项目&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/zhuangbiaowei/smart_agent&quot;&gt;SmartAgent框架&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/zhuangbiaowei/smart_prompt&quot;&gt;SmartPrompt引擎&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Fri, 31 Oct 2025 02:00:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2025/10/31/introducing-ruby-rich-terminal-ui-toolkit.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2025/10/31/introducing-ruby-rich-terminal-ui-toolkit.html</guid>
        
        <category>OpenSource</category>
        
        <category>Ruby</category>
        
        <category>AI</category>
        
        <category>Agent</category>
        
        <category>TUI</category>
        
        <category>Terminal</category>
        
        
      </item>
    
      <item>
        <title>用Ruby从头做一个AI Agent应用 -- SmartResearch （一个真实、有用的研究助手）</title>
        <description>&lt;p&gt;这是一篇系列文章，描述我如何使用Ruby语言，从头构建一个AI Agent的应用。在前两篇中，我们分别介绍了&lt;a href=&quot;/2025/04/06/making-an-ai-app-from-scratch-with-ruby-1.html&quot;&gt;Smart Prompt&lt;/a&gt;和&lt;a href=&quot;/2025/04/23/making-an-ai-app-from-scratch-with-ruby-2.html&quot;&gt;Smart Agent&lt;/a&gt;，现在终于来到了这个系列的最终章：&lt;strong&gt;SmartResearch&lt;/strong&gt;，一个真正实用、能够帮助进行学术研究和知识管理的AI助手。&lt;/p&gt;

&lt;p&gt;开源地址：&lt;a href=&quot;https://github.com/zhuangbiaowei/SmartResearch&quot;&gt;SmartResearch&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;第三部分smartresearch---学习与思考的循环colt&quot;&gt;第三部分：SmartResearch - 学习与思考的循环（CoLT）&lt;/h2&gt;

&lt;p&gt;SmartResearch不仅仅是一个AI对话工具，它实现了一个完整的&lt;strong&gt;学习与思考循环（Chain of Learning &amp;amp; Thinking, CoLT）&lt;/strong&gt;：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[思考] → [搜索] → [学习] → [存储] → [重复]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个自增强循环让AI能够持续积累知识、自适应推理，并不断改进。&lt;/p&gt;

&lt;h3 id=&quot;三模式应用系统&quot;&gt;三模式应用系统&lt;/h3&gt;

&lt;p&gt;SmartResearch运行在TUI（终端用户界面）中，通过F键切换三种操作模式：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;F2 - 交流与探索模式&lt;/strong&gt;：交互式研究和问答，带自主搜索规划&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;F3 - 知识库模式&lt;/strong&gt;：文档管理、下载、标记和基于向量的检索&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;F4 - 创作模式&lt;/strong&gt;：基于积累的知识生成大纲和撰写文章&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;核心架构建立在smartagent之上&quot;&gt;核心架构：建立在SmartAgent之上&lt;/h3&gt;

&lt;p&gt;SmartResearch建立在之前介绍的SmartAgent框架之上，提供了完整的Agent系统：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 在agents/smart_search.rb中定义的搜索Agent&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:smart_search&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;question&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:pre_search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_tools: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_history: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_tools&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;call_tools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;请输出一份搜索规划&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:pre_search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_tools: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_history: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;content&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_tools: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_history: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_tools&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;call_tools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;question&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_tools: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_history: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;content&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;知识存储系统&quot;&gt;知识存储系统&lt;/h3&gt;

&lt;p&gt;SmartResearch使用PostgreSQL + pgvector扩展来存储和管理知识：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;ResearchTopic&lt;/strong&gt;：顶层研究主题&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SourceDocument&lt;/strong&gt;：网页、PDF、DOCX文件&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SourceSection&lt;/strong&gt;：内容块（最大4000字符，100字符重叠）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Embedding&lt;/strong&gt;：向量嵌入用于语义搜索（1024维）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Tag&lt;/strong&gt;：层次化标记系统，包含类型标签和内容标签&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;内容首先按Markdown标题分割，然后按最大字符数分块，每个块都会被嵌入和标记。&lt;/p&gt;

&lt;h3 id=&quot;内容处理管道&quot;&gt;内容处理管道&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;用户在F2模式提问&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pre_search&lt;/code&gt;工作器分析范围并生成搜索计划&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smart_search&lt;/code&gt;工作器使用工具执行搜索&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;结果存储为SourceDocuments（内容为”null”占位符）&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;在F3模式使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dall&lt;/code&gt;命令下载完整内容&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;内容被分块、嵌入、标记并链接到研究主题&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;在F4模式，向量搜索检索相关内容用于文章写作&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;分块策略&quot;&gt;分块策略&lt;/h3&gt;

&lt;p&gt;内容首先按Markdown标题分割，然后按max_chars（默认4000）分块，各块之间保留100字符的重叠：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;chunk_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;max_chars&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# 如果内容长度小于max_chars，则整篇返回&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;max_chars&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# 按照markdown的语法分段&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;chunks&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;split_by_markdown_headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;max_chars&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# 如果按markdown分段后仍然有超过max_chars的块，则进一步分片&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;final_chunks&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;chunks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;max_chars&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;final_chunks&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# 按max_chars大小分片，且各片之间保留100的重叠内容&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;final_chunks&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;split_with_overlap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;max_chars&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;final_chunks&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;f3知识库命令&quot;&gt;F3知识库命令&lt;/h3&gt;

&lt;p&gt;在F3模式下，你可以使用以下命令：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;l&lt;/code&gt; / &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list&lt;/code&gt;：列出所有研究主题&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;l [num]&lt;/code&gt;：列出主题ID下的文档&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ll [num]&lt;/code&gt;：显示文档内容和标签&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d [num]&lt;/code&gt;：下载文档ID的完整内容&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d [url]&lt;/code&gt;：下载并保存新URL&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd [num]&lt;/code&gt;：下载主题ID下的所有文档&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dall&lt;/code&gt;：下载所有不完整的文档&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ask [question]&lt;/code&gt;：使用向量搜索查询知识库&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;del [num]&lt;/code&gt;：删除文档及其所有关系&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;f4写作命令&quot;&gt;F4写作命令&lt;/h3&gt;

&lt;p&gt;在F4模式下，你可以使用以下命令：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;outline [topic]&lt;/code&gt;：生成文章大纲 → &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reports/outline.json&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;outline&lt;/code&gt;：显示当前大纲&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;outline [discussion]&lt;/code&gt;：基于反馈修改现有大纲&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;del&lt;/code&gt;：删除outline.json&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;write_all&lt;/code&gt; / &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wa&lt;/code&gt;：从大纲写完整文章 → &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reports/&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rewrite [chapter_id] [instructions]&lt;/code&gt;：重写特定章节&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;format&lt;/code&gt;：清理和去重脚注&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;流式显示&quot;&gt;流式显示&lt;/h3&gt;

&lt;p&gt;TUI使用回调进行实时显示：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_reasoning&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;reasoning_content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;finish_reason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;stop&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_content&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;finish_reason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;stop&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_tool_call&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;mcp服务器集成&quot;&gt;MCP服务器集成&lt;/h3&gt;

&lt;p&gt;SmartResearch集成了多个MCP服务器：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;opendigger.rb&lt;/strong&gt;：开源项目指标分析&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;all_in_one.rb&lt;/strong&gt;：通用研究工具包&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;amap.rb&lt;/strong&gt;：位置/地图服务&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;每个MCP服务器都是一个Ruby类，定义了SmartAgent可以调用的工具。&lt;/p&gt;

&lt;h3 id=&quot;配置系统&quot;&gt;配置系统&lt;/h3&gt;

&lt;p&gt;SmartResearch使用分层配置：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config/llm_config.yml&lt;/code&gt;&lt;/strong&gt;：SmartPrompt引擎配置（LLM适配器、API密钥、工作器/模板路径）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config/agent.yml&lt;/code&gt;&lt;/strong&gt;：SmartAgent引擎配置（代理/工具/MCP路径、日志记录）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib/database.rb&lt;/code&gt;&lt;/strong&gt;：数据库连接字符串&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;实际使用示例&quot;&gt;实际使用示例&lt;/h3&gt;

&lt;p&gt;让我们看看SmartResearch如何帮助进行实际研究：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;启动应用&lt;/strong&gt;：
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./bin/smart_research
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;在F2模式提问&lt;/strong&gt;：
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;请帮我研究一下Ruby在AI领域的应用现状
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;系统自动&lt;/strong&gt;：
    &lt;ul&gt;
      &lt;li&gt;分析问题范围&lt;/li&gt;
      &lt;li&gt;生成搜索计划&lt;/li&gt;
      &lt;li&gt;执行搜索并保存结果&lt;/li&gt;
      &lt;li&gt;提供初步总结&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;在F3模式下载内容&lt;/strong&gt;：
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dall
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;在F4模式生成文章&lt;/strong&gt;：
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;outline Ruby在AI领域的应用现状
write_all
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;为什么选择ruby&quot;&gt;为什么选择Ruby？&lt;/h3&gt;

&lt;p&gt;正如前两篇文章提到的，Ruby在LLM生态中确实”一穷二白”，但这正是挑战所在。通过SmartResearch，我们证明了：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Ruby可以构建复杂的AI应用&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;DSL设计让代码更优雅&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;TUI界面提供优秀的用户体验&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;完整的Agent系统可以处理复杂任务&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;技术栈总结&quot;&gt;技术栈总结&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;RubyRich&lt;/strong&gt;：提供TUI组件和事件处理&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SmartPrompt Engine&lt;/strong&gt;：管理LLM交互、历史记录和工作器调用&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SmartAgent Engine&lt;/strong&gt;：提供代理定义、工具调用和MCP集成&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Better Prompt&lt;/strong&gt;：提示优化系统&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Sequel ORM&lt;/strong&gt;：数据库抽象&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;外部依赖&quot;&gt;外部依赖&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;markitdown&lt;/strong&gt;：Python工具，用于将各种格式转换为Markdown&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;PostgreSQL + pgvector&lt;/strong&gt;：向量相似性搜索&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SQLite3&lt;/strong&gt;：Better Prompt提示优化数据库&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;MCP Servers&lt;/strong&gt;：基于Node.js的工具&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;结语&quot;&gt;结语&lt;/h2&gt;

&lt;p&gt;通过这个系列，我们展示了如何从零开始，用Ruby语言构建一个完整的AI Agent应用生态系统：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Smart Prompt&lt;/strong&gt;：基础的大模型调用和模板系统&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Smart Agent&lt;/strong&gt;：增强的Agent框架，支持工具调用和MCP&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SmartResearch&lt;/strong&gt;：实用的研究助手，实现学习与思考循环&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;SmartResearch不仅仅是一个技术演示，它是一个真正有用的工具，能够帮助研究人员、学生和任何需要系统化知识管理的人。它证明了Ruby语言在AI领域的潜力，以及”从零开始”构建复杂系统的可行性。&lt;/p&gt;

&lt;p&gt;希望这个系列对你有所启发，也欢迎你参与SmartResearch的开发，共同探索AI Agent的更多可能性！&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;em&gt;本系列文章到此结束，感谢阅读！&lt;/em&gt;&lt;/p&gt;
</description>
        <pubDate>Fri, 31 Oct 2025 01:00:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2025/10/31/making-an-ai-app-from-scratch-with-ruby-3.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2025/10/31/making-an-ai-app-from-scratch-with-ruby-3.html</guid>
        
        <category>OpenSource</category>
        
        <category>Ruby</category>
        
        <category>AI</category>
        
        <category>Agent</category>
        
        <category>Research</category>
        
        
      </item>
    
      <item>
        <title>2050@2025 那些若有所思的时刻</title>
        <description>&lt;p&gt;每年的2050结束之后，我都会反复回味，然后写一篇博客，今年也不例外。照例，还是先要想好文章的标题。&lt;/p&gt;

&lt;p&gt;在2050大会最后一天的下午，我正好在主持一个圆桌，在那个圆桌的开场，我就说了这么一段话：“每年都来2050，这是我的节日。我们都会在2050感受到很多不同的情绪，有开怀大笑、有热血沸腾、甚至还有热泪盈眶，但是对我而言，最有价值的体验，是&lt;strong&gt;那些若有所思的时刻&lt;/strong&gt;。”&lt;/p&gt;

&lt;h2 id=&quot;ai时代我们如何做家长&quot;&gt;AI时代，我们如何做家长？&lt;/h2&gt;

&lt;p&gt;第一天的下午，是各种各样的团聚。我也发起了一个名为《&lt;a href=&quot;https://2050.org/#/activity/11796&quot;&gt;AI时代的家庭教育&lt;/a&gt;》的团聚。在与朋友们交流的过程中，我首先介绍了我发起这个团聚的初心：在这个扑面而来的AI时代，家长应该做些什么？应该如何选择？应该鼓励、引导孩子们去学习（接触）些什么？又应该防范、避免孩子们去沉迷一些别的什么？&lt;/p&gt;

&lt;p&gt;结果就遇到了两个朋友，不约而同的挑战：为什么家长要替孩子做选择？为什么不能让孩子寻找自己的热爱，发现自己的特长？&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;我当时就是一愣，然后陷入了思考。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;当然，我的内心其实并不认同这种过于理想化的家长模式。在我看来：在孩子不同的年龄段，家长负有不同的责任。在孩子的见识、判断、思考的能力尚且不足的时候，家长不但要帮助孩子培养这些能力，也同样需要替孩子做出一些重要的决定。如果“一味的让孩子做决定”，其实是放弃了作为家长，自己的责任。&lt;/p&gt;

&lt;p&gt;当然，这样的责任，在任何一个时代，都不会发生变化，而真正考验的是家长对于当下这个时代（及其变化）的判断力与理解力。&lt;/p&gt;

&lt;h2 id=&quot;ai时代将会如何发展&quot;&gt;AI时代，将会如何发展？&lt;/h2&gt;

&lt;p&gt;在另一个场地的聚会中，我们还是会聊到AI，聊到这个AI时代。有一些朋友表达了相当乐观的情绪，而我则发表了一些相对悲观的看法。&lt;/p&gt;

&lt;p&gt;赛赛在《所言吉事》的那个场地，还准备了蒲团和茶饮，我们坐在地上，中间铺着一个长条的白纸，茶壶和杯子都放在白纸上。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/2050-01.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;然后我就指着面前的杯子和那一长条白纸说：“我们现在肯定已经站在了这个白纸上面，看向地面，已经不是之前的地毯了。我们都知道我们进入了一个新的名为AI的时代，往前看，能够看到一个杯子挡在前面。但是再往前看，就看不清了。我们只知道世界正在飞快的变化，但是究竟会变成什么样子，我们谁都猜不到。”&lt;/p&gt;

&lt;p&gt;事实上，我想要表达的，是更加严重的一层意思：如果有谁言之凿凿的跟你说，未来的AI时代，将会如何如何，就肯定是在骗人。&lt;/p&gt;

&lt;p&gt;AI能够带来的好处，大家都在谈。但是，AI可能带来的危险，似乎大家都觉得没啥可担心的。我举了一个大洪水来临时的例子。我们都站在一个山坡（金字塔）的不同的高度上，洪水来了，正在不断的上涨。我们所有的人，都必须快速的往更高的地方跑。风险有两个：很多人跑的速度，可能没有洪水上涨的速度快。山上留下的空间是不够的。&lt;/p&gt;

&lt;p&gt;在我们想好如何安置那些时代的落伍者之前，他们应该怎么办？&lt;/p&gt;

&lt;p&gt;于是一位朋友突然说：“为什么就不能躺平呢？”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;我当时就是一愣，然后陷入了思考。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;我想要谈到“工作的意义”，以及“劳动对人们的价值不仅仅是赚钱，还有个人的成就感”。但是，这个事情似乎没有那么简单。我当时说了一句话：“面对AI时代，悲观是为了有所准备。”&lt;/p&gt;

&lt;p&gt;于是，那几位朋友，也开始若有所思起来。&lt;/p&gt;

&lt;h2 id=&quot;ai背后是不是有一个本性&quot;&gt;AI背后，是不是有一个本性？&lt;/h2&gt;

&lt;p&gt;一直在讨论AI，我也会向一些朋友介绍AI的基本原理。尤其是碰到一个朋友，她在描述自己与DeepSeek交流的过程：“AI对我有很大的帮助，甚至比很多的心理医生更加懂我，我都哭了。然后我把我哭了这件事情告诉了AI，AI又回复了我一段话，我哭得更加厉害了。”&lt;/p&gt;

&lt;p&gt;于是，我开始想要劝她，AI就是一个概率预测的模型，也没有智慧，只是在顺着你的话往下说。DeepSeek特别能够提供情绪价值，但是这不能被认为他是懂你的。在我Bla Bla 之后，我想要发表一个结论：“我们应该始终将AI看作工具，而不是以拟人化的方式看待他。”&lt;/p&gt;

&lt;p&gt;另一位朋友这时插话进来：经过你的分析，AI背后没有一个人，也没有本性，按照佛法来说就是“空”的。&lt;/p&gt;

&lt;p&gt;我说：对呀。&lt;/p&gt;

&lt;p&gt;他继续说：那么按照佛法，人也是四大和合而成，性空缘起，缘起性空，本来是空。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;我当时就是一愣，然后陷入了思考。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;我的内心思考：如果我们很理解AI，尤其是AI背后的原理，我们就会将其看作没有本性的纯粹的工具。但是，如果我们以同样的方式去探究人类认知的原理，同样也会将其看作（背后没有什么的）一个大模型，性空缘起而已。人与AI只有理解难度上的差异，而并没有本质的区别。&lt;/p&gt;

&lt;p&gt;直到现在，我也没有想得非常清楚：是不是可以以纯工具的方式，来看待AI？&lt;/p&gt;

&lt;h2 id=&quot;别向ai提问要与ai交流&quot;&gt;别向AI提问，要与AI交流&lt;/h2&gt;

&lt;p&gt;我偶然在周日的上午，听到了一个演讲。整个新生论坛的主题是《把冰冷的AI装进保温杯》，是由万焱社群发起的。其中一位朋友的演讲，就是《别向AI提问，要与AI交流》。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/2050-02.jpg&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/assets/img/2050-03.jpg&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/assets/img/2050-04.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;我在现场拍了几张照片，也感受到了这种“不那么工程化，而是更加人文”的AI使用方式。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;这是一个若有所思的时刻&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在演讲结束以后，我与演讲者也有一个简短的交流，我也提出了我的疑问：“不是应该严守工具的边界吗？就是不该把人当成工具，也不该把工具当成人啊？”&lt;/p&gt;

&lt;p&gt;当然，讨论不会有简单的结论，大家都可以继续思索。&lt;/p&gt;

&lt;h2 id=&quot;ai时代人的创造力正在-衰减增强-&quot;&gt;AI时代人的创造力正在 衰减/增强 ？&lt;/h2&gt;

&lt;p&gt;这是一个辩论赛的主题。我去听了一下，但是却对于双方辩友的发言，都不是很满意。我自己思考了一下这个问题。&lt;/p&gt;

&lt;p&gt;需要将创造力分解开来看：创是有所不同；造是实现创意；力是各种能力。&lt;/p&gt;

&lt;p&gt;在“创之力”的前面，其实还有一个“察之力”，在“造之力”后面，还有一个“解之力”。&lt;/p&gt;

&lt;p&gt;察 –&amp;gt;  创 –&amp;gt; 造 –&amp;gt; 解 –&amp;gt; (对于察的解决)&lt;/p&gt;

&lt;p&gt;察：好奇心、观察力、同理心、洞察力。
创：不守常规、但是又能遵循客观规律；能够突发奇想、联想，但是又能严谨的推理，让一切成为可能。&lt;/p&gt;

&lt;p&gt;在AI时代，人的造与解的能力，应该都会上升，而察与创的能力，则可能下降。&lt;/p&gt;

&lt;p&gt;所以我的整体判断是：&lt;strong&gt;在AI时代，人类的创造力还是会增强。但是具体到个人，却可能还下降的。&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;ps-一个感想&quot;&gt;PS. 一个感想&lt;/h2&gt;

&lt;p&gt;这次的2050，绝大多数的话题，包括有意识组织的与无意间聊到的，都会跟AI有关。但是整个2050大会，还不够“智能”，这是后续需要改进的地方。&lt;/p&gt;

&lt;h2 id=&quot;pps-另一个感想&quot;&gt;PPS. 另一个感想&lt;/h2&gt;

&lt;p&gt;与朋友聊到2050的辩论赛，他有一个提议：是不是可以搞成辩论擂台赛，两个人在台上，每人发言3分钟，观众投票以后，一个人输了，就另一个人上去继续挑战。&lt;/p&gt;

&lt;p&gt;如果一个擂主，已经没有人上去挑战了。那就换一个辩论的题目。&lt;/p&gt;

&lt;p&gt;我很想在明年的2050，主持一个这样的辩论擂台赛。&lt;/p&gt;
</description>
        <pubDate>Tue, 29 Apr 2025 01:16:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2025/04/29/2050-2025-those-thought-provoking-moments.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2025/04/29/2050-2025-those-thought-provoking-moments.html</guid>
        
        <category>2050</category>
        
        <category>AI</category>
        
        
      </item>
    
      <item>
        <title>用Ruby从头做一个AI Agent应用 -- Smart Agent</title>
        <description>&lt;p&gt;这是一篇系列文章，描述我如何使用Ruby语言，从头构建一个AI Agent的应用。原本打算尽快发出的第二篇，结果因为MCP的SSE，卡了好久。&lt;strong&gt;因为Ruby语言在LLM这个生态中，简直就是一穷二白，啥也没有。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;开源地址：&lt;a href=&quot;https://github.com/zhuangbiaowei/smart_agent&quot;&gt;smart_agent&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;第二部分-smart-agent&quot;&gt;第二部分： Smart Agent&lt;/h2&gt;

&lt;p&gt;首先要讨论：到底什么是Agent？与上一章提到的&lt;a href=&quot;/2025/04/06/making-an-ai-app-from-scratch-with-ruby-1.html#用DSL来写一个Worker&quot;&gt;Worker&lt;/a&gt;，有什么区别？&lt;/p&gt;

&lt;p&gt;最简单的解释就是：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Worker：相当于一系列对于大模型的直接调用，属于普通AI&lt;/li&gt;
  &lt;li&gt;Agent：就是在Worker的基础上添加了一组工具调用能力+MCP，属于增强型AI&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;写一个简单的agent&quot;&gt;写一个简单的Agent&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_tools: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_tools&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;call_tools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;请总结上述的结果&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_tools: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_history: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;content&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;写一个-ai-tool&quot;&gt;写一个 AI Tool&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Tool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:get_weather&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Get weather of an location, the user shoud supply a location first&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;param_define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;City or More Specific Address&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:string&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;param_define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Specific Date or Today or Tomorrow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:string&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Call the Weather API&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;tool_proc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;Sunny 10 ℃ ~ 20 ℃&quot;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;装配一个agent并调用&quot;&gt;装配一个Agent，并调用&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/agent.yml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;build_agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;tools: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:get_weather&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;please&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;请用中文回答，明天上海的天气。&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;输出的结果应该会类似于：&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;以下是关于上海明天天气的详细总结：&lt;/p&gt;

&lt;h3 id=&quot;上海明日天气预报&quot;&gt;上海明日天气预报&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;天气状况&lt;/strong&gt;: 晴天 (Sunny)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;温度范围&lt;/strong&gt;: 10℃ ~ 20℃&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;体感&lt;/strong&gt;: 白天温暖，早晚较凉，建议适当增减衣物。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;建议&lt;/strong&gt;: 适合户外活动，注意防晒和补水。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果需要更详细的信息（如湿度、风速等），可以进一步查询！&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;更加复杂的tools生成代码&quot;&gt;更加复杂的Tools：生成代码&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Tool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:get_code&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Call the LLM to generate a Ruby function with the input details&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;param_define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ruby function name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:string&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;param_define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:description&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ruby function description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:string&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;param_define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:input_params_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;define of input parameters: (name:type, name:type ... )&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:string&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;param_define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:output_value_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;type of return value.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:string&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;param_define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;input parameters: (value, value ...)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:string&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;tool_proc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:get_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;input_params&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;(&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;input_params&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;)&quot;&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;input_params&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;(&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;input_params&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;)&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;通过生成的代码:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;得到了结果: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;装配一个agent并调用-1&quot;&gt;装配一个Agent，并调用&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/agent.yml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;build_agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;tools: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:get_weather&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:get_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;please&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;请通过get_code生成Ruby函数计算三角形的面积，底边长132，高为7.6，告诉我面积是多少？&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;输出的结果应该会类似于：&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;结果总结&quot;&gt;结果总结&lt;/h3&gt;

&lt;h4 id=&quot;请求内容&quot;&gt;请求内容&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;函数名称&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;triangle_area&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;功能描述&lt;/strong&gt;: 计算三角形的面积&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;输入参数类型&lt;/strong&gt;:
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base&lt;/code&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Float&lt;/code&gt; 类型，表示三角形的底边长度&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;height&lt;/code&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Float&lt;/code&gt; 类型，表示三角形的高&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;返回值类型&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Float&lt;/code&gt; 类型，表示计算出的三角形面积&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;输入参数值&lt;/strong&gt;:
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base = 132&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;height = 7.6&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;生成的-ruby-代码&quot;&gt;生成的 Ruby 代码&lt;/h4&gt;
&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;triangle_area&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;base&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;2.0&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 调用函数并传入参数&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;triangle_area&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;132&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;7.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;计算结果&quot;&gt;计算结果&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;面积&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;501.59999999999997&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;说明&quot;&gt;说明&lt;/h4&gt;
&lt;ol&gt;
  &lt;li&gt;函数通过公式 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(base * height) / 2.0&lt;/code&gt; 计算三角形的面积。&lt;/li&gt;
  &lt;li&gt;由于浮点数运算的特性，结果可能存在微小的精度误差（如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;501.59999999999997&lt;/code&gt; 而非 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;501.6&lt;/code&gt;）。&lt;/li&gt;
  &lt;li&gt;如果需要更高的精度，可以考虑使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BigDecimal&lt;/code&gt; 或其他高精度计算库。&lt;/li&gt;
&lt;/ol&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;支持mcp&quot;&gt;支持MCP&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;MCPClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:opendigger&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:stdio&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;node ~/open-digger-mcp-server/dist/index.js&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;SmartAgent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;MCPClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:amap&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:sse&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://mcp.amap.com/sse?key=72adc379733dfd020dba574c65847a26&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;如何配置&quot;&gt;如何配置&lt;/h3&gt;

&lt;p&gt;配置文件： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;agent.yml&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;ss&quot;&gt;logger_file: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./log/agent.log&quot;&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;engine_config: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/llm_config.yml&quot;&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;agent_path: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./agents&quot;&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;tools_path: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./agents/tools&quot;&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;mcp_path: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./agents/mcps&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;支持流式显示&quot;&gt;支持流式显示&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_reasoning&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;reasoning_content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reasoning_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;finish_reason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;stop&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_content&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;finish_reason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;stop&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on_tool_call&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;后续内容&quot;&gt;后续内容&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;用Ruby从头做一个AI Agent应用 – 番外篇：MCP SDK （真的很难写）&lt;/li&gt;
  &lt;li&gt;用Ruby从头做一个AI Agent应用 – RubyRich （一个纯Ruby编写的仿Python框架）&lt;/li&gt;
  &lt;li&gt;用Ruby从头做一个AI Agent应用 – SmartResearch （一个真实、有用的研究助手）&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;敬请期待&quot;&gt;敬请期待&lt;/h4&gt;
</description>
        <pubDate>Wed, 23 Apr 2025 08:06:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2025/04/23/making-an-ai-app-from-scratch-with-ruby-2.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2025/04/23/making-an-ai-app-from-scratch-with-ruby-2.html</guid>
        
        <category>OpenSource</category>
        
        <category>Ruby</category>
        
        <category>AI</category>
        
        <category>Agent</category>
        
        
      </item>
    
      <item>
        <title>用Ruby从头做一个AI Agent应用 -- Smart Prompt</title>
        <description>&lt;p&gt;这是一篇系列文章，描述我如何使用Ruby语言，从头构建一个AI Agent的应用，真的（几乎）是从头构建，因为Ruby语言在LLM这个生态中，简直就是一穷二白，啥也没有。&lt;/p&gt;

&lt;p&gt;我的底层依赖只有两个：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/alexrudall/ruby-openai&quot;&gt;ruby-openai&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;ollama-ai（后来发现，这个几乎也可以不用，只需要OpenAI兼容，基本上就行了）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;其他的，基本上都得靠自己。&lt;/p&gt;

&lt;p&gt;开源地址：&lt;a href=&quot;https://github.com/zhuangbiaowei/smart_prompt&quot;&gt;smart_prompt&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;第一部分-smart-prompt&quot;&gt;第一部分： Smart Prompt&lt;/h2&gt;

&lt;p&gt;为啥要做一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Smart Prompt&lt;/code&gt;，而不是直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ruby-openai&lt;/code&gt;？因为我感觉原生的SDK不够灵活，我希望添加以下功能：&lt;/p&gt;

&lt;h3 id=&quot;模板化的提示词&quot;&gt;模板化的提示词&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;调用代码&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;prompt&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:summarize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;summarize.erb&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-erb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Please organize and output the results of the following request in a more complete and comprehensive manner:
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在使用提示词时，通过传入参数，能够调用一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;erb&lt;/code&gt;模板文件，而在这个模板文件里，我们可以用上所有的ERB语法。&lt;/p&gt;

&lt;h3 id=&quot;随意切换供应商&quot;&gt;随意切换供应商&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deepseek&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deepseek-chat&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;send_msg&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deepseek-reasoner&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;send_msg&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SiliconFlow&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deepseek-ai/DeepSeek-V3&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;send_msg&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;用dsl来写一个worker&quot;&gt;用DSL来写一个Worker&lt;/h3&gt;

&lt;p&gt;Ruby语言最好的地方，就是我们可以设计自己的DSL，所以我们可以用更加舒服的方式来写一个调用各种大模型，完成特定任务的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;worker&lt;/code&gt;。&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;smart_prompt&quot;&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;SmartPrompt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define_worker&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SiliconFlow&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Qwen/QwQ-32B&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sys_msg&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;你是一个聪明的智能助手。&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;prompt&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:summarize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;send_msg&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SmartPrompt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/llm_config.yml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;关于结构化的提示词，你有哪些好的建议？&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;当然，既然是DSL，我们还可以这么改写：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;smart_prompt&quot;&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;SmartPrompt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define_worker&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:provider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sys_msg&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;你是一个聪明的智能助手。&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;prompt&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:summarize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;send_msg&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SmartPrompt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/config.yml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;关于结构化的提示词，你有哪些好的建议？&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;provider: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;deepseek&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;model: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;deepseek-chat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;关于结构化的提示词，你有哪些好的建议？&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;provider: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;SiliconFlow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;model: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;deepseek-ai/DeepSeek-V3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;如何配置&quot;&gt;如何配置？&lt;/h3&gt;

&lt;p&gt;一看就懂的配置：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.yml&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;adapters&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;openai&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;OpenAIAdapter&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;llms&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SiliconFlow&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;adapter&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;openai&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://api.siliconflow.cn/v1/&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;api_key&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ENV[&quot;APIKey&quot;]&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;default_model&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Qwen/Qwen2.5-7B-Instruct&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;ollama&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;adapter&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;openai&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://localhost:11434/&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;default_model&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;deepseek-r1&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;deepseek&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;adapter&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;openai&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://api.deepseek.com&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;api_key&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ENV[&quot;DSKEY&quot;]&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;default_model&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;deepseek-reasoner&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;logger_file&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./log/log.txt&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;worker_path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;./workers&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;template_path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;./templates&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;如何获取流式信息&quot;&gt;如何获取流式信息？&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;smart_prompt&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SmartPrompt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/config.yml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_worker_by_stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_bytesize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;reasoning_content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;reasoning_content: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;reasoning_content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;content: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;choices&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;delta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;如何保持多轮对话如何重新开始&quot;&gt;如何保持多轮对话？如何重新开始？&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;smart_prompt&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SmartPrompt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/llm_config.yml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;张聪明的父亲名叫张老实，张老实只有一个儿子。&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_history: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call_worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:smart_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;张老实的儿子叫什么名字？&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;with_history: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#清除对话历史&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;smart_prompt&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SmartPrompt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./config/llm_config.yml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;clear_history_messages&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;后续内容&quot;&gt;后续内容&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;用Ruby从头做一个AI Agent应用 – Smart Agent （一个支持Function Calling与MCP的Agent框架）&lt;/li&gt;
  &lt;li&gt;用Ruby从头做一个AI Agent应用 – RubyRich （一个纯Ruby编写的仿Python框架）&lt;/li&gt;
  &lt;li&gt;用Ruby从头做一个AI Agent应用 – SmartResearch （一个真实、有用的研究助手）&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;敬请期待&quot;&gt;敬请期待&lt;/h4&gt;
</description>
        <pubDate>Sun, 06 Apr 2025 03:59:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2025/04/06/making-an-ai-app-from-scratch-with-ruby-1.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2025/04/06/making-an-ai-app-from-scratch-with-ruby-1.html</guid>
        
        <category>OpenSource</category>
        
        <category>Ruby</category>
        
        <category>AI</category>
        
        <category>Agent</category>
        
        
      </item>
    
      <item>
        <title>开源伦理研究</title>
        <description>&lt;h2 id=&quot;一为何开源也需要关注伦理问题&quot;&gt;一、为何开源也需要关注伦理问题&lt;/h2&gt;

&lt;p&gt;当我们谈及伦理学时，许多人首先想到的是医学、法律或商业领域的道德规范。那么，开源领域也需要关注伦理问题吗？这个问题看似夸张，但实际上却非常重要。&lt;/p&gt;

&lt;p&gt;在开源的世界里，我们经常会看到各种现象。有些行为被认为是正当且值得鼓励的，如代码共享、社区协作，甚至只要有公司开源了什么项目，我们就会为之叫好；而有些行为则可能引发争议或被视为有害，如代码剽窃、社区排斥、特定的歧视等等，甚至只要有公司将开源项目改为闭源，就会被社区群起而攻之。我们经常讨论哪些行为是正当的，哪些行为是不正当的，这些讨论实际上就是伦理评价的范畴。&lt;/p&gt;

&lt;p&gt;尽管开源社区中充满了关于行为规范的讨论，但很少有人深入思考这些伦理问题，更不用说形成一致性的见解和标准。正因为如此，我们需要建立某种&lt;strong&gt;开源伦理学&lt;/strong&gt;来系统地分析、评估和规范开源行为，确保开源生态的健康发展。&lt;/p&gt;

&lt;h3 id=&quot;1-伦理学从何而来&quot;&gt;1. 伦理学从何而来？&lt;/h3&gt;

&lt;p&gt;为了更好地理解伦理学，我们可以用一个简单的模型来表示：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;（A→B）←C
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在这个模型中，A对B做了某种行为，而C作为第三方会对这种行为进行评价。如果C的评价是基于道德层面的，那么这种评价就可以称之为“伦理评价”。&lt;/p&gt;

&lt;p&gt;在上述模型中，A、B、C都可能只是一个人，但也都可能是一群人。C，通常会是一个群体。而真正困难的在于：作为围观群众的一群人，他们的评价可能是不一致的。有些人可能认为A的行为是正当的，有些人则可能认为B受到了不公正的对待。这种多样的社会评价需要通过伦理学的理论和方法来协调和统一。&lt;/p&gt;

&lt;p&gt;将各种各样社会评价，协调一致，并找出背后的推理依据，就是伦理学的起点。简化而言，我们可以将伦理学大致区分为以下三类：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;目的论&lt;/strong&gt;：这种伦理学派别通过行为的最终结果来衡量其道德价值。例如，A的行为对B造成了什么样的结果，这个结果对更多的人产生了怎样的影响，整体结果是好是坏。功利主义就是目的论的一种典型代表，它强调行为应当最大化整体幸福。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;义务论&lt;/strong&gt;：这种伦理学派别关注行为本身是否符合某种道德原则或规则。以康德为代表的义务论者认为，人应当遵循道德法则行动，而不单单考虑行为的后果。例如，诚实是一种道德义务，不论结果如何，我们都应该诚实。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;德性论&lt;/strong&gt;：这种伦理学派别强调个人品德和道德品质的重要性。古希腊的亚里士多德和中国古代的孔子都是德性论的代表。他们认为，我们应该培养自身的德性，成为有德性的人，从而自然地做出道德的行为。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;以上三类伦理拥护者，而我们却需要思考：在开源领域发生的众多行为，哪一种判断模式会更加适合？&lt;/p&gt;

&lt;h3 id=&quot;2-开源伦理的研究思路&quot;&gt;2. 开源伦理的研究思路&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;从评价社会化行为出发&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;“社会化行为”是指个体在社会环境中与他人互动的行为。或者说：是（最终）会对他人产生影响的行为。&lt;/p&gt;

&lt;p&gt;在中国传统的伦理学讨论中，一直有论迹还是论心的讨论，一般而言：有些事情应该论迹，而另一些事情应该论心。但是在开源的领域，我们可以认为绝大多数行为都是发生在公共领域，甚至是互联网上的公共平台上的。因此，论迹才是更加合理的出发点。另一方面，反复猜测行动者的内心动机，往往会陷入无穷无尽的争论，无法获得一致的结论。&lt;/p&gt;

&lt;p&gt;另一个更加深层次的原因，是行为的种类始终在不断增加。在没有汽车之前，自然不会有开车这样的行为，因此也不需要行车规范、交通法规这样的东西。在软件开发的领域，有了互联网平台，有了git这样的源代码管理工具，随之而来的GitHub才成为可能，在GitHub上产生了各种各样的行为，也才会成为开源社区需要理解、评论、分辨对错的对象。&lt;/p&gt;

&lt;p&gt;随着行为种类的不断增加，开源社区内五花八门的行为不断出现，我们通常都会经历：新闻事件–&amp;gt;评价与争论–&amp;gt;形成社区共识的过程。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;基于能够被观察与评估的结果来做出判断&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;对于行为的评价，我们可以做出主观的评价：我喜欢、我不喜欢；这令我感到开心，这伤害了我。我们也可以做出客观的评价：因为某人的行为，社区的活跃度上升，所以是好事。因为某些人的争吵，不少社区成员流失，所以是坏事。&lt;/p&gt;

&lt;p&gt;虽然在开源社区的伦理评价现象中，主观评价与客观评价，都很常见。甚至还有不少假装是客观评价，其实是基于主观原因的情况。但是，我们还是应该尽量从能够被观察与评估的客观结果，来做出评价。&lt;/p&gt;

&lt;p&gt;比如一个人在社区里骂人，另一个人说：你的粗鲁言辞伤害了我，我被你激怒了。这样的争吵，往往还会卷入很多人，有人站在甲方，有人站在乙方。而另一种评价方式则是：是否有人真的退出了社区，导致社区的贡献者减少？如果仅仅是两个人争吵，或者互不理睬，或者过一段时间由和好如初。这样的现象，就不是&lt;strong&gt;开源伦理学&lt;/strong&gt;需要关注的事情，最多是普通日常伦理学讨论的话题。&lt;/p&gt;

&lt;p&gt;针对“行为+结果”的伦理评价，出于以下两个原因：只考虑行为，不考虑的结果的评价，可能会流于形式主义（政治正确）、进而导致宽严皆误。而只考虑结果，不考虑行为的评价，则难以起到规范行为的作用，缺乏伦理效力。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;是否增加开源的价值是开源伦理评价的关键因素&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;回顾《&lt;a href=&quot;/2024/08/16/open-source-essentialism.html&quot;&gt;开源本质论&lt;/a&gt;》中的讨论，开源作为数字知识公地，具体价值包括：数字知识、数字资产、教育资源的价值。而在开源社区中发生的各种各样的行为，究竟应该获得正面还是负面的评价，就应该根据数字知识公地的价值，是否获得增加，来做判断。&lt;/p&gt;

&lt;p&gt;比如说：一位 开源社区的负责人，在社区里骂人，导致有人愤而退出社区。这样的事情，到底是好事还是坏事？事实上，我们无法判断。因为我们不知道，骂人的细节，是因为人身攻击，还是代码质量？但是，如果从开源价值的角度来看，这个社区是否继续健康成长？是否能够不断提高开源产品的质量？这个开源产品的用户是否因此而不断增加？当然，更加较真一些的话，我们还需要分析这个开源负责人的骂人行为，与上述开源价值的增减之间，是否存在相关性或因果关系？如果因果关系本身就很难成立，我们也难以做出确切的判断。&lt;/p&gt;

&lt;p&gt;这样的分析与判断的思路，本质上是做在大数据、行为相关性的分析，也许不容易，但是会更加有价值。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;围绕典型场景与关键文本进行分析&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;事实上，我们当前在开源社区内发生的各种各样的伦理评价与伦理争论，最容易发现的就是&lt;strong&gt;出发点&lt;/strong&gt;不同，导致对于某个具体行为的评价，也有不同的结论。&lt;/p&gt;

&lt;p&gt;我们将尝试首先对开源世界的各种伦理话题、典型案例，做一个初步的整理，然后大致梳理出一个评价的框架。另一方面，我们也想要分析开源世界里的一些关键文本，并挖掘其中各不相同的伦理内核，最终我们将会通过梳理与扬弃，得到一套我们自己的伦理主张，希望这样的一套主张，能够成为今后开源社区伦理评价的共识基础。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;保留评价体系的外部接口&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;开源世界当然不是独立于整个世界之外的存在，当我们讨论或评价开源世界中的各种事件时，往往难以避免在讨论更加深入之后，判断的基准就溢出了开源世界的范围。尤其当开源世界的伦理，与整个世界的伦理、道德、法律产生冲突的时候。&lt;/p&gt;

&lt;p&gt;面对莫衷一是的外部世界，开源世界也无法独善其身。如何界定开源世界的边界？如何保留一个能够对接外部评价的接口？这也许只能靠我们后续的案例分析之后，再来总结吧。&lt;/p&gt;

&lt;h2 id=&quot;二开源世界的经典文本与典型事例&quot;&gt;二、开源世界的经典文本与典型事例&lt;/h2&gt;

&lt;h3 id=&quot;1-黑客伦理与黑客的作为&quot;&gt;1. 黑客伦理与黑客的作为&lt;/h3&gt;

&lt;p&gt;在讨论开源世界的案例之前，黑客文化与自由软件运动，也是必须讨论的话题。因为，我们虽然可以将开源伦理严格的限定在OSD（Open Source Definition，开源促进会发布的开源定义&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;）诞生之后的开源软件相关的范围。但事实上，黑客伦理，软件自由的伦理，也深刻的影响着我们当今的开源世界，是绕不过去的。&lt;/p&gt;

&lt;p&gt;在Steven Levy的名著《黑客》一书中，Levy对于黑客行为、黑客、黑客文化、黑客伦理都有非常深入的描述与分析。简单概述一下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;黑客行为（Hack）：最初被用来形容麻省理工学院学生经常设计的大学恶作剧，也被用来泛指为实现某些建设性目标而开展项目、制造产品，但也有出于乐趣去单纯参与的行为。&lt;/li&gt;
  &lt;li&gt;黑客（Hacker）：一群计算机革命的英雄，经常以黑客行为为乐，也以黑客的成就为傲的人。&lt;/li&gt;
  &lt;li&gt;黑客文化（Hacker Culture）：背景是 20 世纪 60 年代的美国青年文化，当时的美国青年文化对资本主义和中央集权结构的概念提出了挑战。黑客文化是 20 世纪 60 年代反主流文化中的一种亚文化。黑客们主要关注的是挑战技术专业知识和权威的理念。20 世纪 60 年代的嬉皮士试图 “推翻机器”。尽管黑客们欣赏技术，但他们希望普通公民而不是大公司能够掌握技术的权力，“将其作为一种武器，真正削弱专家的权威和单一系统的控制”。&lt;/li&gt;
  &lt;li&gt;黑客伦理（Hacker ethic）：简单的描述就是：“共享、开放、去中心化、自由使用计算机、改善世界，更加详细的描述有六条
    &lt;ul&gt;
      &lt;li&gt;对计算机的使用，以及任何可能让你了解世界运行方式的东西，都应该是无限的、完全的。永远屈服于实践的要求！&lt;/li&gt;
      &lt;li&gt;所有信息都应是自由的&lt;/li&gt;
      &lt;li&gt;不信任权威–促进权力下放&lt;/li&gt;
      &lt;li&gt;评判黑客的标准应该是他们的黑客技术，而不是学位、年龄、种族或职位等虚假标准&lt;/li&gt;
      &lt;li&gt;你可以在电脑上创造艺术和美&lt;/li&gt;
      &lt;li&gt;计算机可以改变你的生活&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;作为一种典型的理想主义的伦理信条，黑客伦理是非常激动人心的，尤其是对于热衷（沉迷）于计算机世界的朋友们来说，接受黑客伦理，甚至不需要片刻的犹豫。但是在实际的案例中，是非就没那么分明了。&lt;/p&gt;

&lt;h4 id=&quot;11-比尔盖茨与致爱好者的公开信&quot;&gt;1.1. 比尔·盖茨与《致爱好者的公开信》&lt;/h4&gt;

&lt;p&gt;1980年代，当Altair（一种早期个人电脑）开始流行时，比尔·盖茨的创业公司微软，开始销售一种Altair BASIC解释器。但是，对于当时家酿计算机俱乐部的朋友们来说，&lt;strong&gt;分享&lt;/strong&gt;是俱乐部成员之间的常态，于是盖茨认为自己的利益受到了损害，在一封著名的《致爱好者的公开信&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;》中，他直言不讳的说：“你们在偷我的钱”。&lt;/p&gt;

&lt;p&gt;当然，在此后的20多年的时间里，比尔·盖茨与他的微软，一直是“黑客、自由软件运动、开源软件运动”最大的敌人。&lt;/p&gt;

&lt;h4 id=&quot;12-互联网之子的悲剧&quot;&gt;1.2. 互联网之子的悲剧&lt;/h4&gt;

&lt;p&gt;亚伦·斯沃茨(Aaron Swartz)是年少成名的计算机天才，著名社交网站Reddit联合创始人，web.py的设计者。他亦是数字时代的罗宾汉，致力于网络信息开放，却因涉嫌非法侵入麻省理工学院（MIT）和JSTOR（全称Journal Storage,存储学术期刊的在线系统）被指控，将受到最高35年监禁和100万美元罚款。该案在认罪辩诉阶段的时候亚伦·斯沃茨于2013年1月11日在其纽约布鲁克林的寓所内，用一根皮带上吊自杀，尸体随后被女友发现，年仅26岁。&lt;/p&gt;

&lt;p&gt;在亚伦自杀之后，有一部著名的纪录片《互联网之子&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;》讲述了他的成长经历与最后的悲剧结局。有很多人都同情亚伦、谴责JSTOR、谴责美国政府，将其形容为“盗火的普罗米修斯”，甚至有一句经典的控诉是：“这个世界不配拥有他！”&lt;/p&gt;

&lt;h4 id=&quot;13-信息应该自由在什么意义上&quot;&gt;1.3. 信息应该自由，在什么意义上？&lt;/h4&gt;

&lt;p&gt;虽然上述的两个案例，一个是商业软件，一个是学术论文，但却都与数字化的形式有关。当早期黑客提倡“信息应该自由”的时候，事实上基于一个全新的前提：数字化的信息，无论是复制还是传播，都非常容易，且成本低廉。为这样的数字化信息的复制与传播设置障碍，原本就是多出来的事情。&lt;/p&gt;

&lt;p&gt;在《操作系统革命&lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;》这部纪录片里，Richard Stallman讲了一个故事：他所在的MIT人工智能实验室，开始要求输入&lt;strong&gt;用户名/密码&lt;/strong&gt;然后才能登录，于是他破解了所有人的密码，然后“帮”他们都改成了回车。因为在他看来，这种做法浪费时间，且毫无必要。&lt;/p&gt;

&lt;p&gt;输入密码才能登录的系统，付费才能下载的论文或软件，禁止将软件拷贝给自己的朋友，这样的禁令都会让黑客们怒不可遏。所以，他们才会用上各种各样的技术手段，去追求信息的自由。&lt;/p&gt;

&lt;h4 id=&quot;14-应该如何建设数字知识公地&quot;&gt;1.4. 应该如何建设数字知识公地？&lt;/h4&gt;

&lt;p&gt;从开源的本质：数字知识公地的角度来看，信息当然应该是自由的。或者说：越来越多的知识，以数字化的形式被投放到知识公地，这是在造福全人类的事情。所有这么做的人，都是值得称赞的“数字时代的英雄”。&lt;/p&gt;

&lt;p&gt;但是另一方面：这些被数字化的知识，原本是属于谁的？如果一个人将自己的知识数字化，投入公地，当然非常好。但要是他将别人的数字知识（数字资产），以未经许可的方式获取，并投入公地，这是不是一种慷他人之慨呢？&lt;/p&gt;

&lt;p&gt;于是我们可以区分三种情况：自我奉献 &amp;lt;–&amp;gt; 慷他人之慨，自己分文不取 &amp;lt;–&amp;gt; 盗卖他人资产为自己牟利。最左边与最右边的情况，都称得上是非分明。但是，中间的这种情况，就属于灰色地带了。&lt;/p&gt;

&lt;p&gt;我与霍炬讨论过这个问题，他的观点是：paper来源于大学，大学来源于纳税人资金支持，phd写paper没有现金收入，审稿人没有报酬。这个东西本质上是纳税人资助的研究成果，他从来不该被一家期刊公司拿版权作控制住，这是正义性的来源。这本质上是美国制度的问题，这种明显不合理的制度不宜使用门上有锁作为理由啊，不然奴隶制和种族隔离都是正经法律，这不就否定了废奴和民权运动的正义性了吗？如果从学校到论文作者都认为scihub必须存在，而且这个必须上升到了对人类整个群体的知识和科学这个高度了，那错的肯定是制度而不是作者！&lt;/p&gt;

&lt;p&gt;当面对一个不合理的制度，是以“公民不服从”的方式去公然触犯法律，还是努力推动法律本身的修订（在此之前不越雷池一步）。的确是一个非常困难的伦理决定。&lt;/p&gt;

&lt;h3 id=&quot;2-gnu宣言与自由软件运动&quot;&gt;2. GNU宣言与自由软件运动&lt;/h3&gt;

&lt;p&gt;著名的自由软件运动，是由Richard Stallman在1983年发起GNU计划开始的。随后的1985年，RMS发布了GNU宣言；1986年创立自由软件基金会；1989 年，该基金会发布了第一版的 GPL (GNU通用公共许可证)，并在1991年发布了进行了少量更新的第二版。随后，由于越来越多的著名的自由软件，进一步增强了自由软件运动的吸引力与影响力，直到&lt;strong&gt;开源软件运动&lt;/strong&gt;诞生并蓬勃发展……&lt;/p&gt;

&lt;p&gt;自由软件运动中诞生了诸多经典的文本，并且表现出强烈的伦理自觉（道德批判）的倾向。因此，我们从对于一些经典的文本分析入手，展开讨论。&lt;/p&gt;

&lt;h4 id=&quot;21-gnu宣言与自由软件定义&quot;&gt;2.1. GNU宣言与自由软件定义&lt;/h4&gt;

&lt;p&gt;在GNU宣言中，RMS表达了很多相互关联的观点，我们可以引用一些（翻译为中文之后的）原文，然后分别进行讨论：”&lt;em&gt;我认可的黄金法则是如果我喜欢一个程序，我就必须把它分享给喜欢它的人。&lt;/em&gt;“；“&lt;em&gt;我的良知让我无法签署这样的保密协议或软件许可证协议。&lt;/em&gt;“；“&lt;em&gt;程序员之间的友谊的基本方式是分享程序；而现在典型的市场活动基本上是禁止程序员互相成为朋友。软件买家必须在友谊和守法之间抉择。&lt;/em&gt;“&lt;/p&gt;

&lt;p&gt;这几段话都是在诉诸“道德直觉”，尤其是关于“黄金法则”的部分。事实上，黄金法则（Golden Rule&lt;sup id=&quot;fnref:5&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:5&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;）的确是全人类通行的道德准则。只不过，黄金法则历来有多种表述方式：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;积极或指导：用你希望别人对待你的方式去对待别人&lt;/li&gt;
  &lt;li&gt;消极或禁止：己所不欲，勿施于人&lt;/li&gt;
  &lt;li&gt;同情或回应：你希望别人得到什么，你自己也会得到什么&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RMS的黄金法则，是软件领域的积极表述。而且还附带了一种道德谴责：凡是阻止我分享的（人/做法），都是不道德的。但是，在这个场景中，其实有三个角色：A–(销售)–&amp;gt;B–(分享)–&amp;gt;C。从换位思考的角度，B将自己代入C的位置，认为我当然希望别人分享给我，所以我也应该分享。但是B却没有将自己代入A的位置，软件的原作者，是否愿意别人“免费分享”自己的软件的。作为B，将一个好软件的信息介绍给C，并将是否购买使用的选择，交给C自己来做，是不是一种更加道德的分享呢？&lt;/p&gt;

&lt;p&gt;”我的良知让我无法……“、”程序员之间的友谊……是分享程序“，在现在的我们看来，也只是当年的黑客们的习惯，被道德化了而已。&lt;/p&gt;

&lt;p&gt;在GNU宣言以及后续的自由软件定义，对于自由都有很多的论述。“&lt;em&gt;GNU允许任何人修改和再发布，但是任何发布者都不能限制它的继续发布。就是说，它不允许专有性的修改。我想让GNU的所有版本都保持自由。&lt;/em&gt;”，更进一步，RMS也正式定义了自由软件的四个等级的自由&lt;sup id=&quot;fnref:6&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:6&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- 自由度0：无论用户出于何种目的，必须可以按照用户意愿，自由地运行该软件。
- 自由度1：用户可以自由地学习并修改该软件，以此来帮助用户完成用户自己的计算。作为前提，用户必须可以访问到该软件的源代码。
- 自由度2：用户可以自由地分发该软件的拷贝，这样就可以助人。
- 自由度3：用户可以自由地分发该软件修改后的拷贝。借此，用户可以把改进后的软件分享给整个社区令他人也从中受益。作为前提，用户必须可以访问到该软件的源代码。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;按照我们前述的研究思路，我们应该首先识别，围绕软件可能会发生哪些行为：针对可执行的软件，我们可以执行、使用，可以复制，可以传递给他人；针对软件的源代码，我们可以阅读、修改；针对修改后的源代码，我们可以使用、复制、传递，也可以编译、运行、复制、销售。作为商业软件，我们被禁止获得源代码，当然也就不再有随之而产生的各种行为。而作为自由软件，我们也被禁止在修改以后闭源/销售（不允许专有性的修改）。&lt;/p&gt;

&lt;p&gt;商业软件的授权协议，维护了自己的商业利益，看起来不那么道德。自由软件的授权，也损害了后续用户获取商业利益的机会（但是，却被认为是道德的）。&lt;/p&gt;

&lt;p&gt;这其中道德/不道德的判断，实际上并不能简单的以自由来做辩护。（因为自由软件在授予一部分自由的同时，又限制了另一部分自由）。按照我们的研究思路，自由软件的做法，实质性的&lt;strong&gt;增加了数字知识公地的价值&lt;/strong&gt;，因此是道德的。&lt;/p&gt;

&lt;p&gt;“&lt;em&gt;一旦GNU完成…这意味着避免了大量重复的系统编程工作造成的浪费。&lt;/em&gt;”；“&lt;em&gt;通过麻烦的机制来搞清楚一个人应该为该程序支付多少费用，总是会导致大量的社会成本。&lt;/em&gt;”；“&lt;em&gt;所有开发费用都可以由软件税来支付&lt;/em&gt;”。&lt;/p&gt;

&lt;p&gt;虽然整个GNU宣言，都是立足于义务论的论证思路，但是也提到了一些&lt;strong&gt;功利因素&lt;/strong&gt;，但是在我们看来，RMS并没有对此做足够深入的思考，基本上只是程序员朴素的直觉，再加上一些想当然尔。首先是GNU能够减少大量编程工作浪费，是一个非常有价值的判断，我们对于开源作为数字知识公地，其中作为&lt;strong&gt;数字化知识&lt;/strong&gt;的价值，能够为全人类节约大量的时间，就是对这一思想的进一步深化。但是，觉得搞不清楚程序应该如何销售，实质上就会导致自由/开源软件的0定价，而且在互联网普及之后，只会被免费自由下载。再加上想当然的，实际上不可能实现的&lt;em&gt;软件税&lt;/em&gt;，就会导致为自由/开源软件做出贡献的开发者，难以获得公平、公正的回报。关于这一点，我们将在后面讨论礼物文化的时候，再深入分析。&lt;/p&gt;

&lt;h4 id=&quot;22-gpl专利与oin&quot;&gt;2.2. GPL、专利与OIN&lt;/h4&gt;

&lt;p&gt;要理解GPL如何演变，还是要从RMS如何贯彻自己对于软件自由的追求入手，这也是理解软件自由运动的关键。最开始的GPL，就是一个针对Copyright的hack，于是诞生了Copyleft。Copyleft巧妙地利用了版权法的框架，它并非放弃版权,而是通过版权法赋予的权利来保护软件的自由使用权。另外值得钦佩的一点在于：Richard Stallman率先垂范，将自己开发软件，以GPL的方式分发，再激励更多的程序员，采纳GPL。相对于仅仅呼吁“那些唯利是图的企业”开放源代码，自己成为榜样的效果也更好。&lt;/p&gt;

&lt;p&gt;在GPLv2的前言中，有这么一段话&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;每个程序都持续受到软件专利的威胁。政府不应该允许专利限制通用计算机软件的开发和应用，在做不到这点时，我们希望避免专利应用有效地使自由软件私有化的危险。就此，GNU通用公共许可协议保证专利不能使程序非自由化。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;由此我们可以看出Richard Stallman的核心观点：软件专利威胁到了软件自由，软件开发者随时面临因侵犯专利而被起诉的风险。虽然政府现在做不到这一点，至少“咱们”可以通过GPL，来确保基于GPL分发的软件，不会受到专利的威胁（而变得不再自由）。&lt;/p&gt;

&lt;p&gt;从GPLv2到GPLv3，也是为了应对技术和法律环境的变化，从而新出现的威胁软件自由的情况，在专利、Tivoization、DRM等方面，Richard Stallman都做了进一步的明确。再后来AGPL的出现，也是为了应对服务器端软件、云计算、SaaS等新技术模式的兴起。直到SSPL、Elastic License 2.0这样的协议出现，我们才会来深入讨论，什么样的协议不再是“自由/开源协议”？&lt;/p&gt;

&lt;p&gt;在不做过多深入分析的情况下，我们应该如何来看待这些现象呢？说到底，还是各方的利益，产生了冲突。对于开发商（企业）而言，自己费钱费时费力开发出来的软件，当然要想办法在尽可能长的时间内，赚取尽可能多的利润。如果能够通过专利实现垄断利润，当然最好。但是对于用户而言，普通用户会发现自己必须支付更高的价格，想要分享给朋友就会被指责为盗版。而那些作为开发者的用户，明明自己有能力做到的事情（改进软件、修复缺陷）却不被允许，自然更加愤懑。&lt;/p&gt;

&lt;p&gt;那么，如果从整个社会公益的角度来看呢？到底专利是激励了创新，还是阻碍了创新？是否促进了研发投入？是否真的促进了整个社会的经济增长呢？不同的研究人员，也得出了不同的结论。唯一可以确定的是：自1980年代以来，软件专利的申请数量显著增加。一个可能的猜测是：大大小小的企业，都被迫卷入了专利对决的战争之中，非如此不足以保护自己的利益。&lt;/p&gt;

&lt;p&gt;在莫衷一是的情况下，我们如何来评价自由软件运动所反对的软件专利呢？还是看两个案例吧。&lt;/p&gt;

&lt;p&gt;第一个案例，Linux内核很早就采纳了GPLv2，但是在2007年自由软件基金会发布GPLv3之后，Linus却没有升级，这是出于什么样的原因？从网上能够看到的各种讨论与Linus本人的言论来看，他认为GPLv2已经很好地实现了自由软件的目标，并且足够简单和有效。我们的衍生推论就是：如果Linux内核采纳了更加严格、复杂、执行困难的GPLv3，也许整个社区会引发不必要的混乱和不确定性。在已经有数千名开发者与数百家公司为Linux内核做出贡献之后，贸然升级到GPLv3，也许会导致社区分裂、项目衰落。&lt;/p&gt;

&lt;p&gt;第二个案例，是在2005年成立的Open Invention Network (OIN)，最初是由IBM、索尼、飞利浦、红帽、和Novell（现为Micro Focus的一部分）共同成立，目的是保护Linux和相关开源软件免受专利诉讼的威胁。在此之后，OIN飞速发展，2013 年 12 月，谷歌加入，而丰田则在 2016 年 7 月宣布加入。2018 年 10 月 10 日，微软也终于加入了OIN。迄今为止，OIN已经有超过3600名成员了！简单的总结就是：通过不断扩展成员数量和专利池，OIN为全球开源项目提供了强有力的法律保障和支持。尽管面临一些挑战，OIN的影响力和重要性在未来仍将继续增长，为开源生态系统的健康发展做出重要贡献。&lt;/p&gt;

&lt;p&gt;从我们的伦理视角，如何评价上述的理念与实际案例呢？还是回到我们建设数字知识公地的初衷。GPL作为一套非凡的授权架构，为数字知识公地的建设，做出了突破性的贡献，这在仅有商业软件+专利保护的世界里，是难以想象的。成千上万的开发者受到自由软件理念的激发，积极的推动并捍卫自由软件运动，努力开发并分享了大量的高质量软件，这些都是难以磨灭的。但是，从理念出发，而不是从实际的功效出发，Richard Stallman与以Linus为代表的一批人产生了分歧，最终自由软件与开源软件分道扬镳，最初的起因也在于此。从我们的立场出发，务实、商业友好、不断谋求多方共赢的做法，才能使得数字知识公地，使得我们所共享的开源生态，不断健康发展。&lt;/p&gt;

&lt;h4 id=&quot;23-自由软件与开源软件之争的本质是什么&quot;&gt;2.3. 自由软件与开源软件之争的本质是什么？&lt;/h4&gt;

&lt;p&gt;在1998年，发生了开源历史上的里程碑事件：Open Source（开源）这个词被正式提出，OSI（开源促进会）成立，这可以被称之为“开源软件运动元年”。但是随即，Richard Stallman就写了文章《“开源软件” 还是 “自由软件”？&lt;sup id=&quot;fnref:7&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:7&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt;》，随后又在2007、2009直至2021年不断修改名为《为什么 “开源” 错失了自由软件的重点&lt;sup id=&quot;fnref:8&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:8&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt;》的文章。他一直想要表达的意见都非常明确：自由软件不是开源软件，自由软件比开源软件好得多，自由软件背后的理念要比开源软件的理念好得多。&lt;/p&gt;

&lt;p&gt;在前一篇文章中，RMS写到：“&lt;strong&gt;两个运动的根本差别在于它们的价值、它们看待世界的方法。就开源运动而言，软件是否应该开源是一个实际的问题，而不是道德诉求。正如有人指出，“开源是一种开发的方法；自由软件是一场社会运动。”对开源运动来说，非自由软件不是最佳答案。对自由软件运动来说，非自由软件是社会问题，而自由软件是正解。&lt;/strong&gt;”&lt;/p&gt;

&lt;p&gt;在后一篇文章，RMS的说法是：“&lt;strong&gt;自由软件运动为用户的计算自由而战斗；这是一个为自由和公正而战的运动。相反，开源理念重视的是实用优势而不是原则利害。&lt;/strong&gt;”&lt;/p&gt;

&lt;p&gt;这背后的逻辑，其实就很“武断”，RMS出于一种“义务论”的伦理观，认为自由具有无比崇高的价值，因而追求自由是道德的。至于开源，不过是追求用比较好一些的开发方法，开发更多好的软件而已，“因而是非道德的”。但是，“功利主义”也是一种堂堂正正的伦理框架，追求让更多的人，以更低的成本，用上更好的软件，从而使得整个世界变得更好，也是完全可以自豪的宣称“这是我的道德追求”的呀！&lt;/p&gt;

&lt;p&gt;但是，在自由软件与开源软件的争论历史上，似乎从来没有看到开源阵营的人，从功利主义的立场出发，来为自己辩护过。（他们真的主要是在闷头写代码，而不是写文章）&lt;/p&gt;

&lt;p&gt;在RMS的文章里，很多地方都提到“捍卫用户的自由”，这其中有一个值得辨析的时代变化，在RMS发起自由软件运动的时代，用户就是他们这群Hacker，一群不仅在用软件，而且完全有能力改进软件的Hacker。到了现在，80%甚至90%的用户，真的只是使用软件，他们完全没有能力，更没有意愿，自己去修改软件。在一个更好但是不能改的软件，与一个不太完善，但是可以自由修改的软件之间，他们宁可选择前者。那种赋予我修改的自由，由于我不具备修改的能力，因此也没有那么重要（值钱）。&lt;/p&gt;

&lt;p&gt;当然，开源软件事实上也同样授予用户修改软件的许可，那么差别在哪里呢？在RMS的前一篇文章里，有一个重要的案例：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1998年8月，在开放源码开发者日会议上，几个受邀的商业软件商表示他们只愿意让一部分产品变成自由软件（或“开源”）。他们的事业重心仍在开发其他的专属附加组件（软件或手册），以销售给他们的自由软件客户。他们希望我们认同此举的正当性，因为部分获利会赞助自由软件的开发。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;当我们读到这里的时候，内心是否认为：这很合理，也是很健康的开源商业模式？但是，RMS继续说：“&lt;strong&gt;实质上，他们想要为他们的专属软件赢得“开源”的名声—即使这些产品不是“开源软件”—只因为他们与自由软件有点渊源、或者这些公司也在维护一些自由软件。&lt;/strong&gt;”以及另外一句：“&lt;strong&gt;他们把自己打扮成“开源软件公司”，以为我们将因此升起好感而在这问题上打迷糊仗。&lt;/strong&gt;”&lt;/p&gt;

&lt;p&gt;在我们看来，如果一家公司能够用某种正当的手段持续盈利，从而可以更长久、在更大范围内投入开源贡献，这当然是一件值得称赞的好事。但是在RMS看来，除非你完全开源，否则就不能自称开源公司。你开一半，闭一半的做法，就是不道德的。&lt;/p&gt;

&lt;h3 id=&quot;3-开源时代的伦理问题&quot;&gt;3. 开源时代的伦理问题&lt;/h3&gt;

&lt;p&gt;虽然，大多数人都认为开源社区里的人，不像自由软件社区的人那么关注道德问题，更加注重软件开发过程本身。但事实上，在开源社区里发生的，与道德评价、伦理争议有关的案例，还是很多的。毕竟，很多事情虽然确实不犯法，但我们依然忍不住要批评一下。另外两个重要的变化，我们也可以通过深入理解各种案例，有所体会。一个变化是“底线”，相对于自由软件阵营，开源软件运动的众多参与者，都更加能够容忍一些合理的商业行为。但是，对于何为“合理的商业行为“，同为开源社区的人们，依然会有争论。这就涉及到第二个变化——”内部争议“，在自由软件运动阶段的争论，往往是划分”敌我“的。我们和他们就不是一类人。但是在开源运动阶段的争议，往往会更加深入细节，针对具体的事情或做法，希望能够识别或确认，自己”队伍内部“的问题。&lt;/p&gt;

&lt;h4 id=&quot;31-osd的来龙去脉&quot;&gt;3.1. OSD的来龙去脉&lt;/h4&gt;

&lt;p&gt;OSD（The Open Source Definition, 开源定义）的来历值得介绍一下。简要的因果链条是：Linux内核 –&amp;gt; Red Hat公司 –&amp;gt; Debian的担忧 –&amp;gt; Debian 社群契约 (Debian Social Contract, DSC) –&amp;gt;Debian 自由软件指导方针 (Debian Free Software Guidelines, DFSG) –&amp;gt; OSD。&lt;/p&gt;

&lt;p&gt;在Linux内核采用GPL授权发布（1992年）之后，GNU社区的众多开发者，热情的投入各种各样GNU/Linux发行版的开发工作之中。其中最成功的发行版，应该要算是Red Hat Linux（1995年）。而另一个更加严格捍卫自由软件理想的发型版，则是Debian GNU/Linux（1993年），在1997年，Debian的一位核心开发者Ean Schuessler，与Red Hat的创始人Bob Young有一场交流。Schuessler说：“红帽公司应该发布一套指导方针，向社区保证，随着公司的扩大，它将始终致力于自由软件的理想。”而Young却说：“这将是红帽公司的 “死亡之吻””，暗示这将限制公司创造利润的能力。&lt;/p&gt;

&lt;p&gt;由于担心Young的反应，Schuessler和其他 Debian 开发人员决定提出 “社会契约 “的想法，以补充伊恩-默多克（Ian Murdock）最初撰写的 Debian 宣言。后来，布鲁斯-佩伦斯（Bruce Perens）从 1997 年 6 月开始，牵头协调以自由软件定义为基础的 Debian社会契约的创建工作。契约中 Debian 自由软件指导方针 (Debian Free Software Guidelines, DFSG) 的部分，也是10条针对License的定义。&lt;/p&gt;

&lt;p&gt;到了1998年，网景公司发布了开源 Mozilla 浏览器，布鲁斯-佩伦斯随之起草了一套开源指南。这一定义的修订版被开源促进会 (OSI) 采纳为 “开源定义”。&lt;/p&gt;

&lt;p&gt;要理解开源，其实可以从自由软件的4条定义入手，经过GPL，然后到DFSG，再到OSD，仔细看看发生了哪些变化。&lt;/p&gt;

&lt;p&gt;在自由度0~3的定义中，只有针对用户的肯定性定义。但是到了GPL，为了落实四大自由，就衍生出了一系列的禁止条款。通过一系列的禁止，确保用户的自由不会被“阻断”。其中的传递性（传染性）的意味是非常强烈的。但是到了DFSG，就出现了一些明显的“自我限制”的条款，其中的第8条：许可证不能特定于 Debian；第9条：许可证的规定不得污染其他软件。其中第9条的内容，还特别举例：“许可证不得要求所有与它在同一媒体中一同分发的软件都是自由软件。”这些都是非常了不起的自我克制的精神。&lt;/p&gt;

&lt;p&gt;这里就不得不再提一段公案了，在自由软件基金会发布的《自由系统发布指南&lt;sup id=&quot;fnref:9&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:9&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;9&lt;/a&gt;&lt;/sup&gt;》中，特别注明：“自由发行版一定不能为了实用而引导用户获取任何非自由信息，也不能鼓励用户这么做。该发行版不应该带有非自由软件的资源库或安装非自由软件的指导。该发行版也不应该指向不承诺只包含自由软件的第三方资源库；即使它们目前只有自由软件，将来也可能会变化。该发行版的程序不应该推荐安装非自由的插件、文档等等。”&lt;/p&gt;

&lt;p&gt;于是，由于这样一种理念上的冲突，在自由软件基金会的自由 GNU/Linux 發行版的列表&lt;sup id=&quot;fnref:10&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:10&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;10&lt;/a&gt;&lt;/sup&gt;中，就没有将Debian列入其中。在这篇文章《自由软件基金会为什么不认为 Debian 是一种自由发行版？&lt;sup id=&quot;fnref:11&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:11&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;11&lt;/a&gt;&lt;/sup&gt;》有较为详细的解释，简单的说就是：“FSF认为，Debian给用户提供了安装非自由软件的便利”。即使Debian承诺&lt;strong&gt;Debian 将始终是 100% 的自由软件&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;到了开源定义（OSD）的时候，Bruce Perens只做了少量的改动，第8条的不能特定于Debian，变成了不能特定于任何一个产品。第9条的不得污染，改成了不得限制，且不得限制的对象举例，从自由软件，变成了开源软件。最后，将DFSG的第10条许可证举例，变成了OSD的第10条：许可必须技术中立。许可证的任何条款都不得以任何个别技术或界面风格为前提。&lt;/p&gt;

&lt;p&gt;这在更加强调纯洁性的FOSS成员看来，自然是为闭源软件大举入侵开源世界，打开了大门。但是这也是在向着“用户友好”，而非“开发者/社区成员友好”，又迈出了一步。&lt;/p&gt;

&lt;p&gt;所以，当我们深入历史，去看那些争论的时候，就会发现一条长长的光谱，在这条光谱的不同位置上，分别站着一些观点的捍卫者，从彻底自由软件阵营，到完全商业闭源阵营，中间地带也有很多观点，远远不是简单的非此即彼，能够判断的。按照经典的功利主义的逻辑：应该追求最大多数人的最大幸福。随着用户数量的不断增加，用户成分的不断变化，软件、IT技术的发展也自然应该更加偏向这些普通用户的利益。如果死守着过去的理念，就会阻碍社会的不断发展了。&lt;/p&gt;

&lt;h4 id=&quot;32-伪开源伪国产伪自研&quot;&gt;3.2. 伪开源、伪国产、伪自研&lt;/h4&gt;

&lt;p&gt;虽然开源相对于自由软件，没有那么死板，但是也有自己的底线要守。这种守底线的现象，主要就体现在OSI是否批准某一个License上。例如，著名的Elastic许可证（Elastic License 2.0），SSPL（Server Side Public License）都没有获得OSI的批准，就是两个典型的案例。为此，OSI还专门发了一篇博客强调：SSPL 不是一个开源许可证&lt;sup id=&quot;fnref:12&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:12&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;12&lt;/a&gt;&lt;/sup&gt;，在这篇文章里，还出现了一个新名词 fauxpen（Fake Open / 伪开源）。&lt;/p&gt;

&lt;p&gt;在一些普通人的理解里，善恶的评价逻辑是这样的：GPL是好的，所以AGPL是更好的，因为邪恶的云厂商以为提供SaaS服务就不算分发，这条路被堵上了。那么，自然——SSPL就是更好、更完善的许可证。&lt;/p&gt;

&lt;p&gt;但实际情况却是：在PC软件时代，主要是用户（开发者）与商业软件厂商之间的利益（权利）之争。到了云计算时代，却出现了四种利益群体：用户、开发者、小厂商（通常是开源的发起者）、大厂商（通常是用了开源而且赚得更多的一方）。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;对于厂商（无论大小）而言，开源会同时带来两个效应，一方面因为开源的向善光环，用户好感度，尤其是开发者好感度会上升。另一方面却会因为开源释出了自己的内部知识，导致产品的利润下降。所以，厂商们都希望开源能够使自己的总利润增加，否则他们就不是在做生意，而是在做慈善了。&lt;/li&gt;
  &lt;li&gt;对于大厂商而言，因为他们事实上拥有更加完整的技术栈（比如云计算基础设施），所以同等开源的情况下，他们的成本会更低，利润会更高。&lt;/li&gt;
  &lt;li&gt;而对于最初开源的小厂商而言，他们虽然是率先开源的发起者、甚至是开源项目的主导者，却无法维持自己的技术竞争力，于是他们才希望通过SSPL这样的许可证，阻止大厂商基于自己开源的项目，夺走自己的客户。&lt;/li&gt;
  &lt;li&gt;对于用户而言，他们其实只想用更加便宜、先进、高性能的产品/服务，用脚投票也会倾向于大厂。&lt;/li&gt;
  &lt;li&gt;于是，小厂商不仅需要修改许可证，还需要发起舆论攻势，将大厂商描述成为邪恶的霸凌（白嫖）者。&lt;/li&gt;
  &lt;li&gt;当然，还有第五个利益群里，那就是OSI，他们希望通过批准或不批准某个License，以维护自己在开源世界里的权威地位。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;相对于修改许可证这样的争议行为，另一类行为可以说是毫无争议的伪开源。那就是PPT开源、按揭开源、在GitHub上放二进制可执行文件然后号称开源。这些厂商几乎毫无损失，却冒充开源，假装开放。这是一种虚假营销的手段，几乎被社区里的所有人唾弃。&lt;/p&gt;

&lt;p&gt;但是，在AI尤其是LLM兴起之后，的确出现了一大批“开源”的LLM，他们的许可证未经OSI批准，他们的源代码、训练数据并没有开放出来，只有一堆训练结果参数供大家下载，由于LLM的情况远比软件复杂，所以现在OSI正在牵头一个工作组，试图制定开源AI的定义（The Open Source AI Definition），目前只进展到0.0.8版。从0.0.8版体现的精神来看，OSAID还是做出了一些妥协的，在定义中包括了“默认必备组件（default required components）列表”，这些都Open了，才算是开源AI。但是还有一个“非必须但建议（not required… but…）的列表”，作为开源与非开源的灰色地带。&lt;/p&gt;

&lt;p&gt;从功利主义的角度来看，这依然是多方利益博弈，各自妥协，并寻求最大多数人的最大幸福的努力。&lt;/p&gt;

&lt;p&gt;还有一个中国特有的现象，值得简单提及。因为在中国，国产自主研发，还具有某种民族大义（正当性），就会有一些企业，拿了开源的东西，把外壳换掉，Logo改掉，然后号称是自己自研的，国产的，完全自主可控的软件。这背后当然还是商业利益，最少的付出（拿来主义），最大的收益（民族大义、国家补贴）。企业当然最好是无本万利，至于法律，则是需要阻止这种突破底线的行为。&lt;/p&gt;

&lt;h4 id=&quot;33-大教堂与集市礼物文化与冰山现象&quot;&gt;3.3. 《大教堂与集市》、礼物文化与冰山现象&lt;/h4&gt;

&lt;p&gt;在著名的开源圣经《大教堂与集市》中，第三章《开垦心智层》与伦理学的关系最大。我们可以先简单总结一下这一章内与价值观、伦理评价之类相关的内容。&lt;/p&gt;

&lt;p&gt;首先，为了说明黑客们（现在往往称之为开发者）的行为逻辑，Eric Raymond讲解了开源世界中的所有权概念。“一个软件项目的“所有者”就是在社区中众所周知的对软件版本改动有唯一发布权的那个人。”&lt;/p&gt;

&lt;p&gt;如果一款开源软件，同时有两个人声称自己发布了新的版本，这就是在社区中被大多数人反对的分叉（Fork）现象。Eric还进一步列出了一些细则（重大禁忌）：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;分叉一个项目会遇到强大的社会压力，只有在极为必要的情况下才使用，而且要重新命名和做出大量的公开解释。&lt;/li&gt;
  &lt;li&gt;在没有项目主持人认可的情况下发布更新是令人不悦的，除非是特殊情况（如本质上不重要的移植bug修复）。&lt;/li&gt;
  &lt;li&gt;在项目历史、致谢表或维护列表中移除某个人的名字是绝对不可以的，除非当事人明确表示同意。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;类比物理世界的土地收益，按照Eric的说法，一个一个的开源项目，就是黑客们的“土地”。这些“土地”的收益，就是因为分享礼物，而获得的声誉。根据书中的说法：人类组织模式可以分为“命令体系”、“交换经济”与“礼物文化”，“礼物文化并不是对物质稀缺的适应，而是对物质充裕的适应。产生于没有生活必需品稀缺问题的人群中，在气候宜人且物产丰富的生态环境中，我们经常可以在其原居民文化中观察到礼物文化。我们也能在自身所处的社会中观察到这点，特别是娱乐行业和富豪阶层。充裕性会使命令关系难以维持，会使交换关系变成无意义的游戏。在礼物文化中，社会地位并不取决于你控制了什么，而是你给予了什么。”&lt;/p&gt;

&lt;p&gt;因此，Eric构建了两个类比关系：将开源项目所有权类比为土地所有权，将开源贡献类比为分享礼物–&amp;gt;获取声誉–&amp;gt;土地收益。而在社区中有较高声誉的人，则能够更容易与他人合作，以及“如果你所处的礼物经济和交换经济或命令体系互相关联交织，你的名声就可能传播到后两种环境中，使你在那里获得更高的地位。”&lt;/p&gt;

&lt;p&gt;在构造了所有权+声誉竞争模型之后，Eric也进一步分析了：哪些类型、领域的贡献更能够获得声誉，哪些礼物更加受人欢迎，以及社区治理和冲突的原因等等方面。&lt;/p&gt;

&lt;p&gt;这个模型有一些关键点，值得深入分析一下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;事实上的声誉分配，是两级、甚至多级的。首先是社区给到一个项目，项目的所有者自然获得最大的声誉。然后这个项目的所有者，将会以某种公开感谢的方式，再将一部分声誉，分配给这个项目的其他贡献者。
    &lt;ul&gt;
      &lt;li&gt;由于两级分配、聚光灯效应、社区潮流风向等原因，一个人所获得的声誉，往往无法与他的付出相称，这是第一层的不公平。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;社区成员对于某一个黑客的感谢，事实上出于两类原因：他的贡献，对我有价值（使用是最真实的赞美）。他的贡献，事实上使他有所损失（业余时间、甚至商业收入），原本他也许可以挣更多。
    &lt;ul&gt;
      &lt;li&gt;礼物文化中，开发者所获得的声誉，未必能够很好的兑现为交换经济中的物质收益，或者命令体系中的社会地位。这是第二层的不公平。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;20~30年过去了，开源黑客们现在被称为开源开发者，他们的数量有了成千上万倍的增长，于是Eric的模型，受到了更多挑战。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;所有权越来越多属于企业、组织或者基金会，这使得荣誉的“自然授予”出现了更多的转折，到底是项目最初的创始人、当前的实际负责人，项目所在公司的技术负责人或者其他什么人，应该获得荣誉，变得更加复杂了。&lt;/li&gt;
  &lt;li&gt;开源项目的冰山效应，使得海面以下的开源项目，有人使用却无人关注。各个项目原本各自应得的荣誉，只是集中体现在了那些明星开源项目上。&lt;/li&gt;
  &lt;li&gt;开源人的冰山效应，使得海面以下的开源人，付出努力，做出贡献，却无人知晓。虽然GitHub内置了贡献值列表，但是除了开源的研究者，几乎无人关注。&lt;/li&gt;
  &lt;li&gt;大量的开源人受雇于企业，追求声誉的动力不足。原本是“我的开源项目”、“我投入贡献的开源项目”，变成了“公司的开源项目”，“公司雇佣我参与的开源项目”。归属感不足，自然荣誉感也不足。&lt;/li&gt;
  &lt;li&gt;那些并未受雇于企业，以自由职业身份参与开源，并期望通过社区声誉兑现其他收益的开源开发者，往往默默无闻、运气不佳，甚至处境悲惨，在线哭诉。例如core-js的作者Denis Pushkarev的遭遇，就是一个典型案例&lt;sup id=&quot;fnref:13&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:13&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;13&lt;/a&gt;&lt;/sup&gt;。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果我们依然抱着20多年前“开源圣经”，相信一切运行良好，就会看到更多的开源人在线哭诉，甚至删库跑路。我们当然可以在道义上指责他们，但真正要解决问题，还是要从“建立更加公平、健康的开源生态入手”才行。&lt;/p&gt;

&lt;p&gt;另一个值得关注的现象，是Eric提到的“反功利主义”倾向，简单的总结就是：Eric期望给开源社区里的黑客行为寻找一个功利主义的解释：“因为做了XXX，就能获得XXX”。但是很多黑客们并不喜欢这样的解释，不希望被人认为自己的行为，是出于自利的动机。他们更喜欢挂在嘴边的是“Just for fun”。&lt;/p&gt;

&lt;h4 id=&quot;34-社区领袖的言行对于开源社区的影响&quot;&gt;3.4. 社区领袖的言行对于开源社区的影响&lt;/h4&gt;

&lt;p&gt;在 2021年3月23日的时候，Github 上新建了一个 repo，这是一封公开信，标题是：《要求撤除理查德·M·斯托曼所有领导职务的公开信&lt;sup id=&quot;fnref:14&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:14&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;14&lt;/a&gt;&lt;/sup&gt;》，这封公开信的主旨是：“由于自由软件基金会（FSF）最近重新任命他为董事会成员，我们要求自由软件基金董事会全体辞职，并撤除 RMS 所有领导职务。”&lt;/p&gt;

&lt;p&gt;公开信还表示：“RMS 的很多言行展示他眨抑女性、歧视残障人士、厌恨跨性别人士等等思想，我们不宽恕他的言行。我们不接受他的领导，也不会接受现在自由软件基金会的领导层。”&lt;/p&gt;

&lt;p&gt;这封公开信的主要作者是：GNOME 基金会战略计划经理 &lt;a href=&quot;https://github.com/mollydb&quot;&gt;Molly de Blanc&lt;/a&gt;、GNOME 基金会执行董事 &lt;a href=&quot;https://github.com/neilmcgovern&quot;&gt;Neil McGovern&lt;/a&gt;、Debian 技术委员会成员 &lt;a href=&quot;https://github.com/ehashman&quot;&gt;Elana Hashman&lt;/a&gt;、以及多学科高级设计师 &lt;a href=&quot;https://github.com/devinhalladay&quot;&gt;Devin Halladay&lt;/a&gt;。 这封信最终共有3003人署名，主要签名人物还包括：开源促进会(OSI)的总经理 Deb Nicholson；FSF 董事会前成员 Matthew Garrett；X.org 基金会董事会的所有八名成员。OSI 也宣布，如果Richard Stallman不辞职，OSI 将停止与FSF 合作&lt;sup id=&quot;fnref:15&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:15&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;15&lt;/a&gt;&lt;/sup&gt;。3 月 25 日，红帽也在其官网发表声明，表示震惊于理查德·斯托曼重新加入 FSF 董事会，因此红帽决定将立即中止对 FSF 的所有资助，以及不再支持 FSF 主办的任何活动&lt;sup id=&quot;fnref:16&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:16&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;16&lt;/a&gt;&lt;/sup&gt;。&lt;/p&gt;

&lt;p&gt;另一方面，声援RMS的人们，也创建了一个repo，发出了《一封支持理查德·斯托曼(Richard Stallman)的公开信&lt;sup id=&quot;fnref:17&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:17&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;17&lt;/a&gt;&lt;/sup&gt;》，最终，支持RMS的签名者，达到了6876人。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/rms.png&quot; alt=&quot;图片&quot; style=&quot;zoom:50%;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;最终，2021年4月12日，自由软件基金会发表声明，坚持邀请 RMS 回归，并表示：“we missed his wisdom&lt;sup id=&quot;fnref:18&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:18&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;18&lt;/a&gt;&lt;/sup&gt;”。&lt;/p&gt;

&lt;p&gt;这样的案例，究竟说明了什么问题？按照我的朋友霍炬的说法，这是：“这可能是近年来不多的取消失败事件”，这还得先回答什么是“取消文化”。&lt;sup id=&quot;fnref:19&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:19&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;19&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;一种因为某人说或者做了某些让你感觉冒犯的东西，而完全抵制他的群体的社会行为，它特别发生在社交媒体上。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;多年来在美国（欧美地区）广泛出现的取消文化，已经有过多次成功案例，包括：著名作家被抵制，支持某种言论的作家被出版社解雇，政客、记者、电台主持人被迫辞职，甚至某些品牌的产品销售和公司股票价格都受到影响。&lt;/p&gt;

&lt;p&gt;但是，在开源社区，另一种文化却根深蒂固——“评判黑客的标准应该是他们的黑客技术，而不是学位、年龄、种族或职位等虚假标准”，这一黑客伦理被进一步引申：只需要关注一个互联网上的ID在社区里的实际贡献，而不需要关联到真实世界里的人。一个人在物理世界里的言行，与数字世界里的言行，需要区别对待。&lt;/p&gt;

&lt;p&gt;正如支持RMS的那封公开信里所说：“无论如何，Stallman 对他所遭受迫害的事情的观点与他领导诸如 FSF 之类社区的能力无关。此外，他有权与他人一样表达意见。成员和支持者不必同意他的观点，但应尊重他的思想和言论自由的权利。”&lt;/p&gt;

&lt;p&gt;当然，我们需要注意到的不仅仅是这次支持RMS一方的胜利，还需要注意到有1/3的人，确实支持对于RMS的驱逐，这并不是一个非常小的比例，这也正说明要在开源社区取得伦理共识，有多么困难。&lt;/p&gt;

&lt;p&gt;在支持驱逐RMS的知名人士中，还有&lt;a href=&quot;[Sage Sharp - Wikipedia](https://en.wikipedia.org/wiki/Sage_Sharp)&quot;&gt;Sage Sharp&lt;/a&gt;以及&lt;a href=&quot;https://en.wikipedia.org/wiki/Valerie_Aurora&quot;&gt;Valerie Aurora&lt;/a&gt;，这两位都是Linux内核社区的贡献者，也是著名的Linus言行反对者，她们都因为无法忍受Linus的“辱骂他人、公开撕裂他人情感的言论”，愤而退出Linux内核社区。在纽约客的一篇题为《After Years of Abusive E-mails, the Creator of Linux Steps Aside&lt;sup id=&quot;fnref:20&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:20&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;20&lt;/a&gt;&lt;/sup&gt;》的文章中，报道了Linux的创始人，Linus Torvalds破天荒第一次在邮件列表中的道歉。他作为 Linux 内核维护者经常直截了当骂别人是脑残、笨蛋、白痴，“Please just kill yourself now. The world will be a better place”、“Guys, this is not a dick-sucking contest”、“SHUT THE FUCK UP!”都是他曾经说过的话。这激起了Linux社区内众多人士的反对，在多年的自我辩解并拒不改正之后，Linus终于道歉、宣布暂离社区进行反思，并且由Linux基金会颁布了一份新的《行为准则（Code of Conduct）&lt;sup id=&quot;fnref:21&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:21&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;21&lt;/a&gt;&lt;/sup&gt;》。&lt;/p&gt;

&lt;p&gt;这一案例，又说明了什么问题？与之前的RMS被驱逐有何异同？在我看来，前者是一位开源社区的领袖，因为社区之外的言论，而受到驱逐。后者则是一位相似地位的社区领袖，因为在社区之内的言论，而持续受到批评，并终于开始反省。前者是不健康的，而后者是健康的。前者是外部世界将自身的伦理规范强加于开源世界，而后者则是开源社区内部的自我修正现象。&lt;/p&gt;

&lt;h3 id=&quot;4-现实世界的伦理问题对于开源世界的挑战&quot;&gt;4. 现实世界的伦理问题对于开源世界的挑战&lt;/h3&gt;

&lt;p&gt;世界在不断变化，不仅仅是商业在挑战开源的伦理，还有很多其他的问题，在挑战着企图自成一体的开源世界。&lt;/p&gt;

&lt;h4 id=&quot;41-道德源码运动与anti996运动&quot;&gt;4.1. 道德源码运动与anti996运动&lt;/h4&gt;

&lt;p&gt;在签名呼吁驱逐RMS的人中，有：&lt;a href=&quot;https://en.wikipedia.org/wiki/Coraline_Ada_Ehmke&quot;&gt;Coraline Ada Ehmke&lt;/a&gt;、&lt;a href=&quot;https://don.goodman-wilson.com/about/&quot;&gt;Don Goodman-Wilson&lt;/a&gt;、&lt;a href=&quot;https://ethicalsource.dev/who-we-are/people/sean-bailey&quot;&gt;Sean Bailey&lt;/a&gt;、&lt;a href=&quot;https://ethicalsource.dev/who-we-are/people/will-barton&quot;&gt;Will Barton&lt;/a&gt;等人，他们都来自于一个名为Ethical Source（道德源码运动）的组织。其中一位Don Goodman-Wilson在2019年10月，发表了一篇很长的Blog《Open Source is Broken&lt;sup id=&quot;fnref:22&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:22&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;22&lt;/a&gt;&lt;/sup&gt;》，以及后续的 Blog《A Post-Open Source World&lt;sup id=&quot;fnref:23&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:23&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;23&lt;/a&gt;&lt;/sup&gt;》发表于 2020年9月，集中阐述了道德源码运动的观点。&lt;/p&gt;

&lt;p&gt;道德源码运动，可以认为是在开源运动内部发生的一次“革命”，他们的主要观点，分为三个部分：开源社区对于社区贡献者的身心伤害（这也是他们反对Linus、驱逐RMS的理由）；开源软件项目的维护者常常无偿劳动，而大公司从中获利；开源软件常常被不道德的实体滥用，例如进行监视或制造武器。&lt;/p&gt;

&lt;p&gt;第一个观点，我们前面已经讨论过，而开源软件维护者无偿劳动的问题，我们在最后一个小节再一起讨论。最难处理的是“开源软件被不道德的实体滥用”这个问题。&lt;/p&gt;

&lt;p&gt;在OSI的FAQ页面&lt;sup id=&quot;fnref:24&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:24&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;24&lt;/a&gt;&lt;/sup&gt;，有一个重要的提问与回答：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Can I stop “evil people” from using my program?
我能阻止“坏人”使用我的程序吗？

No. The Open Source Definition specifies that Open Source licenses may not discriminate against persons or groups. Giving everyone freedom means giving evil people freedom, too.
不，《开放源代码定义》规定，开放源代码许可不得歧视个人或团体。给每个人自由，也就意味着给坏人自由。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;而在道德源码运动的官网上，他们完全是对着干的&lt;sup id=&quot;fnref:25&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:25&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;25&lt;/a&gt;&lt;/sup&gt;：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;We as software developers cannot be neutral or naïve about the work that software does in the world. We are implicated in the social outcomes the usage of our software creates. Just as open source software acknowledges that there is social value in the development of software in the open, ethical source acknowledges there is social value in software avoiding harm.

作为软件开发人员，我们不能对软件在世界上所做的工作保持中立或天真。我们与使用我们的软件所创造的社会成果息息相关。正如开放源码软件承认在开放环境中开发软件具有社会价值一样，道德源码也承认软件在避免危害方面具有社会价值。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在这场追求更加道德的开源的潮流中，有一项运动被众多的中国开发者所熟知，就是996.ICU&lt;sup id=&quot;fnref:26&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:26&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;26&lt;/a&gt;&lt;/sup&gt;项目，这个活动旨在反对诱导、暗示或强迫员工执行996工作制的公司。所谓“996”工作制，即每天早 9 点到岗，一直工作到晚上 9 点，每周工作 6 天。从经济上，按照劳动法规定，996 工作制下只有拿到当前工资的 &lt;strong&gt;2.275&lt;/strong&gt; 倍，才在经济账上不吃亏。而从健康上，开发人员长期996加班，也会有损害健康、生活品质下降，甚至猝死的风险。于是，他们推出了《Anti-996许可证&lt;sup id=&quot;fnref:27&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:27&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;27&lt;/a&gt;&lt;/sup&gt;》，在这个许可证中，与反对996工作制相关的条款，有以下两条：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2. 个人或法人实体必须严格遵守与个人实际所在地或个人出生地或归化地、或法人实体注册地或经营地（以较严格者为准）的司法管辖区所有适用的与劳动和就业相关法律、法规、规则和标准。如果该司法管辖区没有此类法律、法规、规章和标准或其法律、法规、规章和标准不可执行，则个人或法人实体必须遵守国际劳工标准的核心公约。
3. 个人或法人不得以任何方式诱导、暗示或强迫其全职或兼职员工或其独立承包人以口头或书面形式同意直接或间接限制、削弱或放弃其所拥有的，受相关与劳动和就业有关的法律、法规、规则和标准保护的权利或补救措施，无论该等书面或口头协议是否被该司法管辖区的法律所承认，该等个人或法人实体也不得以任何方法限制其雇员或独立承包人向版权持有人或监督许可证合规情况的有关当局报告或投诉上述违反许可证的行为的权利。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我也去查看了采用了Anti996的开源项目列表&lt;sup id=&quot;fnref:28&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:28&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;28&lt;/a&gt;&lt;/sup&gt;，一共有165款软件，但是非常遗憾的是，目前只有32款软件，还在明确使用Anti996许可证，其他的项目是否继续采纳，尚需一一查证。&lt;/p&gt;

&lt;p&gt;如何看待这样的现象？以及如何评估这一运动的成效？这些都是非常复杂，且难以回答的问题。&lt;/p&gt;

&lt;p&gt;为什么OSI要坚持绝对的非歧视条款？在我看来，这是一项重要的免责（切割）声明，这意味着宣称“我们不去判断善恶，我们专注于技术创造，而不是去充当我们不擅长的&lt;strong&gt;道德裁判&lt;/strong&gt;”。&lt;/p&gt;

&lt;p&gt;当我们要求用我们的开源软件的个人与企业，都是善良的、不会作恶的时候，事实上我们在提出的是一个“空洞且难以执行”的要求。除非我们有着像美国政府那样的自信，公然宣称某些国家邪恶，甚至是邪恶轴心。然后对他们施加种种制裁。开源社区的任何人，都不具备这样的能力，也不具备这样的资格。&lt;/p&gt;

&lt;p&gt;比如：假设存在一家996工作制的企业，他们在做绿色环保相关的公益软件呢？假设存在一家企业，他们对于员工的错误处罚严厉，但是却在极力开发助老助残的相关服务呢？我们（作为开发者、开源社区）是否有能力、有资格来判断这家公司的善恶呢？&lt;/p&gt;

&lt;p&gt;再进一步分析，一款开源软件，也许被独立使用，也许被组合起来用于另一个开源项目之中，也许被直接使用，也许被修改以后使用，在开源软件作者，到最终的使用之间，存在着一系列的开发者、使用者、传播者，就算到了最终，某一个软件的确用于罪恶的目的，在这个链条之中的每一个人，都有阻止的责任吗？&lt;/p&gt;

&lt;p&gt;以Anti996许可证为样本来分析，事实上它将是否侵犯劳动者的权益的判断标准，“外包”给了所在国的法律或“国际劳工标准”，那么，他们为啥要主动“追加惩罚”，而不是干脆将处罚该违规企业的责任，也一并“外包”给当地司法机关呢？&lt;/p&gt;

&lt;p&gt;在我看来，OSI的免责（切割）声明，才是真正明智的做法。至于道德源码运动，甚至可能会成为“美式制裁”的漂亮借口，倒是不得不警惕！&lt;sup id=&quot;fnref:29&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:29&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;29&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;h4 id=&quot;42-开源反战禁止开源贡献与政治性投毒&quot;&gt;4.2. 开源反战、禁止开源贡献与政治性投毒&lt;/h4&gt;

&lt;p&gt;2022年2月24日，俄乌战争全面升级，一系列相关的事件随之爆发，并逐渐波及到开源领域。2022 年 3 月 2 日 GitHub CEO Thomas Dohmke 发文《我们对乌克兰战争的回应&lt;sup id=&quot;fnref:30&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:30&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;30&lt;/a&gt;&lt;/sup&gt;》，在Thomas的文章里，主要有两段话值得关注：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;In parallel with our efforts to make sure GitHub is available to developers in all countries, we are continuing to ensure free open source services are available to all, including developers in Russia.

在我们努力确保所有国家的开发者都能使用GitHub的同时，我们也在继续确保所有人都能获得免费的开源服务，包括俄罗斯的开发者。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Our legal team examines such mandates thoroughly, and we are complying with export controls and trade regulations as they evolve. This includes implementing stringent new export controls that are aimed at severely restricting Russia’s access to technologies and other items it needs to sustain its aggressive military capabilities.

我们的法律团队对此类任务进行了彻底审查，而且我们正在遵守不断发展的出口管制和贸易法规。这包括实施严格的新出口管制，旨在严格限制俄罗斯获得其维持侵略性军事能力所需的技术和其他物品。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;第一段话，非常“开源”，符合我们所理解的“非歧视”原则。但是，第二段却令人担忧：如果俄罗斯确实通过某个开源项目“获得其维持侵略性军事能力所需的技术”，是不是就需要严格限制呢？这样的做法，是不是违背了OSD的精神呢？当一家企业严格遵守所在国的法律，与努力践行开源的精神之间产生了冲突，又该如何权衡呢？&lt;/p&gt;

&lt;p&gt;在React社区里，发生了更多的纷争，由于在React的官网&lt;sup id=&quot;fnref:31&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:31&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;31&lt;/a&gt;&lt;/sup&gt;直接表达了对于乌克兰的支持，导致大量中国大陆的Github用户来到React社区，发出了大量攻击与谩骂的issue。而在Vue社区，一位名叫 &lt;a href=&quot;https://github.com/vasylnahuliak&quot;&gt;Vasyl Nahuliak&lt;/a&gt; 的 React Native 开发者提交的 PR 。结果被尤雨溪关掉了&lt;sup id=&quot;fnref:32&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:32&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;32&lt;/a&gt;&lt;/sup&gt;。而且，他还提交了另外 6 个 PR ，只可惜都被关闭了。尤雨溪的答复是：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;As an individual, I deeply sympathize with what the Ukrainian people are going through and wish nothing but peace and safety for Ukraine. I have personally expressed support on Twitter, and many Vue team / community members have done the same. However, I do not want Vue, an OSS project, to become a vehicle for political messages. We will do what we can as individuals, but not under the name of the project.

作为个人，我对乌克兰人民所经历的一切深表同情，只希望乌克兰和平和安全。我个人在Twitter上表示支持，许多Vue团队/社区成员也做了同样的事情。然而，我不希望Vue这个开放源码软件项目成为政治信息的载体。我们将作为个人做我们能做的，但不是以项目的名义。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在我看来，尤雨溪的回答，是典型的开源社区的伦理思路：开发者个人的政治偏好、立场是一回事，但开源社区不应该涉入政治。另外还有两个案例，也与此类似：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;有人在 OpenBLAS 项目上提议，删除对俄罗斯 Elbrus 处理器的支持，大意是：“继续支持 OpenBLAS 中的 Elbrus 处理器就等于支持普京政权及其军事侵略。” &lt;sup id=&quot;fnref:33&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:33&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;33&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
  &lt;li&gt;有人在 Eclipse 项目上提议，不仅应该移除对 Elbrus 处理器的支持，还应该移除对中国的龙芯处理器的支持。&lt;sup id=&quot;fnref:34&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:34&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;34&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;令人感到高兴的是：大多数社区，都反感在讨论代码和技术的地方，讨论不相干的政治问题。因为任何政治的讨论，都会涉及到各自的立场，而在开源社区，就应该是“&lt;strong&gt;非政治&lt;/strong&gt;”的。&lt;/p&gt;

&lt;p&gt;然而，事情并未到此为止，更加激进的开源开发者（和平“爱好者”），开始将开源武器化，至少在一个案例中 —— node-ipc 包中的 peacenotwar 模块&lt;sup id=&quot;fnref:35&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:35&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;35&lt;/a&gt;&lt;/sup&gt; —— 这个更新破坏了 npm 开发者的代码，旨在抹去存储在俄罗斯和白俄罗斯的数据。这已经完全越过了所有的界限，几乎遭到了开源社区内所有人的批评。OSI的一篇博客评论到：“从长远来看，这种武器化很可能就像是向风中吐痰。破坏开源项目的坏处远远超过任何可能的好处，而且这种反作用力最终会损害负责的项目和贡献者。推而广之，所有的开放源码都会受到伤害。” &lt;sup id=&quot;fnref:36&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:36&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;36&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;在OSI的博客中，还有一段话，其实大有问题：“大多数抗议软件在运行时只是显示反战或支持乌克兰的信息。这是一种非暴力的、创造性的抗议形式，可能是有效的。”&lt;/p&gt;

&lt;p&gt;如果有软件，在运行时，呼吁大家“帮助可怜的乌干达儿童&lt;sup id=&quot;fnref:37&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:37&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;37&lt;/a&gt;&lt;/sup&gt;”，如果有软件，呼吁大家“每周吃素一天”？如果有软件，呼吁大家“虔诚信奉古兰经”，如果有软件呼吁大家“加入3K党”……。那么，这些呼吁、抗议、宣称是否应该存在？伦理边界应该如何划定？他们“可能是有效的”，但也可能是“有冒犯的”，甚至可能是一种犯罪。&lt;/p&gt;

&lt;p&gt;对于开源世界，最好的做法是不要涉入任何这样的立场与偏好，软件就是软件，开源就是开源。当然，Vim的做法，至少是无害于他人、且令人尊敬的。&lt;/p&gt;

&lt;h4 id=&quot;43-后开放运动与后开放零成本许可证&quot;&gt;4.3. 后开放运动与后开放零成本许可证&lt;/h4&gt;

&lt;p&gt;Bruce Perens，作为开源运动的创始人之一，近年来一直对于开源多有批评。他首先提到的是&lt;strong&gt;开源许可证的问题&lt;/strong&gt;：Bruce 认为现有的开源许可证不再适用，因为许可证无法达到其原本的目的。他指出，目前有大约三分之一的Linux系统销售时包含了GPL规避条款，禁止源代码的再分发，这涉及数十亿美元的业务。&lt;sup id=&quot;fnref:38&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:38&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;38&lt;/a&gt;&lt;/sup&gt;其次是&lt;strong&gt;合规性问题&lt;/strong&gt;：他指出，希望遵守开源规则的公司需要花费数百万美元来满足合规性要求，这是对资源的浪费。&lt;sup id=&quot;fnref:39&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:39&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;39&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;但他最主要的观点是：&lt;strong&gt;开发者与公司之间存在的权力差异&lt;/strong&gt;，虽然开源软件促进了像谷歌这样的公司的创建，但开源开发者往往得不到适当的补偿，除非他们为这些公司工作。为了解决这些问题，佩伦斯提出了“后开放”（Post-Open）概念。这个概念旨在通过新的许可模式，为开源开发者提供更公平的报酬，并简化合规流程。他提议创建一个非营利组织来管理这些许可证，收取大型公司的费用，并将这些费用分配给开发者。&lt;/p&gt;

&lt;p&gt;在2024年3月8日，Bruce Perens发布了一篇博客，标题是《Post-Open License: First Draft&lt;sup id=&quot;fnref:40&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:40&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;40&lt;/a&gt;&lt;/sup&gt;》。很多人会称之为“后开源许可证”，但是我还是认为称之为“后开放许可证”更加恰当。不久之后，他又发布了《POST-OPEN ZERO-COST LICENSE&lt;sup id=&quot;fnref:41&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:41&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;41&lt;/a&gt;&lt;/sup&gt;》的0.06版，可以称之为《后开放零成本许可证》。&lt;/p&gt;

&lt;p&gt;在这个已经非常长的草案中，Bruce提出了一系列新的概念：&lt;/p&gt;

&lt;p&gt;注意其中的第2.1条：&lt;strong&gt;后开放管理机构&lt;/strong&gt;（The POST-OPEN ADMINISTRATION）是一个实体，它通过与&lt;strong&gt;后开放作品集&lt;/strong&gt;（POST-OPEN COLLECTION）中所有作品的许可人签订的&lt;strong&gt;后开放运营协议&lt;/strong&gt;（POST-OPEN OPERATING AGREEMENT），可以在由这些条款及其他协议和程序引起的或与之相关的任何争议或索赔中代表任何这些许可人。作为其正常运作的一部分，&lt;strong&gt;后开放管理机构&lt;/strong&gt;可以代表其自身和&lt;strong&gt;后开放作品集&lt;/strong&gt;中所有作品的许可使用人，与您共同签署开放后许可。&lt;strong&gt;后开放管理机构&lt;/strong&gt;可以代表&lt;strong&gt;后开放作品集&lt;/strong&gt;中所有作品的许可使用人提起诉讼或执行其他法律。&lt;/p&gt;

&lt;p&gt;另外还有&lt;strong&gt;后开放零成本合同&lt;/strong&gt;（The POST-OPEN ZERO-COST CONTRACT）、&lt;strong&gt;后开放付费合同&lt;/strong&gt;（The POST-OPEN PAID CONTRACT）、&lt;strong&gt;后开放补救程序&lt;/strong&gt;（The POST-OPEN REMEDIATION PROCESS）等等概念，也需要专门的条款说明。&lt;/p&gt;

&lt;p&gt;如何理解Bruce的努力？他试图通过创建一个开源开发者的“工会组织”（后开放管理机构），然后将所有的作品都打包成一个整体（后开放作品集），以这样的形式增强开发者与大企业的议价能力，从而迫使大企业（年收入超过 500 万美元）能够支付每年大约（其软件使用和收入）1%的费用，再由这个管理机构负责接收和分配付款、执行和运营服务实体。&lt;/p&gt;

&lt;p&gt;事实上，Bruce本人完全清楚这个事情的难度，不仅需要有能力收取费用，还需要复杂的分配方案，还需要获得尽可能多的开发者的信任&lt;sup id=&quot;fnref:42&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:42&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;42&lt;/a&gt;&lt;/sup&gt;。在我看来，如果这个尝试发生在开源（Open Source）刚刚诞生，甚至是自由软件刚刚的诞生的年代，开源代码（Source Code）极度稀缺、大企业们还没有太多选择、而开发者们还很有干劲的时候，也许这事真的能够干成。但是现在，可供选择的开源软件到处都有，而且还多半倾向于选择“商业友好”的授权协议，“后开放运动”想要成功，几乎不可能了。另一个联想，则是RMS曾经提到过关于“软件税”的设想，一种需要政府之力才能够推行的政策，也许与“后开放运动”，同样困难吧。&lt;/p&gt;

&lt;p&gt;虽然，这个“后开放运动”看起来与开源伦理无关，仅仅是商业上的事情。但是，要让那些原本就喜欢去中心化、喜欢匿名、强调隐私、喜欢挑战权威的开发者们，与后开放管理机构，签署这样的运营协议，也实在是有些挑战他们的伦理底线了。&lt;/p&gt;

&lt;h2 id=&quot;三观点总结&quot;&gt;三、观点总结&lt;/h2&gt;

&lt;p&gt;在分析了众多的开源伦理相关案例之后，终于到了需要总结观点的时候了。我们想要从以下几个方面来进行总结。&lt;/p&gt;

&lt;h3 id=&quot;31-开源伦理的阶段变化&quot;&gt;3.1. 开源伦理的阶段变化&lt;/h3&gt;

&lt;p&gt;我们可以发现，开源伦理经历了三个阶段的变化，一开始是&lt;strong&gt;精英伦理主导&lt;/strong&gt;的阶段。这个阶段甚至被很多人认为是“真正的开源伦理”，或者说是“开源伦理的核心”。在这一阶段，“上古大神”们一方面创造了各种各样传说级的开源项目，一方面也奠定了以黑客伦理为标志的的伦理基础观念：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;协作与共享&lt;/strong&gt;：开源社区强调协作与共享，认为通过开放代码，所有人都可以受益并共同进步。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;透明带来信任&lt;/strong&gt;：代码是公开的，任何人都可以审查和改进，从而建立起一种基于透明度的信任文化。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;自由的权利&lt;/strong&gt;：开源倡导软件自由，强调用户应当有使用、修改和再分发软件的自由。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;然后就进入了&lt;strong&gt;商业伦理冲击&lt;/strong&gt;的阶段，随着开源软件不断蚕食商业软件的市场，商业伦理也开始对开源运动产生冲击。在这一阶段，越来越多的商业公司认识到开源软件的潜力，并开始参与其中。公司逐渐将开源软件纳入其商业战略，通过开源来降低开发成本、提高市场竞争力和促进技术创新。这一阶段的伦理变化主要体现在：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;商业化与盈利&lt;/strong&gt;：公司通过提供开源软件的商业支持、定制服务和增值产品来实现盈利，这在一定程度上改变了开源社区的原有价值观。RMS曾经严厉的批评过通过商业利润来养开源的逻辑，但是他的批评无法阻拦这样的趋势。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;知识产权与许可&lt;/strong&gt;：商业公司更加关注知识产权保护和许可协议的制定，以确保在开源合作中的权益。尊重版权、注重合规义务，成为与尊重开源贡献同等重要的伦理要求。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;社区与企业关系&lt;/strong&gt;：公司需要平衡开源社区的利益与企业的商业目标，这要求建立新的合作模式和伦理规范。我们常常会说有些公司不会玩开源，把一些糟糕的玩法带到开源社区，就是因为商业伦理与开源伦理之间出现的碰撞。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;目前我们正在经历的是&lt;strong&gt;外部伦理冲击&lt;/strong&gt;的阶段，在开源软件广泛普及和应用的背景下，外部伦理因素开始对开源运动产生重大影响。这些因素包括社会责任、隐私保护、数据安全和地缘政治等。这一阶段的开源伦理变化主要体现在以下几个方面：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;社会责任与政治正确&lt;/strong&gt;：开源社区和公司越来越多地关注社会责任，强调开源技术应当服务于社会公益和可持续发展。进一步的说法就变成了：开源不应该成为恶势力的帮凶，开源应该追求政治正确、社会正义，于是道德源码运动，随之兴起。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;隐私与安全&lt;/strong&gt;：随着开源软件在敏感领域的应用增加，隐私保护和数据安全成为重要的伦理考量。开源项目需要在代码开发和使用中严格遵守隐私和安全标准。这方面的案例，在本文并且提及，但也确实是非常重要的议题。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;地缘政治议题的冲击&lt;/strong&gt;：生来就是国际化的、全球协作的开源，遭遇了各种各样的地缘政治危机，敌对国家的开发者，能不能在一个开源社区里协作？一款开源软件，要不要声明支持一方而反对另一方？更有甚者，政治性的软件投毒也开始出现了！开源社区，是否能够坚守自己的伦理底线，明确有些事情绝不可为？&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;当开源不再是一小群黑客们自娱自乐的小园地，而是深刻的嵌入整个世界运行之中时，开源的伦理原则应该如何确定？这是一个越来越难以回答的问题了！&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;开源伦理在中国&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在开源进入中国之后，开源伦理在中国的情况，也有一些值得分析的地方。有继承的部分，也有变化的部分。首先是继承的部分，比如&lt;strong&gt;礼物文化&lt;/strong&gt;，开源社区中的“礼物文化”强调贡献代码和分享知识的会获得较高的社区地位，这与中国传统文化中的“礼尚往来”理念有相似之处，但是更加接近的是中国“尊师重道”的传统，开源社区里的“大牛”常常会被尊称为老师，初学者会向他们请教各种问题，并期待获得指导。&lt;/p&gt;

&lt;p&gt;相较于西方世界，中国的开发者更加强调实用主义，对于“自由软件”与“开源软件”的争论，既不能理解，也不感兴趣。另外，“（中国的）开源文化中很多用户将开源软件开发者视为“&lt;strong&gt;道德楷模&lt;/strong&gt;”，认为他们是在做公益。而这并不是开源软件开发者自己的初衷，他们常常会感觉到负累和麻烦。”&lt;sup id=&quot;fnref:43&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:43&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;43&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;随着近年来中美对抗的愈演愈烈，对抗性的话语也开始不断的进入开源伦理评价的日常中。例如：国产、自主、可控，防止被美国人卡脖子等等。相应的，那些强调自己在做“根技术”的社区，突出自己的自主研发的项目，在某一领域战胜了外国同类型开源项目的技术，往往也会获得更多的赞扬（如果被拆穿，也会被更加严重的批评）。&lt;/p&gt;

&lt;h3 id=&quot;32-开源伦理的基本原则&quot;&gt;3.2. 开源伦理的基本原则&lt;/h3&gt;

&lt;p&gt;终于来到这篇论文最难写的一部分了，我们想要总结一下，开源伦理的基本原则，这些原则不仅为参与者提供行为规范，也为开源社区的发展提供了道德框架，也能为今后的开源伦理方面的争论，确立某种边界、某种基础。以下是几个值得探讨的重要原则：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;实用主义与功利主义&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;首先是实用主义与功利主义的结合，在开源社区中，贡献者和使用者通常以解决问题、实现目标为导向，追求实用的结果，“Talk is Cheap，Show me the Code”。在判断实用价值的过程中，我们认为以“是否增加整个开源知识公地的价值”，作为所有伦理评价的出发点，是一个根本性的原则。&lt;/p&gt;

&lt;p&gt;开源社区应该鼓励以实践为导向的贡献，并通过合作和共享来提升集体的技术能力和生产力，不断为“让世界变得更好”做出实际的贡献。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;开源伦理孤立主义&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;我们提倡在开源社区内保持独立的伦理体系。开源是开源人的开源，开源的善恶是非，只在开源社区内部讨论。这一原则的提出，是为了保护开源社区的核心价值观和行为规范，避免外部力量的过度干涉或扭曲。开源伦理孤立主义并不意味着拒绝与整个现实世界的伦理规范的互动或合作，而是强调开源伦理应独立于其他伦理体系，具有其独特性和自洽性，从而确保开源活动始终符合最大限度公益、利他的开源精神。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;以匿名的方式尊重开源贡献&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在开源社区中，匿名贡献是一种被广泛接受和尊重的行为方式。这也是从黑客伦理继承而来的最重要的原则，这个原则强调的是尊重贡献者的隐私和个人意愿，同时认可他们的技术贡献。匿名性为那些不愿公开身份或希望专注于技术本身的人提供了一个平等的参与机会。&lt;/p&gt;

&lt;p&gt;尊重匿名性，一方面可以避免因为一个人的性别、身份、地位、国籍、民族、种族等因素，而对TA做各种预设性的评价。另一方面，也可以避免一个人因为在其他领域的言行（身份），导致TA在开源社区的贡献被忽略，甚至被驱逐。&lt;/p&gt;

&lt;p&gt;这一原则有助于维护开源社区的开放性和包容性，让更多人能够在不受身份或背景限制的情况下参与其中，从而激发更广泛的创造力和创新。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;付出与收益对等&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在开源伦理中，付出与收益对等是一个核心原则。参与者在贡献代码、文档或其他资源的同时，也期望获得相应的回报。这种回报可以是技术上的成长、社区的认可，或者是项目的使用权等形式。企业在做出了向社区贡献开源项目、开源代码、提供资金赞助等行为时，也理应获得社区的普遍赞扬，获取合理的商业回报。&lt;/p&gt;

&lt;p&gt;但是，这一原则一直并未被很好的贯彻。或者说，一旦发现有人付出却不得回报，我们也仅仅是报之以同情和唏嘘。一旦发现有企业，回报大于实际的付出，虚假开源却暴得大名，我们也只能口诛笔伐，不能真的纠正什么。&lt;/p&gt;

&lt;p&gt;只能说，作为开源伦理的核心追求，这是很重要的。&lt;/p&gt;

&lt;h3 id=&quot;33-本项研究的不足之处&quot;&gt;3.3. 本项研究的不足之处&lt;/h3&gt;

&lt;p&gt;在对开源伦理进行深入研究的过程中，尽管我们取得了一些重要的成果，但也必须诚实地面对和承认研究中存在的不足之处。这些不足不仅反映了当前研究的局限性，也为未来的进一步探索提供了明确的方向。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;缺少音视频与图像类的资料&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;本次研究主要集中在文本资料的收集与分析上，对于音视频和图像类资料的涉及则相对匮乏。音视频与图像不仅是重要的研究材料，还是开源社区交流中的常见形式，尤其在开源项目的推广、教育和培训等领域更为常见。这一不足限制了研究的广度，也使得我们在讨论开源伦理时，未能全面考虑到非文本媒介对伦理实践的影响。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;缺少国别比较&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;开源伦理的研究在不同国家和文化背景下可能呈现出显著差异。然而，本次研究未能充分考虑国别之间的比较。案例研究的选择范围也主要局限在欧美（尤其是美国）地区。这种缺乏跨文化视角的局限性，可能导致研究结论在全球范围内的适用性受到限制，从而影响到开源伦理的普遍性探讨。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;缺少对于伦理观点背后的深入分析&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在探讨开源伦理的过程中，我们对某些伦理观点的形成背景和背后逻辑未能进行深入分析。开源伦理涉及复杂的价值观和利益权衡，背后可能涉及多种社会、经济和技术因素的交织影响。对于这些伦理观点为何形成、如何演变以及其内在逻辑的探讨尚显不足，导致研究在解释某些现象时，深度不足。这一不足可能会让研究成果显得表面化，缺乏说服力和理论深度。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;结语&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;本次开源伦理研究虽然在很多方面取得了有益的成果，但上述不足也显露出研究尚未覆盖的领域和未能深入的层面。未来的研究应着力补充音视频与图像资料的分析，增强国别比较的维度，并加深对伦理观点形成背景的探索。只有在这些方面取得进展，才能对开源伦理有更全面和深入的理解，为全球开源社区的发展提供更加坚实的理论支持。&lt;/p&gt;

&lt;hr /&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://opensource.org/osd &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://en.wikipedia.org/wiki/An_Open_Letter_to_Hobbyists &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://en.wikipedia.org/wiki/The_Internet%27s_Own_Boy &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://en.wikipedia.org/wiki/Revolution_OS &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://en.wikipedia.org/wiki/Golden_Rule &lt;a href=&quot;#fnref:5&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.gnu.org/philosophy/free-sw.html &lt;a href=&quot;#fnref:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:7&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.gnu.org/philosophy/free-software-for-freedom.html &lt;a href=&quot;#fnref:7&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:8&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.gnu.org/philosophy/open-source-misses-the-point.html &lt;a href=&quot;#fnref:8&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:9&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.gnu.org/distros/free-system-distribution-guidelines.html &lt;a href=&quot;#fnref:9&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:10&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://gnu.org/distros/free-distros.en.html &lt;a href=&quot;#fnref:10&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:11&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://linux.cn/article-14628-1.html &lt;a href=&quot;#fnref:11&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:12&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://opensource.org/blog/the-sspl-is-not-an-open-source-license &lt;a href=&quot;#fnref:12&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:13&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://mp.weixin.qq.com/s?__biz=MzAxMDc4NDc5OA%3D%3D&amp;amp;mid=2649435483&amp;amp;idx=1&amp;amp;sn=39c7ca4b299b4a2ef15c7b9df367a58f&amp;amp;scene=45 &lt;a href=&quot;#fnref:13&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:14&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://rms-open-letter.github.io/index.zh_CN &lt;a href=&quot;#fnref:14&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:15&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://opensource.org/OSI_Response &lt;a href=&quot;#fnref:15&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:16&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.redhat.com/en/blog/red-hat-statement-about-richard-stallmans-return-free-software-foundation-board &lt;a href=&quot;#fnref:16&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:17&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://rms-support-letter.github.io/index-zh-hans.html &lt;a href=&quot;#fnref:17&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:18&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.fsf.org/news/statement-of-fsf-board-on-election-of-richard-stallman &lt;a href=&quot;#fnref:18&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:19&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://dictionary.cambridge.org/us/dictionary/english/cancel-culture &lt;a href=&quot;#fnref:19&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:20&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.newyorker.com/science/elements/after-years-of-abusive-e-mails-the-creator-of-linux-steps-aside &lt;a href=&quot;#fnref:20&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:21&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8a104f8b5867c682d994ffa7a74093c54469c11f &lt;a href=&quot;#fnref:21&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:22&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://dev.to/degoodmanwilson/open-source-is-broken-g60 &lt;a href=&quot;#fnref:22&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:23&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://dev.to/degoodmanwilson/a-post-open-source-world-57gh &lt;a href=&quot;#fnref:23&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:24&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://opensource.org/faq &lt;a href=&quot;#fnref:24&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:25&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;table&gt;
        &lt;tbody&gt;
          &lt;tr&gt;
            &lt;td&gt;[Ethical Source&lt;/td&gt;
            &lt;td&gt;Frequently Asked Questions](https://ethicalsource.dev/faq/)&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
      &lt;p&gt;&lt;a href=&quot;#fnref:25&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:26&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://github.com/996icu/996.ICU &lt;a href=&quot;#fnref:26&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:27&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://github.com/996icu/996.ICU/blob/master/LICENSE_CN &lt;a href=&quot;#fnref:27&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:28&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://github.com/996icu/996.ICU/blob/master/awesomelist/README.md &lt;a href=&quot;#fnref:28&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:29&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;在 &lt;a href=&quot;https://firstdonoharm.dev/build/&quot;&gt;The Hippocratic License: Hippocratic License 3.0&lt;/a&gt; 就有一堆可定制的“模块”，其中包括：“Taliban module”、“Myanmar module”、“Xinjiang Uygur Autonomous Region module”等等 &lt;a href=&quot;#fnref:29&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:30&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://github.blog/news-insights/company-news/our-response-to-the-war-in-ukraine/ &lt;a href=&quot;#fnref:30&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:31&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://react.dev/ &lt;a href=&quot;#fnref:31&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:32&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://github.com/vuejs/vue/pull/12483 &lt;a href=&quot;#fnref:32&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:33&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://github.com/xianyi/OpenBLAS/issues/3551 &lt;a href=&quot;#fnref:33&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:34&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/191171 &lt;a href=&quot;#fnref:34&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:35&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://snyk.io/blog/peacenotwar-malicious-npm-node-ipc-package-vulnerability/ &lt;a href=&quot;#fnref:35&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:36&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://opensource.org/blog/open-source-protestware-harms-open-source &lt;a href=&quot;#fnref:36&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:37&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.vim.org/sponsor/ &lt;a href=&quot;#fnref:37&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:38&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.itpro.com/software/open-source/bruce-perens-open-source-licenses-arent-working-but-we-can-fix-them &lt;a href=&quot;#fnref:38&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:39&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://www.thestack.technology/open-source-pioneer-perens-says-time-for-post-open/ &lt;a href=&quot;#fnref:39&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:40&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://perens.com/2024/03/08/post-open-license-first-draft/ &lt;a href=&quot;#fnref:40&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:41&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://perens.com/static/DEVELOPMENT_LICENSE.txt?v=2024_05_24.1 &lt;a href=&quot;#fnref:41&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:42&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;https://postopen.org/ &lt;a href=&quot;#fnref:42&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:43&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;《&lt;a href=&quot;https://book.douban.com/subject/36022318/&quot;&gt;开源文化在中国&lt;/a&gt;》作者：范小青，第189页 &lt;a href=&quot;#fnref:43&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Fri, 16 Aug 2024 04:04:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2024/08/16/open-source-ethics-research.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2024/08/16/open-source-ethics-research.html</guid>
        
        <category>OpenSource</category>
        
        
      </item>
    
      <item>
        <title>开源本质论</title>
        <description>&lt;p&gt;开源的本质需要从两个层面来理解。首先是一个&lt;strong&gt;开源项目&lt;/strong&gt;、围绕这个开源项目形成的开源社区，以及在这个开源社区的努力下创造出来的开源产品。其次是无数开源项目，所组成的整个&lt;strong&gt;开源生态&lt;/strong&gt;，以及围绕开源生态的各种形形色色的利益主体所组成的开源世界。&lt;/p&gt;

&lt;h2 id=&quot;一开源项目的本质&quot;&gt;一、开源项目的本质&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;开源项目&lt;/strong&gt;的本质，就是一群人以&lt;strong&gt;开放式协作&lt;/strong&gt;的方式，组成一个开源社区，共同创造&lt;strong&gt;数字公共产品&lt;/strong&gt;。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;开放式协作&lt;/strong&gt;的本质是：基于规则的开放参与，且规则本身对与全体参与者来说，也是开放可修改的。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;数字公共产品&lt;/strong&gt;的本质是：以数字形式凝聚的人类知识，这些知识可以以多种方式，节约人类的时间。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;二开源生态的本质&quot;&gt;二、开源生态的本质&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;开源生态&lt;/strong&gt;的本质，就是由各种各样&lt;strong&gt;授权协议/规则&lt;/strong&gt;所界定的、由全部数字公共产品组成的数字知识公地。所有参与这个开源生态的主体，基于共同遵守的规则，形成了&lt;strong&gt;开放利益共同体&lt;/strong&gt;。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;数字知识公地&lt;/strong&gt;的本质：与&lt;strong&gt;公地悲剧&lt;/strong&gt;中所说的物理世界的公地不同，只要数字世界依然存在，只要复制成本始终接近于0，数字世界的公地就不会减少，只会越来越繁荣。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;开源世界的规则&lt;/strong&gt;的本质，就是约束力大小不等的各种共识，这些共识内容，共识者的数量，共识被执行的可能性，共同决定了这个数字知识公地的使用成本。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;开放利益共同体&lt;/strong&gt;的本质，就是各种主体基于各自不同的理由、价值判断，都认为向这个数字知识公地做出贡献，利大于弊。哪怕大家对于利弊的定义和理解，都完全不同。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三开源从何而来&quot;&gt;三、开源从何而来&lt;/h2&gt;

&lt;p&gt;开源之所以能够发生，是因为人类有助人为乐的本能。助人为乐，并不是有人（人人）以助人为乐事。而是任何人，在助人之后，都能够感受到快乐。这样的快乐，有三种来源：自我肯定（我做了正确的事情），受助者的感谢，他人的赞扬。&lt;/p&gt;

&lt;p&gt;一个人行善举的原因，在于助人的收获大于付出，这其中的收获，就包括感受到的各种（当下的、长期的）快乐。至于付出，就包括当下的付出，与（长期的、潜在的）损失。&lt;/p&gt;

&lt;p&gt;在开源领域，因为数字产品的复制成本为接近于0，因此当下的付出几乎为0。因为互联网的传播效应，助人者收获的快乐也被放大了。因此，在自由/开源软件诞生的早期，有一技之长的开发者，会非常乐于分享自己的智力成果。&lt;/p&gt;

&lt;p&gt;至于开源为何从个人参与，进而引发企业参与？为何开源这一个人英雄主义的现象，进化为广泛存在的商业现象，则留待&lt;strong&gt;开源经济学&lt;/strong&gt;来解释。&lt;/p&gt;

&lt;h2 id=&quot;四开源的价值&quot;&gt;四、开源的价值&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;作为&lt;strong&gt;数字化知识&lt;/strong&gt;的价值：由于开源公开可获取的特征，能够为减少重复思考、重复劳动，从而为全人类节约大量的时间。&lt;/li&gt;
  &lt;li&gt;作为&lt;strong&gt;数字资产&lt;/strong&gt;的价值：代码作为数据、代码的提交过程作为数据、整个社区的生产协作过程作为数据，都具有“资产”性质，这些数字资产，有可能被以不同的方式“挖掘”，从而产生层出不穷的价值。&lt;/li&gt;
  &lt;li&gt;作为&lt;strong&gt;协作社区&lt;/strong&gt;的价值：人与人在社区中协作，知识在社区中传递，同时被沉淀下来。社区的价值就体现为&lt;strong&gt;教育&lt;/strong&gt;与&lt;strong&gt;转化&lt;/strong&gt;的作用。&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Fri, 16 Aug 2024 04:02:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2024/08/16/open-source-essentialism.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2024/08/16/open-source-essentialism.html</guid>
        
        <category>OpenSource</category>
        
        
      </item>
    
      <item>
        <title>与朋友的对话记录</title>
        <description>&lt;p&gt;&lt;strong&gt;这篇对话记录，主要是 Jarod 的思考，我只是与他有些讨论，然后他也建议我能够发布出来，供大家讨论。&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;一缘由&quot;&gt;一、缘由&lt;/h2&gt;

&lt;p&gt;自初遇人间词话已30年，境界一词萦绕不去；知其刻画人之精神世界本质、启迪进阶门径颇重要。然数年，偶有得，不算通透，辗转几30年。近读从王国维，上溯叔本华及至康德，横贯参佛，及检索历史提及境界处，捡远近专论书本，一一读透。主办姻缘，汇通一处，若有所得；又间与庄表伟兄多讨论，互相激荡，成此文字。曰：不意绝地天通，扫绝后学，愿做红尘春药，开启风气，是为记。&lt;/p&gt;

&lt;h2 id=&quot;二三个境界&quot;&gt;二、三个境界&lt;/h2&gt;

&lt;p&gt;无论为何事，人皆处于3个境界之一。境界由低到高，如下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;小我&lt;/strong&gt; —— 以“我”而为
    &lt;ol&gt;
      &lt;li&gt;&lt;strong&gt;混沌&lt;/strong&gt; —— 没有目标、任意而为&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;固我&lt;/strong&gt; —— 从自己出发、以自己为准绳和目的&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;常规&lt;/strong&gt; —— &lt;strong&gt;循规&lt;/strong&gt;而为
    &lt;ol&gt;
      &lt;li&gt;&lt;strong&gt;守成&lt;/strong&gt; —— 未明事理，亦步亦趋、步步惊心&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;通幽&lt;/strong&gt; —— 析事明理，能随心所欲而不逾矩&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;本来&lt;/strong&gt; —— &lt;strong&gt;赏析&lt;/strong&gt;而为（实事求是、如是观等）
    &lt;ol&gt;
      &lt;li&gt;&lt;strong&gt;具体&lt;/strong&gt; —— 以赏其美、析其理、用其妙的心态为一事&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;逍遥&lt;/strong&gt; —— 以赞天地之美、赏万物之理、用一物之妙的心为一切&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;三作为分析工具&quot;&gt;三、作为分析工具&lt;/h2&gt;

&lt;p&gt;这个分析框架是启发一种观察分析视角。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;比如，我们可以说 Cook比 Steve Jobs的境界就低了些；一个群体会因为一个领导者境界突破而整体跃迁；反之亦然；&lt;/li&gt;
  &lt;li&gt;一个人可以对照境界及案例，分析、并寻找突破的方向和路径&lt;/li&gt;
  &lt;li&gt;什么书值，什么人值得分析消防，都可以参照境界分析&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;四识人&quot;&gt;四、识人&lt;/h2&gt;

&lt;p&gt;历史人物，按上述境界可如下分&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;周公5+&lt;/li&gt;
  &lt;li&gt;孔子3+&lt;/li&gt;
  &lt;li&gt;老子也许5+&lt;/li&gt;
  &lt;li&gt;Steve Jobs 5+&lt;/li&gt;
  &lt;li&gt;Elon Musk 5+&lt;/li&gt;
  &lt;li&gt;邓小平5+&lt;/li&gt;
  &lt;li&gt;川普也许2+&lt;/li&gt;
  &lt;li&gt;Joe Bidden3~4&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;讨论&quot;&gt;讨论：&lt;/h3&gt;

&lt;p&gt;Jarod：上述，我尝试跑的 case，来检验这个框架&lt;/p&gt;

&lt;p&gt;庄：这是你的个人好恶；我对马斯克的评价，怎么也不会那么高&lt;/p&gt;

&lt;p&gt;Jarod：作为一个讨论，讨论本身才是价值，结论并不那么重要(在于启发分析讨论，而非定性)&lt;/p&gt;

&lt;p&gt;庄：所以我说“要区分自我评价与外部评价。自我评价，觉得自己有提升，这个应该是真实的。但是：外部评价，如何避免自己的偏见，这个不容易。&lt;/p&gt;

&lt;p&gt;Jarod：Elon musk 不算一个道德完人，但对事情理解境界是非常深入的；特蕾莎修女可能道德高尚，就认知境界而言，可能就是3~4；孔子和老子，在于遵循和赏析、妙用事情本身的区别，孔子是遵循，老子是赏析、妙用而有所成&lt;/p&gt;

&lt;p&gt;庄：我不是在说马斯克的道德高低；我是认为，他是被包装出来的商业偶像；而商业偶像这种事情我最早崇拜过比尔盖茨，后来就免疫了；还有张小龙，我也是免疫的&lt;/p&gt;

&lt;p&gt;Jarod：不排除，但没必要因此得到反向结论；其实很多人还是要看他到底做了什么。孔子何尝不是过度包装的产物?&lt;/p&gt;

&lt;p&gt;庄：哈哈，也是。&lt;/p&gt;

&lt;p&gt;Jarod：对比孔子和周公，我们会明确识别他们在不同境界。&lt;/p&gt;

&lt;p&gt;Jarod：这个分析框架不在给人定性，而是让我们多一个分析学习的工具(通过这个分析框架，把原来模糊糊不能识别的人的差别，变得可以讨论、发现区别、分析原因、得到真正的启发)。&lt;/p&gt;

&lt;h2 id=&quot;五辨物&quot;&gt;五、辨物&lt;/h2&gt;

&lt;p&gt;Jarod：所有人类创造的作品都是某种境界的人的创造。iPhone可能代表5+;淘宝3-4;拼多多可能是4+。[是这样境界的人创造了这样的东西，这样的东西反映出了这样人的境界]&lt;/p&gt;

&lt;p&gt;庄：我还是只能接受人类自评，对于评价他人，已经有所保留，对于评价某种人造物，更加保留&lt;/p&gt;

&lt;p&gt;Jarod：不求绝对，作为观察分析工具用，我们所求的启发新的分析视角、知道从哪里看、如何观察、如何辨析、得到什么样的有效启发就行(作为分析效率工具，我们要关注这个分析工具本身的合理性和可操作性)&lt;/p&gt;
</description>
        <pubDate>Thu, 11 Jul 2024 12:55:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2024/07/11/conversations-with-friends.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2024/07/11/conversations-with-friends.html</guid>
        
        
      </item>
    
      <item>
        <title>2050之道</title>
        <description>&lt;p&gt;每年参加完2050大会，我总是要写一篇文章的。写文章、记录感想、随手记，其实不难。真正困难的是为这篇文章起一个合适的标题。我的前两篇，是统一的《作为XX的2050》，本来这次也想套用，结果发现套不上。结果思前想后，只能选择现在的这个标题。列为看官，请先往下读吧。&lt;/p&gt;

&lt;h2 id=&quot;2050会场的道路&quot;&gt;2050会场的道路&lt;/h2&gt;

&lt;p&gt;今年在2050，我听了大量的新生论坛，其中的很多场演讲和演讲人，都给我留下了深刻的印象。但是，最特别的，还是詹娜老师。她是坐在轮椅上，被人抬上演讲台的。但是讲着讲着，她从轮椅上站起来了。然后又戴上了一个眼罩，首次以盲人的状态，完成了剩下的演讲。&lt;/p&gt;

&lt;p&gt;她的演讲主题是：《为更包容有爱的2050而设计》。但是，她生动的演示了，一个残障人士如果真的来到2050参加活动，将会感受到多少的困难？当一个人坐在轮椅上，有多少地方她是去不了的？当一个人只有手里的导盲杖，她又会发现多少不能去的地方？如果一个人听不见，现场的演讲只有翻译之后的语言字幕，却没有手语翻译。&lt;/p&gt;

&lt;p&gt;所以，詹娜老师说：本来他们是让我邀请一些残障的朋友过来参加2050，但是我想还是我自己先来体验一下吧。&lt;/p&gt;

&lt;p&gt;描写这场演讲，并不是想批评2050大会、或者云栖小镇。事实上，我们绝大多数的活动场馆，我们的大会组织者，都很少会考虑“无障碍与包容性设计”的问题。希望明年的2050大会，能够在这方面有更多的改进。&lt;/p&gt;

&lt;h2 id=&quot;2050大会之道&quot;&gt;2050大会之道&lt;/h2&gt;

&lt;p&gt;作为2050的常客，我们这些“老人”已经都很熟练了。先把心理预期设置为0，然后遇到的一切都是惊喜。之前的两篇文章，我也分析过一些现象。这篇文章里，我也再讲一些感受吧。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;混乱是故意的&lt;/strong&gt;，这是我听到的某一个朋友的评论：“XXX这些bug，他们就是故意这么干的”。其实，我觉得还好，2050的组织者就那几个人。他们并不是故意要制造混乱，仅仅是“在时间、精力都不足的情况，优先考虑XXXX那些方面了。”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;一俊遮百丑&lt;/strong&gt;，反正事情充满变化，一切都不可预料。没有人能够面面俱到的考虑一个大会的方方面面。所以策略就很简单：尽可能制造一些令人难忘的亮点。让人在离开2050的时候，念念不忘，甚至主动传播。另一方面，就是通过群内的传播，将在各个角落里产生的亮点及时传播出来，让大家产生一种分身乏术的遗憾之感。让人产生一种，我下次还得再来的决心。ps. 因为听一个朋友的介绍，我明年确实想试试露营。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;青年总是会带来惊喜&lt;/strong&gt;，这次在2050，我遇到了好多令人惊叹的高中生和大学生。比如在辩论场上侃侃而谈的高中生，尝试为盲人做无障碍设计的高中生，还有颇具传销首领气质的大学生社团负责人（他一定要把更多的学弟学妹从学校里带出来）。还有一个我自己的亲身经历，两个高一的小朋友，因为听说我是产品经理，就跑来问我一些今后的职业生涯规划的问题。无论是思考的深度，还是眼界的广度，无论是自身观点的流畅表达，还是在与人交流时的落落大方，都非常的了不起！&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E人天堂、I人地狱&lt;/strong&gt;，这也是某一位朋友的评论。说实话，我也深有同感。如果你足够E，你可以在2050找到太多的大牛、老师、甚至以前只能仰望的偶像，直接冲过去，拉他拍照，找他聊天，介绍自己，提出疑问。那天我混入了一个浙大人的团聚，就听到了一个神奇的故事：上一次的2050大会，她不但找到了自己的合作伙伴，还找到了现在的老公。总之，你得更E一点，奇遇就会发生。&lt;/p&gt;

&lt;h2 id=&quot;你也想在2050布道&quot;&gt;你也想在2050布道？&lt;/h2&gt;

&lt;p&gt;2050有一个重要的口号：把你的热爱，带到2050来！带来干嘛呢？当然是分享给更多的人。不仅仅是与同好一起分享，更重要的是尝试招揽更多新的同好。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;为什么要登山？因为山就在那里。&lt;/strong&gt;韩子君给大家带来了坎道尔山地电影节的两部纪录片，一部是记述一群在高山之巅走“扁带”的冒险家，他们来到了挪威，想要一边走在扁带上，一边试图碰到正巧出现的极光。经历了千难万险，当暴风骤雪突然停止，天地都安静下来，绚烂的极光在天空中流动时，人站在万丈高空的扁带之上，一切都仿佛是值得的。&lt;/p&gt;

&lt;p&gt;另一部纪录片，其实更加感人。一位早已功成名就的攀岩世界冠军，却因为意外摔伤脊椎，在休息了几年之后，虽然无法再去攀岩，却发下宏愿，要在一年之内攀登阿尔卑斯山区一共82座海拔4000米以上的山峰。依然是艰险，依然是各种困苦，但是她的自述却很简单：我喜欢待在山里的感觉。&lt;/p&gt;

&lt;p&gt;总的来说，登山、探险的纪录片，其中的主人公往往都不会直接说：“为什么我要去登山”，或者“我就是喜欢登山”。而是会说：“这是一种全然不同的人生体验”，“如果没有处在危险之中，我会觉得自己好像没有活着”。总之，他会促使人去思考：什么才是不顾一切的热爱？&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;超级工程，为何是国运的体现？&lt;/strong&gt;中国工程院的胡文瑞院士，在2050学习节的开场演讲，就给大家介绍了他们超级工程课题组的研究成果。在这个“相当枯燥”的演讲中，有一句话特别打动我：“&lt;strong&gt;超级工程数量与文明程度成正比关系，反之亦然&lt;/strong&gt;”。另外一个结论是关于近代超级工程的：“&lt;strong&gt;超级工程数量与工业化规模和程度成正比关系&lt;/strong&gt;”。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/SE.jpg&quot; alt=&quot;SE&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在演讲现场，胡院士展示了一张图表：1400年来中华民族国运图或权利、财富图。在盛世王朝，超级工程数量较多，例如唐朝有12个，北宋+南宋有12个。近代（1840年）以来，清朝22个，民国20个。但是1949年之后，至2020年为止，新中国共有257个超级工程！所谓中华民族的伟大复兴，不是喊出来的，而是干出来的！&lt;/p&gt;

&lt;p&gt;我想，在现场听到这场演讲的朋友，应该会深受感动吧！&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;社会企业为啥难，因为他们既要又要还要。&lt;/strong&gt;我还去听了好几场社会企业的创办者与支持者的演讲，不过《50%以上的青年创业者会选择“社会创业”，为什么？》这样的布道，就会让人觉得情绪过于饱满——“这个坑我不能跳”。而希瑞的演讲《来聊聊社企创业为啥这么难？这么难，你还愿来挑战吗？》，却让我理解了这些社会企业的创业者，会处在一个“既要又要还要”的艰难境况之下。那都是一些非常了不起的追求，也是令人钦佩的坚持。所以我越发认为：不会有50%以上的青年，选择“社会创业”，能够有1%的人去做这样的事情，就已经非常难得了。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;学中医的人，他们的心路历程是怎么样的？&lt;/strong&gt;杨赛和一燕之前就办了一个“所言吉事”的播客电台，这次在2050，她们发起了一个“所言吉事团聚”，结果一堆人躺着就把天聊了（很遗憾，我在参加开源人团聚）。在后面的新生论坛，我也听了一燕的演讲《机器都这么智能了，为什么我还在学习？》，其实还是在说她们学习中医的心路历程。给我留下深刻印象的是：一燕如何学会了放松，学会了玩，学会不要制定并执行严格的计划。正如杨赛的新歌《真实少年与觉知少年的生命力》里唱的那样：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;如果你有干劲儿就去干吧去干吧，干它个认认真真明明白白啦
如果你没干劲儿就歇歇吧歇歇吧，理直气壮躺平摸鱼无所事事啦
要我说这没关系没关系呀没关系，因为这就是就是你真实的你呀
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;面对科技、城市与各行各业的专家，人类学家在想什么？&lt;/strong&gt;还有一场名为《科技·城市·我》的新生论坛，后面圆桌讨论的部分非常有意思，梦溪论坛的设计师：一位无可救药的乐观主义者——刘广荣，被两位人类学家：陈茁和菲利浦，问得都有点郁闷了。以我对于人类学的一点浅薄的了解，这是一门非常注重站在人的立场出发，进行反思的学科。经常能够发现一些从特定专业（建筑设计师、产品经理之类）的角度，无法理解或难以预料到的问题。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2024%2F0429%2F1776b21bj00scpc4l002ud200u000jzg00it00ci.jpg&amp;amp;thumbnail=660x2147483647&amp;amp;quality=80&amp;amp;type=jpg&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;不过，在现场的时候，我却站在一名产品经理的立场，为设计师做了一段辩护。所谓：一时怼人一时爽，一直怼人就不太好了 :p&lt;/p&gt;

&lt;p&gt;心平气和的表达的话，我想传递的思考是：各行各业的专业人士，一方面在不断进步，一方面也有高下之分。人类学提供的反思素材固然很好，但是专业水准的体现就在于，是否能够避免犯下太多的，一厢情愿的错误。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;当我想招揽更多的开源人时，我是怎么做的？&lt;/strong&gt;在2050有一个我发起的开源人团聚，其实那才是我的“主战场”。虽然与其他朋友交流他们的“道”会给我很多启发。其实，我也是想去传自己的“道”的。在2楼的五云厅，我们在一个大厅里有好几百人，有参加学习节的，有参加Datawhale团聚的，有参加集智俱乐部团聚的，当然还有开源人的团聚。随着我们热火朝天的交流不断进行，我们惊喜发现，开源人团聚的这个角落里，人越聚越多了。其中杭州电子科大的“传销头目”，也是Datawhale成员的张哲铭，就提到了他为啥要把自己的这么多学弟、学妹们带出来“见世面”？因为，“在学校里，视野受限”。其实，我倒是觉得：对于在校的大学生而言，方方面面提供的选择、甚至做好的攻略，都已经太多了。各方都在努力的吸引大学生的注意力，牵扯他们的精力，诱使他们成为“我们这边的人”。&lt;/p&gt;

&lt;p&gt;当然，其实我也在这么干。“诱使更多的大学生，能够成为开源人”。要做到这一点：一方面各凭本事，看各家的手段高低。另一方面，也希望自己推荐的这条道路，真的能够为大学生带来实实在在的收益（总不能纯忽悠吧）。&lt;/p&gt;

&lt;h2 id=&quot;青年在2050如何寻道&quot;&gt;青年在2050如何寻道？&lt;/h2&gt;

&lt;p&gt;这次在2050，其实我遇到了非常多、非常厉害的青年，甚至有两个高一的小妹妹，跑过来问我：“请问产品经理与职业经理人，有什么区别？”、“职业经理人与创业者哪个方向更好？”、“我发现似乎社会上对于创业者，相对于职业经理人，会有更高的评价？”&lt;/p&gt;

&lt;p&gt;我都惊呆了，这是才上高一的孩子吗？于是她说：“我在考虑，大学是不是要去读一个商学院，还是别的什么专业。”——真的很佩服。&lt;/p&gt;

&lt;p&gt;在介绍了不少关于“产品经理是做什么的”之后，其中一个小妹妹突然问了我一个问题：“你觉得你的职业生涯，成功吗？”&lt;/p&gt;

&lt;p&gt;在沉默（斟酌）了挺长一段时间后，我回答到：“应该不能用成功来描述，怎么也算不上（成功）。或者说，以是否成功来衡量职业生涯，也是一个非常困难的问题。我的自我评价是：我一直在做自己喜欢的事情，这个比较重要。”&lt;/p&gt;

&lt;p&gt;正如在上文描述的，大家都想在2050布道，想传递自己的热爱，也想招揽更多的（未来）同道。但是，从受众，也就是我们想要影响的这些青年的角度来说，他们可能远比我们想象的，要更加见多识广，也更加思虑周详。如果将我代入他们的角色，来到2050的感受可能会是：“这个很好玩，那个也很有意思，这个人讲的比较有趣，那个人的介绍比较无趣”，真要做什么重大的人生决定，应该还不用太急。&lt;/p&gt;

&lt;p&gt;从寻道的角度来说：我想那些平时就有很多深入思考的青年，再E一些，积极找人交流的话，应该会有更多的收获吧。&lt;/p&gt;
</description>
        <pubDate>Sat, 11 May 2024 02:54:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2024/05/11/2050-s-way.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2024/05/11/2050-s-way.html</guid>
        
        
      </item>
    
      <item>
        <title>翻译与评述《后开放零成本许可证》</title>
        <description>&lt;p&gt;&lt;strong&gt;特别感谢：赵云虎律师帮我审阅了翻译的初稿，并提出了很多专业的修改意见，详情请参见&lt;a href=&quot;https://github.com/zhuangbiaowei/zhuangbiaowei.github.io/commit/92fc102bc96e31774886f5e76943b2df5448ef4a&quot;&gt;commit diff&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;4 天前，著名的 &lt;a href=&quot;https://perens.com/about-bruce-perens/&quot;&gt;Bruce Perens&lt;/a&gt; 发表了一篇新的博客，标题是《&lt;a href=&quot;https://perens.com/2024/03/08/post-open-license-first-draft/&quot;&gt;Post-Open License: First Draft&lt;/a&gt;》。作为开源运动的创始人之一，开源定义（OSD）的撰写人，在今年 1 月的一篇专访《&lt;a href=&quot;https://linux.cn/article-16524-1.html&quot;&gt;专访开源先锋 Bruce Perens：后开源、许可证、AI&lt;/a&gt;》中，他就已经提到，自己正在开发一种新的许可证。Perens 提到，开源社区需要解决几个紧迫的问题。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;我们现在的许可证已无法满足需求&lt;/li&gt;
  &lt;li&gt;开源完全未能服务于普通人&lt;/li&gt;
  &lt;li&gt;他所描述的“后开源”，比开源稍微复杂一些。它将明确企业与开发者的关系，以确保企业为所获得的利益支付合理的费用。对于个人和非营利机构，仍可免费使用，而且只需一个许可证即可。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;现在，我们终于能够看到全文了。&lt;/p&gt;

&lt;p&gt;借助 ChatGPT 的帮助，我快速阅读了这个协议，并打算与一些朋友讨论，然后在翻译的基础上，略作评述，也希望与更多朋友，一起讨论。&lt;/p&gt;

&lt;p&gt;【Post-Open】，在 Linux.cn 的网站翻译中，称之为“后开源”，而我会称之为“后开放”，因为如果是后开源，应该是【Post-OpenSource】才对。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;【原文】POST OPEN ZERO-COST LICENSE 0.01, March 2024.&lt;/p&gt;

&lt;p&gt;【译文】后开放零成本许可证 0.01 版，2024 年 3 月。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. PRELUDE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.1 HOW TO USE THIS TEXT ON YOUR OWN WORK.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you wish to apply these terms to your own work, you must first enter into the POST-OPEN OPERATING AGREEMENT, which gives permission to use this copyrighted text.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. 前言&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.1 如何将本文应用于您自己的作品。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;如果您希望将这些条款应用于您自己的作品，您必须首先签订《&lt;strong&gt;后开放运营协议&lt;/strong&gt;》，该协议许可使用此受版权保护的文本。&lt;/p&gt;

&lt;p&gt;【译注】POST-OPEN OPERATING，是一个需要被定义的概念。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.2 COPYRIGHT OF THIS TEXT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Copyright (C) 2024 POST-OPEN ADMINISTRATION. All rights reserved. The section on ARBITRATION originates with the American Arbitration Association and we do not claim copyright upon it.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.2 本文的版权&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;版权所有 (C) 2024 &lt;strong&gt;后开放管理机构&lt;/strong&gt;。保留所有权利。关于&lt;strong&gt;仲裁&lt;/strong&gt;的部分起源于美国仲裁协会，我们对此不主张版权。&lt;/p&gt;

&lt;p&gt;【译注】POST-OPEN ADMINISTRATION，是一个需要被定义的概念。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.3 ADVISORY SECTIONS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Text contained within square brackets (“[” and “]”) is advisory in nature and not part of these terms. These terms shall not be invalidated or otherwise impaired if advisory sections are incorrect or become out-of-date. [This is an example of an advisory section.]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.3 建议章节&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;放在方括号（“[”和“]”）内的文本是建议性质的，并不构成这些条款的一部分。如果建议章节错误或过时，这些条款不应被视为无效或以其他方式受到损害。[这是一个建议章节的例子。]&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.4 THE CONTACT.txt FILE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The identity of the LICENSOR and the means of contacting them should appear in the file “CONTACT.txt” where the SOURCE CODE is stored. This file may also contain caveats regarding the work, declarations of PUBLIC INTERFACES, statements regarding the source and status of some portions of the work (for example, that the developer disclaims copyright to that portion), and other information that may effect your rights.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.4 CONTACT.txt 文件&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;许可方&lt;/strong&gt;的身份及其联系方式应当出现在存储&lt;strong&gt;源代码&lt;/strong&gt;的 “CONTACT.txt” 文件中。该文件还可以包含关于作品的警告、公共接口的声明、关于作品某些部分的来源和状态的声明（例如，开发者声明放弃该部分的版权），以及可能影响您权利的其他信息。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.5 DRAFT NATURE OF THIS DOCUMENT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a DRAFT version of the POST-OPEN ZERO-COST LICENSE 0.01 . [If you don’t like these terms, contact the LICENSOR for a different license.]&lt;/p&gt;

&lt;p&gt;WARNING: These terms are not the product of an attorney, and that’s a particularly bad practice - the way a judge would enforce (or decline to enforce) these terms is unpredictable, and they may let down the developer who attempts to enforce them in court. Apply these terms to your work at your own risk. [We intend to release a version that is the product of a competent attorney.]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.5 本文档的草案性质&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;这是&lt;strong&gt;后开放零成本许可证&lt;/strong&gt; 0.01 的&lt;strong&gt;草案&lt;/strong&gt;版本。[如果您不喜欢这些条款，请联系&lt;strong&gt;许可方&lt;/strong&gt;以获取不同的许可证。]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;警告&lt;/strong&gt;：这些条款不是由律师制定的，这是一个特别糟糕的做法——法官如何执行（或拒绝执行）这些条款是不可预测的，它们可能会让尝试在法庭上执行这些条款的开发者失望。将这些条款应用于您的作品需自担风险。[我们打算发布一个由合格律师制定的版本。]&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. DEFINITIONS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;References to defined terms are rendered in all-capital lettering, for example: “TERMINATION”. When a defined term appears in lower-case, it refers to the general usage of that word rather than the defined form, for example “WORK” refers specifically to the work placed under these terms by the LICENSOR, and a “work” may be the WORK or another one. Some words in these terms appear as all-capital simply as part of of common parlance, for example “A” and “HTTP”.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. 定义&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;对定义术语的引用以全部大写字母呈现，例如：“TERMINATION”（&lt;strong&gt;终止&lt;/strong&gt;）。当一个定义术语以小写出现时，它指的是该词的一般用途，而非定义形式，例如“WORK”（&lt;strong&gt;作品&lt;/strong&gt;）特指由&lt;strong&gt;许可方&lt;/strong&gt;根据这些条款发布的作品，而一个“work”可能是该作品或另一个作品。这些条款中的一些词语以全部大写形式出现，仅作为常用语的一部分，例如“A”和“HTTP”。&lt;/p&gt;

&lt;p&gt;【译注】在中文翻译中，术语会以加粗方式展现。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.1 The POST-OPEN ADMINISTRATION is the entity which, through the POST-OPEN OPERATING AGREEMENT with all of the LICENSORS of works in the POST-OPEN COLLECTION, may represent any of those LICENSORS in any controversy or claim arising out of or related to these terms and its other agreements and processes. The POST-OPEN ADMINISTRATION may bring suit or enforce other law on behalf of the LICENSOR.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.1 &lt;strong&gt;后开放管理机构&lt;/strong&gt;是一个实体，通过与所有&lt;strong&gt;后开放系列&lt;/strong&gt;中作品的&lt;strong&gt;许可方&lt;/strong&gt;签订的&lt;strong&gt;后开放运营协议&lt;/strong&gt;，可以代表任何这些&lt;strong&gt;许可方&lt;/strong&gt;在与这些条款及其其他协议和流程相关的任何争议或索赔中。&lt;strong&gt;后开放管理机构&lt;/strong&gt;可代表&lt;strong&gt;许可方&lt;/strong&gt;提起诉讼或执行其他法律。&lt;/p&gt;

&lt;p&gt;【译注】&lt;strong&gt;后开放管理机构&lt;/strong&gt;相当于是创设了一个站在所有（采纳了Post-Open License的）开源作者背后的支持方。但是，在这个文本里，并没有出现&lt;strong&gt;后开放运营协议&lt;/strong&gt;的具体内容或链接指向。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.2 The POST-OPEN ZERO-COST CONTRACT is these same terms, with the addition of clear and recorded consent by the licensee. [To enter into it, see https://postopen.org/zero-contract/ ]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.2 &lt;strong&gt;后开放零成本合同&lt;/strong&gt;是这些相同的条款，加上被许可人的明确和记录在案的同意。[请访问 &lt;a href=&quot;https://postopen.org/zero-contract/&quot;&gt;https://postopen.org/zero-contract/&lt;/a&gt; ]&lt;/p&gt;

&lt;p&gt;【译注】这个网站尚未开放，但是感觉一种不必要的“外部依赖性”&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.3 The POST-OPEN PAID CONTRACT is a separate agreement which grants additional rights not provided by these terms. [To enter into it, see https://postopen.org/paid-contract/ ]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.3 &lt;strong&gt;后开放付费合同&lt;/strong&gt;是一份单独的协议，它授予这些条款未提供的附加权利。[请访问 &lt;a href=&quot;https://postopen.org/paid-contract/&quot;&gt;https://postopen.org/paid-contract/&lt;/a&gt; ]&lt;/p&gt;

&lt;p&gt;【译注】同上&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.4 The POST-OPEN INFRINGEMENT PROCESS is the process by which an infringing entity cures an infringement and comes back into compliance without litigation.  Uncooperative infringers are, of course, subject to litigation, blocking of imports, simple and punitive damages, and other prosecution. [To participate in the POST-OPEN INFRINGEMENT PROCESS, see https::/postopen.org/infringement/ ]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.4 &lt;strong&gt;后开放侵权处理流程&lt;/strong&gt;是一个过程，通过该过程，侵权实体治愈侵权并在不进行诉讼的情况下恢复合规。当然，不合作的侵权者将面临诉讼、进口阻止、简单和惩罚性赔偿以及其他起诉。[要参与&lt;strong&gt;后开放侵权处理流程&lt;/strong&gt;，请访问 &lt;a href=&quot;https://postopen.org/infringement/&quot;&gt;https://postopen.org/infringement/&lt;/a&gt; ]&lt;/p&gt;

&lt;p&gt;【译注】同上&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.5 YOU are the legal entity exercising RESTRICTED RIGHTS under these terms and any other legal entities that YOU have more than 5% ownership of or equivalent control without ownership. YOUR is the possessive or adjective form of YOU.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.5 &lt;strong&gt;您&lt;/strong&gt;是在这些条款下行使&lt;strong&gt;受限权利&lt;/strong&gt;的法律实体，以及&lt;strong&gt;您&lt;/strong&gt;拥有超过5%所有权或相当的非所有权控制权的其他法律实体。“&lt;strong&gt;您的&lt;/strong&gt;”是“&lt;strong&gt;您&lt;/strong&gt;”的所有格或形容词形式。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.6 A MACHINE LEARNING MODEL is a computational program or device that makes use of data to inflence its future logical operations, with or without inclusion of that data textually or in any recognizable form. Other names for MACHINE LEARNING MODEL are artificial intelligence (abbreviated AI), and large language model.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.6 &lt;strong&gt;机器学习模型&lt;/strong&gt;是一种计算程序或设备，它使用数据影响其未来的逻辑操作，无论是否包含该数据的文本或任何可识别形式。&lt;strong&gt;机器学习模型&lt;/strong&gt;的其他名称包括人工智能（简称 AI）和大型语言模型。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.7 To TRAIN is to input data to a MACHINE LEARNING MODEL or for the purpose of producing or improving a MACHINE LEARNING MODEL. TRAINED is the past tense of TRAIN.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.7 &lt;strong&gt;训练&lt;/strong&gt;是向&lt;strong&gt;机器学习模型&lt;/strong&gt;输入数据，或为了产生或改进一个&lt;strong&gt;机器学习模型&lt;/strong&gt;的目的。&lt;strong&gt;训练过&lt;/strong&gt;的是&lt;strong&gt;训练&lt;/strong&gt;的过去时。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.8 AGGREGATION is the storage of multiple works on a storage medium for the purpose of permitting access to the indivual works for the purpose of transferring them to another medium, for example computer memory or another storage medium; or the provision of those works via a method of access, for example a web site, for the purpose of transferring the indivdual works to another medium.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.8 &lt;strong&gt;聚合&lt;/strong&gt;是将多个作品存储在一个存储介质上，以便允许访问个别作品以将它们转移到另一个介质，例如计算机内存或另一个存储介质；或通过一种访问方法提供这些作品，例如一个网站提供这些作品，从而将这些单独的作品转移到另一个介质上。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.9 The WORK is the computer program, data, or other information to which these terms are applied by the LICENSOR, any derivative of the WORK under copyright or moral rights law, any transformation of the WORK (for example, compilation, text processing, non-literal copying), and any work combining or incorporating the WORK other than AGGREGTION, whether or not such combining or incorporation is considered derivative under copyright law or moral rights law. For example: a compiled program; a modified program; a program, system or device containing the WORK; a program produced by connecting another program and the WORK together except through a PUBLIC INTERFACE; a program that executes the WORK as a separate program to do some of its processing; a version of the WORK translated to a different computer language; a version of the texts of the WORK translated to another human language; or a MACHINE LEARNING MODEL TRAINED with the SOURCE CODE or any transformation of the WORK are all considered to be the WORK.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.9 &lt;strong&gt;作品&lt;/strong&gt;是指&lt;strong&gt;许可方&lt;/strong&gt;适用这些条款的计算机程序、数据或其他信息，任何根据版权或精神权利法的&lt;strong&gt;作品&lt;/strong&gt;的衍生品，&lt;strong&gt;作品&lt;/strong&gt;的任何转换（例如，编译、文本处理、非字面复制），以及除了&lt;strong&gt;聚合&lt;/strong&gt;以外合并或纳入&lt;strong&gt;作品&lt;/strong&gt;的任何作品，无论此类合并或纳入是否在版权法或精神权利法下被视为衍生作品。例如：编译后的程序；修改后的程序；包含&lt;strong&gt;作品&lt;/strong&gt;的程序、系统或设备；除通过&lt;strong&gt;公共接口&lt;/strong&gt;外，将另一个程序和&lt;strong&gt;作品&lt;/strong&gt;连接在一起产生的程序；将&lt;strong&gt;作品&lt;/strong&gt;作为单独程序进行部分处理的方式予以执行的程序；将&lt;strong&gt;作品&lt;/strong&gt;翻译成不同计算机语言的版本；将&lt;strong&gt;作品&lt;/strong&gt;的文本翻译成另一种人类语言的版本；或用&lt;strong&gt;源代码&lt;/strong&gt;或作品的任何转换训练的&lt;strong&gt;机器学习模型&lt;/strong&gt;，都被视为&lt;strong&gt;作品&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.10 COMPILATION is the creation of an executable form of the WORK from SOURCE CODE. COMPILATION generally involves multiple tools, for example a compiler, an assembler, and a linker. COMPILATON may include the use of conditional compilation facilities provided by the developers of the WORK, and configuration of the options of the aforementioned tools.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.10 &lt;strong&gt;编译&lt;/strong&gt;是从&lt;strong&gt;源代码&lt;/strong&gt;创建&lt;strong&gt;作品&lt;/strong&gt;的可执行形式的过程。&lt;strong&gt;编译&lt;/strong&gt;通常涉及多个工具，例如编译器、汇编器和链接器。&lt;strong&gt;编译&lt;/strong&gt;可能包括使用&lt;strong&gt;作品&lt;/strong&gt;开发者提供的条件编译设施，以及配置上述工具的选项。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.11 A PUBLIC INTERFACE is an interface that is part of a fundamental purpose of the work to provide services to other works without those works becoming MODIFICATIONS, or causing the combination of works. For example, the HTTP interface of a web browser, or the system call interface of an operating system kernel. The fundamental nature of the interface within the work is important, a developer may not unilaterally add a PUBLIC INTERFACE to an existing program or remove such an interface without the agreement of the other LICENSORS. The simple existence of an API does not automatically make that API a PUBLIC INTERFACE. PUBLIC INTERFACES means one or  more of a PUBLIC INTERFACE. [Where it could be unclear, the declaration of a public interface, or that a particular interface is not a public interface, may be stated in the CONTACT.txt file.]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.11 &lt;strong&gt;公共接口&lt;/strong&gt;是作品的一部分，其基本目的是向其他作品提供服务，而不使这些作品被&lt;strong&gt;修改&lt;/strong&gt;，或导致作品的组合。例如，网络浏览器的HTTP接口，或操作系统内核的系统调用接口。接口在作品中的基本性质很重要，开发者不能单方面向现有程序添加&lt;strong&gt;公共接口&lt;/strong&gt;或在没有其他&lt;strong&gt;许可方&lt;/strong&gt;同意的情况下移除此类接口。一个API的简单存在并不自动使该API成为&lt;strong&gt;公共接口&lt;/strong&gt;。&lt;strong&gt;公共接口(复数)&lt;/strong&gt;指的是一个或多个&lt;strong&gt;公共接口&lt;/strong&gt;。[在可能不清楚的情况下，公共接口的声明，或特定接口不是公共接口的声明，可以在CONTACT.txt文件中说明。]&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.12 MODIFICATION is:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a) Any alteration or transformation of the WORK other than COMPILATION.&lt;/li&gt;
  &lt;li&gt;b) The combination or inclusion of the WORK or any portion of it with another work other than through a PUBLIC INTERFACE or AGGREGATION, such that the two works are combined into a single program or application, regardless of the means of such combination or inclusion or or not such combination or inclusion is considered the creation of a derivative work under copyright and moral rights law. For example, dynamic linking, or the provision of a program through any interface that is integrated into a second program, such that the functionality of the first program is added to the combination of both programs. AGGREGATION is not MODIFCATION.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.12 &lt;strong&gt;修改&lt;/strong&gt;是：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a) 除&lt;strong&gt;编译&lt;/strong&gt;外，对&lt;strong&gt;作品&lt;/strong&gt;的任何改变或转换。&lt;/li&gt;
  &lt;li&gt;b) 将&lt;strong&gt;作品&lt;/strong&gt;或其任何部分与另一作品结合或包含在一起，除非通过&lt;strong&gt;公共接口&lt;/strong&gt;或&lt;strong&gt;聚合&lt;/strong&gt;，使得两个作品合并成一个单一程序或应用，无论此种结合或包含的手段如何，或者此种结合或包含是否在版权和精神权利法下被认为形成衍生作品。例如，动态链接，或通过任何集成到第二个程序中的接口提供程序，使得第一个程序的功能被添加到两个程序的组合中。&lt;strong&gt;聚合&lt;/strong&gt;不是&lt;strong&gt;修改&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.13 RESTRICTED RIGHTS are the exercise of any rights regarding the WORK that are protected by copyright, patent, or moral rights law, and additionally any acts which are specifically restricted by these terms. RESTRICTED RIGHTS include (but are not limited to) ephemeral or other copying, reading or examining the WORK other than to read these terms and the CONTACT.txt file, use, redistribution, modification, performance of the WORK, TRAINING of a MACHINE LEARNING MODEL with SOURCE CODE or any transformation of the WORK, and exercise of any of the aforestated rights or acts upon a MACHINE LEARNING MODEL TRAINED thusly.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.13 &lt;strong&gt;受限权利&lt;/strong&gt;是对受版权、专利或精神权利法保护的&lt;strong&gt;作品&lt;/strong&gt;行使的任何权利，以及这些条款明确限制的任何行为。&lt;strong&gt;受限权利&lt;/strong&gt;包括（但不限于）临时或其他复制，阅读或检查作品（除了阅读这些条款和CONTACT.txt文件之外），使用、再分发、修改、执行作品、用&lt;strong&gt;源代码&lt;/strong&gt;或作品的任何转换形式&lt;strong&gt;训练&lt;/strong&gt;&lt;strong&gt;机器学习模型&lt;/strong&gt;，以及对于以这种方式&lt;strong&gt;训练&lt;/strong&gt;的&lt;strong&gt;机器学习模型&lt;/strong&gt;行使上述任何权利或行为。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.14 PROTECTING JURISDICTIONS are those that provide legal protection of RESTRICTED RIGHTS regarding the work, except that they are not required to protect patents. Along with all of the usual copyright and/or moral rights protections, they must protect the copyright or moral rights of works used to used to TRAIN a MACHINE LEARNING MODEL. At this writing, (March, 2024) the POST-OPEN ADMINISTRATION asserts that the nation of Japan is not a PROTECTING JURISDICTION due to the lack of protection of works used to TRAIN a MACHINE LEARNING MODEL.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.14 &lt;strong&gt;司法保护辖区&lt;/strong&gt;是对作品的有关&lt;strong&gt;受限权利&lt;/strong&gt;提供法律保护的地区，但它们不需要保护专利。除了所有通常的版权和/或道德权利保护之外，它们还必须保护用于&lt;strong&gt;训练&lt;/strong&gt;&lt;strong&gt;机器学习模型&lt;/strong&gt;的作品的版权或道德权利。截至本文撰写时（2024年3月），&lt;strong&gt;后开放管理机构&lt;/strong&gt;声称，由于缺乏保护用于&lt;strong&gt;训练&lt;/strong&gt;&lt;strong&gt;机器学习模型&lt;/strong&gt;的作品，日本国不是一个&lt;strong&gt;司法保护辖区&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.15 The LICENSOR is the legal entity which owns the WORK, and which applies these terms to it. LICENSORS means one or more LICENSOR. Most works in the POST-OPEN COLLECTION will be the product of many real persons, and businesses, and organizations, who may license it directly or through another legal entity.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.15 &lt;strong&gt;许可方&lt;/strong&gt;是拥有&lt;strong&gt;作品&lt;/strong&gt;并将这些条款应用于它的法律实体。&lt;strong&gt;许可方(复数)&lt;/strong&gt;意味着一个或多个&lt;strong&gt;许可方&lt;/strong&gt;。&lt;strong&gt;后开放系列&lt;/strong&gt;中的大多数作品将是许多自然人、企业和组织的产品，他们可以直接或通过另一个法律实体进行许可。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.17 SOURCE CODE is the human-readable, unobfuscated and preferred form of a work for modification. In the case of a compiled or interpreted computer language, this would be the language used as input to the compiler or interpreter.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.17 &lt;strong&gt;源代码&lt;/strong&gt;是作品的人类可读、无歧义且首选的便于修改的形式。在编译或解释的计算机语言的情况下，这将是用作编译器或解释器输入的语言。&lt;/p&gt;

&lt;p&gt;【译注】 2.16 在原文中就缺失了&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.18 PUBLIC RELEASE is the publication of the SOURCE CODE of the WORK or a MODIFICATION in a public site on the internet, licensed under these terms, where it is expected to be permanently and reliably available worldwide for download without any permission or legal agreement in addition to these terms. One example, at this writing, would be a public repository on “github.com”. [The most common practical form of PUBLIC RELEASE at this writing is contribution of a modification to a project via the “pull” mechanism of public “git” repository.]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.18 &lt;strong&gt;公开发布&lt;/strong&gt;是指在互联网的公开网站上发布&lt;strong&gt;作品&lt;/strong&gt;或&lt;strong&gt;修改&lt;/strong&gt;的&lt;strong&gt;源代码&lt;/strong&gt;，并在这些条款下许可，期望它能在全球范围内永久且可靠地供人下载，无需除这些条款之外的任何许可或法律协议。在本文撰写时的一个例子，将是“github.com”上的一个公共存储库。[目前最常见的&lt;strong&gt;公开发布&lt;/strong&gt;实践形式是通过公共“git”仓库的“pull”机制向项目贡献修改。]&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.19 The POST-OPEN COLLECTION is all works that have been placed under these terms by LICENSORS who have entered into the POST-OPEN OPERATING AGREEMENT, and for which PUBLIC RELEASE has been performed.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.19 &lt;strong&gt;后开放系列&lt;/strong&gt;是指那些已签订&lt;strong&gt;后开放运营协议&lt;/strong&gt;的&lt;strong&gt;许可方&lt;/strong&gt;按照这些条款放置的所有作品，并且已进行了&lt;strong&gt;公开发布&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;2.20 TERMINATION immediately discontinues YOUR GRANT OF RIGHTS to all works in the POST-OPEN COLLECTION, including (but not limited to) the WORK, but all other terms contine to apply and YOUR consent to these terms survives TERMINATION. TERMINATION is never ended automatically, or simply by the cure of the condition causing TERMINATION. YOU must take a specific action to cure TERMINATION, such as entering into one of the contracts that allows the condition that previously caused TERMINATION (the POST-OPEN ZERO-COST CONTRACT or the POST-OPEN PAID CONTRACT), or by participating in the POST-OPEN INFRINGEMENT PROCESS. TERMINATES is the act or past-tense of TERMINATION.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;2.20 &lt;strong&gt;终止&lt;/strong&gt;立即结束&lt;strong&gt;您&lt;/strong&gt;对&lt;strong&gt;后开放系列&lt;/strong&gt;中所有作品的&lt;strong&gt;权利授予&lt;/strong&gt;，包括（但不限于）&lt;strong&gt;作品&lt;/strong&gt;，但所有其他条款继续适用，且&lt;strong&gt;您&lt;/strong&gt;对这些条款的同意在&lt;strong&gt;终止&lt;/strong&gt;后仍然有效。&lt;strong&gt;终止&lt;/strong&gt;从不会自动结束，或仅仅通过纠正导致&lt;strong&gt;终止&lt;/strong&gt;的条件而结束。&lt;strong&gt;您&lt;/strong&gt;必须采取特定行动来纠正&lt;strong&gt;终止&lt;/strong&gt;，例如签订允许先前导致&lt;strong&gt;终止&lt;/strong&gt;的条件的其中一份合同（&lt;strong&gt;后开放零成本合同&lt;/strong&gt;或&lt;strong&gt;后开放付费合同&lt;/strong&gt;），或参与&lt;strong&gt;后开放侵权处理流程&lt;/strong&gt;。&lt;strong&gt;终止&lt;/strong&gt;是&lt;strong&gt;终止&lt;/strong&gt;的行为或过去时。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. CONDITIONS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.1 ZERO-COST CONDITIONS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TERMINATION occurs when any of the conditions in the following list apply to YOU and YOU have not already entered into the POST-OPEN ZERO-COST CONTRACT. If YOU wish to continue to exercise RESTRICTED RIGHTS after one of these conditions applies, YOU may enter into the POST-OPEN ZERO-COST CONTRACT. [Which is a version of these same terms with the addition of clear and recorded consent by the licensee.]&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a) You exercise RESTRICTED RIGHTS outside of a PROTECTING JURISDICTION.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. 条件&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.1 零成本条件&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;当以下列表中的任何条件适用于&lt;strong&gt;您&lt;/strong&gt;且&lt;strong&gt;您&lt;/strong&gt;尚未签订&lt;strong&gt;后开放零成本合同&lt;/strong&gt;时，将发生&lt;strong&gt;终止&lt;/strong&gt;。如果在其中一种情况适用后&lt;strong&gt;您&lt;/strong&gt;希望继续行使&lt;strong&gt;受限权利&lt;/strong&gt;，&lt;strong&gt;您&lt;/strong&gt;可以签订&lt;strong&gt;后开放零成本合同&lt;/strong&gt;。[这是这些相同条款的一个版本，增加了被许可人的明确和记录在案的同意。]&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a) &lt;strong&gt;您&lt;/strong&gt;在&lt;strong&gt;司法保护辖区&lt;/strong&gt;之外行使&lt;strong&gt;受限权利&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.2 PAID CONDITIONS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TERMINATION occurs when any of the conditions in the following list apply to YOU. If YOU wish to continue to exercise RESTRICTED RIGHTS, YOU may enter into the POST-OPEN PAID CONTRACT. [Which is a separate agreement that gives permission to perform the stated actions, in exchange for annual payment and an annual disclosure requirement.]&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a) The end-user revenue through all legal entities in which YOU have ownership exceeding 5% or equivalent control without ownership exceeds USD$5 Million anually. End-user revenue is all money or other value collected from customers, including the financial value equivalent of any non-monetary remuneration such as barter or the grant of rights or privileges.&lt;/li&gt;
  &lt;li&gt;b) You provide, for remuneration, any work in the POST-OPEN COLLECTION to others, other than PERSONAL USE, or perform that provision at the order of another legal entity that receives remuneration for it. This includes (but is not limited to) provision of the work as a service; or inclusion of the work in a product that is sold, for example software that is sold or sale of a device containing the WORK.&lt;/li&gt;
  &lt;li&gt;c) You make MODIFICATIONS to any WORK in the POST-OPEN COLLECTION without performing one of these actions (you may perform both):
    &lt;ul&gt;
      &lt;li&gt;I)  You enter into the POST-OPEN OPERATING AGREEMENT and make a PUBLIC RELEASE of the MODIFICATION.&lt;/li&gt;
      &lt;li&gt;II) You enter into the POST-OPEN PAID CONTRACT.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.2 付费条件&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;当以下列表中的任何条件适用于&lt;strong&gt;您&lt;/strong&gt;时，将发生&lt;strong&gt;终止&lt;/strong&gt;。如果&lt;strong&gt;您&lt;/strong&gt;希望继续行使&lt;strong&gt;受限权利&lt;/strong&gt;，您可以签订&lt;strong&gt;后开放付费合同&lt;/strong&gt;。[这是一个单独的协议，允许执行规定的行动，以换取年度支付和年度披露要求。]&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a)  通过&lt;strong&gt;您&lt;/strong&gt;拥有超过5%所有权或等效无所有权控制的所有法律实体，最终用户收入年度超过500万美元。最终用户收入是从客户收集的所有金钱或其他价值，包括任何非货币报酬的财务价值等价物，如易货或权利或特权的授予。&lt;/li&gt;
  &lt;li&gt;b)  除了个人使用外，&lt;strong&gt;您&lt;/strong&gt;为&lt;strong&gt;他人&lt;/strong&gt;提供&lt;strong&gt;后开放系列&lt;/strong&gt;中的任何作品以获取报酬，或者按另一个获得报酬的法律实体的命令执行该提供。这包括（但不限于）以服务形式提供作品；或将作品包含在出售的产品中，例如出售的软件或包含&lt;strong&gt;作品&lt;/strong&gt;的设备的销售。&lt;/li&gt;
  &lt;li&gt;c)  您对&lt;strong&gt;后开放系列&lt;/strong&gt;中的任何&lt;strong&gt;作品&lt;/strong&gt;进行&lt;strong&gt;修改&lt;/strong&gt;，未执行以下行动之一（您可以执行两者）：
    &lt;ul&gt;
      &lt;li&gt;I)  您签订&lt;strong&gt;后开放运营协议&lt;/strong&gt;并进行&lt;strong&gt;修改&lt;/strong&gt;的&lt;strong&gt;公开发布&lt;/strong&gt;。&lt;/li&gt;
      &lt;li&gt;II) 您签订&lt;strong&gt;后开放付费合同&lt;/strong&gt;。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;【译注】本质上类似于双许可（Dual-License）&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.3 TERMINATION CONDITIONS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TERMINATION occurs if any of the conditions in the following list apply to you.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.3 终止条件&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;如果以下列表中的任何条件适用于您，则会发生&lt;strong&gt;终止&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;a) You perform any action prohibited by these terms, breach this contract, or infringe RESTRICTED RIGHTS of any work in the POST-OPEN COLLECTION.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;a) 您执行这些条款禁止的任何行为，违反此合约，或侵犯&lt;strong&gt;后开放系列&lt;/strong&gt;中任何作品的&lt;strong&gt;受限权利&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;【译注】结成了一个保护同盟，一个都不能被侵犯。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;b) You bring suit or other enforcement for patent infringement regarding any work in the POST-OPEN COLLECTION or cause, fund or join such a suit or enforcement.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;b) 您对后开放系列中的任何作品提起专利侵权诉讼或进行其他执法，或导致、资助或加入此类诉讼或执法。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;c) YOU further restrict the rights granted in these terms, YOU add any terms to these terms, or YOU make separate terms which change the effect of these terms. For example, you enter into a contract with users which includes a punitive action if they redistribute security information regarding a work in the POST-OPEN COLLECTION or MODIFICATIONS of such a work intended to cure or mitigate a security issue.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;c) &lt;strong&gt;您&lt;/strong&gt;进一步限制这些条款中授予的权利，&lt;strong&gt;您&lt;/strong&gt;添加任何条款到这些条款中，或&lt;strong&gt;您&lt;/strong&gt;制定单独的条款改变这些条款的效果。例如，您与用户签订合约，如果他们重新分发有关&lt;strong&gt;后开放系列&lt;/strong&gt;中作品或旨在纠正或减轻安全问题的该作品的&lt;strong&gt;修改&lt;/strong&gt;的安全信息，则包含惩罚性行动。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;d) You cause the any work in the POST-OPEN COLLECTION to potentially become subject to export control laws (for example the US ITAR and EAR) by exercising RESTRICTED RIGHTS for military, defense, or weaponization purposes; by requesting or participating in support or services regarding any work in the POST-OPEN COLLECTION for military, defense, or weaponization purposes, or by making a MODIFICATION of any work in the POST-OPEN COLLECTION for military, defense, or weaponization purposes.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;d) 由于您出于军事、防御或武器化目的行使&lt;strong&gt;受限权利&lt;/strong&gt;；请求或参与与&lt;strong&gt;后开放系列&lt;/strong&gt;中任何作品的军事、防御或武器化目的相关的支持或服务；或出于军事、防御或武器化目的&lt;strong&gt;修改&lt;/strong&gt;&lt;strong&gt;后开放系列&lt;/strong&gt;中的任何作品，您导致&lt;strong&gt;后开放系列&lt;/strong&gt;中的任何作品可能受到出口控制法律（例如美国的ITAR和EAR）的约束。&lt;/p&gt;

&lt;p&gt;【译注】这一条看起来违背了“OSD中的非歧视性条款”，但在事实上，却有利于作品被更大范围的使用。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;e) YOU deliberately do not report security-related information regarding the any work in the POST-OPEN COLLECTION to the LICENSOR and the POST-OPEN ADMINISTRATION as soon as possible, or YOU create an agreement with terms restricting any other party from making such a report, except in the case that you are legally restricted from making such a disclosure by a direct order of your government (rather than a private agreement such as an NDA), and then only as long as such a restriction applies. [Please see https://postopen.org/security/ to make a report to the POST-OPEN ADMINISTRATION and the LICENSOR.]&lt;/p&gt;

&lt;p&gt;For example, if YOU are a company or other entity that provides security services, and you disclose security information about the WORK to your customers and affiliates without also disclosing it to the POST-OPEN ADMINISTRATION and the LICENSOR before then or at the same time, you violate these terms and TERMINATION occurs.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;e) &lt;strong&gt;您&lt;/strong&gt;故意不尽快向&lt;strong&gt;许可方&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;报告&lt;strong&gt;后开放系列&lt;/strong&gt;中任何作品的与安全相关的信息，或者&lt;strong&gt;您&lt;/strong&gt;创建一个协议，其条款限制任何其他方进行此类报告，除非您因直接受到政府命令（而不是私人协议如保密协议）而法律上被禁止进行此类披露，在此情况下，只有当此类限制适用时才是如此。[请访问 &lt;a href=&quot;https://postopen.org/security/&quot;&gt;https://postopen.org/security/&lt;/a&gt; 向&lt;strong&gt;后开放管理机构&lt;/strong&gt;和&lt;strong&gt;许可方&lt;/strong&gt;报告。]&lt;/p&gt;

&lt;p&gt;例如，如果&lt;strong&gt;您&lt;/strong&gt;是一家提供安全服务的公司或其他实体，并且您在之前或同时没有向&lt;strong&gt;后开放管理机构&lt;/strong&gt;和&lt;strong&gt;许可方&lt;/strong&gt;披露有关&lt;strong&gt;作品&lt;/strong&gt;的安全信息，而仅向您的客户和关联方披露，则您违反了这些条款，&lt;strong&gt;终止&lt;/strong&gt;发生。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;f) You train a MACHINE LEARNING MODEL with the SOURCE CODE or any transformation of a work within the POST-OPEN COLLECTION, or exercise any rights protected by copyight, patent, or moral rights law regarding a MACHINE LEARNING MODEL TRAINED with the text of a work within the POST-OPEN COLLECTION. These would include (but are not limited to) use, copying, or redistribution of such a model; exercise of the same rights on the behalf of others; or having those rights exercised on YOUR behalf.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;f) 您使用&lt;strong&gt;后开放系列&lt;/strong&gt;内的&lt;strong&gt;源代码&lt;/strong&gt;或任何作品的转换训练&lt;strong&gt;机器学习模型&lt;/strong&gt;，或行使受版权、专利或精神权利法保护的关于以&lt;strong&gt;后开放系列&lt;/strong&gt;内的作品文本&lt;strong&gt;训练&lt;/strong&gt;的&lt;strong&gt;机器学习模型&lt;/strong&gt;的任何权利。这些将包括（但不限于）使用、复制或重新分发此类模型；代表他人行使相同的权利；或让这些权利在&lt;strong&gt;您&lt;/strong&gt;的代表下被行使。&lt;/p&gt;

&lt;p&gt;【译注】看来是为了封堵GitHub Copilot的行为&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;g) YOU are unresponsive for more than 60 days to enforcement-related communications of the POST-OPEN ADMINISTRATION regarding these terms or one of these agreements if you have entered into it: the POST-OPEN ZERO-COST CONTRACT, the POST-OPEN PAID CONTRACT, or the POST-OPEN OPERATING AGREEMENT.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;g) 如果&lt;strong&gt;您&lt;/strong&gt;已经签订如下的其中一个合同：&lt;strong&gt;后开放零成本合同&lt;/strong&gt;、&lt;strong&gt;后开放付费合同&lt;/strong&gt;或&lt;strong&gt;后开放运营协议&lt;/strong&gt;，您对&lt;strong&gt;后开放管理机构&lt;/strong&gt;关于这些条款或其中一个协议的与执法相关的通信超过60天天没有响应。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. TERMS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These terms include this entire document, including (but not limited to) the DEFINITIONS and PRELUDE, except for the ADVISORY SECTIONS.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. 条款&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;这些条款包括本整个文档，包括（但不限于）定义和序言，但咨询部分除外。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.1 REQUIREMENT TO LICENSE&lt;/p&gt;

&lt;p&gt;You must license the WORK if YOU exercise RESTRICTED RIGHTS, even the right to read or examine the WORK, or if another legal entity exercises RESTRICTED RIGHTS on YOUR behalf, for example a software-as-a-service business which provides servers that execute the WORK for YOU. You may license the WORK via these terms, or by executing the POST-OPEN ZERO-COST CONTRACT or the POST-OPEN PAID CONTRACT.&lt;/p&gt;

&lt;p&gt;At your option, you may enter into the POST-OPEN ZERO-COST CONTRACT at any time. This provides you a executed contract with these same terms, and consent by YOU and the POST-OPEN ADMINISTRATION, which may be more convenient to your business or legal process.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.1 许可要求&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;如果&lt;strong&gt;您&lt;/strong&gt;行使&lt;strong&gt;受限权利&lt;/strong&gt;，即使是阅读或检查&lt;strong&gt;作品&lt;/strong&gt;的权利，或者如果另一个法律实体代表&lt;strong&gt;您&lt;/strong&gt;行使&lt;strong&gt;受限权利&lt;/strong&gt;，例如为&lt;strong&gt;您&lt;/strong&gt;执行&lt;strong&gt;作品&lt;/strong&gt;的 SaaS 业务，您必须对&lt;strong&gt;作品&lt;/strong&gt;进行许可。您可以通过这些条款进行许可，或通过执行&lt;strong&gt;后开放零成本合同&lt;/strong&gt;或&lt;strong&gt;后开放付费合同&lt;/strong&gt;进行许可。&lt;/p&gt;

&lt;p&gt;您可以选择随时签订&lt;strong&gt;后开放零成本合同&lt;/strong&gt;。这为&lt;strong&gt;您&lt;/strong&gt;提供了一个与这些相同条款的执行合同，并得到&lt;strong&gt;您&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;的同意，这可能更便于您的业务或法律流程。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.2 RIGHTS RESTRICTION&lt;/p&gt;

&lt;p&gt;No exercise of RESTRICTED RIGHTS, including (but not restricted to) ephemeral copying, is permitted except under these terms or by entering into the POST-OPEN ZERO-COST CONTRACT, the POST-OPEN PAID CONTRACT, or the POST-OPEN OPERATING AGREEMENT, as applicable.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.2 权利限制&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;除非根据这些条款或通过进入&lt;strong&gt;后开放零成本合同&lt;/strong&gt;、&lt;strong&gt;后开放付费合同&lt;/strong&gt;或&lt;strong&gt;后开放运营协议&lt;/strong&gt;（视情况而定），否则不允许行使&lt;strong&gt;受限权利&lt;/strong&gt;，包括（但不限于）瞬时复制。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.3 NO WARRANTY, REQUIREMENT FOR INDEMNIFICATION&lt;/p&gt;

&lt;p&gt;To the extent permissible by law, no warranties are applicable to the WORK, even warranties of usability or fitness for use. You agree to indemnify the LICENSOR and the POST-OPEN ADMINISTRATION regarding any hazard or liability caused by YOUR use of the WORK, including (but not limited to) damages to you and others, penalties or fines levied by government, and prosecution of patent infringement resulting from YOUR exercise of RESTRICTED RIGHTS. If such liability is of concern to YOU, you are advised to purchase insurance to protect YOU from it. [The POST-OPEN ADMINISTRATION does not offer such insurance at this time.]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.3 无保证，赔偿要求&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在法律允许的范围内，对&lt;strong&gt;作品&lt;/strong&gt;不适用任何保证，即使是适用性或适宜性的保证。您同意就您使用&lt;strong&gt;作品&lt;/strong&gt;引起的任何风险或责任，包括（但不限于）对&lt;strong&gt;您&lt;/strong&gt;和他人的损害、政府征收的罚款或罚金以及由于您行使&lt;strong&gt;受限权利&lt;/strong&gt;而导致的专利侵权诉讼，对&lt;strong&gt;许可方&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;进行赔偿。如果&lt;strong&gt;您&lt;/strong&gt;对此类责任感到担忧，建议&lt;strong&gt;您&lt;/strong&gt;购买保险以保护自己。[目前&lt;strong&gt;后开放管理机构&lt;/strong&gt;不提供此类保险。]&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.4 ASSERTION OF PRESENCE OF DEFECTS, NO RESPONSIBILITY TO REPORT OR CURE&lt;/p&gt;

&lt;p&gt;There are defects in the WORK, both known and unknown, including (but not limited to) ones with a potential effect upon security or privacy of the user, and ones that could conceivably cause damage to life or property. It is not technically or economically possible to produce a work free of defects within the state of the art at this time. The LICENSOR and the POST-OPEN ADMINISTRATION may operate a defect reporting system, but decline responsibility to report, repair, or cure defects under these terms, to the extent permissible by law. Such serivces may be available through a paid support contract.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.4 声明存在缺陷，无报告或纠正责任&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;作品&lt;/strong&gt;存在已知和未知的缺陷，包括（但不限于）可能影响用户安全或隐私的缺陷，以及可能导致对生命或财产造成损害的缺陷。在目前的技术水平下，生产一个无缺陷的作品在技术上或经济上是不可能的。&lt;strong&gt;许可方&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;可能运行一个缺陷报告系统，但在法律允许的范围内拒绝报告、修复或纠正缺陷的责任。此类服务可能通过付费支持合同获得。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.5 ASSERTION OF THE POSSIBILITY OF PATENT CLAIMS&lt;/p&gt;

&lt;p&gt;The WORK may be considered to come under one or more existing patent claims, regardless of the validity or enforcibility of such claims. A complete patent search and the development of an understanding of what patents are actually valid or enforcible is not technically or economically possible. The liability for such claims is entirely yours, and the LICENSOR and the POST-OPEN ADMINISTRATION deny any such liability, including to YOU. If such liability is of concern to YOU, YOU are advised to purchase insurance to protect you from it.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.5 声明可能存在专利索赔的可能性&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;作品&lt;/strong&gt;可能被视为落入一个或多个现有专利索赔之下，不论这些索赔的有效性或可执行性如何。完全进行专利搜索并了解哪些专利实际有效或可执行在技术上或经济上是不可能的。对于此类索赔的责任完全由&lt;strong&gt;您&lt;/strong&gt;承担，&lt;strong&gt;许可方&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;拒绝承担任何此类责任，包括对&lt;strong&gt;您&lt;/strong&gt;的责任。如果&lt;strong&gt;您&lt;/strong&gt;对此类责任感到担忧，建议&lt;strong&gt;您&lt;/strong&gt;购买保险以保护自己。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.6 MODIFICATION&lt;/p&gt;

&lt;p&gt;MODIFICATION of the WORK with PUBLIC RELEASE requires entry into the POST-OPEN OPERATING AGREEMENT. If YOU wish to make MODIFICATIONS without PUBLIC RELEASE, YOU must enter into the POST-OPEN PAID CONTRACT. You may enter into both and make modifications under each as appropriate. If YOU perform MODIFICATION without entering into the POST-OPEN OPERATING AGREEMENT or the POST-OPEN PAID CONTRACT, TERMINATION occurs.&lt;/p&gt;

&lt;p&gt;Producers of significant MODIFICATIONS and new works are advised that if YOU make PUBLIC RELEASE and enter into the POST-OPEN OPERATING AGREEMENT, the POST-OPEN ADMINISTRATION may pay you with part of the revenue collected under the POST-OPEN PAID CONTRACT. Thus, there is a financial incentive for all parties to publish their modifications and increase the size and functionality of the POST-OPEN COLLECTION.&lt;/p&gt;

&lt;p&gt;Modifications that are made available via PUBLIC RELEASE are more likely to be maintained as part of the overall project, while private modifications must be brought up to sync with every public release if you wish to use the features and bug fixes in that release, and this will be a continuing expense.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.6 修改&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;带有公开发布的&lt;strong&gt;作品&lt;/strong&gt;的&lt;strong&gt;修改&lt;/strong&gt;需要签订&lt;strong&gt;后开放运营协议&lt;/strong&gt;。如果&lt;strong&gt;您&lt;/strong&gt;希望在不进行&lt;strong&gt;公开发布&lt;/strong&gt;的情况下进行修改，&lt;strong&gt;您&lt;/strong&gt;必须签订&lt;strong&gt;后开放付费合同&lt;/strong&gt;。您可以同时签订这两个合同，并根据情况进行修改。如果您在不签订&lt;strong&gt;后开放运营协议&lt;/strong&gt;或&lt;strong&gt;后开放付费合同&lt;/strong&gt;的情况下进行&lt;strong&gt;修改&lt;/strong&gt;，则发生&lt;strong&gt;终止&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;对于重大&lt;strong&gt;修改&lt;/strong&gt;和新作品的制作者，建议如果&lt;strong&gt;您&lt;/strong&gt;进行&lt;strong&gt;公开发布&lt;/strong&gt;并签订&lt;strong&gt;后开放运营协议&lt;/strong&gt;，&lt;strong&gt;后开放管理机构&lt;/strong&gt;可能会用&lt;strong&gt;后开放付费合同&lt;/strong&gt;收到的部分收入支付给您。因此，发布修改并增加&lt;strong&gt;后开放系列&lt;/strong&gt;的规模和功能对所有方都有财务激励。&lt;/p&gt;

&lt;p&gt;通过&lt;strong&gt;公开发布&lt;/strong&gt;提供的&lt;strong&gt;修改&lt;/strong&gt;更有可能作为整个项目的一部分得到维护，而私人修改必须与每次公开发布同步更新，如果您希望使用该发布中的功能和错误修复，则这将是一个持续的费用。&lt;/p&gt;

&lt;p&gt;【译注】最后其实再次强调了上游优先的原则&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.7 CONSENT AND AGREEMENT&lt;/p&gt;

&lt;p&gt;This is a contract between YOU, the LICENSOR, and the POST-OPEN ADMINISTRATION. Exercise of any RESTRICTED RIGHTS indicates YOUR consent to these terms. YOU may explicitly indicate your consent by entering into the POST-OPEN ZERO-COST CONTRACT, but your consent is indicated whether or not you do so.&lt;/p&gt;

&lt;p&gt;If YOU are a government, nation, or soverign power, you agree to comply with the law and these terms as they would apply to real persons in your jurisdiction. You specifically consent to allow and commit to respond to any lawsuit by the LICENSOR or the POST-OPEN ADMINISTRATION.&lt;/p&gt;

&lt;p&gt;If YOU are more than one legal entity, each individual entity which exercises RESTRICTED RIGHTS must enter into these terms, the POST-OPEN ZERO-COST LICENSE, or the POST-OPEN PAID LICENSE.&lt;/p&gt;

&lt;p&gt;YOU agree to comply with these terms regardless of the status of the WORK under copyright, moral rights, or patent law. Where the law grants YOU a right and these terms prohibit it, these terms shall prevail to the extent permitted by law. YOU agree not to exercise RESTRICTED RIGHTS outside of these terms. You agree not to TRAIN a MACHINE LEARNING MODEL with the information of any work in the POST-OPEN COLLECTION. You agree not to perform ephemeral copying with the purpose of TRAINING such a model.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.7 同意和协议&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;这是&lt;strong&gt;您&lt;/strong&gt;、&lt;strong&gt;许可方&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;之间的合同。行使任何&lt;strong&gt;受限权利&lt;/strong&gt;表明&lt;strong&gt;您&lt;/strong&gt;同意这些条款。&lt;strong&gt;您&lt;/strong&gt;可以通过签订&lt;strong&gt;后开放零成本合同&lt;/strong&gt;明确表示您的同意，但无论您是否这样做，您的同意都已经表达了。&lt;/p&gt;

&lt;p&gt;如果&lt;strong&gt;您&lt;/strong&gt;是政府、国家或主权力量，您同意遵守法律和这些条款，就像它们适用于您管辖范围内的自然人一样。您特别同意允许并承诺响应&lt;strong&gt;许可方&lt;/strong&gt;或&lt;strong&gt;后开放管理机构&lt;/strong&gt;提起的任何诉讼。&lt;/p&gt;

&lt;p&gt;如果&lt;strong&gt;您&lt;/strong&gt;是不止一个法律实体，每个行使&lt;strong&gt;受限权利&lt;/strong&gt;的单独实体必须签订这些条款、&lt;strong&gt;后开放零成本许可&lt;/strong&gt;或&lt;strong&gt;后开放付费许可&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;不论&lt;strong&gt;作品&lt;/strong&gt;在版权、道德权利或专利法下的状态如何，&lt;strong&gt;您&lt;/strong&gt;同意遵守这些条款。当法律赋予&lt;strong&gt;您&lt;/strong&gt;一项权利而这些条款禁止它时，这些条款在法律允许的范围内将占上风。&lt;strong&gt;您&lt;/strong&gt;同意不在这些条款之外行使&lt;strong&gt;受限权利&lt;/strong&gt;。&lt;strong&gt;您&lt;/strong&gt;同意不使用&lt;strong&gt;后开放系列&lt;/strong&gt;中任何作品的信息&lt;strong&gt;训练&lt;/strong&gt;&lt;strong&gt;机器学习模型&lt;/strong&gt;。您同意不进行瞬时复制以&lt;strong&gt;训练&lt;/strong&gt;此类模型的目的。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.8 NO RIGHT TO RELICENSE&lt;/p&gt;

&lt;p&gt;This agreement directly is between the LICENSOR, the POST-OPEN ADMINISTRATION, and YOU. When you convey a copy of the WORK to another party, or run the work as a service on behalf of another party, you must give them a copy of these terms and inform them that the WORK is covered by these terms. These terms then apply directly between them, the LICENSOR, and the POST-OPEN ADMINISTRATION.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.8 无权再许可&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;本协议直接涉及&lt;strong&gt;许可方&lt;/strong&gt;、&lt;strong&gt;后开放管理机构&lt;/strong&gt;和&lt;strong&gt;您&lt;/strong&gt;。当您向另一方转让&lt;strong&gt;作品&lt;/strong&gt;的副本，或代表另一方运行作品作为服务时，您必须给他们一份这些条款的副本，并通知他们作品受这些条款约束。这些条款然后直接适用于他们、&lt;strong&gt;许可方&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;之间。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.9 PUBLIC INTERFACES&lt;/p&gt;

&lt;p&gt;YOU agree to connect the WORK to software which is not under these terms only through its PUBLIC INTERFACES. YOU agree that an API present in the WORK which is not declared a PUBLIC INTERFACE is not permissible for use for connecting to programs that are not under these terms.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.9 公共接口&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;您&lt;/strong&gt;同意只通过其&lt;strong&gt;公共接口&lt;/strong&gt;将&lt;strong&gt;作品&lt;/strong&gt;连接到不受这些条款约束的软件。&lt;strong&gt;您&lt;/strong&gt;同意，在&lt;strong&gt;作品&lt;/strong&gt;中存在的API如果未声明为&lt;strong&gt;公共接口&lt;/strong&gt;，则不允许用于连接到不受这些条款约束的程序。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.11 NO CIRCUMVENTION&lt;/p&gt;

&lt;p&gt;YOU agree not to employ legal or technical strategies with the main purpose of circumventing the effect of these terms. For example, creating a legal entity for the purpose of entering into these terms while insulating another legal entity from these terms; or creating a technical means of linking a program in the POST-OPEN COLLECTION to a second program which is not under these terms, without that second program being considered part of the WORK.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.11 禁止规避&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;您&lt;/strong&gt;同意不采用法律或技术策略，其主要目的是规避这些条款的效果。例如，创建一个法律实体目的是为了签订这些条款，同时使另一个法律实体免受这些条款的约束；或创建一个技术手段将&lt;strong&gt;后开放系列&lt;/strong&gt;中的程序链接到第二个不受这些条款约束的程序，而不将该第二程序视为&lt;strong&gt;作品&lt;/strong&gt;的一部分。&lt;/p&gt;

&lt;p&gt;【译注】4.10 在原文中就缺失了&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.12 GRANT OF RIGHTS&lt;/p&gt;

&lt;p&gt;In consideration of your consent to the entirety of these terms: as long as TERMINATION has not occured, you are granted the right to exercise RESTRICTED RIGHTS other than MODIFICATION, including (but not restricted to) use and redistribution of the WORK and exercise of patent claims of the LICENSOR and the POST-OPEN ADMINISTRATION necessary to exercise RESTRICTED RIGHTS other than MODIFICATION under these terms.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.12 授予权利&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;考虑到您对这些条款的全部同意：只要未发生&lt;strong&gt;终止&lt;/strong&gt;，您将被授予除修改以外的行使&lt;strong&gt;受限权利&lt;/strong&gt;的权利，包括（但不限于）使用和重新分发作品以及行使&lt;strong&gt;许可方&lt;/strong&gt;和&lt;strong&gt;后开放管理机构&lt;/strong&gt;的专利索赔，这些专利索赔对行使这些条款下的除&lt;strong&gt;修改&lt;/strong&gt;以外的&lt;strong&gt;&lt;em&gt;受限权利&lt;/em&gt;&lt;/strong&gt;是必要的。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.13 CONDITIONS FOR TERMINATION&lt;/p&gt;

&lt;p&gt;At the moment that the PAID CONDITIONS, ZERO-COST CONDITIONS, or TERMINATION CONDITIONS apply to YOU, TERMINATION occurs. You may then, as applicable, enter into the POST OPEN ZERO-COST CONTRACT, the POST-OPEN PAID CONTRACT, or YOU may contact the POST-OPEN ADMINISTRATION regarding curing an infringement under the POST-OPEN INFRINGEMENT PROCESS. Please pre-emptively enter into the aforementioned agreements before such a situation arises.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.13 终止条件&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;一旦&lt;strong&gt;付费条件&lt;/strong&gt;、&lt;strong&gt;零成本条件&lt;/strong&gt;或&lt;strong&gt;终止条件&lt;/strong&gt;适用于&lt;strong&gt;您&lt;/strong&gt;，&lt;strong&gt;终止&lt;/strong&gt;就会发生。然后，根据适用情况，您可以签订&lt;strong&gt;后开放零成本合同&lt;/strong&gt;、&lt;strong&gt;后开放付费合同&lt;/strong&gt;，或&lt;strong&gt;您&lt;/strong&gt;可以联系&lt;strong&gt;后开放管理机构&lt;/strong&gt;关于在&lt;strong&gt;后开放侵权处理流程&lt;/strong&gt;下纠正侵权。请在此类情况发生之前预先签订上述协议。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.14 SEVERABILITY&lt;/p&gt;

&lt;p&gt;If a court should strike any of these terms or find them unenforcible, the minimum possible text is struck and the remainder of these terms survive.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.14 可分割性&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;如果法院裁定这些条款的任何部分无效或不可执行，将尽可能少地删除文本，并且这些条款的其余部分仍然有效。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.15 ACCEPTANCE OF THE POST-OPEN ADMINISTRATION AS A PARTY TO ANY DISPUTE&lt;/p&gt;

&lt;p&gt;YOU accept that the POST-OPEN ADMINISTRATION has the right to represent the LICENSOR in any controversy or claim arising out of or relating to these terms.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.15 接受后开放管理机构作为任何争议的一方&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;您&lt;/strong&gt;接受&lt;strong&gt;后开放管理机构&lt;/strong&gt;有权代表&lt;strong&gt;许可方&lt;/strong&gt;处理因这些条款产生或与这些条款相关的任何争议或索赔。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.16 ARBITRATION&lt;/p&gt;

&lt;p&gt;Any controversy or claim arising out of or relating to these terms, or the breach thereof, shall be settled by arbitration administered by the American Arbitration Association if the parties are all within the United States, or the International Centre for Dispute Resolution in the case that a party to the dispute is external to the United States, in accordance with the Commercial Arbitration Rules and/or other appropriate rules of those organizations. Judgment on the award rendered by the arbitrator(s) may be entered in any court having jurisdiction thereof. YOU and all parties to these terms consent
to the use of computer videoconferencing or telephone conferencing, rather than personal appearance, for the operation of arbitration and any court session.&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.16 仲裁&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;由这些条款或其违反引起的任何争议或索赔，如果当事方都在美国内，应由美国仲裁协会管理进行仲裁，或如果争议方位于美国外，则由国际争议解决中心进行仲裁，按照这些组织的商业仲裁规则和/或其他适当规则进行。仲裁员的裁决可以在有管辖权的任何法院进入判决。您和所有这些条款的方同意使用计算机视频会议或电话会议而不是亲自出现，用于仲裁和任何法庭会议的运作。&lt;/p&gt;

&lt;p&gt;【原文】&lt;/p&gt;

&lt;p&gt;4.17 REVISION OF THESE TERMS&lt;/p&gt;

&lt;p&gt;During the present DRAFT terms period, changes to these terms published as a revised DRAFT by the POST-OPEN ADMINISTRATION are effective immediately and superscede the terms previously issued.&lt;/p&gt;

&lt;p&gt;After the first publication of a FINAL version of these terms, the following terms apply:&lt;/p&gt;

&lt;p&gt;The POST-OPEN ADMINISTRATION may publish revised versions of these terms. Revised terms will remain substantially similar to these ones, and may include changes only to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a) Correct errors and ambiguities.&lt;/li&gt;
  &lt;li&gt;b) Avoid loopholes that have come into use.&lt;/li&gt;
  &lt;li&gt;c) Respond to findings of courts which server some of the terms or interpret some of the terms unfavorably.&lt;/li&gt;
  &lt;li&gt;d) Respond to new law or law newly enforced upon any party to these terms.&lt;/li&gt;
  &lt;li&gt;e) Respond to changes in technology (for example, this text responds to the rise of MACHINE LEARNING MODELS and TRAINING of such, terms which were not included in classical Open Source licenses).&lt;/li&gt;
  &lt;li&gt;f) Respond to changes in monetary value: for example, a change in the real value of the stated amount of end-user revenue requiring that YOU join into the POST-OPEN PAID CONTRACT, or a change in the nation or other entity for which that value is defined: (for example, a change from USD to a presently-theoretical stable global currency).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When changes to these terms are published as FINAL revised terms by the POST-OPEN ADMINISTRATION (rather than a DRAFT), YOU may, at your discretion, immediately apply the new terms, or you may continue to apply these terms to works already in your use for no more than one year from the publication of the revised terms. If you begin to use another work in the collection, the new terms apply to it immediately. [This allows the licensee time for legal evaluation of the new terms and to make decisions regarding their use of the POST-OPEN COLLECTION.]&lt;/p&gt;

&lt;p&gt;【译文】&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.17 这些条款的修订&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在当前&lt;strong&gt;草案&lt;/strong&gt;条款期间，&lt;strong&gt;后开放管理机构&lt;/strong&gt;发布的这些条款的修订&lt;strong&gt;草案&lt;/strong&gt;立即生效，并取代之前发布的条款。&lt;/p&gt;

&lt;p&gt;在这些条款的第一个&lt;strong&gt;最终&lt;/strong&gt;版本发布后，适用以下条款：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;后开放管理机构&lt;/strong&gt;可以发布这些条款的修订版本。修订后的条款将与这些条款大体相似，并且只可能包括以下变更：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a) 更正错误和歧义。&lt;/li&gt;
  &lt;li&gt;b) 避免已经开始使用的漏洞。&lt;/li&gt;
  &lt;li&gt;c) 响应一些法院对条款的服务或不利解释的发现。&lt;/li&gt;
  &lt;li&gt;d) 响应对这些条款的任何一方新施加的新法律或新执行的法律。&lt;/li&gt;
  &lt;li&gt;e) 响应技术变化（例如，本文响应&lt;strong&gt;机器学习模型&lt;/strong&gt;的兴起及其&lt;strong&gt;训练&lt;/strong&gt;，这些术语不包括在传统开源许可中）。&lt;/li&gt;
  &lt;li&gt;f) 响应货币价值变化：例如，更改要求您加入&lt;strong&gt;后开放付费合同&lt;/strong&gt;的最终用户收入声明金额的实际价值，或更改定义该价值的国家或其他实体：（例如，从美元更改为目前理论上的稳定全球货币）。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;当&lt;strong&gt;后开放管理机构&lt;/strong&gt;以&lt;strong&gt;最终&lt;/strong&gt;修订条款（而非&lt;strong&gt;草案&lt;/strong&gt;）形式发布这些条款的变更时，&lt;strong&gt;您&lt;/strong&gt;可以自行决定立即适用新条款，或者您可以继续对已在您使用中的作品适用这些条款，但最多不超过从修订条款发布之日起的一年。如果您开始使用系列中的另一个作品，则新条款立即对其适用。[这允许被许可人时间进行新条款的法律评估，并就他们使用&lt;strong&gt;后开放系列&lt;/strong&gt;的决策进行决定。]&lt;/p&gt;

&lt;p&gt;【译后记】&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;可以发现，这个草稿，的确还是非常“潦草”的。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;后开放管理机构&lt;/strong&gt;及其系列的合同，是一个野心勃勃的策划，不确定是否能够成功。&lt;/li&gt;
  &lt;li&gt;以上的构想本身是有价值的，但是也许以开源基金会（或者开源基金会的联盟）作为载体来推行，或更加有可行性。&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Tue, 12 Mar 2024 05:58:00 +0000</pubDate>
        <link>http://www.zhuangbiaowei.com/2024/03/12/post-open-zero-cost-license.html</link>
        <guid isPermaLink="true">http://www.zhuangbiaowei.com/2024/03/12/post-open-zero-cost-license.html</guid>
        
        <category>OpenSource</category>
        
        <category>License</category>
        
        
      </item>
    
  </channel>
</rss>
