docs: add full zh translations for site

Co-authored-by: Fu-Jie <33599649+Fu-Jie@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-30 01:22:29 +00:00
parent 7f07329f87
commit ba44dfab26
23 changed files with 3071 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
# Gemini Manifold
<span class="category-badge pipe">Pipe</span>
<span class="version-badge">v1.0.0</span>
面向 Google Gemini 模型的集成流水线,支持完整流式返回。
---
## 概览
Gemini Manifold Pipe 提供与 Google Gemini AI 模型的无缝集成。它会将 Gemini 模型作为可选项暴露在 OpenWebUI 中,你可以像使用其他模型一样使用它们。
## 功能特性
- :material-google: **完整 Gemini 支持**:可使用所有 Gemini 模型变体
- :material-stream: **流式输出**:实时流式响应
- :material-image: **多模态**:支持图像与文本
- :material-shield: **错误处理**:健壮的错误管理
- :material-tune: **可配置**:可自定义模型参数
---
## 安装
1. 下载插件文件:[`gemini_manifold.py`](https://github.com/Fu-Jie/awesome-openwebui/tree/main/plugins/pipes/gemini_mainfold)
2. 上传到 OpenWebUI**Admin Panel** → **Settings****Functions**
3. 配置你的 Gemini API Key
4. 在模型下拉中选择 Gemini 模型
---
## 配置
| 选项 | 类型 | 是否必填 | 说明 |
|--------|------|----------|-------------|
| `GEMINI_API_KEY` | string | 是 | 你的 Google AI Studio API Key |
| `DEFAULT_MODEL` | string | 否 | 默认使用的 Gemini 模型 |
| `TEMPERATURE` | float | 否 | 输出温度0-1 |
| `MAX_TOKENS` | integer | 否 | 最大回复 token 数 |
---
## 可用模型
配置完成后,你可以选择以下模型:
- `gemini-pro` —— 纯文本模型
- `gemini-pro-vision` —— 多模态模型
- `gemini-1.5-pro` —— 最新 Pro 模型
- `gemini-1.5-flash` —— 快速响应模型
---
## 使用方法
1. 安装后进入任意对话
2. 打开模型选择下拉
3. 查找以 Pipe 名称前缀的模型
4. 选择 Gemini 模型
5. 开始聊天!
---
## 获取 API Key
1. 访问 [Google AI Studio](https://makersuite.google.com/app/apikey)
2. 创建新的 API Key
3. 复制并粘贴到插件配置中
!!! warning "API Key 安全"
请妥善保管你的 API Key不要公开或提交到版本库。
---
## 伴随过滤器
如需增强功能,可安装 [Gemini Manifold Companion](../filters/gemini-manifold-companion.md) 过滤器。
---
## 运行要求
!!! note "前置条件"
- OpenWebUI v0.3.0 及以上
- 有效的 Gemini API Key
- 可访问 Google AI API 的网络
---
## 常见问题
??? question "模型没有出现?"
请确认 API Key 配置正确且插件已启用。
??? question "出现 API 错误?"
检查 Google AI Studio 中的 Key 有效性和额度限制。
??? question "响应较慢?"
可尝试使用 `gemini-1.5-flash` 获得更快速度。
---
## 源码
[:fontawesome-brands-github: 在 GitHub 查看](https://github.com/Fu-Jie/awesome-openwebui/tree/main/plugins/pipes/gemini_mainfold){ .md-button }

View File

@@ -0,0 +1,133 @@
# Pipe 插件
Pipe 插件用于创建自定义模型集成或转换 LLM 响应,会在 OpenWebUI 的模型下拉中显示。
## 什么是 Pipes
Pipes 可以用于:
- :material-api: 连接外部 AI APIGemini、Claude 等)
- :material-robot: 创建自定义模型封装
- :material-cog-transfer: 变换请求与响应
- :material-middleware: 实现中间件逻辑
---
## 可用的 Pipe 插件
<div class="grid cards" markdown>
- :material-google:{ .lg .middle } **Gemini Manifold**
---
面向 Google Gemini 的集成流水线,支持完整流式返回。
**版本:** 1.0.0
[:octicons-arrow-right-24: 查看文档](gemini-manifold.md)
</div>
---
## Pipe 工作原理
```mermaid
graph LR
A[User selects Pipe as Model] --> B[Pipe receives request]
B --> C[Transform/Route request]
C --> D[External API / Custom Logic]
D --> E[Return response]
E --> F[Display to User]
```
### `pipes` 方法
定义此 Pipe 提供的模型列表:
```python
def pipes(self):
return [
{"id": "my-model", "name": "My Custom Model"},
{"id": "my-model-fast", "name": "My Custom Model (Fast)"}
]
```
### `pipe` 方法
负责处理实际请求:
```python
def pipe(self, body: dict) -> Generator:
# 处理请求
messages = body.get("messages", [])
# 调用外部 API 或自定义逻辑
response = call_external_api(messages)
# 返回响应(可流式)
return response
```
---
## 快速安装
1. 下载需要的 Pipe `.py` 文件
2. 前往 **Admin Panel****Settings****Functions**
3. 上传并配置 API Key
4. 该 Pipe 会作为模型选项出现
---
## 开发模板
```python
"""
title: My Custom Pipe
author: Your Name
version: 1.0.0
description: Description of your pipe plugin
"""
from pydantic import BaseModel, Field
from typing import Generator, Iterator, Union
class Pipe:
class Valves(BaseModel):
API_KEY: str = Field(
default="",
description="API key for the external service"
)
API_URL: str = Field(
default="https://api.example.com",
description="API endpoint URL"
)
def __init__(self):
self.valves = self.Valves()
def pipes(self) -> list[dict]:
"""Define available models."""
return [
{"id": "my-model", "name": "My Custom Model"},
]
def pipe(
self,
body: dict
) -> Union[str, Generator, Iterator]:
"""Process the request and return response."""
messages = body.get("messages", [])
model = body.get("model", "")
# 自定义逻辑
# 返回值可以是:
# - str单次响应
# - Generator/Iterator流式响应
return "Response from custom pipe"
```
更多细节见 [插件开发指南](../../development/plugin-guide.md)。