網頁

2026年1月2日 星期五

vscode 的 vibe coding

點選左側 continue icon
拉寬 continue 視窗
點選 continue 視窗右上側齒輪
點選左側 Models
點選 Chat 右側齒輪
自動出現 config.yaml 檔案, 或手動開啟 %USERPROFILE%\.continue\config.yaml

name: Local Config
version: 1.0.0
schema: v1
models:
  - name: gpt-oss-120b
    provider: vllm
    model: gpt-oss-120b
    apiBase: http://192.168.0.108:8000/v1
    title: gpt-oss-120b
    roles:
      - chat
      - edit
      - autocomplete
      - apply
  - name: Llama-3.1-8B-Instruct
    provider: vllm
    model: Llama-3.1-8B-Instruct
    apiBase: https://www.sunhousetechnology.com.tw/trtllm-Llama-3.1-8B-Instruct/v1
    title: Llama-3.1-8B-Instruct
    roles:
      - chat
      - edit
      - autocomplete
      - apply
      
點選 continue 視窗右上 "Local Config v" 選擇 Reload

=========================
安裝 Cline 完成後 選 Login to Cline, 開啟網頁, 同意授權
回 vscode, 有對話框 Allow 'Cline' extension to open this URL
按 Open
點選左側 cline icon
點選 cline 視窗右上側齒輪
API Provider: OpenAI Compatible
Base URL: http://192.168.0.108:8000
OpenAI Compatible API Key: token-abc123
Model ID: gpt-oss-120b
點選 cline 視窗右上 Done

=========================
安裝 Remote-SSH
點選左側 Remote Explorer
在 REMOTE/SSH 右側按齒輪
中間視窗上面選擇 C:/Users/user_name/.ssh/config
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
Host hostA
    HostName user_ip
    User user_name
    Port 2201
Host hostB
    HostName user_ip
    User user_name
    Port 2202
在 REMOTE/SSH/spark 右側可以選擇
Connect in Current Window... 或 Connect in New Window...
第一次登入時在中間視窗上面選擇 linux, 選擇 continue
中間視窗上面輸入密碼

DGX Spark 使用 LLM 經歷

同一模型使用 TRT LLM 比使用 vLLM 好, 不論有無轉成 nvfp4

10GB 以下 Qwen2.5-Coder-7B
10GB 以下 Qwen2.5-Coder-32B-Instruct
30GB 以下 gpt-oss-20b
30GB 以下 Llama-3.1-8B-Instruct
上述模型耗記憶體和反應速度都不錯,只是 Qwen2.5-Coder-7B 對話不行

gpt-oss-120b 耗記憶體,速度有些慢

Llama-3.3-70B-Instruct 耗記憶體,速度超慢
# 原本應該從 meta-llama/Llama-3.3-70B-Instruct 下載模型,再轉成 nvfp4
# 但是下載的模型不只無法轉成 nvfp4, 也無法執行
# 發現有 nvidia/Llama-3.3-70B-Instruct-NVFP4 直接下載使用

將 open webui 的 http 轉成 https

產生證書,需先執行一個 nginx 在 80 port 上,以便 cerbot 產生證書
$ sta_nginx_certbot.sh
$ docker run --rm -it \
  -v $(pwd)/nginx/certs:/etc/letsencrypt \
  -v $(pwd)/nginx/acme:/var/www/certbot \
  certbot/certbot certonly \
  --webroot \
  -w /var/www/certbot \
  -d www.sunhousetechnology.com.tw
證書產生在下列目錄
nginx/certs/live/www.sunhousetechnology.com.tw/fullchain.pem
nginx/certs/live/www.sunhousetechnology.com.tw/privkey.pem
停止 nginx_certbot

docker nginx 加入 nginx_certbot.conf, 以便在更新證書時,不用停止 nginx
server {
    listen 80 default_server;
    server_name _;

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;
    
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    location / {
        return 200 "nginx certbot ok\n";
    }
}

更新證書
$ docker run --rm \
  -v $(pwd)/nginx/certs:/etc/letsencrypt \
  -v $(pwd)/nginx/acme:/var/www/certbot \
  certbot/certbot renew

測試證書
$ docker run --rm \
  -v $(pwd)/nginx/certs:/etc/letsencrypt \
  -v $(pwd)/nginx/acme:/var/www/certbot \
  certbot/certbot renew --dry-run


# 1. Nginx 是否在 webnet
docker network inspect webnet
# 2. open-webui 是否在 webnet
docker ps
# 3. Nginx 內部能否解析
docker exec -it nginx getent hosts open-webui
# 4. Nginx 內部直連測試
docker exec -it nginx curl http://open-webui:8080
# nginx.conf 修改後 nginx 重開
docker restart nginx
# 測試命令
curl -k -H "Cache-Control: no-cache" \
     -H "Pragma: no-cache" \
     https://www.sunhousetechnology.com.tw/

為了避免一些 docker 沒有啟動,造成 nginx 無法啟動,將
    location /sub-path/ {
        proxy_pass http://sub-path:8001;
    }
改成
    location /sub-path/ {
        set $p8001 http://sub-path:8001;
        rewrite ^/sub-path/(.*)$ /$1 break;
        proxy_pass $p8001;
    }

open-webui 無法掛到 https://www.sunhousetechnology.com.tw/open-webui 必須使用 /
    location / {
        set $webui http://open-webui:8080;
        # 無法使用 rewrite, 只能用 location /
        proxy_pass $webui;
        # 避免下列 WebSocket 錯誤
        # "GET /ws/socket.io/?EIO=4&transport=websocket HTTP/1.1" 400 46
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

原先也要加入 dashboard, 但兩者同時都使用 WebSocket, 而且是 GET /ws 開頭,所以只好放棄
    location /dashboard/ {
        set $dashboard http://dashboard:8080;
        rewrite ^/dashboard/(.*)$ /$1 break;
        proxy_pass $dashboard;
        # 避免下列 WebSocket 錯誤
        # "GET /ws HTTP/1.1" 500 21
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }