Skip to content

Commit 9377286

Browse files
committed
feat: Add Gemini and OpenAI image processing plugins
refactor: Refactoring the Agnes image and video plugin fix: Fixed the issue where the image model could not generate images correctly. doc: Add the AGENTS.md document.
1 parent 837f1f2 commit 9377286

60 files changed

Lines changed: 3279 additions & 218 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
5+
This is a Next.js/React chat application using TypeScript, Zustand, Vitest, and
6+
pnpm. Core routes and API handlers live in `src/app/`. UI components are grouped
7+
under `src/components/`, with feature-specific chat hooks in
8+
`src/features/chat/`. Shared domain logic, provider adapters, security gates,
9+
and API helpers live in `src/lib/`; client service wrappers are in
10+
`src/services/`; persisted Zustand stores and migrations are in `src/store/`.
11+
Tests are centralized in `src/__tests__/`. Static images and skill metadata live
12+
under `public/`, and operational docs live in `docs/`.
13+
14+
## Build, Test, and Development Commands
15+
16+
Use the pinned package manager (`pnpm@10.30.3`), preferably through Corepack:
17+
18+
- `corepack pnpm install` installs dependencies from `pnpm-lock.yaml`.
19+
- `corepack pnpm dev` starts the local Next.js server at `localhost:3000`.
20+
- `corepack pnpm build` creates the production Next.js build.
21+
- `corepack pnpm lint` runs ESLint with Next.js core-web-vitals and TypeScript
22+
rules.
23+
- `corepack pnpm typecheck` runs `tsc --noEmit`.
24+
- `corepack pnpm test` runs the Vitest suite.
25+
- `corepack pnpm build:worker` builds the OpenNext Cloudflare Worker output.
26+
27+
## Coding Style & Naming Conventions
28+
29+
Prettier is authoritative: 2-space indentation, 80-column print width,
30+
semicolons, double quotes, and trailing commas. Keep TypeScript strict-friendly
31+
and prefer explicit domain types over broad `any` unless existing integration
32+
code already requires it. Components use `PascalCase`, hooks use `useCamelCase`,
33+
tests use `*.test.ts` or `*.test.tsx`, and path aliases may use `@/` for `src/`.
34+
35+
## Testing Guidelines
36+
37+
Add focused Vitest coverage for bug fixes, migrations, API routes, provider
38+
adapters, security-sensitive behavior, and renderer changes. Run targeted tests
39+
while iterating, for example:
40+
41+
```bash
42+
corepack pnpm exec vitest run src/__tests__/pluginConfig.test.ts
43+
```
44+
45+
Before a pull request, run `format:check`, `lint`, `typecheck`, `test`, and
46+
`build`. Add `build:worker` when Cloudflare, runtime environment, or deployment
47+
code changes.
48+
49+
## Commit & Pull Request Guidelines
50+
51+
History uses conventional-style prefixes such as `feat:`, `fix:`, `refactor:`,
52+
`chore:`, and `doc:`. Keep commits focused and imperative, for example
53+
`fix: preserve Cloudflare dashboard vars`. Pull requests should describe the
54+
user-facing change, list verification commands, link related issues, and include
55+
screenshots for UI changes. Update docs when changing configuration,
56+
deployment, localization, plugins, privacy boundaries, or user workflows.
57+
58+
## Security & Configuration Tips
59+
60+
Use `.env.local` for local secrets and keep `.env.example` plus
61+
`docs/environment-variables.md` current. Do not commit API keys, access
62+
passwords, private chat logs, generated user files, or real provider responses.
63+
For Cloudflare deploys, preserve dashboard variables with the existing
64+
`--keep-vars` deployment flow.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ when the matching tag is pushed.
1515
- Added native image generation and image editing for models with image
1616
input/output metadata, including ordered mixed text/image output blocks,
1717
image edit attachments, and OPFS-backed display caching.
18+
- Expanded built-in plugin media tools: Agnes and Gemini now present as image
19+
processing plugins, OpenAI-compatible Images API and OpenAI Responses image
20+
processing are separate built-ins, and image plugin results are compacted into
21+
tool details/history so follow-up model messages decide how to reference them.
22+
- Added plugin-level API Base URL and Model ID controls for supported image
23+
plugins, image count parameters where the upstream API supports them, Agnes
24+
image-to-image editing, and Agnes video image-to-video support with custom
25+
video model IDs while preserving the two-step `create_video` /
26+
`get_video_result` workflow.
1827
- Added thinking intensity controls and provider-specific reasoning mapping for
1928
Gemini and OpenAI-compatible model requests.
2029
- Added Japanese localization across the app, SEO metadata, LobeHub assistant

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ It is designed for people who want the power of modern AI workspaces without giv
2828

2929
- Rebuilt System Settings with clearer grouped controls, an About panel, deployment health visibility, and local data export/reset actions.
3030
- Added native model image generation/editing with ordered mixed text/image output blocks and OPFS-backed image display caching.
31+
- Expanded built-in plugin media tools with Agnes/Gemini image processing, separate OpenAI-compatible Images API and OpenAI Responses image processing plugins, plugin-level Base URL/Model ID controls, image count parameters where supported, compact image tool results, and Agnes image/video processing upgrades.
3132
- Added thinking intensity controls for reasoning-capable Gemini and OpenAI-compatible models.
3233
- Added Japanese localization for the app shell, SEO metadata, assistant locale routing, voice language handling, and the public Skills catalog.
3334
- Hardened hosted deployments with API request proof, shared-store checks, service health coverage, safer URL/secret handling, and Cloudflare Worker command fixes.
@@ -41,7 +42,7 @@ It is designed for people who want the power of modern AI workspaces without giv
4142
- Assistant presets from the LobeHub agent registry plus local custom assistants.
4243
- Text-only Skills with localized public catalogs, install/uninstall flows, local edits, custom skills, auto-selection, and workspace presets.
4344
- OpenAPI-based plugin tools with per-plugin authentication and server-side execution.
44-
- Built-in tools for web reading, weather, Unsplash search, Agnes image generation, and Agnes video generation. Agnes remains a plugin path, separate from native model image output.
45+
- Built-in tools for web reading, weather, Unsplash search, Agnes/Gemini image processing, OpenAI-compatible image processing, OpenAI Responses image processing, and Agnes video generation. Agnes image processing supports image-to-image edits, and Agnes video generation supports public image URL to video plus plugin-level model IDs. Image processing plugins remain separate from native model image output.
4546
- Web search through Gemini native Google Search or external providers such as Tavily, Firecrawl, Exa, Bocha, and SearXNG.
4647
- Knowledge-base RAG with OPFS file storage, Mineru/LlamaParse document parsing, and optional vector indexing.
4748
- Local memory with optional memory search, background extraction, and dream consolidation.
@@ -346,7 +347,7 @@ The app keeps durable user data in browser storage whenever possible. API routes
346347

347348
Skills are text-only prompt-context modules. The app loads localized metadata catalogs from `public/data/skills`, fetches full skill definitions only when needed, and stores installed, edited, and custom skills locally. Active skills can be selected manually, inherited from workspace presets, or auto-selected for a message.
348349

349-
Plugins are OpenAPI-style tools installed from manifests or built-in definitions. Enabled plugin functions are exposed to compatible models as tools, then executed by the server-side plugin route. Tool-call orchestration uses a high but bounded loop limit to avoid runaway recursive calls while still allowing multi-step tasks.
350+
Plugins are OpenAPI-style tools installed from manifests or built-in definitions. Enabled plugin functions are exposed to compatible models as tools, then executed by the server-side plugin route. Built-in image processing plugin results stay in the tool details and compact conversation history, so the model can decide whether and how to reference generated or edited images in its follow-up message. OpenAI-compatible Images API and OpenAI Responses image processing are separate plugins so their credentials and activation can be managed independently. Supported built-in media plugins expose plugin-level API Base URL and Model ID fields, optional image count parameters, Agnes image-to-image editing, and Agnes video generation from a public HTTPS image URL while keeping Agnes video as the explicit `create_video` / `get_video_result` two-step flow. Tool-call orchestration uses a high but bounded loop limit to avoid runaway recursive calls while still allowing multi-step tasks.
350351

351352
Search can run through Gemini native Google Search for Gemini models or external providers for other model families. Knowledge-base RAG stores source files in OPFS, optionally parses documents with Mineru or LlamaParse, and can index chunks into an external vector service.
352353

README.zh-CN.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Neo Chat 是一个可自托管、本地优先的 AI 对话应用,基于 Next.j
2828

2929
- 重构 System Settings,提供更清晰的分组控制、About 面板、部署健康可见性,以及本地数据导出/重置入口。
3030
- 新增模型原生图片生成/编辑,支持按顺序渲染图文混合输出块,并使用 OPFS 做图片显示缓存。
31+
- 扩展内置插件媒体工具:Agnes/Gemini 图片处理、独立的 OpenAI 兼容 Images API 与 OpenAI Responses 图片处理插件、插件级 Base URL/Model ID 配置、受支持接口的图片数量参数、压缩后的图片工具结果,以及 Agnes 图片/视频处理能力升级。
3132
- 为支持 reasoning 的 Gemini 和 OpenAI-compatible 模型新增 thinking intensity 控制。
3233
- 新增日文支持,覆盖应用界面、SEO metadata、助理语言路由、语音语言处理和公共 Skills 目录。
3334
- 加强 hosted 部署安全,加入 API request proof、共享存储检查、服务健康覆盖、更安全的 URL/密钥处理,以及 Cloudflare Worker 命令修复。
@@ -41,7 +42,7 @@ Neo Chat 是一个可自托管、本地优先的 AI 对话应用,基于 Next.j
4142
- 支持 LobeHub Agent Registry 助理预设,也支持本地自定义助理。
4243
- 支持纯文本技能:本地化公共目录、安装/卸载、编辑内置技能、本地自定义技能、自动选择和工作区预设。
4344
- 支持 OpenAPI 风格插件工具、插件鉴权和服务端执行。
44-
- 内置网页阅读、天气、Unsplash 搜索、Agnes 图片生成、Agnes 视频生成工具。Agnes 仍是插件路径,和模型原生图片输出分开
45+
- 内置网页阅读、天气、Unsplash 搜索、Agnes/Gemini 图片处理、OpenAI 兼容图片处理、OpenAI Responses 图片处理、Agnes 视频生成工具。Agnes 图片处理支持图生图编辑,Agnes 视频生成支持公开图片 URL 生成视频和插件级模型 ID。图片处理插件和模型原生图片输出保持分离
4546
- 支持 Gemini 原生 Google Search,以及 Tavily、Firecrawl、Exa、Bocha、SearXNG 等外部搜索。
4647
- 知识库 RAG 支持 OPFS 文件存储、Mineru/LlamaParse 文档解析和可选向量索引。
4748
- 支持本地记忆、可选记忆搜索、后台记忆提取和记忆整合。
@@ -339,7 +340,7 @@ flowchart LR
339340

340341
技能是纯文本的提示词上下文模块。应用会从 `public/data/skills` 加载本地化元数据目录,只在需要时获取完整技能定义,并把已安装、已编辑和自定义技能保存在本地。活跃技能可以手动选择,也可以来自工作区预设,或在发送消息时自动选择。
341342

342-
插件是 OpenAPI 风格工具,可以来自 manifest 或内置定义。启用的插件函数会以 tool 形式暴露给兼容模型,再由服务端插件路由执行。工具调用编排使用较高但有边界的循环上限,既允许多步任务,也避免递归工具调用失控。
343+
插件是 OpenAPI 风格工具,可以来自 manifest 或内置定义。启用的插件函数会以 tool 形式暴露给兼容模型,再由服务端插件路由执行。内置图片处理插件结果保留在工具详情和压缩后的对话历史中,由模型决定是否以及如何在后续回复中引用生成或编辑后的图片。OpenAI 兼容 Images API 和 OpenAI Responses 图片处理是两个独立插件,便于分别管理密钥和启用状态。受支持的内置媒体插件提供插件级 API Base URL 与 Model ID 字段、可选图片数量参数、Agnes 图生图编辑,以及基于公开 HTTPS 图片 URL 的 Agnes 图生视频;Agnes 视频仍保持显式 `create_video` / `get_video_result` 两步流程。工具调用编排使用较高但有边界的循环上限,既允许多步任务,也避免递归工具调用失控。
343344

344345
搜索可以使用 Gemini 模型的原生 Google Search,也可以对其他模型族使用外部搜索供应商。知识库 RAG 会把源文件存在 OPFS,可选使用 Mineru 或 LlamaParse 解析文档,并可把 chunks 索引到外部向量服务。
345346

docs/plugin-development.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ registered before use and stored in the shared registry for hosted or
9494
multi-instance deployments; otherwise another instance may be unable to resolve
9595
the function call.
9696

97+
Built-in media plugin IDs are reserved and protocol-specific. Agnes and Gemini
98+
image tools are image processing plugins, `openai-image-generation` targets the
99+
OpenAI-compatible Images API, and `openai-responses-image-processing` targets
100+
the OpenAI Responses API. Supported built-ins can expose plugin-level API Base
101+
URL and Model ID fields; Agnes video remains a two-step `create_video` /
102+
`get_video_result` flow and accepts public HTTPS image URLs for image-to-video.
103+
97104
Runtime tool calls execute automatically after a plugin is enabled for the chat.
98105
There is no per-call confirmation modal, so the plugin market, function toggle,
99106
auth configuration, and risk metadata are the user's control points.

0 commit comments

Comments
 (0)