# code_ext **Repository Path**: LyricsWangKL/code_ext ## Basic Information - **Project Name**: code_ext - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-06 - **Last Updated**: 2026-04-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenCode Extension Chrome/Edge browser sidebar extension with AI Chat, Agent Workflow, and OpenCode integration. ## Features - **Chat Bot**: AI-powered chat interface connected to your backend API - **Agent Workflow**: Built-in workflows for code review, test generation, documentation, refactoring, and bug analysis - **OpenCode Integration**: Embedded OpenCode serve interface - **Admin Configuration**: Manage workflows through the admin panel ## Project Structure ``` src/ Extension source code (manifest, HTML, JS, CSS) script/ Build and utility scripts test/ Test reports logs/ Runtime logs config.yaml Configuration file run.py Build/package script requirement.txt Python dependencies ``` ## Setup ### 1. Install Python dependencies (optional, for build scripts) ```bash python script/setup.py ``` ### 2. Generate icons ```bash python script/generate_icons.py ``` Or install Pillow first: `pip install Pillow` ### 3. Build the extension ```bash python run.py build ``` ## Install in Chrome/Edge 1. Open `chrome://extensions/` (or `edge://extensions/`) 2. Enable **Developer mode** 3. Click **Load unpacked** 4. Select the `dist/` directory (or `src/` for development) ## Usage ### Chat Tab Type messages to interact with the AI chatbot. Requires a backend API running at the configured base URL. ### Workflow Tab Click any workflow card to trigger it. Workflows send requests to the backend API. ### OpenCode Tab Displays the OpenCode serve interface in an embedded frame. **连接配置步骤:** 1. 确保后端 OpenCode 服务已启动 (例如运行 `opencode serve` 或其他等效命令) 2. 打开插件侧边栏,点击"设计助手"Tab 3. 系统会显示连接面板,展示当前配置的服务地址 4. 点击"测试连接"按钮验证服务是否可达 5. 测试成功后点击"进入设计助手"开始使用 6. 如需修改地址,点击"修改地址"或通过设置(齿轮图标)修改 **默认地址:** `http://192.168.3.111:4096/` **也可通过 Settings 配置:** - 点击齿轮图标 -> "设计助手 URL" 字段 -> 修改后保存 - 设置页也提供"测试"按钮验证地址是否可达 ### Settings Click the gear icon to configure: - API Base URL - API Prefix - OpenCode Serve URL (含测试按钮) - Request Timeout ### Admin Configuration Right-click the extension icon -> **Options** (or use the popup) to access the admin panel for managing workflows. ## Configuration Edit `config.yaml` to set default values for: - Server URLs - Built-in workflows - Logging settings ## Development The extension uses Manifest V3 with a side panel. Key files: | File | Purpose | |------|---------| | `src/manifest.json` | Extension manifest | | `src/sidepanel.html` | Main sidebar UI | | `src/sidepanel.js` | Sidebar logic | | `src/background.js` | Service worker | | `src/styles.css` | UI styles | | `src/admin.html/js` | Admin config page | | `src/popup.html/js` | Extension popup | ## API Endpoints Expected The extension expects the following backend endpoints: - `POST /api/v1/chat` - Chat completion (OpenAI-compatible format) - `POST /api/v1/workflow/{id}/trigger` - Trigger a workflow