docs: sync all documentation to V3 config format
- Replace config/config.example.json with V3 format (version: 3, api_keys array, channel_list) - Update config-versioning.md: version 2→3, ConfigV2→ConfigV3, CurrentVersion=3 - Update 7 project READMEs: api_key→api_keys, add version: 3 to quick-start examples - Update 12 security docs (ANTIGRAVITY_AUTH + credential_encryption): api_key→api_keys - Update provider-refactoring.md: api_key→api_keys in all config examples - Update security_configuration.md: api_key→api_keys in Before example - Update 3 channel docs: channels→channel_list in JSON examples
This commit is contained in:
1 parent
be67aed4dc
commit
e304dce40e
26 files changed
+187
-132
No files matched your search
@@ -78,17 +78,17 @@ Inspired by [LiteLLM](https://docs.litellm.ai/docs/proxy/configs) design:
|
||||
"model_name": "deepseek-chat",
|
||||
"model": "openai/deepseek-chat",
|
||||
"api_base": "https://api.deepseek.com/v1",
|
||||
"api_key": "sk-xxx"
|
||||
"api_keys": ["sk-xxx"]
|
||||
},
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-xxx"
|
||||
"api_keys": ["sk-xxx"]
|
||||
},
|
||||
{
|
||||
"model_name": "claude-sonnet-4.6",
|
||||
"model": "anthropic/claude-sonnet-4.6",
|
||||
"api_key": "sk-xxx"
|
||||
"api_keys": ["sk-xxx"]
|
||||
},
|
||||
{
|
||||
"model_name": "gemini-3-flash",
|
||||
@@ -99,7 +99,7 @@ Inspired by [LiteLLM](https://docs.litellm.ai/docs/proxy/configs) design:
|
||||
"model_name": "my-company-llm",
|
||||
"model": "openai/company-model-v1",
|
||||
"api_base": "https://llm.company.com/v1",
|
||||
"api_key": "xxx"
|
||||
"api_keys": ["xxx"]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -252,7 +252,7 @@ func (c *Config) GetModelConfig(modelName string) (*ModelConfig, error) {
|
||||
{
|
||||
"providers": {
|
||||
"deepseek": {
|
||||
"api_key": "sk-xxx",
|
||||
"api_keys": ["sk-xxx"],
|
||||
"api_base": "https://api.deepseek.com/v1"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -346,6 +346,7 @@ Cela crée `~/.picoclaw/config.json` et le répertoire workspace.
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model_name": "gpt-5.4"
|
||||
@@ -355,7 +356,7 @@ Cela crée `~/.picoclaw/config.json` et le répertoire workspace.
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-your-api-key"
|
||||
"api_keys": ["sk-your-api-key"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ Ini membuat `~/.picoclaw/config.json` dan direktori workspace.
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model_name": "gpt-5.4"
|
||||
@@ -351,7 +352,7 @@ Ini membuat `~/.picoclaw/config.json` dan direktori workspace.
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-your-api-key"
|
||||
"api_keys": ["sk-your-api-key"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ Questo crea `~/.picoclaw/config.json` e la directory workspace.
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model_name": "gpt-5.4"
|
||||
@@ -351,7 +352,7 @@ Questo crea `~/.picoclaw/config.json` e la directory workspace.
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-your-api-key"
|
||||
"api_keys": ["sk-your-api-key"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -343,6 +343,7 @@ picoclaw onboard
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model_name": "gpt-5.4"
|
||||
@@ -352,7 +353,7 @@ picoclaw onboard
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-your-api-key"
|
||||
"api_keys": ["sk-your-api-key"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -343,6 +343,7 @@ Isso cria `~/.picoclaw/config.json` e o diretório workspace.
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model_name": "gpt-5.4"
|
||||
@@ -352,7 +353,7 @@ Isso cria `~/.picoclaw/config.json` e o diretório workspace.
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-your-api-key"
|
||||
"api_keys": ["sk-your-api-key"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -343,6 +343,7 @@ Lệnh này tạo `~/.picoclaw/config.json` và thư mục workspace.
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model_name": "gpt-5.4"
|
||||
@@ -352,7 +353,7 @@ Lệnh này tạo `~/.picoclaw/config.json` và thư mục workspace.
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-your-api-key"
|
||||
"api_keys": ["sk-your-api-key"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -343,6 +343,7 @@ picoclaw onboard
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model_name": "gpt-5.4"
|
||||
@@ -352,7 +353,7 @@ picoclaw onboard
|
||||
{
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_key": "sk-your-api-key"
|
||||
"api_keys": ["sk-your-api-key"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ When you load a config file:
|
||||
The `version` field in `config.json` indicates the schema version:
|
||||
- `0` or missing: Legacy config (no version field)
|
||||
- `1`: Previous version (will be auto-migrated to V2 on load)
|
||||
- `2`: Current version
|
||||
- `2`: Previous version (will be auto-migrated to V3 on load)
|
||||
- `3`: Current version
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -64,8 +65,8 @@ When making breaking changes to the config schema:
|
||||
Create a new struct for the new version if the structure changes significantly:
|
||||
|
||||
```go
|
||||
// ConfigV2 represents version 2 config structure
|
||||
type ConfigV2 struct {
|
||||
// ConfigV3 represents version 3 config structure
|
||||
type ConfigV3 struct {
|
||||
Version int `json:"version"`
|
||||
Agents AgentsConfig `json:"agents"`
|
||||
// ... other fields with new structure
|
||||
@@ -75,7 +76,7 @@ type ConfigV2 struct {
|
||||
### Step 2: Update Current Config Version
|
||||
|
||||
```go
|
||||
const CurrentVersion = 2 // Increment this
|
||||
const CurrentVersion = 3 // Increment this
|
||||
```
|
||||
|
||||
### Step 3: Add a Loader Function
|
||||
@@ -141,9 +142,9 @@ Create a test in `config_migration_test.go`:
|
||||
|
||||
```go
|
||||
func TestMigrateV2ToV3(t *testing.T) {
|
||||
// Create a version 2 config
|
||||
v2Config := Config{
|
||||
Version: 2,
|
||||
// Create a version 3 config
|
||||
v3Config := Config{
|
||||
Version: 3,
|
||||
// ... set up test data
|
||||
}
|
||||
|
||||
@@ -224,7 +225,7 @@ Backups are created in the same directory as your config file:
|
||||
|
||||
### Scenario: Adding a new field with default value
|
||||
|
||||
Old config (version 2):
|
||||
Old config (version 3):
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
|
||||
@@ -691,7 +691,7 @@ case "your-provider":
|
||||
{
|
||||
"model_name": "your-model",
|
||||
"model": "your-provider/model-name",
|
||||
"api_key": "your-api-key",
|
||||
"api_keys": ["your-api-key"],
|
||||
"api_base": "https://api.your-provider.com/v1"
|
||||
}
|
||||
]
|
||||
@@ -725,7 +725,7 @@ picoclaw agent -m "Hello" --model your-model
|
||||
export PICOCLAW_AGENTS_DEFAULTS_MODEL=your-model
|
||||
|
||||
# Remplacer les paramètres du fournisseur
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_key":"..."}]'
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_keys":["..."]}]'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -691,7 +691,7 @@ case "your-provider":
|
||||
{
|
||||
"model_name": "your-model",
|
||||
"model": "your-provider/model-name",
|
||||
"api_key": "your-api-key",
|
||||
"api_keys": ["your-api-key"],
|
||||
"api_base": "https://api.your-provider.com/v1"
|
||||
}
|
||||
]
|
||||
@@ -725,7 +725,7 @@ picoclaw agent -m "Hello" --model your-model
|
||||
export PICOCLAW_AGENTS_DEFAULTS_MODEL=your-model
|
||||
|
||||
# プロバイダー設定の上書き
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_key":"..."}]'
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_keys":["..."]}]'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -689,7 +689,7 @@ case "your-provider":
|
||||
{
|
||||
"model_name": "your-model",
|
||||
"model": "your-provider/model-name",
|
||||
"api_key": "your-api-key",
|
||||
"api_keys": ["your-api-key"],
|
||||
"api_base": "https://api.your-provider.com/v1"
|
||||
}
|
||||
]
|
||||
@@ -723,7 +723,7 @@ picoclaw agent -m "Hello" --model your-model
|
||||
export PICOCLAW_AGENTS_DEFAULTS_MODEL=your-model
|
||||
|
||||
# Override provider settings
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_key":"..."}]'
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_keys":["..."]}]'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -691,7 +691,7 @@ case "your-provider":
|
||||
{
|
||||
"model_name": "your-model",
|
||||
"model": "your-provider/model-name",
|
||||
"api_key": "your-api-key",
|
||||
"api_keys": ["your-api-key"],
|
||||
"api_base": "https://api.your-provider.com/v1"
|
||||
}
|
||||
]
|
||||
@@ -725,7 +725,7 @@ picoclaw agent -m "Hello" --model your-model
|
||||
export PICOCLAW_AGENTS_DEFAULTS_MODEL=your-model
|
||||
|
||||
# Substituir configurações do provedor
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_key":"..."}]'
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_keys":["..."]}]'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -691,7 +691,7 @@ case "your-provider":
|
||||
{
|
||||
"model_name": "your-model",
|
||||
"model": "your-provider/model-name",
|
||||
"api_key": "your-api-key",
|
||||
"api_keys": ["your-api-key"],
|
||||
"api_base": "https://api.your-provider.com/v1"
|
||||
}
|
||||
]
|
||||
@@ -725,7 +725,7 @@ picoclaw agent -m "Hello" --model your-model
|
||||
export PICOCLAW_AGENTS_DEFAULTS_MODEL=your-model
|
||||
|
||||
# Ghi đè cài đặt nhà cung cấp
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_key":"..."}]'
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_keys":["..."]}]'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -691,7 +691,7 @@ case "your-provider":
|
||||
{
|
||||
"model_name": "your-model",
|
||||
"model": "your-provider/model-name",
|
||||
"api_key": "your-api-key",
|
||||
"api_keys": ["your-api-key"],
|
||||
"api_base": "https://api.your-provider.com/v1"
|
||||
}
|
||||
]
|
||||
@@ -725,7 +725,7 @@ picoclaw agent -m "Hello" --model your-model
|
||||
export PICOCLAW_AGENTS_DEFAULTS_MODEL=your-model
|
||||
|
||||
# 覆盖提供商设置
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_key":"..."}]'
|
||||
export PICOCLAW_MODEL_LIST='[{"model_name":"your-model","model":"your-provider/model-name","api_keys":["..."]}]'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -33,7 +33,7 @@ enc://AAAA...base64...
|
||||
{
|
||||
"model_name": "gpt-4o",
|
||||
"model": "openai/gpt-4o",
|
||||
"api_key": "enc://AAAA...base64...",
|
||||
"api_keys": ["enc://AAAA...base64..."],
|
||||
"api_base": "https://api.openai.com/v1"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -32,7 +32,7 @@ enc://AAAA...base64...
|
||||
{
|
||||
"model_name": "gpt-4o",
|
||||
"model": "openai/gpt-4o",
|
||||
"api_key": "enc://AAAA...base64...",
|
||||
"api_keys": ["enc://AAAA...base64..."],
|
||||
"api_base": "https://api.openai.com/v1"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -31,7 +31,7 @@ enc://AAAA...base64...
|
||||
{
|
||||
"model_name": "gpt-4o",
|
||||
"model": "openai/gpt-4o",
|
||||
// "api_key": "enc://AAAA...base64..." move to .security.yml
|
||||
// "api_keys": ["enc://AAAA...base64..."] move to .security.yml
|
||||
"api_base": "https://api.openai.com/v1"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -33,7 +33,7 @@ enc://AAAA...base64...
|
||||
{
|
||||
"model_name": "gpt-4o",
|
||||
"model": "openai/gpt-4o",
|
||||
"api_key": "enc://AAAA...base64...",
|
||||
"api_keys": ["enc://AAAA...base64..."],
|
||||
"api_base": "https://api.openai.com/v1"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -33,7 +33,7 @@ enc://AAAA...base64...
|
||||
{
|
||||
"model_name": "gpt-4o",
|
||||
"model": "openai/gpt-4o",
|
||||
"api_key": "enc://AAAA...base64...",
|
||||
"api_keys": ["enc://AAAA...base64..."],
|
||||
"api_base": "https://api.openai.com/v1"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -32,7 +32,7 @@ enc://AAAA...base64...
|
||||
{
|
||||
"model_name": "gpt-4o",
|
||||
"model": "openai/gpt-4o",
|
||||
"api_key": "enc://AAAA...base64...",
|
||||
"api_keys": ["enc://AAAA...base64..."],
|
||||
"api_base": "https://api.openai.com/v1"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -145,7 +145,7 @@ You can now remove sensitive fields from `config.json` since they're loaded from
|
||||
"model_name": "gpt-5.4",
|
||||
"model": "openai/gpt-5.4",
|
||||
"api_base": "https://api.openai.com/v1",
|
||||
"api_key": "sk-your-actual-api-key-here"
|
||||
"api_keys": ["sk-your-actual-api-key-here"]
|
||||
}
|
||||
],
|
||||
"channel_list": {
|
||||
|
||||
Reference in new issue
Block a user