droid / src /configs /config.js
devme's picture
Upload 15 files
bde2c7b verified
// 配置常量
const CONFIG = {
port:process.env.PORT || 3000,
endpoint: [
{
name: 'openai',
base_url: 'https://app.factory.ai/api/llm/o/v1/responses'
},
{
name: 'anthropic',
base_url: 'https://app.factory.ai/api/llm/a/v1/messages'
},
{
name: 'common',
base_url: 'https://app.factory.ai/api/llm/o/v1/chat/completions'
}
],
models: [
{
id: 'claude-opus-4-5-20251101',
type: 'anthropic',
reasoning: 'auto'
},
{
id: 'claude-opus-4-1-20250805',
type: 'anthropic',
reasoning: 'auto'
},
{
id: 'claude-haiku-4-5-20251001',
type: 'anthropic',
reasoning: 'auto'
},
{
id: 'claude-sonnet-4-5-20250929',
type: 'anthropic',
reasoning: 'auto'
},
{
id: 'gpt-5-codex',
type: 'openai',
reasoning: 'off'
},
{
id: 'glm-4.6',
type: 'common'
}
],
user_agent: 'factory-cli/0.27.0',
system_prompt: 'You are Droid, an AI software engineering agent built by Factory.\n\n'
}
export function getConfig() {
return CONFIG
}
export function getModelById(modelId) {
return CONFIG.models.find(m => m.id === modelId)
}
export function getEndpointByType(type) {
return CONFIG.endpoint.find(e => e.name === type)
}
export function getPort() {
return parseInt(process.env.PORT) || CONFIG.port
}
export function getSystemPrompt() {
return CONFIG.system_prompt || ''
}
export function getModelReasoning(modelId) {
const model = getModelById(modelId)
if (!model || !model.reasoning) {
return null
}
const reasoningLevel = model.reasoning.toLowerCase()
if (['low', 'medium', 'high', 'auto'].includes(reasoningLevel)) {
return reasoningLevel
}
return null
}
export function getUserAgent() {
return CONFIG.user_agent
}
export function getProxyUrl() {
return process.env.PROXY_URL || null
}