Delete config.js
Browse files
config.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
| 1 |
-
// 配置常量
|
| 2 |
-
const CONFIG = {
|
| 3 |
-
port:process.env.PORT || 3000,
|
| 4 |
-
|
| 5 |
-
endpoint: [
|
| 6 |
-
{
|
| 7 |
-
name: 'openai',
|
| 8 |
-
base_url: 'https://app.factory.ai/api/llm/o/v1/responses'
|
| 9 |
-
},
|
| 10 |
-
{
|
| 11 |
-
name: 'anthropic',
|
| 12 |
-
base_url: 'https://app.factory.ai/api/llm/a/v1/messages'
|
| 13 |
-
},
|
| 14 |
-
{
|
| 15 |
-
name: 'common',
|
| 16 |
-
base_url: 'https://app.factory.ai/api/llm/o/v1/chat/completions'
|
| 17 |
-
}
|
| 18 |
-
],
|
| 19 |
-
|
| 20 |
-
models: [
|
| 21 |
-
{
|
| 22 |
-
id: 'claude-opus-4-1-20250805',
|
| 23 |
-
type: 'anthropic',
|
| 24 |
-
reasoning: 'auto'
|
| 25 |
-
},
|
| 26 |
-
{
|
| 27 |
-
id: 'claude-haiku-4-5-20251001',
|
| 28 |
-
type: 'anthropic',
|
| 29 |
-
reasoning: 'auto'
|
| 30 |
-
},
|
| 31 |
-
{
|
| 32 |
-
id: 'claude-sonnet-4-5-20250929',
|
| 33 |
-
type: 'anthropic',
|
| 34 |
-
reasoning: 'auto'
|
| 35 |
-
},
|
| 36 |
-
{
|
| 37 |
-
id: 'gpt-5-2025-08-07',
|
| 38 |
-
type: 'openai',
|
| 39 |
-
reasoning: 'auto'
|
| 40 |
-
},
|
| 41 |
-
{
|
| 42 |
-
id: 'gpt-5-codex',
|
| 43 |
-
type: 'openai',
|
| 44 |
-
reasoning: 'off'
|
| 45 |
-
},
|
| 46 |
-
{
|
| 47 |
-
id: 'glm-4.6',
|
| 48 |
-
type: 'common'
|
| 49 |
-
}
|
| 50 |
-
],
|
| 51 |
-
|
| 52 |
-
dev_mode: process.env.DEV_MODE=='true' || false,
|
| 53 |
-
user_agent: 'factory-cli/0.22.14',
|
| 54 |
-
system_prompt: 'You are Droid, an AI software engineering agent built by Factory.\n\n'
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
export function loadConfig() {
|
| 58 |
-
// 配置已经在代码中定义,无需加载
|
| 59 |
-
return CONFIG
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
export function getConfig() {
|
| 63 |
-
return CONFIG
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
export function getModelById(modelId) {
|
| 67 |
-
return CONFIG.models.find(m => m.id === modelId)
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
export function getEndpointByType(type) {
|
| 71 |
-
return CONFIG.endpoint.find(e => e.name === type)
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
export function isDevMode() {
|
| 75 |
-
return CONFIG.dev_mode === true
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
export function getPort() {
|
| 79 |
-
return parseInt(process.env.PORT) || CONFIG.port
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
export function getSystemPrompt() {
|
| 83 |
-
return CONFIG.system_prompt || ''
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
export function getModelReasoning(modelId) {
|
| 87 |
-
const model = getModelById(modelId)
|
| 88 |
-
if (!model || !model.reasoning) {
|
| 89 |
-
return null
|
| 90 |
-
}
|
| 91 |
-
const reasoningLevel = model.reasoning.toLowerCase()
|
| 92 |
-
if (['low', 'medium', 'high', 'auto'].includes(reasoningLevel)) {
|
| 93 |
-
return reasoningLevel
|
| 94 |
-
}
|
| 95 |
-
return null
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
export function getUserAgent() {
|
| 99 |
-
return CONFIG.user_agent
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
export function getProxyUrl() {
|
| 103 |
-
return process.env.PROXY_URL || null
|
| 104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|