Update docs and sort content

This commit is contained in:
github-actions[bot]
2025-02-21 11:19:40 +00:00
parent 4288d472c7
commit d70d2af9d1
8 changed files with 327 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -0,0 +1,99 @@
---
astroType: null
author: KazooTTT
category: 碎片
date: 2025-02-20T00:00:00.000Z
date_created: 2025-02-11T15:38:40.000Z
date_modified: 2025-02-21T08:25:07.000Z
description: null
published: true
slug: openwebui-long-loading-white-screen-solution
tags:
- 碎片
- docker
- ollama
- openwebui
title: 碎片-2025-02-20 21时22分 openwebui长时间白屏解决方案
toAstro: true
toJuejin: false
toWexin: true
---
#ollama #openwebui #docker
最近 deepseek 的大火,官方服务响应缓慢或者宕机,再加上其他云平台厂商也开始免费提供 deepseek 的模型服务,赠送一定额度的 tokens 供用户使用。用户自己接入 api 再次成为了一个热门的使用场景web 端的 lobe chat、openwebui 都是不错的选择。
本篇文章主要用于记录 [open-webui](<https://github.com/open-webui/open-webui>) 的长时间白屏的原因和具体的解决方案。
## 现象描述
我在 nas 和 macos 上都通过 docker 部署了 open-webui 的服务。
macos 上访问无异常nas 上登录后会白屏一段时间后才显示对话界面,观察到是一个现象是 `/api/models` 这个接口响应速度很慢
![IMG-DEAEF41B70E00D753CD9E7E2FE6AAF3C](<https://pictures.kazoottt.top/2025/02/20250221-IMG-DEAEF41B70E00D753CD9E7E2FE6AAF3C.jpg>)
搜索关键词后发现有人遇到了一样的问题
[SSLCertVerificationError when adding HTTPS openai api url](<https://github.com/open-webui/open-webui/discussions/3702?continueFlag=46552421a3aff8d4ecb9d5f2841ef485>)
问题中提到无法访问 `api.openai.com`
![IMG-5F83BC41FC57FAD259E87E280FE00FF0](<https://pictures.kazoottt.top/2025/02/20250221-IMG-5F83BC41FC57FAD259E87E280FE00FF0.jpg>)
这是因为在 open-webui 网页加载的时候,会从配置中读取各个接入的服务的配置,然后返回用户可以选择的额模型列表。
而在我们没有做任何配置的情况下openai 的服务是默认接入的,所以会去查询 openai 的服务哪些可以用,但是因为网络无法访问,所以会一直等待,直到超时。
注意:此问题与模型服务提供商无关,是 OpenWebUI 默认配置导致的前端阻塞。
## 解决方案
所以当在某些不具备访问 openai 接口的环境下,要避免长时间白屏直到/api/models 超时才显示对话界面,解决方法如下:
### 第一种: 在设置中关闭 openai 的接入勾选
1. 右上角点击头像,点击设置菜单 p3
![IMG-08A71B3CE5F6749EC5A310AE2807A0CF](<https://pictures.kazoottt.top/2025/02/20250221-IMG-08A71B3CE5F6749EC5A310AE2807A0CF.jpg>)
2. 点击管理员设置,跳转至管理员设置页面 p4
![IMG-5C87DCCA7434D6913A727FC5F3D4A18A](<https://pictures.kazoottt.top/2025/02/20250221-IMG-5C87DCCA7434D6913A727FC5F3D4A18A.jpg>)
3. 点击外部连接 - 取消 openai 的勾选,点击右下角的保存(一定要记得点保存)
![IMG-CED4BB374BFAB7E40D425A1822603C25](<https://pictures.kazoottt.top/2025/02/20250221-IMG-CED4BB374BFAB7E40D425A1822603C25.jpg>)
### 第二种:启动之前设置环境变量 ENABLE_OPENAI_API=0
[enh: speedup open\_webui.main.get\_all\_models()](<https://github.com/open-webui/open-webui/discussions/7769>)
![IMG-B5850B37C58BB64070CFFF56871C61F8](<https://pictures.kazoottt.top/2025/02/20250221-IMG-B5850B37C58BB64070CFFF56871C61F8.jpg>)
举个例子:
``` bash
docker run -d \
--name openwebui \
-e ENABLE_OPENAI_API=0 \ # 启动的时候配置环境变量
-p 3000:8080 \
--volume openwebui:/app/backend/data \
ghcr.io/open-webui/open-webui:main
```
---
另外我去翻了一下源代码,这里的意思是:
![IMG-D5F37B7896723B2F83BFF77527127033](<https://pictures.kazoottt.top/2025/02/20250221-IMG-D5F37B7896723B2F83BFF77527127033.png>)
- 如果环境变量 ENABLE_OPENAI_API 没有被设置过,那么默认为 true也就是启用
- 如果有被设置过,会把 ENABLE_OPENAI_API 转化为全小写的单词与 true 进行比较
所以也就是说如果要设置环境变量以达到禁用 ENABLE_OPENAI_API 的目的,写法是:设置一个值,且这个值被转化为小写之后不能是 true。
所以:
- 满足要求false,0
- 不满足要求true,True,tRue
---
## 总结
若需使用 OpenAI 服务,请确保服务器具备国际网络访问能力,否则请按照上述解决方案禁用 openai 的接入。

View File

@ -0,0 +1,151 @@
---
toAstro: true
astroType:
- post
toWexin: null
toJuejin: null
title: rsshub中新增asianfanfics路由
date: 2025-02-21T00:00:00.000Z
author: KazooTTT
tags:
- 脑洞
- asianfanfics
- rss
- rsshub
description: null
slug: fragmented-notes-2025-02-21-16-38-50
published: true
category: 碎片
date_created: 2025-02-11T15:38:40.000Z
date_modified: 2025-02-21T11:17:55.000Z
---
突然想订阅 #asianfanfics 某个 Tag 或者搜索关键词的更新,打算用 rsshub 来实现,在 follow 中订阅。
举个例子:<https://www.asianfanfics.com/browse/tag/milklove/N>
代表 tag 为 milklove排序类型为 newest最近发布的所有文章
通过查看 devtool 的请求发现,所需数据并非接口而是一个静态网页:
![IMG-803E576335AF5653F8963BE7881E4DD8](/mdImages/IMG-803E576335AF5653F8963BE7881E4DD8.png)
具体的内容:
![IMG-C54B455556952B47DBE32B14D26E5548](/mdImages/IMG-C54B455556952B47DBE32B14D26E5548.png)
示例代码
[[IMG-E759B225225068DF0D09FBD60313AEF3.html]]
手动剔除掉无关的元素之后,剩下的结构为:
![IMG-5ECA04383C3D96B4A767C5A0B3463E19](/mdImages/IMG-5ECA04383C3D96B4A767C5A0B3463E19.png)
观察了一下,获取文章列表就是找到 primary-container 中的所有的.excerpt
现在再来看单个的.excerpt
``` html
<section class="excerpt">
<div class="clearfix">
<h1 class="excerpt__title">
<a href="/story/view/1623986/n-a">《出走信仰》</a>
</h1>
<div class="excerpt__meta">
<div class="excerpt__meta__main">
<div class="excerpt__meta__name">
By <a href="/profile/u/DebrisL">DebrisL </a>
Published
<time datetime="2025-02-21 06:58:08" class="text--regular">Feb 21, 2025 06:58:08
</time>
</div>
<div class="excerpt__meta__tags">
Tags &nbsp;<a href='/browse/tag/milklove'>milklove</a>
&nbsp;
</div>
<div class="excerpt__meta__views">
With
<span class="text--regular">
<strong>2</strong>
subscribers, <strong>1460</strong>
views, <strong>514</strong>
words
</span>
</div>
<div class="excerpt__meta__status">
Status <em class="text--regular">[M]</em>
</div>
</div>
</div>
</div>
</section>
```
可以从这个 excerpt 中获取到的信息
1. 链接
excerpt__title a 的 href
2. 标题
excerpt__title 的 text
3. 作者的 name
excerpt__meta__name 的 text
4. 发布时间
excerpt__meta__main time 的 datetime
而一个 rss item 需要的信息,上述内容都可以满足。
``` xml
<item>
<title>2025-W07</title>
<link>https://blog.kazoottt.top/posts/2025-W07/</link>
<guid isPermaLink="true">https://blog.kazoottt.top/posts/2025-W07/</guid>
<pubDate>Sun, 16 Feb 2025 00:00:00 GMT</pubDate>
<content:encoded> </content:encoded>
<category>周报</category>
<author>KazooTTT</author>
</item>
```
观察和调研结束,我们开始用 rsshub 来实现。
## 实现步骤
pr 地址 [feat(route): add asianfanfics route #18430](<https://github.com/DIYgod/RSSHub/pull/18430>)
rsshub 官方有很详细的新建路由文档 [Quick Start \| RSSHub](<https://docs.rsshub.app/joinus/>)
我要创建的路由有两个
1. 某个 Tag 的更新
2. 搜索关键词的更新
所以创建, lib\routes\asianfanfics 文件夹,和三个文件
- lib\routes\asianfanfics\namespace.ts
- lib\routes\asianfanfics\tag.ts
- lib\routes\asianfanfics\text-search.ts
tag 和 text-search 的分别根据上面的分析进行实现即可。代码很简单所以不做过多的介绍。
分享其他内容:
踩坑:使用 got 和 ofetch 的时候,都遇到了网站的反爬机制,报 403 forbidden。所以改为了 pptr。但是具体是为什么缺了 agent 还是什么,暂时没有去研究,这个后面有时间会再研究一下。
类型:
- L: Latest 最近更新
- N: Newest 最近发布
- O: Oldest 最早发布
- C: Completed 已完成
- OS: One Shots 短篇
这里学到了 latest 和 newest 的区别latest 是按照发布时间排序newest 是按照更新时间排序。
如何发现的,激活 latest 筛选的时候item 重点显示的是 updated
![IMG-EAB6D9A347C7926AB395DC9F5D27F42A](/mdImages/IMG-EAB6D9A347C7926AB395DC9F5D27F42A.png)
激活 newest 筛选的时候item 重点显示的是 published
![IMG-42AE74197F09A21FA3B3182045DE5126](/mdImages/IMG-42AE74197F09A21FA3B3182045DE5126.png)

View File

@ -0,0 +1,77 @@
---
astroType:
- post
author: KazooTTT
category: 脑洞
date: 2025-02-12T00:00:00.000Z
date_created: 2025-02-12T03:06:45.000Z
date_modified: 2025-02-21T08:22:20.000Z
description: null
published: true
slug: handling-markdown-image-links-containing-spaces-causing-preview-failures
tags:
- 脑洞
title: 处理markdown图片链接包含空格导致无法预览图片的问题
toAstro: true
toJuejin: null
toWexin: null
---
![IMG-4792F6481346E5FBAA24C7291676135F-1](<https://pictures.kazoottt.top/2025/02/20250221-4792f6481346e5fbaa24c7291676135f.jpg>)
在很久之前有写过 [md路径正确但是图片不显示的原因](https://notes.kazoottt.top/05-临时/01-草稿箱/md路径正确但是图片不显示的原因)
具体来说就是flowus如果上传了多张图片到一个md然后导出的时候会出现在obsidian或者vscode中无法正常查看图片的情况。
这是因为这些图片被命名为 image.png image 1.png image 2.png, 然后在md中的语法为:
`![alt 属性文本](<图片地址>)`
所以导出的时候写法如下:
![alt text](<https://pictures.kazoottt.top/2025/02/20250221-050047f17cb009229dee6327839820b6.png>)
但是因为路径中包含空格,所以这些编辑器无法正确地识别到。
有两种方式来解决这个问题:
1. 把空格替换为%20
2. 把链接使用<>包裹起来
为了更好兼容性和更符合md的规范我使用了第二种方法也就是把链接使用<>包裹起来
[CommonMark](<https://spec.commonmark.org/0.30/#link-reference-definition>)
![alt text](<https://pictures.kazoottt.top/2025/02/20250221-d553bacdc647838e5684f4366bee55f1.png>)
<>包裹起来的链接会被视为一个整体,这样就无需担心空格的问题了
处理方法如下:
## 方法一obsidian + linter + 正则表达式处理
在obsidian中安装linter插件然后在自定义配置中添加正则表达式处理
![alt text](<https://pictures.kazoottt.top/2025/02/20250221-741d60dc1e53b648a7292cf2fb082598.png>)
第一栏填写:`(?<=\]\()(?!<)(.+?)(?!=>)(?=\))`
第二栏填写 `gm`
第三栏填写:`<$1>`
---
如果你开启了保存后就运行linter的话那么当前文件的链接就会被包裹起来了
![IMG-A76323EF3B622BCF0A912CEAD848C0A0](<https://pictures.kazoottt.top/2025/02/20250221-a76323ef3b622bcf0a912cead848c0a0.png>)
如果你想要一次性批量修改全部的话保险起见可以先git commit或者手动复制备份一下
然后windows按下 ctrl + pmac 按下 cmd + p。
然后搜索 `linter` 然后选择到格式化所有文件,按下回车,就能全部处理了
![IMG-5D8A27823A22095AC71D22EA80049C00](<https://pictures.kazoottt.top/2025/02/20250221-5d8a27823a22095ac71d22ea80049c00.png>)
如果批量格式化有问题就用git回退一下或者手动还原一下之前备份的内容