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: 添加测试文件验证工作区路径
82 lines
2.0 KiB
TypeScript
82 lines
2.0 KiB
TypeScript
/**
|
|
* API URL Constants - Single Source of Truth
|
|
*
|
|
* All API URLs should reference this file.
|
|
* Backend (Rust) should use the same values in config.rs
|
|
*/
|
|
|
|
// === LLM Provider URLs ===
|
|
|
|
/**
|
|
* LLM Provider API URLs
|
|
*/
|
|
export const LLM_PROVIDER_URLS = {
|
|
// OpenAI
|
|
OPENAI: 'https://api.openai.com/v1',
|
|
|
|
// Anthropic
|
|
ANTHROPIC: 'https://api.anthropic.com',
|
|
|
|
// Gemini
|
|
GEMINI: 'https://generativelanguage.googleapis.com/v1beta',
|
|
|
|
// DeepSeek
|
|
DEEPSEEK: 'https://api.deepseek.com/v1',
|
|
|
|
// 智谱 (Zhipu)
|
|
ZHIPU: 'https://open.bigmodel.cn/api/paas/v4',
|
|
ZHIPU_CODING: 'https://open.bigmodel.cn/api/coding/paas/v4',
|
|
|
|
// Kimi (Moonshot)
|
|
KIMI: 'https://api.moonshot.cn/v1',
|
|
KIMI_CODING: 'https://api.kimi.com/coding/v1',
|
|
|
|
// 百炼 (Qwen/Bailian)
|
|
QWEN: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
|
|
QWEN_CODING: 'https://coding.dashscope.aliyuncs.com/v1',
|
|
|
|
// 火山引擎 (Volcengine/Doubao)
|
|
VOLCENGINE: 'https://ark.cn-beijing.volces.com/api/v3',
|
|
|
|
// Local/OLLama
|
|
OLLAMA: 'http://localhost:11434/v1',
|
|
LM_STUDIO: 'http://localhost:1234/v1',
|
|
VLLM: 'http://localhost:8000/v1',
|
|
} as const;
|
|
|
|
// === ZCLAW Gateway URLs ===
|
|
|
|
/**
|
|
* ZCLAW Gateway default URLs
|
|
*/
|
|
export const GATEWAY_URLS = {
|
|
DEFAULT_HTTP: 'http://127.0.0.1:50051',
|
|
DEFAULT_WS: 'ws://127.0.0.1:50051/ws',
|
|
FALLBACK_HTTP: 'http://127.0.0.1:4200',
|
|
FALLBACK_WS: 'ws://127.0.0.1:4200/ws',
|
|
} as const;
|
|
|
|
// === Helper Functions ===
|
|
|
|
/**
|
|
* Get provider URL by name
|
|
*/
|
|
export function getProviderUrl(provider: string): string {
|
|
const key = provider.toUpperCase().replace(/-/g, '_') as keyof typeof LLM_PROVIDER_URLS;
|
|
return LLM_PROVIDER_URLS[key] || LLM_PROVIDER_URLS.OPENAI;
|
|
}
|
|
|
|
/**
|
|
* Check if URL is a coding plan endpoint
|
|
*/
|
|
export function isCodingUrl(url: string): boolean {
|
|
return url.includes('/coding/') || url.includes('-coding');
|
|
}
|
|
|
|
/**
|
|
* Check if URL is a local endpoint
|
|
*/
|
|
export function isLocalUrl(url: string): boolean {
|
|
return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('[::1]');
|
|
}
|