mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 22:14:22 +00:00
fix(presets): make requiresApiKey required boolean, add sentinel docs
- Change requiresApiKey from optional to required boolean in CLI - Add requiresApiKey: true to all existing presets for consistency - Document 'ollama' placeholder as sentinel value in code comment - Add trailing newline to ollama.svg
This commit is contained in:
1 parent
3ce698c5fe
commit
8e29c48c6d
2 files changed
+14
-3
No files matched your search
@@ -17,8 +17,8 @@ export interface ProviderPreset {
|
|||||||
apiKeyPlaceholder: string;
|
apiKeyPlaceholder: string;
|
||||||
apiKeyHint: string;
|
apiKeyHint: string;
|
||||||
category: PresetCategory;
|
category: PresetCategory;
|
||||||
/** Set to false for local providers that don't need API key (default: true) */
|
/** Whether API key is required (default: true, set false for local providers) */
|
||||||
requiresApiKey?: boolean;
|
requiresApiKey: boolean;
|
||||||
/** Additional env vars for thinking mode, etc. */
|
/** Additional env vars for thinking mode, etc. */
|
||||||
extraEnv?: Record<string, string>;
|
extraEnv?: Record<string, string>;
|
||||||
/** Enable always thinking mode */
|
/** Enable always thinking mode */
|
||||||
@@ -44,6 +44,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'sk-or-...',
|
apiKeyPlaceholder: 'sk-or-...',
|
||||||
apiKeyHint: 'Get your API key at openrouter.ai/keys',
|
apiKeyHint: 'Get your API key at openrouter.ai/keys',
|
||||||
category: 'recommended',
|
category: 'recommended',
|
||||||
|
requiresApiKey: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'ollama',
|
id: 'ollama',
|
||||||
@@ -68,6 +69,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'ghp_...',
|
apiKeyPlaceholder: 'ghp_...',
|
||||||
apiKeyHint: 'Get your API key from Z.AI',
|
apiKeyHint: 'Get your API key from Z.AI',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'glmt',
|
id: 'glmt',
|
||||||
@@ -79,6 +81,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'ghp_...',
|
apiKeyPlaceholder: 'ghp_...',
|
||||||
apiKeyHint: 'Same API key as GLM',
|
apiKeyHint: 'Same API key as GLM',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
extraEnv: {
|
extraEnv: {
|
||||||
ANTHROPIC_TEMPERATURE: '0.2',
|
ANTHROPIC_TEMPERATURE: '0.2',
|
||||||
ANTHROPIC_MAX_TOKENS: '65536',
|
ANTHROPIC_MAX_TOKENS: '65536',
|
||||||
@@ -99,6 +102,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'sk-...',
|
apiKeyPlaceholder: 'sk-...',
|
||||||
apiKeyHint: 'Get your API key from Moonshot AI',
|
apiKeyHint: 'Get your API key from Moonshot AI',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
alwaysThinkingEnabled: true,
|
alwaysThinkingEnabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -111,6 +115,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'YOUR_AZURE_API_KEY',
|
apiKeyPlaceholder: 'YOUR_AZURE_API_KEY',
|
||||||
apiKeyHint: 'Create resource at ai.azure.com, get API key from Keys tab',
|
apiKeyHint: 'Create resource at ai.azure.com, get API key from Keys tab',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'mm',
|
id: 'mm',
|
||||||
@@ -122,6 +127,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'YOUR_MINIMAX_API_KEY_HERE',
|
apiKeyPlaceholder: 'YOUR_MINIMAX_API_KEY_HERE',
|
||||||
apiKeyHint: 'Get your API key at platform.minimax.io',
|
apiKeyHint: 'Get your API key at platform.minimax.io',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'deepseek',
|
id: 'deepseek',
|
||||||
@@ -133,6 +139,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'sk-...',
|
apiKeyPlaceholder: 'sk-...',
|
||||||
apiKeyHint: 'Get your API key at platform.deepseek.com',
|
apiKeyHint: 'Get your API key at platform.deepseek.com',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'qwen',
|
id: 'qwen',
|
||||||
@@ -144,6 +151,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'sk-...',
|
apiKeyPlaceholder: 'sk-...',
|
||||||
apiKeyHint: 'Get your API key from Alibaba Cloud Model Studio',
|
apiKeyHint: 'Get your API key from Alibaba Cloud Model Studio',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'ollama-cloud',
|
id: 'ollama-cloud',
|
||||||
@@ -155,6 +163,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
||||||
apiKeyHint: 'Get your API key at ollama.com',
|
apiKeyHint: 'Get your API key at ollama.com',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,9 @@ async function handleCreate(args: string[]): Promise<void> {
|
|||||||
apiKey = parsedArgs.apiKey;
|
apiKey = parsedArgs.apiKey;
|
||||||
} else {
|
} else {
|
||||||
console.log(info('No API key required for local Ollama'));
|
console.log(info('No API key required for local Ollama'));
|
||||||
apiKey = 'ollama'; // Placeholder token matching template
|
// Sentinel value 'ollama' matches config/base-ollama.settings.json template
|
||||||
|
// This is not a valid API key, just a placeholder for local-only providers
|
||||||
|
apiKey = 'ollama';
|
||||||
}
|
}
|
||||||
} else if (!apiKey) {
|
} else if (!apiKey) {
|
||||||
const keyPrompt = preset?.apiKeyHint ? `API Key (${preset.apiKeyHint})` : 'API Key';
|
const keyPrompt = preset?.apiKeyHint ? `API Key (${preset.apiKeyHint})` : 'API Key';
|
||||||
|
|||||||
Reference in new issue
Block a user