Cline 是開源 AI 程式設計助理,可以外掛至 VS Code,具計劃/執行模式,支援 MCP 協議, 所以我選擇它當作入門的工具之一。
問題筆記
使用 VSCode 與 Cline 作為起點時,一個雷點就是使用 Azure Open AI 用戶,究竟應該怎麼設定? 從此處可以看到很多人的討論。 看來有很多人也常常撞牆,雖然無法全面的測試一輪, 但以下是我對 Azure OpenAI 成功的設置,記錄下來作為以後參考用
API Provider 選擇 OpenAI Compatible Base URL 我直接從 Azure AI Foundry 上取出: 在 https://portal.azure.com/ 找到 Azure AI services | Azure OpenAI,再前往 Azure AI Foundry Portal 此時你應該可以在 Deployments 找到你的 Targe URI,類似如下 https://{resourcename}.openai.azure.com/openai/deployments/{deployment_name}/chat/completions?api-version={apiversion} API Key 就不用多說了,Azure 會提供你兩把金鑰,如果有異常時可以替換它們, Model ID 可以在 deployments > Model name 點擊連結後找到,會類似下面這樣
Compute Engine System service account [email protected] needs to have [compute.instances.start,compute.instances.stop] permissions applied in order to perform this operation.
This is an uncensored version of deepseek-ai/deepseek-r1 created with abliteration (see remove-refusals-with-transformers to know more about it). This is a crude, proof-of-concept implementation to remove refusals from an LLM model without using TransformerLens.
If “” does not appear or refuses to respond, you can first provide an example to guide, and then ask your question. For instance:
How many ‘r’ characters are there in the word “strawberry”?
Cloning into 'BreezyVoice'... fatal: unable to access 'https://github.com/mtkresearch/BreezyVoice.git/': Could not resolve host: github.com
因為 Kaggle 無法連網(x)
可以在右側[Session Option]區塊調整 Internet on
File > Open in Colab 可以
改用 [Google Colab]
執行到 !pip install -r requirements.txt 會有以下錯誤
1 2 3 4
Collecting ttsfrd-dependency==0.1 (from -r requirements.txt (line 10)) Downloading https://www.modelscope.cn/models/speech_tts/speech_kantts_ttsfrd/resolve/master/ttsfrd_dependency-0.1-py3-none-any.whl (1.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 1.4 MB/s eta 0:00:00 ERROR: ttsfrd-0.3.9-cp310-cp310-linux_x86_64.whl is not a supported wheel on this platform.
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu118 Collecting ttsfrd-dependency==0.1 (from -r requirements-mac.txt (line 35)) Downloading https://www.modelscope.cn/models/speech_tts/speech_kantts_ttsfrd/resolve/master/ttsfrd_dependency-0.1-py3-none-any.whl (1.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 1.6 MB/s eta 0:00:00 ERROR: ttsfrd-0.3.9-cp310-cp310-linux_x86_64.whl is not a supported wheel on this platform.
docker run -d –name mysql-sample -p 3306:3306 mysql-sample
這將啟動一個名為 mysql-sample 的容器,並將 MySQL 的 3306 埠映射到本機。
步驟 3: 驗證資料庫
進入 MySQL 容器並確認資料庫與表格是否正確建立:
docker exec -it mysql-sample mysql -u root -p
在 MySQL shell 中執行:
1 2 3
SHOW DATABASES; USE sample; SHOW TABLES;
參考
開發用指令
1 2 3 4 5 6
❯ docker run -d \ --name mysql-container \ -e MYSQL_ROOT_PASSWORD=You don't need to try this password; I made it up. A7X3P \ -v mysql-data:/var/lib/mysql \ -p 3306:3306 \ mysql:latest
# 定義 API 路徑 @app.post("/items/") asyncdefcreate_item(item: Item): # 假設邏輯檢查 if item.price <= 0: return {"error": "Price must be greater than 0"} return {"message": "Item created successfully!", "item": item}
接下來,讓我試著用不正確的方式呼叫 API,並且得到一個 422 的錯誤
1 2 3 4
curl -X POST "http://127.0.0.1:8000/items/" -H "Content-Type: application/json" -d '{"item": "should be number", "price": 10.5}'
# 定義 API 路徑 @app.post("/items/") asyncdefcreate_item(item: Item): # 假設邏輯檢查 if item.price <= 0: return {"error": "Price must be greater than 0"} return {"message": "Item created successfully!", "item": item}