feat: 新增技能编排引擎和工作流构建器组件
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
refactor: 统一Hands系统常量到单个源文件 refactor: 更新Hands中文名称和描述 fix: 修复技能市场在连接状态变化时重新加载 fix: 修复身份变更提案的错误处理逻辑 docs: 更新多个功能文档的验证状态和实现位置 docs: 更新Hands系统文档 test: 添加测试文件验证工作区路径
This commit is contained in:
112
desktop/src/constants/models.ts
Normal file
112
desktop/src/constants/models.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* Model Default Constants - Single Source of Truth
|
||||
*
|
||||
* All model-related defaults should reference this file.
|
||||
* Backend (Rust) should use the same values in kernel_commands.rs
|
||||
*/
|
||||
|
||||
// === Default Model Configuration ===
|
||||
|
||||
/**
|
||||
* Default model ID when user hasn't configured one
|
||||
* Using gpt-4o-mini as it's cost-effective and capable
|
||||
*/
|
||||
export const DEFAULT_MODEL_ID = 'gpt-4o-mini' as const;
|
||||
|
||||
/**
|
||||
* Default provider when user hasn't configured one
|
||||
*/
|
||||
export const DEFAULT_PROVIDER = 'openai' as const;
|
||||
|
||||
/**
|
||||
* Default max tokens for responses
|
||||
*/
|
||||
export const DEFAULT_MAX_TOKENS = 4096 as const;
|
||||
|
||||
/**
|
||||
* Default temperature for responses
|
||||
*/
|
||||
export const DEFAULT_TEMPERATURE = 0.7 as const;
|
||||
|
||||
/**
|
||||
* Default base URL for OpenAI API
|
||||
*/
|
||||
export const DEFAULT_OPENAI_BASE_URL = 'https://api.openai.com/v1' as const;
|
||||
|
||||
/**
|
||||
* Default base URL for Anthropic API
|
||||
*/
|
||||
export const DEFAULT_ANTHROPIC_BASE_URL = 'https://api.anthropic.com' as const;
|
||||
|
||||
// === Provider-Specific Defaults ===
|
||||
|
||||
export const PROVIDER_DEFAULTS = {
|
||||
openai: {
|
||||
baseUrl: 'https://api.openai.com/v1',
|
||||
defaultModel: 'gpt-4o-mini',
|
||||
},
|
||||
anthropic: {
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
defaultModel: 'claude-sonnet-4-20250514',
|
||||
},
|
||||
zhipu: {
|
||||
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
|
||||
defaultModel: 'glm-4-flash',
|
||||
},
|
||||
zhipu_coding: {
|
||||
baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4',
|
||||
defaultModel: 'glm-4-flash',
|
||||
},
|
||||
kimi: {
|
||||
baseUrl: 'https://api.moonshot.cn/v1',
|
||||
defaultModel: 'moonshot-v1-8k',
|
||||
},
|
||||
kimi_coding: {
|
||||
baseUrl: 'https://api.kimi.com/coding/v1',
|
||||
defaultModel: 'kimi-for-coding',
|
||||
},
|
||||
qwen: {
|
||||
baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
|
||||
defaultModel: 'qwen-turbo',
|
||||
},
|
||||
qwen_coding: {
|
||||
baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
|
||||
defaultModel: 'qwen3-coder-next',
|
||||
},
|
||||
deepseek: {
|
||||
baseUrl: 'https://api.deepseek.com/v1',
|
||||
defaultModel: 'deepseek-chat',
|
||||
},
|
||||
gemini: {
|
||||
baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
|
||||
defaultModel: 'gemini-2.0-flash',
|
||||
},
|
||||
local: {
|
||||
baseUrl: 'http://localhost:11434/v1',
|
||||
defaultModel: 'llama3',
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type ProviderType = keyof typeof PROVIDER_DEFAULTS;
|
||||
|
||||
// === Helper Functions ===
|
||||
|
||||
/**
|
||||
* Get provider default configuration
|
||||
*/
|
||||
export function getProviderDefaults(provider: string): {
|
||||
baseUrl: string;
|
||||
defaultModel: string;
|
||||
} {
|
||||
return PROVIDER_DEFAULTS[provider as ProviderType] || {
|
||||
baseUrl: DEFAULT_OPENAI_BASE_URL,
|
||||
defaultModel: DEFAULT_MODEL_ID,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a provider is a coding plan provider
|
||||
*/
|
||||
export function isCodingProvider(provider: string): boolean {
|
||||
return provider.endsWith('-coding') || provider === 'zhipu-coding';
|
||||
}
|
||||
Reference in New Issue
Block a user