feat: release github-copilot-sdk v0.6.0 and files-filter v0.1.2
This commit is contained in:
53
plugins/filters/github_copilot_sdk_files_filter/README.md
Normal file
53
plugins/filters/github_copilot_sdk_files_filter/README.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# GitHub Copilot SDK Files Filter
|
||||
|
||||
**Author:** [Fu-Jie](https://github.com/Fu-Jie/awesome-openwebui) | **Version:** 0.1.2 | **Project:** [Awesome OpenWebUI](https://github.com/Fu-Jie/awesome-openwebui) | **License:** MIT
|
||||
|
||||
This is a dedicated **companion filter plugin** designed specifically for the [GitHub Copilot SDK Pipe](https://openwebui.com/posts/github_copilot_official_sdk_pipe_ce96f7b4).
|
||||
|
||||
Its core mission is to **protect user-uploaded files from being "pre-processed" by the OpenWebUI core system, ensuring that the Copilot Agent receives the raw files for autonomous analysis.**
|
||||
|
||||
## 🎯 Why is this needed?
|
||||
|
||||
In OpenWebUI's default workflow, when you upload a file (e.g., PDF, Excel, Python script), OpenWebUI automatically initiates a **RAG (Retrieval-Augmented Generation)** process: parsing the file, vectorizing it, extracting text, and injecting it into the prompt.
|
||||
|
||||
While useful for standard models, this is often disruptive for a **Copilot SDK Agent**:
|
||||
|
||||
1. **Agent Needs Raw Files**: The Agent may need to run Python code to read an Excel file or analyze a full directory structure, not chopped-up text fragments.
|
||||
2. **Context Pollution**: Large amounts of text injected by RAG consume tokens and can confuse the Agent about "where the file is."
|
||||
3. **Control & Performance**: Bypassing the extraction step speeds up the response and gives the Agent full autonomy over how to handle the data.
|
||||
|
||||
**This plugin acts as a "bodyguard" to solve these issues.**
|
||||
|
||||
## 🚀 How it Works
|
||||
|
||||
When you select a Copilot model (name containing `copilot_sdk`) in OpenWebUI and send a file:
|
||||
|
||||
1. **Intercept**: This plugin runs with high priority (Priority 0), before RAG and other filters.
|
||||
2. **Relocate**: Detecting a Copilot model, it moves the `files` list from the request to a secure custom field `copilot_files`.
|
||||
3. **Hide**: It clears the original `files` field.
|
||||
4. **Pass**: The OpenWebUI core sees an empty `files` list and **does not trigger RAG**.
|
||||
5. **Deliver**: The subsequent Copilot SDK Pipe plugin checks `copilot_files`, retrieves file information, and automatically copies them into the Agent's isolated workspace.
|
||||
|
||||
## 📦 Installation & Configuration
|
||||
|
||||
### 1. Installation
|
||||
|
||||
Import this plugin on the OpenWebUI **Functions** page.
|
||||
|
||||
### 2. Enable
|
||||
|
||||
Ensure this Filter is enabled globally or in chat settings.
|
||||
|
||||
### 3. Configuration (Valves)
|
||||
|
||||
Default settings work for most users:
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| :--- | :--- | :--- |
|
||||
| **priority** | Execution priority. **Must be lower than OpenWebUI RAG priority**. | `0` |
|
||||
| **target_model_keyword** | Keyword to identify Copilot models for interception. | `copilot_sdk` |
|
||||
|
||||
## ⚠️ Important Notes
|
||||
|
||||
* **Must be used with Copilot SDK Pipe**: If you install this plugin without the main Pipe plugin, uploaded files will simply "disappear" (as no subsequent plugin will look for them).
|
||||
* **Gemini Filter Compatibility**: Fully compatible with the Gemini Multimodal Filter. Just ensure priorities don't conflict.
|
||||
51
plugins/filters/github_copilot_sdk_files_filter/README_CN.md
Normal file
51
plugins/filters/github_copilot_sdk_files_filter/README_CN.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# GitHub Copilot SDK 文件过滤器
|
||||
|
||||
**作者:** [Fu-Jie](https://github.com/Fu-Jie/awesome-openwebui) | **版本:** 0.1.2 | **项目:** [Awesome OpenWebUI](https://github.com/Fu-Jie/awesome-openwebui) | **许可证:** MIT
|
||||
|
||||
这是一个专门为 [GitHub Copilot SDK Pipe](https://openwebui.com/posts/github_copilot_official_sdk_pipe_ce96f7b4) 设计的**伴侣过滤器插件**。
|
||||
|
||||
它的核心使命是:**保护用户上传的文件不被 OpenWebUI 核心系统“抢先处理”,确保 Copilot Agent 能够接收到原始文件并进行自主分析。**
|
||||
|
||||
## 🎯 为什么需要它?
|
||||
|
||||
在 OpenWebUI 的默认流程中,当你上传一个文件(如 PDF、Excel、Python 脚本)时,OpenWebUI 会自动启动 **RAG(检索增强生成)** 流程:解析文件、向量化、提取文本并注入到提示词中。
|
||||
|
||||
虽然这对普通模型很有用,但对于 **Copilot SDK Agent** 来说,这往往是干扰:
|
||||
|
||||
1. **Agent 需要原始文件**:Agent 可能需要运行 Python 代码读取 Excel,或者分析完整的代码结构,而不是被切碎的文本片段。
|
||||
2. **上下文污染**:RAG 注入的大量文本会消耗 Token,且容易让 Agent 混淆“文件在哪里”。
|
||||
3. **控制权与性能**:绕过提取步骤可以加快响应速度,并赋予 Agent 处理数据的完全自主权。
|
||||
|
||||
**本插件就是为了解决这个问题而生的“保镖”。**
|
||||
|
||||
## 🚀 功能原理
|
||||
|
||||
当你在 OpenWebUI 中选择了一个 Copilot 模型(名称包含 `copilot_sdk`)并发送文件时:
|
||||
|
||||
1. **拦截 (Intercept)**:本插件会以极高的优先级(Priority 5)运行,先于 RAG 和其他过滤器。
|
||||
2. **搬运 (Relocate)**:它检测到模型是 Copilot,便将请求中的 `files`(文件列表)移动到一个安全的自定义字段 `copilot_files` 中。
|
||||
3. **隐身 (Hide)**:它清空原始的 `files` 字段。
|
||||
4. **放行 (Pass)**:OpenWebUI 核心看到 `files` 为空,便**不会触发 RAG**。
|
||||
5. **交付 (Deliver)**:后续的 Copilot SDK Pipe 插件会检查 `copilot_files`,从中获取文件信息,并自动将其复制到 Agent 的独立工作区中。
|
||||
|
||||
## 📦 安装与配置
|
||||
|
||||
### 1. 安装
|
||||
|
||||
在 OpenWebUI 的 **Functions** 页面导入此插件。
|
||||
|
||||
### 2. 启用
|
||||
|
||||
确保在全局或对话设置中启用了此 Filter。
|
||||
|
||||
### 3. 配置 (Valves)
|
||||
|
||||
| 参数 | 说明 | 默认值 |
|
||||
| :--- | :--- | :--- |
|
||||
| **priority** | 过滤器的执行优先级。**必须小于 OpenWebUI RAG 的优先级**。 | `5` |
|
||||
| **target_model_keyword** | 用户识别 Copilot 模型的关键词。只有包含此关键词的模型才会触发。 | `copilot_sdk` |
|
||||
|
||||
## ⚠️ 注意事项
|
||||
|
||||
* **必须配合 Copilot SDK Pipe 使用**:如果你没有安装主 Pipe 插件,本插件将导致上传的文件“凭空消失”。
|
||||
* **Gemini Filter 兼容性**:已完美兼容 Gemini 多模态过滤器。只要优先级设置正确,它们可以共存互不干扰。
|
||||
@@ -0,0 +1,66 @@
|
||||
"""
|
||||
title: GitHub Copilot SDK Files Filter
|
||||
id: github_copilot_sdk_files_filter
|
||||
author: Fu-Jie
|
||||
author_url: https://github.com/Fu-Jie/awesome-openwebui
|
||||
funding_url: https://github.com/open-webui
|
||||
version: 0.1.2
|
||||
description: A specialized filter to bypass OpenWebUI's default RAG for GitHub Copilot SDK models. It moves uploaded files to a safe location ('copilot_files') so the Copilot Pipe can process them natively without interference.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Callable, Awaitable
|
||||
|
||||
|
||||
class Filter:
|
||||
class Valves(BaseModel):
|
||||
priority: int = Field(
|
||||
default=0,
|
||||
description="Priority level. Must be lower than RAG processors to intercept files effectively.",
|
||||
)
|
||||
target_model_keyword: str = Field(
|
||||
default="copilot_sdk",
|
||||
description="Keyword to identify Copilot models (e.g., 'copilot_sdk').",
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
self.valves = self.Valves()
|
||||
|
||||
async def inlet(
|
||||
self,
|
||||
body: dict,
|
||||
__user__: Optional[dict] = None,
|
||||
__model__: Optional[dict] = None,
|
||||
__metadata__: Optional[dict] = None,
|
||||
__event_emitter__: Callable[[dict], Awaitable[None]] = None,
|
||||
) -> dict:
|
||||
# Determine the actual model ID
|
||||
base_model_id = None
|
||||
if __model__:
|
||||
if "openai" in __model__:
|
||||
base_model_id = __model__["openai"].get("id")
|
||||
else:
|
||||
base_model_id = __model__.get("info", {}).get("base_model_id")
|
||||
|
||||
current_model = base_model_id if base_model_id else body.get("model", "")
|
||||
|
||||
# Check if it's a Copilot model
|
||||
if self.valves.target_model_keyword.lower() in current_model.lower():
|
||||
# If files exist, move them to 'copilot_files' and clear 'files'
|
||||
# This prevents OpenWebUI from triggering RAG on these files
|
||||
if "files" in body and body["files"]:
|
||||
file_count = len(body["files"])
|
||||
if __event_emitter__:
|
||||
await __event_emitter__(
|
||||
{
|
||||
"type": "status",
|
||||
"data": {
|
||||
"description": f"Managed {file_count} files for Copilot (RAG Bypassed)",
|
||||
"done": True,
|
||||
},
|
||||
}
|
||||
)
|
||||
body["copilot_files"] = body["files"]
|
||||
body["files"] = []
|
||||
|
||||
return body
|
||||
@@ -0,0 +1,66 @@
|
||||
"""
|
||||
title: GitHub Copilot SDK 文件过滤器(GitHub Copilot SDK Files Filter)
|
||||
id: github_copilot_sdk_files_filter
|
||||
author: Fu-Jie
|
||||
author_url: https://github.com/Fu-Jie/awesome-openwebui
|
||||
funding_url: https://github.com/open-webui
|
||||
version: 0.1.2
|
||||
description: 一个专门的过滤器,用于绕过 OpenWebUI 默认的 RAG 机制,针对 GitHub Copilot SDK 模型。它将上传的文件移动到安全位置 ('copilot_files'),以便 Copilot Pipe 可以原生处理它们而不受干扰。
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Callable, Awaitable
|
||||
|
||||
|
||||
class Filter:
|
||||
class Valves(BaseModel):
|
||||
priority: int = Field(
|
||||
default=0,
|
||||
description="优先级。必须低于 RAG 处理器的优先级,以便有效拦截文件。",
|
||||
)
|
||||
target_model_keyword: str = Field(
|
||||
default="copilot_sdk",
|
||||
description="用于识别 Copilot 模型的关键词(例如 'copilot_sdk')。",
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
self.valves = self.Valves()
|
||||
|
||||
async def inlet(
|
||||
self,
|
||||
body: dict,
|
||||
__user__: Optional[dict] = None,
|
||||
__model__: Optional[dict] = None,
|
||||
__metadata__: Optional[dict] = None,
|
||||
__event_emitter__: Callable[[dict], Awaitable[None]] = None,
|
||||
) -> dict:
|
||||
# Determine the actual model ID
|
||||
base_model_id = None
|
||||
if __model__:
|
||||
if "openai" in __model__:
|
||||
base_model_id = __model__["openai"].get("id")
|
||||
else:
|
||||
base_model_id = __model__.get("info", {}).get("base_model_id")
|
||||
|
||||
current_model = base_model_id if base_model_id else body.get("model", "")
|
||||
|
||||
# Check if it's a Copilot model
|
||||
if self.valves.target_model_keyword.lower() in current_model.lower():
|
||||
# If files exist, move them to 'copilot_files' and clear 'files'
|
||||
# This prevents OpenWebUI from triggering RAG on these files
|
||||
if "files" in body and body["files"]:
|
||||
file_count = len(body["files"])
|
||||
if __event_emitter__:
|
||||
await __event_emitter__(
|
||||
{
|
||||
"type": "status",
|
||||
"data": {
|
||||
"description": f"已为 Copilot 管理 {file_count} 个文件 (已绕过 RAG)",
|
||||
"done": True,
|
||||
},
|
||||
}
|
||||
)
|
||||
body["copilot_files"] = body["files"]
|
||||
body["files"] = []
|
||||
|
||||
return body
|
||||
@@ -3,6 +3,7 @@ title: Gemini 多模态过滤器(含字幕增强)
|
||||
author: Gemini Adapter
|
||||
author_url: https://github.com/Fu-Jie
|
||||
funding_url: https://github.com/Fu-Jie/awesome-openwebui
|
||||
|
||||
version: 0.3.2
|
||||
description: >
|
||||
一个强大的过滤器,为 OpenWebUI 中的任何模型提供多模态能力:PDF、Office、图片、音频、视频等。
|
||||
@@ -492,6 +493,13 @@ class Filter:
|
||||
print(
|
||||
f"🤖 Checking model: {current_model} (Target: {self.valves.target_model_keyword})"
|
||||
)
|
||||
# 0. SKIP COPILOT MODELS
|
||||
# If the model is a Copilot Pipe model, we must NOT process files here.
|
||||
# Copilot Pipe has its own file handling logic (copy to workspace).
|
||||
if "copilot_sdk" in current_model.lower():
|
||||
print(f"⏩ Skipping Gemini Filter for Copilot model: {current_model}")
|
||||
return body
|
||||
|
||||
|
||||
# Check if model matches target keyword
|
||||
is_target_model = (
|
||||
|
||||
Reference in New Issue
Block a user