<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>技术文章 &#8211; wqh博客</title>
	<atom:link href="https://wangqianhong.com/category/%E6%8A%80%E6%9C%AF%E6%96%87%E7%AB%A0/feed/" rel="self" type="application/rss+xml" />
	<link>https://wangqianhong.com</link>
	<description>和而不同</description>
	<lastBuildDate>Fri, 12 Jun 2026 23:39:43 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wangqianhong.com/wp-content/uploads/2020/09/cropped-1-1-1-32x32.png</url>
	<title>技术文章 &#8211; wqh博客</title>
	<link>https://wangqianhong.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Unity（四）&#124; UI显示阿拉伯（Arabic）语言</title>
		<link>https://wangqianhong.com/2024/05/unity%ef%bc%88%e5%9b%9b%ef%bc%89-ui%e6%98%be%e7%a4%ba%e9%98%bf%e6%8b%89%e4%bc%af%ef%bc%88arabic%ef%bc%89%e8%af%ad%e8%a8%80/</link>
					<comments>https://wangqianhong.com/2024/05/unity%ef%bc%88%e5%9b%9b%ef%bc%89-ui%e6%98%be%e7%a4%ba%e9%98%bf%e6%8b%89%e4%bc%af%ef%bc%88arabic%ef%bc%89%e8%af%ad%e8%a8%80/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Fri, 10 May 2024 23:31:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Unity]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3934</guid>

					<description><![CDATA[<p>可以，核心思路是：先把 NotoSansArabic-Regular.ttf 生成一个 TextMe&#8230; <a href="https://wangqianhong.com/2024/05/unity%ef%bc%88%e5%9b%9b%ef%bc%89-ui%e6%98%be%e7%a4%ba%e9%98%bf%e6%8b%89%e4%bc%af%ef%bc%88arabic%ef%bc%89%e8%af%ad%e8%a8%80/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Unity（四）&#124; UI显示阿拉伯（Arabic）语言</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/05/unity%ef%bc%88%e5%9b%9b%ef%bc%89-ui%e6%98%be%e7%a4%ba%e9%98%bf%e6%8b%89%e4%bc%af%ef%bc%88arabic%ef%bc%89%e8%af%ad%e8%a8%80/">Unity（四）| UI显示阿拉伯（Arabic）语言</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>可以，核心思路是：先把 <code><a href="https://fonts.google.com/noto/specimen/Noto+Sans+Arabic?preview.script=Arab" target="_blank" rel="noreferrer noopener">NotoSansArabic-Regular.ttf</a></code> 生成一个 TextMeshPro 的 SDF Font Asset，再把这个 Font Asset 挂到 <a href="https://github.com/pnarimani/RTLTMPro" target="_blank" rel="noreferrer noopener">RTLTMPro </a>的组件上。RTLTMPro 官方 README 说明它支持 Arabic / Farsi / Hebrew，并且它明确要求项目里先装好 TextMeshPro；它还给出了用 TMP Font Asset Creator 生成字体资源的流程。(<a href="https://github.com/pnarimani/RTLTMPro">GitHub</a>)</p>



<p>按这个流程做就行：</p>



<ol><li>把 <code>NotoSansArabic-Regular.ttf</code> 导入 Unity。</li><li>打开 <code>Window > TextMeshPro > Font Asset Creator</code>。</li><li><code>Font Source</code> 选择 <code>NotoSansArabic-Regular.ttf</code>。</li><li><code>Character Set</code> 选 Unicode Range。</li><li>在 <code>Character Sequence (Hex)</code> 里填阿拉伯字符范围；RTLTMPro 的 README 建议直接使用它仓库里 <code>Assets/RTLTMPro/Ranges/ArabicAll.txt</code> 的内容，或者按需用 <code>ArabicLetters.txt</code>、<code>ArabicDigits.txt</code>、<code>ArabicTashkeel.txt</code>。</li><li><code>Atlas Size</code> 建议至少 <strong>512&#215;512</strong>；README 也说明阿拉伯字体推荐这个起点，尺寸更大通常质量更好但占用也更大。</li><li>点 <code>Generate Font Atlas</code>，确认字形都进去了。</li><li>点 <code>Save TextMeshPro Font Asset</code> 保存生成的 SDF 资源。</li></ol>



<p>然后在 UI 上这样用：</p>



<ul><li>用 <code>GameObject/UI/* - RTLTMP</code> 创建 RTL 文本对象，或者把现有的 <code>TextMeshPro UGUI</code> 替换成 <code>RTL Text Mesh Pro</code>。</li><li>把刚生成的 TMP Font Asset 填到 <code>RTL Text Mesh Pro</code> 的 <code>Font Asset</code> 属性里。</li><li>如果你的文本里混了富文本标签，可以开 <code>Fix Tags</code>。</li><li>如果文本以英文开头导致 RTL 修正不生效，可以试 <code>Force Fix</code>。</li></ul>



<figure class="wp-block-image size-large"><img loading="lazy" width="2919" height="1146" src="https://wangqianhong.com/wp-content/uploads/2026/06/unity1.png" alt="" class="wp-image-3935" srcset="https://wangqianhong.com/wp-content/uploads/2026/06/unity1.png 2919w, https://wangqianhong.com/wp-content/uploads/2026/06/unity1-768x302.png 768w, https://wangqianhong.com/wp-content/uploads/2026/06/unity1-1536x603.png 1536w, https://wangqianhong.com/wp-content/uploads/2026/06/unity1-2048x804.png 2048w, https://wangqianhong.com/wp-content/uploads/2026/06/unity1-764x300.png 764w" sizes="(max-width: 2919px) 100vw, 2919px" /></figure>



<p>一个实用建议：<br>如果你的界面只显示阿拉伯文，直接用 <code>ArabicAll.txt</code> 最省事；如果还要数字，就把 <code>ArabicDigits.txt</code> 一并覆盖进去。这样生成出来的 SDF 更稳，不容易出现缺字。</p>



<p></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/05/unity%ef%bc%88%e5%9b%9b%ef%bc%89-ui%e6%98%be%e7%a4%ba%e9%98%bf%e6%8b%89%e4%bc%af%ef%bc%88arabic%ef%bc%89%e8%af%ad%e8%a8%80/">Unity（四）| UI显示阿拉伯（Arabic）语言</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2024/05/unity%ef%bc%88%e5%9b%9b%ef%bc%89-ui%e6%98%be%e7%a4%ba%e9%98%bf%e6%8b%89%e4%bc%af%ef%bc%88arabic%ef%bc%89%e8%af%ad%e8%a8%80/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Selenium（一） &#124; Debian环境搭建</title>
		<link>https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/</link>
					<comments>https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sat, 04 May 2024 00:36:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Selenium]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3874</guid>

					<description><![CDATA[<p>Python + Selenium 完全可以在 Debian 上运行。大致流程分两步： 安装 Goo&#8230; <a href="https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Selenium（一） &#124; Debian环境搭建</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/">Selenium（一） | Debian环境搭建</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>Python + Selenium 完全可以在 Debian 上运行。大致流程分两步：</p>



<ol><li>安装 Google Chrome 浏览器</li><li>安装 Python、Selenium 及对应的 ChromeDriver</li></ol>



<p>下面以 Debian 11 (“Bullseye”) 为例，演示具体命令。</p>



<h3>在 Debian 上安装 Google Chrome</h3>



<p>Google 官方并不把 Chrome 放到 Debian 默认源，需要先添加 Google 的 apt 仓库。</p>



<pre class="wp-block-preformatted"># 1. 更新本地包列表
<code>sudo apt update</code>

# 2. 安装必要工具
<code>sudo apt install -y wget gnupg2 apt-transport-https ca-certificates</code>

# 3. 导入 Google 的公钥
<code>wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
| sudo gpg --dearmor -o /usr/share/keyrings/google-linux-signing-keyring.gpg</code>

# 4. 添加 Google Chrome 的 apt 源
<code>echo "deb [signed-by=/usr/share/keyrings/google-linux-signing-keyring.gpg] \
http://dl.google.com/linux/chrome/deb/ stable main" \
| sudo tee /etc/apt/sources.list.d/google-chrome.list</code>

# 5. 再次更新并安装 Chrome
<code>sudo apt update
sudo apt install -y google-chrome-stable</code></pre>



<p>安装完成后，你可以用 <code>google-chrome --version</code> 验证版本。</p>



<h3>安装 Python、Selenium 及 ChromeDriver</h3>



<h4>安装 Python 和 pip</h4>



<p>Debian 11 默认带有 Python3，但可以确保安装最新：</p>



<pre class="wp-block-code"><code>sudo apt install -y python3 python3-venv python3-pip</code></pre>



<h4>安装 Selenium</h4>



<pre class="wp-block-preformatted"># 建议在 virtualenv 中安装
<code>python3 -m venv ~/selenium-env
source ~/selenium-env/bin/activate</code>

# 安装 Selenium 库
<code>pip install --upgrade pip
pip install selenium</code></pre>



<p>如果安装比较慢，可以使用国内镜像源：</p>



<pre class="wp-block-code"><code>pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple</code></pre>



<p>安装 ChromeDriver</p>



<p>ChromeDriver 必须与 Chrome 浏览器版本匹配。可手动下载，也可用 <code>webdriver-manager</code> 自动管理。</p>



<h5>方案 A：手动下载</h5>



<ol><li>查询 Chrome 版本： <code>google-chrome --version </code># 比如输出：Google Chrome <code>115.0.5790.98</code></li><li>到 <a href="https://chromedriver.storage.googleapis.com/index.html">https://chromedriver.storage.googleapis.com/index.html</a> 找到对应的 “115.0.5790.98” 版本，下载 Linux x64 zip。</li><li>解压并移动到 <code>/usr/local/bin</code>： <code>wget -O chromedriver_linux64.zip \ https://chromedriver.storage.googleapis.com/115.0.5790.98/chromedriver_linux64.zip unzip chromedriver_linux64.zip sudo mv chromedriver /usr/local/bin/ sudo chmod +x /usr/local/bin/chromedriver</code></li></ol>



<h5>方案 B：自动管理（推荐开发环境）</h5>



<pre class="wp-block-code"><code>pip install webdriver-manager</code></pre>



<p>在脚本中使用时，示例代码：</p>



<pre class="wp-block-code"><code>from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service

# 自动下载并启动
service = Service(ChromeDriverManager().install())
options = webdriver.ChromeOptions()
# 如果在无头服务器上运行，加上下面两行：
# options.add_argument('--headless')
# options.add_argument('--no-sandbox')

driver = webdriver.Chrome(service=service, options=options)
driver.get("https://www.example.com")
print(driver.title)
driver.quit()</code></pre>



<p>完成以上步骤后，就可以在 Debian 上用 Python + Selenium + ChromeDriver 驱动真实的 Chrome 浏览器来做自动化测试或爬虫／RPA 了。</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/">Selenium（一） | Debian环境搭建</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Docker 清理</title>
		<link>https://wangqianhong.com/2024/04/docker-%e6%b8%85%e7%90%86/</link>
					<comments>https://wangqianhong.com/2024/04/docker-%e6%b8%85%e7%90%86/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sat, 27 Apr 2024 09:38:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Docker]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3869</guid>

					<description><![CDATA[<p>docker在使用的过程中会越来越臃肿，可以用下面的命令瘦身 Volume 用于持久化和共享容器数据&#8230; <a href="https://wangqianhong.com/2024/04/docker-%e6%b8%85%e7%90%86/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Docker 清理</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/docker-%e6%b8%85%e7%90%86/">Docker 清理</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>docker在使用的过程中会越来越臃肿，可以用下面的命令瘦身</p>



<p>Volume 用于持久化和共享容器数据，清理不再使用的 Volume 可以释放磁盘空间。常用的清理方法有：</p>



<ol><li><strong>查看现有 Volume</strong></li></ol>



<pre class="wp-block-code"><code># 列出所有 Volume
docker volume ls

# 只列出“悬空”（dangling，即未被任何容器使用）的 Volume
docker volume ls -f dangling=true</code></pre>



<ol start="2"><li><strong>删除单个 Volume</strong></li></ol>



<pre class="wp-block-code"><code># 删除指定名字的 Volume
docker volume rm VOLUME_NAME</code></pre>



<ol start="3"><li><strong>一键清理所有“悬空”Volume</strong></li></ol>



<pre class="wp-block-code"><code># 交互式确认
docker volume prune

# 或者跳过确认
docker volume prune -f</code></pre>



<p>此命令会删除所有未被任何容器使用的 Volume。</p>



<ol start="4"><li><strong>清理所有未使用的 Docker 资源（网络、镜像、容器、Volume）</strong><br>如果想一并清理所有未使用的资源，可以用：</li></ol>



<pre class="wp-block-code"><code>docker system prune --volumes</code></pre>



<p>它会：</p>



<ul><li>删除所有停止的容器</li><li>删除所有未用的网络</li><li>删除所有 dangling 镜像（中间层）</li><li>删除所有未使用的 Volume</li></ul>



<p>加上 <code>-a</code> 可以连同未被容器直接引用但不是 dangling 的镜像一并清理：</p>



<pre class="wp-block-code"><code>docker system prune -a --volumes</code></pre>



<ul><li><strong>谨慎操作</strong>：清理 Volume 会永久丢失其中的数据，务必确认不再需要或已做好备份。</li><li><strong>定期检查</strong>：在开发环境中频繁创建/删除容器，很容易积累大量悬空 Volume，可考虑配置 CI/CD 或定时任务自动执行 <code>docker volume prune -f</code>。</li><li><strong>脚本化清理</strong>：如果想针对名称模式或创建日期做更精细的清理，可以结合 <code>docker volume ls --format '{{.Name}} {{.CreatedAt}}'</code> 输出，再用 shell 脚本过滤并依次 <code>docker volume rm</code>。</li></ul>



<p>这样，你就可以根据需要，按容器级别或全局一次性地清理 Docker Volume，释放磁盘空间。</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/docker-%e6%b8%85%e7%90%86/">Docker 清理</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2024/04/docker-%e6%b8%85%e7%90%86/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debian系统配置</title>
		<link>https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/</link>
					<comments>https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Tue, 16 Apr 2024 06:20:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Debian]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3865</guid>

					<description><![CDATA[<p>Vim配置 修改 ~/.vimrc Debian软件源更新 使用清华的软件源 /etc/apt/so&#8230; <a href="https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Debian系统配置</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/">Debian系统配置</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<h3>Vim配置</h3>



<p>修改 <code>~/.vimrc</code></p>



<pre class="wp-block-code"><code>" 基础设置
set nocompatible        " 关闭兼容模式
set encoding=utf-8
set fileencodings=utf-8,gbk,latin1

" 界面美化
syntax on               " 启用语法高亮
set number              " 显示行号
set relativenumber      " 显示相对行号
set cursorline          " 高亮当前行
set showcmd             " 显示命令
set ruler               " 显示光标位置
set laststatus=2        " 总是显示状态栏
set wildmenu            " 命令行补全增强
set lazyredraw          " 执行宏时不重绘

" 编辑行为
set tabstop=4           " 一个 tab 显示 4 个空格
set shiftwidth=4        " 自动缩进使用 4 个空格
set expandtab           " 用空格代替 tab
set autoindent          " 自动缩进
set smartindent         " 智能缩进
set backspace=2         " 支持用退格删除缩进

" 搜索
set hlsearch            " 高亮搜索
set incsearch           " 增量搜索
set ignorecase          " 忽略大小写
set smartcase           " 智能大小写

" 鼠标支持
set mouse=n             " 在 Normal 模式下启用鼠标支持

" 系统剪贴板（需要 vim-gtk3 支持）
set clipboard=unnamedplus

" 中文支持优化
set helplang=cn
set langmenu=zh_CN.UTF-8
language messages zh_CN.UTF-8</code></pre>



<h3>Debian软件源更新</h3>



<p>使用清华的软件源 /etc/apt/source.list</p>



<pre class="wp-block-code"><code>deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware</code></pre>



<p></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/">Debian系统配置</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>如何开发一个AI应用</title>
		<link>https://wangqianhong.com/2024/04/%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aaai%e5%ba%94%e7%94%a8/</link>
					<comments>https://wangqianhong.com/2024/04/%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aaai%e5%ba%94%e7%94%a8/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Mon, 08 Apr 2024 06:10:17 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[AI]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3836</guid>

					<description><![CDATA[<p>开发一个完整的AI应用需要系统化的知识体系，以下是构成AI应用核心能力的四个关键环节及其技术细节与关&#8230; <a href="https://wangqianhong.com/2024/04/%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aaai%e5%ba%94%e7%94%a8/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">如何开发一个AI应用</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aaai%e5%ba%94%e7%94%a8/">如何开发一个AI应用</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>开发一个完整的AI应用需要系统化的知识体系，以下是构成AI应用核心能力的四个关键环节及其技术细节与关联关系的详细说明：</p>



<h3>大语言模型（Large Language Model, LLM）</h3>



<p><strong>核心价值</strong>：作为AI应用的认知中枢，承担核心推理与内容生成任务</p>



<p><strong>技术要点</strong>：</p>



<ol start="1"><li><strong>模型架构</strong>：</li></ol>



<ul><li>Transformer架构：基于自注意力机制的编码器-解码器结构</li><li>参数规模：从70亿到1.8万亿参数不等（如Llama-2到GPT-4架构）</li><li>预训练范式：自监督学习（掩码语言建模、下一句预测等）</li></ul>



<ol start="2"><li><strong>关键技术演进</strong>：</li></ol>



<pre class="wp-block-code"><code>   graph LR
     BERT-->RoBERTa-->DeBERTa
     GPT-2-->GPT-3-->GPT-4
     T5-->FLAN-T5-->PaLM</code></pre>



<ol start="3"><li><strong>应用场景</strong>：</li></ol>



<ul><li>文本生成（代码/文案/故事）</li><li>问答系统</li><li>多模态理解（文本+图像/视频）</li></ul>



<ol start="4"><li><strong>优化方向</strong>：</li></ol>



<ul><li>量化压缩（4-bit/8-bit量化）</li><li>微调方法（LoRA/P-Tuning）</li><li>推理加速（vLLM/TensorRT-LLM）</li></ul>



<p></p>



<h3>Embedding技术</h3>



<p><strong>核心价值</strong>：实现语义到向量空间的映射，构建AI认知的数学基础</p>



<p><strong>技术解析</strong>：</p>



<ol><li><strong>特征表示方法</strong>：</li></ol>



<ul><li>静态嵌入：Word2Vec/GloVe</li><li>动态嵌入：BERT/ELMo</li><li>多模态嵌入：CLIP/ImageBind</li></ul>



<ol start="2"><li><strong>数学特性</strong>：</li></ol>



<ul><li>维度：主流模型输出768-4096维向量</li><li>相似度计算：余弦相似度/欧氏距离</li><li>空间性质：保持语义拓扑结构（king &#8211; man + woman = queen）</li></ul>



<ol start="3"><li><strong>性能指标</strong>：</li></ol>



<pre class="wp-block-code"><code>   # 相似度计算示例
   from sklearn.metrics.pairwise import cosine_similarity
   similarity = cosine_similarity(query_embedding, doc_embeddings)</code></pre>



<ol start="4"><li><strong>优化策略</strong>：</li></ol>



<ul><li>领域自适应训练</li><li>降维处理（PCA/t-SNE）</li><li>混合嵌入融合</li></ul>



<p></p>



<h3>向量数据库（Vector Database）</h3>



<p><strong>核心价值</strong>：构建AI应用的长期记忆系统，实现高效语义检索</p>



<p><strong>架构设计</strong>：</p>



<pre class="wp-block-code"><code>graph TD
    A&#91;数据输入] --> B&#91;Embedding模型]
    B --> C&#91;向量化处理]
    C --> D&#91;索引构建]
    D --> E&#91;存储优化]
    E --> F&#91;查询接口]</code></pre>



<p><strong>核心技术要素</strong>：</p>



<ol start="1"><li><strong>索引算法</strong>：</li></ol>



<ul><li>树状结构：ANNOY</li><li>图结构：HNSW</li><li>量化方法：PQ(Product Quantization)</li></ul>



<ol start="2"><li><strong>性能对比</strong>： 数据库类型 查询速度 内存占用 精度 FAISS 10ms 低 高 Milvus 15ms 中 极高 Pinecone 20ms 高 极高</li><li><strong>关键技术</strong>：</li></ol>



<ul><li>混合检索（向量+标量）</li><li>动态更新（增量索引）</li><li>分布式架构</li></ul>



<p></p>



<h3>提示工程（Prompt Engineering）</h3>



<p><strong>核心价值</strong>：构建人机交互的语义桥梁，释放LLM最大潜能</p>



<p><strong>方法论体系</strong>：</p>



<ol start="1"><li><strong>核心范式</strong>：</li></ol>



<ul><li>Zero-shot提示</li><li>Few-shot提示</li><li>Chain-of-Thought</li></ul>



<ol start="2"><li><strong>设计模式</strong>：</li></ol>



<pre class="wp-block-code"><code>   # 结构化提示模板
   prompt_template = """
   &#91;系统指令] 你是一个资深金融分析师
   &#91;背景知识] 当前市场处于牛市阶段
   &#91;输入数据] {user_input}
   &#91;输出要求] 用Markdown格式输出分析报告
   """</code></pre>



<ol start="3"><li><strong>优化技术</strong>：</li></ol>



<ul><li>自动提示生成（AutoPrompt）</li><li>梯度引导优化（ProGen）</li><li>多模态提示设计</li></ul>



<ol start="4"><li><strong>评估指标</strong>：</li></ol>



<ul><li>任务完成度（0-1）</li><li>输出相关性（BLEU/ROUGE）</li><li>事实准确性（FactScore）</li></ul>



<p></p>



<h3>系统集成</h3>



<p><strong>典型架构</strong>：</p>



<pre class="wp-block-code"><code>sequenceDiagram
    用户->>前端: 输入查询
    前端->>API网关: 转发请求
    API网关->>LLM: 生成初步响应
    LLM->>向量数据库: 检索相关知识
    向量数据库-->>LLM: 返回相关文档
    LLM->>提示引擎: 优化输出格式
    提示引擎-->>用户: 返回最终响应</code></pre>



<p><strong>性能优化点</strong>：</p>



<ol><li>端到端延迟控制（&lt;2s）</li><li>缓存策略（请求/响应缓存）</li><li>负载均衡（模型并行/流水线并行）</li></ol>



<p></p>



<h3>典型应用场景</h3>



<ol start="1"><li><strong>智能客服系统</strong>：</li></ol>



<ul><li>意图识别（Embedding）</li><li>知识检索（向量数据库）</li><li>对话生成（LLM+Prompt）</li></ul>



<ol start="2"><li><strong>企业知识库</strong>：</li></ol>



<ul><li>文档向量化（Embedding）</li><li>语义搜索（向量数据库）</li><li>摘要生成（LLM）</li></ul>



<ol start="3"><li><strong>推荐系统</strong>：</li></ol>



<ul><li>用户画像嵌入</li><li>内容相似度匹配</li><li>个性化生成</li></ul>



<p>这四个核心环节构成了现代AI应用的基石，实际开发中需要根据具体场景进行深度优化和定制。例如在医疗领域，可能需要使用领域专用的BioBERT模型，配合医学知识图谱的向量化存储，并通过严谨的提示工程确保输出的专业性。技术选型时需要平衡计算资源、响应延迟和准确率等关键指标，最终构建出高效可靠的AI应用系统。</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aaai%e5%ba%94%e7%94%a8/">如何开发一个AI应用</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2024/04/%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aaai%e5%ba%94%e7%94%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hugo 介绍</title>
		<link>https://wangqianhong.com/2022/10/hugo-%e4%bb%8b%e7%bb%8d/</link>
					<comments>https://wangqianhong.com/2022/10/hugo-%e4%bb%8b%e7%bb%8d/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sat, 22 Oct 2022 00:36:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Go]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3898</guid>

					<description><![CDATA[<p>概览 Hugo 是用 Go 写的高速静态站点生成器（Static Site Generator），以&#8230; <a href="https://wangqianhong.com/2022/10/hugo-%e4%bb%8b%e7%bb%8d/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Hugo 介绍</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/hugo-%e4%bb%8b%e7%bb%8d/">Hugo 介绍</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<h3>概览</h3>



<p>Hugo 是用 <strong>Go</strong> 写的高速静态站点生成器（Static Site Generator），以超快的构建速度、灵活的模板系统和丰富的功能集合著称，适合博客、文档、公司站、Landing Page 等场景。 (<a href="https://github.com/gohugoio/hugo">GitHub</a>)</p>



<h3>核心特点</h3>



<ul><li><strong>极快的构建速度</strong>：能在秒级甚至毫秒/页级别生成大型站点（这也是 Hugo 的主要卖点）。 (<a href="https://gohugo.io/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>单个二进制即可运行</strong>：Hugo 是一个可独立运行的二进制 CLI，安装/部署非常简单。 (<a href="https://github.com/gohugoio/hugo">GitHub</a>)</li><li><strong>基于文件的内容模型</strong>：内容通常用 Markdown（或其他格式）放在 <code>content/</code>，通过 front matter（YAML/TOML/JSON）控制元数据与 taxonomies（分类/标签）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>强大的模板系统</strong>：使用 Go template 引擎，支持短代码（shortcodes）、布局继承、局部模板、数据模板等。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>内建资源处理（assets）</strong>：支持 image processing、SCSS/SASS 管道、JS/CSS 压缩、Fingerprinting 等静态资源管线。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>多语言/国际化（i18n）支持</strong>：内建多语言站点支持。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>丰富的主题生态</strong>：有官方/社区维护的主题库，可直接套用或作为起点。 (<a href="https://github.com/gohugoio/hugoThemesSiteBuilder?utm_source=chatgpt.com">GitHub</a>)</li></ul>



<h3>关键概念</h3>



<ul><li><strong>content/</strong>：你的 Markdown 文件和目录结构（每个文件是一个“页面”或文章）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>layouts/</strong>：模板目录（决定最终 HTML 的呈现）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>archetypes/</strong>：新建文章的模板（如 <code>hugo new</code> 时使用）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>shortcodes</strong>：在 Markdown 中使用的可复用模板片段（比如嵌入视频、响应式图集等）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>data/</strong>：可以放 JSON/YAML/TOML 的数据文件，在模板中直接读取并渲染（适合制作动态目录或外部数据驱动的页面）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li></ul>



<h3>内部实现 &amp; 技术亮点</h3>



<ul><li>用 <strong>Go</strong> 实现：跨平台构建、单二进制分发，编译后的二进制体积小、启动快。 (<a href="https://github.com/gohugoio/hugo">GitHub</a>)</li><li>模板基于 Go 的 <code>text/template</code>/<code>html/template</code>，性能与安全性好，但模板语法与某些其他 SSG（如 Liquid）略有差异，需要适应。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li>静态资源处理（image resizing、Sass/SCSS、concat/minify、fingerprint）内置在 Hugo 的管道里，减少额外构建工具依赖。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li></ul>



<h3>常用命令</h3>



<p>假设已安装 <code>hugo</code> 二进制（见安装文档）：</p>



<pre class="wp-block-code"><code># 新建站点
hugo new site mysite

# 本地预览（开发服务器，实时热重载）
hugo server -D

# 新建一篇文章（会根据 archetype 自动填 front matter）
hugo new posts/my-first-post.md

# 生成静态站点（输出到 public/）
hugo -v

# 指定输出目录
hugo --destination ./dist
</code></pre>



<p>（这些命令与教程在官方文档/入门页可查到）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</p>



<h3>部署与托管</h3>



<p>Hugo 生成静态文件后可托管到任何静态站点主机或 CDN：</p>



<ul><li><strong>GitHub Pages</strong>（通过 gh-pages 或 actions 自动部署）。 (<a href="https://gohugo.io/host-and-deploy/host-on-github-pages/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>Netlify</strong>（支持自动构建、预览分支、表单、函数等）。 (<a href="https://docs.netlify.com/build/frameworks/framework-setup-guides/hugo/?utm_source=chatgpt.com">Netlify Docs</a>)</li><li><strong>Cloudflare Pages / AWS S3 + CloudFront / Vercel</strong> 等静态托管或边缘平台均可。 (<a href="https://developers.cloudflare.com/pages/framework-guides/deploy-a-hugo-site/?utm_source=chatgpt.com">Cloudflare Docs</a>)</li></ul>



<h3>生态与社区</h3>



<ul><li><strong>主题库</strong>：官方/社区主题集中在 themes.gohugo.io（也有 GitHub 仓库索引）。 (<a href="https://github.com/gohugoio/hugoThemesSiteBuilder?utm_source=chatgpt.com">GitHub</a>)</li><li><strong>活跃发布与维护</strong>：Hugo 发布频繁（可查看 Releases 页面与官方 News 列表），社区活跃。 最近若干次小版本和功能更新详见 Releases。 (<a href="https://github.com/gohugoio/hugo/releases?utm_source=chatgpt.com">GitHub</a>)</li><li><strong>文档齐全</strong>：官方文档覆盖安装、模板、管道、部署等，适合查阅与学习。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li></ul>



<h3>优点 / 适用场景</h3>



<p><strong>优点</strong></p>



<ul><li>构建速度快（大型站点也能秒级完成）。 (<a href="https://gohugo.io/?utm_source=chatgpt.com">gohugo.io</a>)</li><li>无需运行时服务器（生成静态文件后可放 CDN），运维成本低。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li>内置丰富的功能（图像处理、管道、多语言、taxonomy），减少外部工具依赖。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li></ul>



<p><strong>适用场景</strong></p>



<ul><li>个人/团队博客、技术文档站、公司站、产品落地页、知识库（非交互式）等。 (<a href="https://gohugo.io/?utm_source=chatgpt.com">gohugo.io</a>)</li></ul>



<h3>缺点 / 需要注意的点</h3>



<ul><li><strong>不是动态应用框架</strong>：对需要用户交互（登录、动态评论、实时功能）的场景，需要额外接入服务（如 Netlify Functions、第三方评论、后台 API）。</li><li><strong>模板学习曲线</strong>：Go template 的语法/模板逻辑对新手可能有点不直观（尤其从 Liquid/Handlebars 转来）。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li><strong>部分高级功能依赖构建时逻辑</strong>：例如需要 CMS（内容管理后台）可以用 Netlify CMS、Forestry、Netlify CMS 等第三方或 headless CMS 来配合。<br>（这些是选择 SSG 时通用的权衡点。）</li></ul>



<h3>实操建议</h3>



<ol><li>先在本地用 <code>hugo new site</code> + 一个社区主题 快速搭建并用 <code>hugo server -D</code> 调试。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li><li>把站点托管在 Git 仓库，配置 CI（GitHub Actions / GitLab CI / Netlify）在 push 时自动 <code>hugo</code> 构建并部署到静态托管服务。 (<a href="https://gohugo.io/host-and-deploy/host-on-github-pages/?utm_source=chatgpt.com">gohugo.io</a>)</li><li>若要图像优化或 Sass 管理，优先尝试 Hugo 内置的资源管道，必要时再补充外部构建工具。 (<a href="https://gohugo.io/about/introduction/?utm_source=chatgpt.com">gohugo.io</a>)</li></ol>



<h3>参考与文档</h3>



<ul><li>官方 GitHub 仓库（源码、Issues、Releases）：gohugoio/hugo。 (<a href="https://github.com/gohugoio/hugo">GitHub</a>)</li><li>官方站点与文档（入门、模板、管道、部署）：gohugo.io。 (<a href="https://gohugo.io/?utm_source=chatgpt.com">gohugo.io</a>)</li><li>Releases（查看最近版本、变更日志）：GitHub Releases。 (<a href="https://github.com/gohugoio/hugo/releases?utm_source=chatgpt.com">GitHub</a>)</li><li>主题库（themes.gohugo.io / 主题索引仓库）。 (<a href="https://github.com/gohugoio/hugoThemesSiteBuilder?utm_source=chatgpt.com">GitHub</a>)</li></ul>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/hugo-%e4%bb%8b%e7%bb%8d/">Hugo 介绍</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/10/hugo-%e4%bb%8b%e7%bb%8d/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debian中的vi开启鼠标右键功能</title>
		<link>https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/</link>
					<comments>https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Fri, 14 Oct 2022 12:53:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Debian]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3863</guid>

					<description><![CDATA[<p>debian系统中用鼠标右键粘贴时，会导致后面内容出错，可以修改vi的配置/usr/share/vi&#8230; <a href="https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Debian中的vi开启鼠标右键功能</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/">Debian中的vi开启鼠标右键功能</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>debian系统中用鼠标右键粘贴时，会导致后面内容出错，可以修改vi的配置<code>/usr/share/vim/vim90/defaults.vim</code></p>



<pre class="wp-block-preformatted">把<code>set mouse=a</code>修改为<code>set mouse-=a</code></pre>



<p>报错修改就可以正常使用鼠标右键功能</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/">Debian中的vi开启鼠标右键功能</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Bleve 查询时如何处理特殊字符</title>
		<link>https://wangqianhong.com/2022/10/bleve-%e6%9f%a5%e8%af%a2%e6%97%b6%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e7%89%b9%e6%ae%8a%e5%ad%97%e7%ac%a6/</link>
					<comments>https://wangqianhong.com/2022/10/bleve-%e6%9f%a5%e8%af%a2%e6%97%b6%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e7%89%b9%e6%ae%8a%e5%ad%97%e7%ac%a6/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sun, 09 Oct 2022 02:43:23 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Bleve]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3849</guid>

					<description><![CDATA[<p>Bleve（https://github.com/blevesearch/bleve）是一个全文检索&#8230; <a href="https://wangqianhong.com/2022/10/bleve-%e6%9f%a5%e8%af%a2%e6%97%b6%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e7%89%b9%e6%ae%8a%e5%ad%97%e7%ac%a6/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Bleve 查询时如何处理特殊字符</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/bleve-%e6%9f%a5%e8%af%a2%e6%97%b6%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e7%89%b9%e6%ae%8a%e5%ad%97%e7%ac%a6/">Bleve 查询时如何处理特殊字符</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>Bleve（<a href="https://github.com/blevesearch/bleve" target="_blank" rel="noreferrer noopener">https://github.com/blevesearch/bleve</a>）是一个全文检索库，用于Go语言。它支持各种查询类型。</p>



<p>Bleve在存储mime_type字段，有类似“image/jpeg”这样数据的时候，我们可以设置字段的Analyzer为keyword，不分词查询：</p>



<pre class="wp-block-code"><code>fileMapping := bleve.NewIndexMapping()
fileMapping.DefaultAnalyzer = "keyword"
docMapping := bleve.NewDocumentMapping()
// 关键字类型字段，不分词
keywordField := bleve.NewKeywordFieldMapping()
docMapping.AddFieldMappingsAt("mime_type", keywordField)
fileMapping.AddDocumentMapping("file", docMapping)
index, err = bleve.New(path, fileMapping)
if err != nil {
	return err
}</code></pre>



<p>可以使用下面代码查看keyword是否生效：</p>



<pre class="wp-block-code"><code>// 获取 mime_type 字段的所有词条
fieldDict, _ := index.FieldDict("mime_type")
defer fieldDict.Close()

for {
	termEntry, err := fieldDict.Next()
	if err != nil || termEntry == nil {
		break
	}
	fmt.Printf("Term: %s\n", termEntry.Term)
}</code></pre>



<p>如果结果是Term: image/jpeg，就表示映射设置成功了</p>



<p>当使用NewPrefixQuery时，可以保证查询的时候，对关键词使用keyword分析器，不进行分词查询</p>



<pre class="wp-block-code"><code>prefixQuery := bleve.NewPrefixQuery(mimeType)
prefixQuery.SetField("mime_type")
prefixSearch := bleve.NewSearchRequest(prefixQuery)
prefixResults, err := index.Search(prefixSearch)
if err != nil {
	return err
}
fmt.Printf("前缀查询结果数: %d", prefixResults.Total)</code></pre>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/bleve-%e6%9f%a5%e8%af%a2%e6%97%b6%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e7%89%b9%e6%ae%8a%e5%ad%97%e7%ac%a6/">Bleve 查询时如何处理特殊字符</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/10/bleve-%e6%9f%a5%e8%af%a2%e6%97%b6%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e7%89%b9%e6%ae%8a%e5%ad%97%e7%ac%a6/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nextcloud文档在线协作Collabora服务的部署</title>
		<link>https://wangqianhong.com/2022/09/nextcloud%e6%96%87%e6%a1%a3%e5%9c%a8%e7%ba%bf%e5%8d%8f%e4%bd%9ccollabora%e6%9c%8d%e5%8a%a1%e7%9a%84%e9%83%a8%e7%bd%b2/</link>
					<comments>https://wangqianhong.com/2022/09/nextcloud%e6%96%87%e6%a1%a3%e5%9c%a8%e7%ba%bf%e5%8d%8f%e4%bd%9ccollabora%e6%9c%8d%e5%8a%a1%e7%9a%84%e9%83%a8%e7%bd%b2/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sun, 04 Sep 2022 08:56:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[nextcloud]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3718</guid>

					<description><![CDATA[<p>搭建个人文件系统，采用了NextCloud + Collabora 的方式搭建，方便大家分享文档和保&#8230; <a href="https://wangqianhong.com/2022/09/nextcloud%e6%96%87%e6%a1%a3%e5%9c%a8%e7%ba%bf%e5%8d%8f%e4%bd%9ccollabora%e6%9c%8d%e5%8a%a1%e7%9a%84%e9%83%a8%e7%bd%b2/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Nextcloud文档在线协作Collabora服务的部署</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/09/nextcloud%e6%96%87%e6%a1%a3%e5%9c%a8%e7%ba%bf%e5%8d%8f%e4%bd%9ccollabora%e6%9c%8d%e5%8a%a1%e7%9a%84%e9%83%a8%e7%bd%b2/">Nextcloud文档在线协作Collabora服务的部署</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>搭建个人文件系统，采用了NextCloud + Collabora 的方式搭建，方便大家分享文档和保存文档使用，并可以在线协助编辑文档。</p>



<h3>部署mysql</h3>



<p>首先部署数据库，如果只是测试，也可以不安装数据库，直接使用sqlite做数据库即可，但如果是生产环境，建议使用其他数据库：</p>



<pre class="wp-block-code"><code>docker run --name nextcloud_db -e TZ='Asia/Shanghai' -e MYSQL_ROOT_PASSWORD='你的密码' -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -e MYSQL_PASSWORD='你的密码' -v /你的路径/mysql_data:/var/lib/mysql -p 3306:3306  -td  mysql:8.4</code></pre>



<h3>部署nextcloud</h3>



<pre class="wp-block-code"><code>docker run --name nextcloud -e TZ='Asia/Shanghai' -e MYSQL_HOST=localhost:3306 -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -v /你的路径/collabora_data:/var/www/html/data -p 8080:80  -td  nextcloud:production</code></pre>



<p>部署完成之后，通过http://&lt;服务器IP>:8080 完成配置</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="563" height="828" src="https://wangqianhong.com/wp-content/uploads/2024/11/image.png" alt="" class="wp-image-3722" srcset="https://wangqianhong.com/wp-content/uploads/2024/11/image.png 563w, https://wangqianhong.com/wp-content/uploads/2024/11/image-204x300.png 204w" sizes="(max-width: 563px) 100vw, 563px" /></figure>



<h3>部署collabora</h3>



<pre class="wp-block-code"><code>docker run --name nextcloud_collabora -e TZ='Asia/Shanghai' -e domain=服务器IP -e username=admin -e password='你的密码'  -e "extra_params=--o:ssl.enable=false" --cap-add MKNOD -p 9980:9980  -td  collabora/code:24.04.9.1.1</code></pre>



<p>安装完成之后，访问http://&lt;服务器IP>:9980 如果页面显示ok，表示安装成功</p>



<h3>安装netcloud office插件</h3>



<p>由于自动下载安装插件需要翻墙，所以这里需要下载离线安装包，并手动安装</p>



<p>访问<a href="https://apps.nextcloud.com/" target="_blank" rel="noreferrer noopener">https://apps.nextcloud.com/</a>，搜索collabora online和nextcloud office，然后下载离线安装包 richdocuments和richdocumentscode</p>



<pre class="wp-block-preformatted">#把安装包复制到对应的目录下面
<code>docker cp richdocumentscode.tar.gz nextcloud:/var/www/html/apps</code>

#进入容器
<code>docker exec -it -uroot nextcloud /bin/bash</code>

#解压文件并修改权限
<code>tar -zxvf richdocumentscode.tar.gz</code>
<code>chown www-data:www-data richdocumentscode -R</code>

#另一个安装包也是同样的操作
</pre>



<p>退出容器，然后重启</p>



<pre class="wp-block-code"><code>docker restart nextcloud</code></pre>



<p>重启之后，在<code>http://&lt;服务器IP>:8080/settings/apps/disabled</code>下面启用Collabora Online &#8211; Built-in CODE Server和Nextcloud Office插件</p>



<p>然后在<code>http://&lt;服务器IP>:8080/settings/admin/richdocuments</code>下选择使用自有服务器，设置collabora的服务器地址：</p>



<pre class="wp-block-code"><code>http://&lt;服务器IP>:9980/</code></pre>



<p>点击保存，在上面会显示连接成功</p>



<pre class="wp-block-preformatted">Collabora Online 服务器可以访问。
Collabora Online Development Edition 24.04.9.1 55317ef
<strong>浏览器使用的 URL：</strong> <code>http://&lt;服务器IP>:9980</code>
<strong>Collabora 使用的 Nextcloud URL：</strong> <code>http://&lt;服务器IP>:8080</code> <em>(Determined from the browser URL)</em></pre>



<p></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/09/nextcloud%e6%96%87%e6%a1%a3%e5%9c%a8%e7%ba%bf%e5%8d%8f%e4%bd%9ccollabora%e6%9c%8d%e5%8a%a1%e7%9a%84%e9%83%a8%e7%bd%b2/">Nextcloud文档在线协作Collabora服务的部署</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/09/nextcloud%e6%96%87%e6%a1%a3%e5%9c%a8%e7%ba%bf%e5%8d%8f%e4%bd%9ccollabora%e6%9c%8d%e5%8a%a1%e7%9a%84%e9%83%a8%e7%bd%b2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSSL 自签名证书</title>
		<link>https://wangqianhong.com/2022/08/openssl-%e8%87%aa%e7%ad%be%e5%90%8d%e8%af%81%e4%b9%a6/</link>
					<comments>https://wangqianhong.com/2022/08/openssl-%e8%87%aa%e7%ad%be%e5%90%8d%e8%af%81%e4%b9%a6/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Thu, 25 Aug 2022 12:47:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[openssl]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3705</guid>

					<description><![CDATA[<p>使用 OpenSSL 生成 TLS 自签名证书和自签名 CA 通常包括以下几个步骤： 生成自签名 C&#8230; <a href="https://wangqianhong.com/2022/08/openssl-%e8%87%aa%e7%ad%be%e5%90%8d%e8%af%81%e4%b9%a6/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">OpenSSL 自签名证书</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/08/openssl-%e8%87%aa%e7%ad%be%e5%90%8d%e8%af%81%e4%b9%a6/">OpenSSL 自签名证书</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>使用 OpenSSL 生成 TLS 自签名证书和自签名 CA 通常包括以下几个步骤：</p>



<h3>生成自签名 CA 证书</h3>



<p>首先，生成 CA 私钥和 CA 自签名证书。CA 证书用于签署 TLS 服务器证书</p>



<pre class="wp-block-code"><code>openssl genrsa -out ca.key 4096</code></pre>



<p>这将生成一个 4096 位的 RSA 私钥并保存为 <code>ca.key</code> 文件。</p>



<pre class="wp-block-code"><code>openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.crt</code></pre>



<ul><li>-x509 表示生成自签名证书</li><li>-new 表示创建一个新的证书请求</li><li>-nodes 表示不对私钥加密</li><li>-key ca.key 表示使用之前生成的 ca.key 私钥</li><li>-days 3650 表示证书有效期为 3650 天（约 10 年）</li><li>-out ca.crt 表示将证书保存为 ca.crt</li></ul>



<p>提示填写证书的信息（如国家代码、组织名、域名等），这些信息会包含在 CA 证书中。</p>



<h3>生成服务器的私钥和证书请求 (CSR)</h3>



<p>接下来，为服务器生成私钥和证书签名请求 (CSR)：</p>



<pre class="wp-block-code"><code>openssl genrsa -out server.key 2048</code></pre>



<p>这将生成一个 2048 位的 RSA 私钥并保存为 server.key。</p>



<pre class="wp-block-code"><code>openssl req -new -key server.key -out server.csr</code></pre>



<ul><li>-new 表示生成一个新的证书请求</li><li>-key server.key 表示使用刚才生成的服务器私钥</li><li>-out server.csr 表示生成的 CSR 文件名为 server.csr</li></ul>



<p>在此过程中，需要填写有关服务器的信息，最重要的是 Common Name (CN)，应填写服务器域名或 IP 地址。</p>



<h3>用 CA 签署服务器证书</h3>



<p>现在，使用之前生成的自签名 CA 证书和私钥来签署服务器证书请求。</p>



<pre class="wp-block-code"><code>openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 825 -sha256</code></pre>



<ul><li>-req 表示基于证书请求 (CSR) 生成证书</li><li>-CA ca.crt 表示使用 CA 证书来签署服务器证书</li><li>-CAkey ca.key 表示使用 CA 的私钥来签署证书</li><li>-CAcreateserial 表示自动生成一个 ca.srl 文件，保存 CA 的序列号</li><li>-out server.crt 表示将生成的服务器证书保存为 server.crt</li><li>-days 825 表示证书的有效期为 825 天</li><li>-sha256 表示使用 SHA256 进行签名</li></ul>



<h3>验证生成的证书</h3>



<p>可以使用以下命令来检查生成的证书是否有效：</p>



<pre class="wp-block-code"><code>openssl x509 -in server.crt -text -noout</code></pre>



<p>这将显示 server.crt 的详细信息。</p>



<h3>配置 TLS</h3>



<ul><li>ca.crt 是自签名 CA 证书，可以分发给客户端，供其信任</li><li>server.crt 是服务器证书，用于配置在你的服务器上</li><li>server.key 是服务器私钥，用于安全连接</li></ul>



<p>你可以将这些文件用于设置 HTTPS 服务器或其他 TLS 应用。</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/08/openssl-%e8%87%aa%e7%ad%be%e5%90%8d%e8%af%81%e4%b9%a6/">OpenSSL 自签名证书</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/08/openssl-%e8%87%aa%e7%ad%be%e5%90%8d%e8%af%81%e4%b9%a6/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
