chore: add package.json, README, example config and gitignore
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
*.log
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
# Opencode Vision Bridge Plugin
|
||||||
|
|
||||||
|
Этот плагин позволяет Opencode работать с изображениями, даже если активная модель не поддерживает мультимодальность. Он перехватывает изображения, отправляет их в указанную vision-модель для анализа, а затем заменяет изображение текстовым описанием в контексте диалога.
|
||||||
|
|
||||||
|
## Требования
|
||||||
|
|
||||||
|
- Доступ к API-эндпоинту Ludmila AI (https://ai.totmin.ru/v1).
|
||||||
|
- Ключ API Ludmila AI.
|
||||||
|
|
||||||
|
## Установка
|
||||||
|
|
||||||
|
### 1. Добавьте плагин в `~/.config/opencode/opencode.json`
|
||||||
|
|
||||||
|
В секцию `plugin` добавьте следующую запись:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"plugin": [
|
||||||
|
// ... другие плагины
|
||||||
|
"https://git.totmin.ru/en2zmax/vision-bridge.git"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Настройте провайдер Ludmila AI
|
||||||
|
|
||||||
|
В секцию `provider` вашего `~/.config/opencode/opencode.json` добавьте или обновите блок `ludmila-ai`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"provider": {
|
||||||
|
"ludmila-ai": {
|
||||||
|
"npm": "@ai-sdk/openai-compatible",
|
||||||
|
"name": "Ludmila AI",
|
||||||
|
"options": {
|
||||||
|
"baseURL": "https://ai.totmin.ru/v1",
|
||||||
|
"apiKey": "<ЗАМЕНИТЕ_НА_ВАШ_API_КЛЮЧ>"
|
||||||
|
},
|
||||||
|
"models": {
|
||||||
|
"gemini/gemini-2.5-flash": {
|
||||||
|
"attachment": true,
|
||||||
|
"limit": {
|
||||||
|
"context": 1048576,
|
||||||
|
"output": 65536
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
**ВАЖНО**: Замените `<ЗАМЕНИТЕ_НА_ВАШ_API_КЛЮЧ>` на ваш реальный API-ключ Ludmila AI.
|
||||||
|
|
||||||
|
### 3. Скопируйте файл субагента
|
||||||
|
|
||||||
|
Субагенты не загружаются из npm-пакетов, поэтому скопируйте файл `vision.md` в соответствующий каталог:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp ~/totmin/opencode/plugins/vision-bridge/agents/vision.md ~/.config/opencode/agents/vision.md
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Перезапустите Opencode
|
||||||
|
|
||||||
|
Изменения в конфигурации применяются только после перезапуска Opencode.
|
||||||
|
|
||||||
|
## Пример конфигурации (`examples/opencode.json`)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"$schema": "https://opencode.ai/config.json",
|
||||||
|
"plugin": [
|
||||||
|
"opencode-browser",
|
||||||
|
"git+ssh://git@git.totmin.ru:en2zmax/vision-bridge.git"
|
||||||
|
],
|
||||||
|
"provider": {
|
||||||
|
"ludmila-ai": {
|
||||||
|
"npm": "@ai-sdk/openai-compatible",
|
||||||
|
"name": "Ludmila AI",
|
||||||
|
"options": {
|
||||||
|
"baseURL": "https://ai.totmin.ru/v1",
|
||||||
|
"apiKey": "<ЗАМЕНИТЕ_НА_ВАШ_API_КЛЮЧ>"
|
||||||
|
},
|
||||||
|
"models": {
|
||||||
|
"gemini/gemini-2.5-flash": {
|
||||||
|
"attachment": true,
|
||||||
|
"limit": {
|
||||||
|
"context": 1048576,
|
||||||
|
"output": 65536
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"agent": {
|
||||||
|
"vision": {
|
||||||
|
"mode": "subagent",
|
||||||
|
"model": "ludmila-ai/gemini/gemini-2.5-flash",
|
||||||
|
"description": "Анализ изображений и скриншотов (OCR текста или разбор UI)",
|
||||||
|
"permission": {
|
||||||
|
"read": "allow",
|
||||||
|
"glob": "allow",
|
||||||
|
"external_directory": "allow",
|
||||||
|
"edit": "deny",
|
||||||
|
"bash": "deny"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://opencode.ai/config.json",
|
||||||
|
"plugin": [
|
||||||
|
"opencode-browser",
|
||||||
|
"https://git.totmin.ru/en2zmax/vision-bridge.git"
|
||||||
|
],
|
||||||
|
"provider": {
|
||||||
|
"ludmila-ai": {
|
||||||
|
"npm": "@ai-sdk/openai-compatible",
|
||||||
|
"name": "Ludmila AI",
|
||||||
|
"options": {
|
||||||
|
"baseURL": "https://ai.totmin.ru/v1",
|
||||||
|
"apiKey": "<ЗАМЕНИТЕ_НА_ВАШ_API_КЛЮЧ>"
|
||||||
|
},
|
||||||
|
"models": {
|
||||||
|
"gemini/gemini-2.5-flash": {
|
||||||
|
"attachment": true,
|
||||||
|
"limit": {
|
||||||
|
"context": 1048576,
|
||||||
|
"output": 65536
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"agent": {
|
||||||
|
"vision": {
|
||||||
|
"mode": "subagent",
|
||||||
|
"model": "ludmila-ai/gemini/gemini-2.5-flash",
|
||||||
|
"description": "Анализ изображений и скриншотов (OCR текста или разбор UI)",
|
||||||
|
"permission": {
|
||||||
|
"read": "allow",
|
||||||
|
"glob": "allow",
|
||||||
|
"external_directory": "allow",
|
||||||
|
"edit": "deny",
|
||||||
|
"bash": "deny"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "vision-bridge",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"type": "module",
|
||||||
|
"description": "Opencode plugin: bridges images to a vision model when the active model cannot see images.",
|
||||||
|
"main": "src/vision-bridge.ts",
|
||||||
|
"exports": {
|
||||||
|
".": "./src/vision-bridge.ts"
|
||||||
|
},
|
||||||
|
"files": ["src"],
|
||||||
|
"keywords": ["opencode", "plugin", "vision"],
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@opencode-ai/plugin": "^1.14.19"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user