差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:opencode [2026/03/23 10:56] – 安裝 lancedb-opencode-pro jonathantech:opencode [2026/05/11 16:55] (目前版本) – [安裝 OpenCode (Ubuntu 24.04)] jonathan
行 1: 行 1:
 ====== 安裝 OpenCode (Ubuntu 24.04) ====== ====== 安裝 OpenCode (Ubuntu 24.04) ======
  
 +<note tip>
 +  * 也可以參考我整合好的專案 \\  **[[https://github.com/tryweb/Codeforge]]** 
 +  * 用 docker compose 就可啟動使用
 +</note>
 ===== 安裝程序 ===== ===== 安裝程序 =====
   * <cli>curl -fsSL https://opencode.ai/install | bash</cli>   * <cli>curl -fsSL https://opencode.ai/install | bash</cli>
行 26: 行 30:
 For more information visit https://opencode.ai/docs For more information visit https://opencode.ai/docs
 </cli>++ </cli>++
 +<note> 
 +  * 預設啟動 opencode 就會自動檢查與更新至最新版本, 如果想固定在特定版本 Exp. 1.3.2 
 +  - 在 ~/.config/opencode/opencode.json 內加上 **"autoupdate": false**<file> 
 +
 +  "$schema": "https://opencode.ai/config.json", 
 +  "autoupdate": false 
 +
 +</file>  
 +  - 安裝特定版本執行檔 Exp. 1.3.2<cli> 
 +curl -fsSL https://opencode.ai/install | bash -s -- --version 1.3.2 
 +</cli> 
 +</note>
 ===== 使用方式 ===== ===== 使用方式 =====
   * 進入專案目錄執行<cli>opencode</cli>   * 進入專案目錄執行<cli>opencode</cli>
  
 ===== 安裝與選用 plugin / MCP / Skills ===== ===== 安裝與選用 plugin / MCP / Skills =====
-==== 安裝 Oh My OpenCode ==== +==== 安裝 Oh My OpenAgent ==== 
-  * Ref - https://github.com/code-yeongyu/oh-my-opencode <cli>+  * Ref - https://github.com/code-yeongyu/oh-my-openagent <cli>
 sudo snap remove bun-js sudo snap remove bun-js
 sudo apt install unzip sudo apt install unzip
行 38: 行 53:
 source ~/.bashrc source ~/.bashrc
 cp ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json.bak cp ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json.bak
-bunx oh-my-opencode install+bunx oh-my-openagent install
 </cli> </cli>
-  * Oh My OpenCode 內建配置熱門的 MCP Exp. context7(動態文檔), grep_app, websearch , 因此就不需要安裝這三個 MCP+  * Oh My OpenAgent 內建配置熱門的 MCP Exp. context7(動態文檔), grep_app, websearch , 因此就不需要安裝這三個 MCP
   * Serena MCP : OpenCode 原生就支援 [[https://opencode.ai/docs/lsp/|LSP]] 因此就不需要安裝 Serena MCP   * Serena MCP : OpenCode 原生就支援 [[https://opencode.ai/docs/lsp/|LSP]] 因此就不需要安裝 Serena MCP
   * ulw : UltraWork Mode -> 讓所有 Agent 可以儘可能最大極限合作執行 Exp. <cli>ulw 請優化後台 UI/UX 讓操作更簡易</cli>   * ulw : UltraWork Mode -> 讓所有 Agent 可以儘可能最大極限合作執行 Exp. <cli>ulw 請優化後台 UI/UX 讓操作更簡易</cli>
行 147: 行 162:
 openspec update openspec update
 </cli> </cli>
- 
-==== 安裝 lancedb-opencode-pro ==== 
-  * 讓 OpenCode 可以增加長記憶功能, 累積專案實際處理過程經驗資料, 解決 AI 重複使用錯誤方式來處理專案內相似議題 
-  * Ref - https://www.npmjs.com/package/lancedb-opencode-pro 
-  * 需要有 embedding 模型 Exp. ollama -> nomic-embed-text , OpenAI -> text-embedding-3-small 
-  - 修改 ~/.config/opencode/opencode.json Exp. <file> 
-{ 
-  "$schema": "https://opencode.ai/config.json", 
-  "plugin": [ 
-    "oh-my-opencode", 
-    "lancedb-opencode-pro" 
-  ] 
-} 
-</file>  
-  - 加上設定檔 ~/.config/opencode/lancedb-opencode-pro.json Exp. 本機有安裝啟動 ollama 服務與下載 nomic-embed-text 模型<file> 
-{ 
-  "provider": "lancedb-opencode-pro", 
-  "dbPath": "~/.opencode/memory/lancedb", 
-  "embedding": { 
-    "provider": "ollama", 
-    "model": "nomic-embed-text", 
-    "baseUrl": "http://127.0.0.1:11434" 
-  }, 
-  "retrieval": { 
-    "mode": "hybrid", 
-    "vectorWeight": 0.7, 
-    "bm25Weight": 0.3, 
-    "minScore": 0.2, 
-    "rrfK": 60, 
-    "recencyBoost": true, 
-    "recencyHalfLifeHours": 72, 
-    "importanceWeight": 0.4 
-  }, 
-  "includeGlobalScope": true, 
-  "globalDetectionThreshold": 2, 
-  "globalDiscountFactor": 0.7, 
-  "unusedDaysThreshold": 30, 
-  "minCaptureChars": 80, 
-  "maxEntriesPerScope": 3000 
-} 
-</file> 
-  - 重新啟動 opencode 
-  - 使用 memory_effectiveness 查看長記憶的狀態 \\ {{:tech:螢幕擷取畫面_2026-03-23_105531.png|}} 
  
 ===== 使用 openchamber Web 操作介面 ===== ===== 使用 openchamber Web 操作介面 =====
行 214: 行 186:
 </cli> </cli>
   * {{:tech:螢幕擷取畫面_2026-01-23_142619.png?1000|}}   * {{:tech:螢幕擷取畫面_2026-01-23_142619.png?1000|}}
-===== 有訂閱 Google AI Pro 用戶進行認證登入 ===== 
-  * 參考 - https://github.com/NoeFabris/opencode-antigravity-auth/tree/main 
-  * 如果之後安裝或更新 oh-my-opencode 必須要將 ~/.config/opencode/opencode.json 進行手動修正, [[https://github.com/NoeFabris/opencode-antigravity-auth/tree/main?tab=readme-ov-file#known-plugin-interactions|參考說明]] 
-  * 將會增加 Antigravity + Gemini CLI 所提供的模型  
-  - 先將 opencode.json 進行備份 <cli>cp -a ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json.bak</cli> 
-  - 編輯 opencode.json <cli>vi ~/.config/opencode/opencode.json</cli><file> 
-{ 
-  "plugin": ["opencode-antigravity-auth@beta"], 
-  : 
-  : 
-} 
-</file> 
-  - 進行 Google oAuth 認證<cli>opencode auth login</cli> 
-    - 選擇 *Google**  
-    - 將產生的 URL 貼到瀏覽器, 進行 Google oAuth 認證 
-    - 如果是 ssh 登入遠端主機, 沒有進行 port redirect 認證成功後會找不到網頁, 可以將網址完整複製下來 Exp. <cli>http://localhost:51121/oauth-callback?state=eyJ2ZXJpZmllciI6IklW......nfigs%20openid&authuser=0&prompt=consent</cli>貼到 opencode 對話內就可完成 
-  - 繼續修改 opencode.json 將需要的模型加入<cli>vi ~/.config/opencode/opencode.json</cli><file> 
-{ 
-  "$schema": "https://opencode.ai/config.json", 
-  "plugin": [ 
-    "oh-my-opencode", 
-    "opencode-antigravity-auth" 
-  ], 
-  "provider": { 
-    "google": { 
-      "models": { 
-        "antigravity-gemini-3-pro": { 
-          "name": "Gemini 3 Pro (Antigravity)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65535 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          }, 
-          "variants": { 
-            "low": { 
-              "thinkingLevel": "low" 
-            }, 
-            "high": { 
-              "thinkingLevel": "high" 
-            } 
-          } 
-        }, 
-        "antigravity-gemini-3.1-pro": { 
-          "name": "Gemini 3.1 Pro (Antigravity)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65535 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          }, 
-          "variants": { 
-            "low": { 
-              "thinkingLevel": "low" 
-            }, 
-            "high": { 
-              "thinkingLevel": "high" 
-            } 
-          } 
-        }, 
-        "antigravity-gemini-3-flash": { 
-          "name": "Gemini 3 Flash (Antigravity)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65536 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          }, 
-          "variants": { 
-            "minimal": { 
-              "thinkingLevel": "minimal" 
-            }, 
-            "low": { 
-              "thinkingLevel": "low" 
-            }, 
-            "medium": { 
-              "thinkingLevel": "medium" 
-            }, 
-            "high": { 
-              "thinkingLevel": "high" 
-            } 
-          } 
-        }, 
-        "antigravity-claude-sonnet-4-6": { 
-          "name": "Claude Sonnet 4.6 (Antigravity)", 
-          "limit": { 
-            "context": 200000, 
-            "output": 64000 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          } 
-        }, 
-        "antigravity-claude-opus-4-6-thinking": { 
-          "name": "Claude Opus 4.6 Thinking (Antigravity)", 
-          "limit": { 
-            "context": 200000, 
-            "output": 64000 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          }, 
-          "variants": { 
-            "low": { 
-              "thinkingConfig": { 
-                "thinkingBudget": 8192 
-              } 
-            }, 
-            "max": { 
-              "thinkingConfig": { 
-                "thinkingBudget": 32768 
-              } 
-            } 
-          } 
-        }, 
-        "gemini-2.5-flash": { 
-          "name": "Gemini 2.5 Flash (Gemini CLI)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65536 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          } 
-        }, 
-        "gemini-2.5-pro": { 
-          "name": "Gemini 2.5 Pro (Gemini CLI)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65536 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          } 
-        }, 
-        "gemini-3-flash-preview": { 
-          "name": "Gemini 3 Flash Preview (Gemini CLI)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65536 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          } 
-        }, 
-        "gemini-3-pro-preview": { 
-          "name": "Gemini 3 Pro Preview (Gemini CLI)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65535 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          } 
-        }, 
-        "gemini-3.1-pro-preview": { 
-          "name": "Gemini 3.1 Pro Preview (Gemini CLI)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65535 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          } 
-        }, 
-        "gemini-3.1-pro-preview-customtools": { 
-          "name": "Gemini 3.1 Pro Preview Custom Tools (Gemini CLI)", 
-          "limit": { 
-            "context": 1048576, 
-            "output": 65535 
-          }, 
-          "modalities": { 
-            "input": [ 
-              "text", 
-              "image", 
-              "pdf" 
-            ], 
-            "output": [ 
-              "text" 
-            ] 
-          } 
-        } 
-      } 
-    } 
-  } 
-} 
-</file> 
  
 ===== 參考網址 ===== ===== 參考網址 =====
  • tech/opencode.1774234568.txt.gz
  • 上一次變更: 2026/03/23 10:56
  • jonathan