openfox 1.6.20 → 1.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{auto-compaction-NFLWKJAO.js → auto-compaction-U75EINMB.js} +3 -3
- package/dist/{chat-handler-2RVTVNPF.js → chat-handler-JEMPI5UF.js} +5 -5
- package/dist/{chunk-IN5EP4ZB.js → chunk-6NPMZFMP.js} +2 -2
- package/dist/{chunk-U3KMU3UE.js → chunk-AU33PQAB.js} +2 -2
- package/dist/{chunk-QY7BMXWT.js → chunk-B7E3BICY.js} +6 -2
- package/dist/{chunk-OVLFEBRR.js → chunk-FX4SUY2S.js} +27 -373
- package/dist/{chunk-LTPZ4GTW.js → chunk-HWOYZ245.js} +6 -6
- package/dist/{chunk-KOBGCNUE.js → chunk-HZP2V5Z6.js} +62 -14
- package/dist/{chunk-R7UAGXQW.js → chunk-SJVEX2NR.js} +42 -24
- package/dist/{chunk-KOUMYBYM.js → chunk-WINI5HX7.js} +54 -3
- package/dist/{chunk-ZDNXCVW4.js → chunk-XRGMFOVG.js} +11 -5
- package/dist/chunk-XYD5JXRM.js +483 -0
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-67AX6CNS.js → config-SWDAJMQ3.js} +5 -5
- package/dist/{orchestrator-ZICQ5NIZ.js → orchestrator-T2IPRZ7B.js} +4 -4
- package/dist/package.json +1 -1
- package/dist/{processor-MPSYT534.js → processor-VKFEOK46.js} +2 -2
- package/dist/{protocol-I7rn7Msg.d.ts → protocol-BYM6rZvW.d.ts} +12 -0
- package/dist/{provider-DKGBQHUS.js → provider-CDM4LQAC.js} +9 -8
- package/dist/{serve-B5A52252.js → serve-X3PKC27B.js} +10 -10
- package/dist/server/index.d.ts +24 -1
- package/dist/server/index.js +8 -8
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-ERJ3QRQU.js → tools-4ODVFMW7.js} +3 -3
- package/dist/{vision-fallback-ADYRFFD4.js → vision-fallback-VXGCQKLA.js} +2 -2
- package/dist/web/assets/{index-vBklayFL.css → index-B9-lT3Kc.css} +1 -1
- package/dist/web/assets/index-DHP3d5Cl.js +151 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-55N6FAAZ.js +0 -117
- package/dist/web/assets/index-vOba1XKB.js +0 -151
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
maybeAutoCompactContext,
|
|
3
3
|
performManualContextCompaction,
|
|
4
4
|
resolveCompactionStatsIdentity
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HZP2V5Z6.js";
|
|
6
6
|
import "./chunk-NBU6KIOD.js";
|
|
7
7
|
import "./chunk-574HZVLE.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-XYD5JXRM.js";
|
|
9
9
|
import "./chunk-PMDJEJYY.js";
|
|
10
10
|
import "./chunk-EEPU4INU.js";
|
|
11
11
|
import "./chunk-DZHZ3UUR.js";
|
|
@@ -22,4 +22,4 @@ export {
|
|
|
22
22
|
performManualContextCompaction,
|
|
23
23
|
resolveCompactionStatsIdentity
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=auto-compaction-
|
|
25
|
+
//# sourceMappingURL=auto-compaction-U75EINMB.js.map
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
} from "./chunk-AV45GQ7B.js";
|
|
11
11
|
import {
|
|
12
12
|
runChatTurn
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-AU33PQAB.js";
|
|
14
|
+
import "./chunk-HZP2V5Z6.js";
|
|
15
15
|
import "./chunk-NBU6KIOD.js";
|
|
16
16
|
import "./chunk-574HZVLE.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-XYD5JXRM.js";
|
|
18
18
|
import {
|
|
19
19
|
getEventStore
|
|
20
20
|
} from "./chunk-PMDJEJYY.js";
|
|
@@ -61,7 +61,7 @@ async function startChatSession(sessionId, content, deps, options) {
|
|
|
61
61
|
sessionManager.setRunning(sessionId, true);
|
|
62
62
|
broadcastForSession(sessionId, createSessionRunningMessage(true));
|
|
63
63
|
try {
|
|
64
|
-
const { maybeAutoCompactContext } = await import("./auto-compaction-
|
|
64
|
+
const { maybeAutoCompactContext } = await import("./auto-compaction-U75EINMB.js");
|
|
65
65
|
await maybeAutoCompactContext({
|
|
66
66
|
sessionManager,
|
|
67
67
|
sessionId,
|
|
@@ -170,4 +170,4 @@ export {
|
|
|
170
170
|
startChatSession,
|
|
171
171
|
stopSessionExecution
|
|
172
172
|
};
|
|
173
|
-
//# sourceMappingURL=chat-handler-
|
|
173
|
+
//# sourceMappingURL=chat-handler-JEMPI5UF.js.map
|
|
@@ -29,7 +29,7 @@ function isVisionFallbackEnabled() {
|
|
|
29
29
|
async function ensureVisionFallbackConfigLoaded() {
|
|
30
30
|
if (configLoaded) return;
|
|
31
31
|
try {
|
|
32
|
-
const { loadGlobalConfig, getVisionFallback } = await import("./config-
|
|
32
|
+
const { loadGlobalConfig, getVisionFallback } = await import("./config-SWDAJMQ3.js");
|
|
33
33
|
const { getRuntimeConfig } = await import("./runtime-config-2XJJIMSC.js");
|
|
34
34
|
const runtimeConfig = getRuntimeConfig();
|
|
35
35
|
const mode = runtimeConfig.mode ?? "production";
|
|
@@ -135,4 +135,4 @@ export {
|
|
|
135
135
|
describeImage,
|
|
136
136
|
describeImageFromDataUrl
|
|
137
137
|
};
|
|
138
|
-
//# sourceMappingURL=chunk-
|
|
138
|
+
//# sourceMappingURL=chunk-6NPMZFMP.js.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getToolRegistryForAgent,
|
|
14
14
|
loadAllAgentsDefault,
|
|
15
15
|
runTopLevelAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HZP2V5Z6.js";
|
|
17
17
|
import {
|
|
18
18
|
getCurrentContextWindowId,
|
|
19
19
|
getEventStore
|
|
@@ -293,4 +293,4 @@ export {
|
|
|
293
293
|
runBuilderTurn,
|
|
294
294
|
runVerifierTurn
|
|
295
295
|
};
|
|
296
|
-
//# sourceMappingURL=chunk-
|
|
296
|
+
//# sourceMappingURL=chunk-AU33PQAB.js.map
|
|
@@ -69,7 +69,11 @@ function buildSessionStats(messagesWithStats) {
|
|
|
69
69
|
completionTime: call.completionTime,
|
|
70
70
|
prefillSpeed: call.prefillSpeed,
|
|
71
71
|
generationSpeed: call.generationSpeed,
|
|
72
|
-
totalTime: call.totalTime
|
|
72
|
+
totalTime: call.totalTime,
|
|
73
|
+
...call.temperature !== void 0 && { temperature: call.temperature },
|
|
74
|
+
...call.topP !== void 0 && { topP: call.topP },
|
|
75
|
+
...call.topK !== void 0 && { topK: call.topK },
|
|
76
|
+
...call.maxTokens !== void 0 && { maxTokens: call.maxTokens }
|
|
73
77
|
});
|
|
74
78
|
}
|
|
75
79
|
}
|
|
@@ -121,4 +125,4 @@ function computeSessionStats(messages) {
|
|
|
121
125
|
export {
|
|
122
126
|
computeSessionStats
|
|
123
127
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-B7E3BICY.js.map
|
|
@@ -1,172 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getBackendCapabilities,
|
|
3
|
+
getModelProfile
|
|
4
|
+
} from "./chunk-XYD5JXRM.js";
|
|
1
5
|
import {
|
|
2
6
|
describeImageFromDataUrl,
|
|
3
7
|
ensureVisionFallbackConfigLoaded
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6NPMZFMP.js";
|
|
5
9
|
import {
|
|
6
10
|
logger
|
|
7
11
|
} from "./chunk-PNBH3RAX.js";
|
|
8
12
|
|
|
9
|
-
// src/server/llm/backend.ts
|
|
10
|
-
var BACKEND_CAPABILITIES = {
|
|
11
|
-
vllm: {
|
|
12
|
-
supportsReasoningField: true,
|
|
13
|
-
supportsChatTemplateKwargs: true,
|
|
14
|
-
supportsTopK: true
|
|
15
|
-
},
|
|
16
|
-
sglang: {
|
|
17
|
-
supportsReasoningField: true,
|
|
18
|
-
supportsChatTemplateKwargs: true,
|
|
19
|
-
supportsTopK: true
|
|
20
|
-
},
|
|
21
|
-
ollama: {
|
|
22
|
-
supportsReasoningField: false,
|
|
23
|
-
supportsChatTemplateKwargs: false,
|
|
24
|
-
supportsTopK: false
|
|
25
|
-
},
|
|
26
|
-
llamacpp: {
|
|
27
|
-
supportsReasoningField: false,
|
|
28
|
-
supportsChatTemplateKwargs: false,
|
|
29
|
-
supportsTopK: true
|
|
30
|
-
},
|
|
31
|
-
"opencode-go": {
|
|
32
|
-
supportsReasoningField: false,
|
|
33
|
-
supportsChatTemplateKwargs: false,
|
|
34
|
-
supportsTopK: true
|
|
35
|
-
},
|
|
36
|
-
unknown: {
|
|
37
|
-
// Assume vLLM-like for unknown backends
|
|
38
|
-
supportsReasoningField: true,
|
|
39
|
-
supportsChatTemplateKwargs: true,
|
|
40
|
-
supportsTopK: true
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
function getBackendCapabilities(backend) {
|
|
44
|
-
return BACKEND_CAPABILITIES[backend];
|
|
45
|
-
}
|
|
46
|
-
async function detectBackend(baseUrl, explicitBackend, silent = false) {
|
|
47
|
-
if (explicitBackend && explicitBackend !== "unknown") {
|
|
48
|
-
if (silent) {
|
|
49
|
-
logger.debug("Using explicit backend", { backend: explicitBackend });
|
|
50
|
-
} else {
|
|
51
|
-
logger.info("Using explicit backend", { backend: explicitBackend });
|
|
52
|
-
}
|
|
53
|
-
return explicitBackend;
|
|
54
|
-
}
|
|
55
|
-
const probeUrl = baseUrl.replace(/\/v1\/?$/, "");
|
|
56
|
-
try {
|
|
57
|
-
if (await probeOllama(probeUrl)) {
|
|
58
|
-
if (silent) {
|
|
59
|
-
logger.debug("Detected Ollama backend", { url: probeUrl });
|
|
60
|
-
} else {
|
|
61
|
-
logger.info("Detected Ollama backend", { url: probeUrl });
|
|
62
|
-
}
|
|
63
|
-
return "ollama";
|
|
64
|
-
}
|
|
65
|
-
if (await probeLlamaCpp(probeUrl)) {
|
|
66
|
-
if (silent) {
|
|
67
|
-
logger.debug("Detected llama.cpp backend", { url: probeUrl });
|
|
68
|
-
} else {
|
|
69
|
-
logger.info("Detected llama.cpp backend", { url: probeUrl });
|
|
70
|
-
}
|
|
71
|
-
return "llamacpp";
|
|
72
|
-
}
|
|
73
|
-
if (await probeSGLang(probeUrl)) {
|
|
74
|
-
if (silent) {
|
|
75
|
-
logger.debug("Detected SGLang backend", { url: probeUrl });
|
|
76
|
-
} else {
|
|
77
|
-
logger.info("Detected SGLang backend", { url: probeUrl });
|
|
78
|
-
}
|
|
79
|
-
return "sglang";
|
|
80
|
-
}
|
|
81
|
-
if (await probeOpenAI(baseUrl)) {
|
|
82
|
-
if (silent) {
|
|
83
|
-
logger.debug("Detected vLLM backend (OpenAI-compatible)", { url: baseUrl });
|
|
84
|
-
} else {
|
|
85
|
-
logger.info("Detected vLLM backend (OpenAI-compatible)", { url: baseUrl });
|
|
86
|
-
}
|
|
87
|
-
return "vllm";
|
|
88
|
-
}
|
|
89
|
-
if (silent) {
|
|
90
|
-
logger.debug("Could not detect backend, using unknown", { url: baseUrl });
|
|
91
|
-
} else {
|
|
92
|
-
logger.warn("Could not detect backend, using unknown", { url: baseUrl });
|
|
93
|
-
}
|
|
94
|
-
return "unknown";
|
|
95
|
-
} catch (error) {
|
|
96
|
-
if (silent) {
|
|
97
|
-
logger.debug("Backend detection failed", {
|
|
98
|
-
url: baseUrl,
|
|
99
|
-
error: error instanceof Error ? error.message : String(error)
|
|
100
|
-
});
|
|
101
|
-
} else {
|
|
102
|
-
logger.warn("Backend detection failed", {
|
|
103
|
-
url: baseUrl,
|
|
104
|
-
error: error instanceof Error ? error.message : String(error)
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return "unknown";
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async function probeOllama(baseUrl) {
|
|
111
|
-
try {
|
|
112
|
-
const response = await fetch(`${baseUrl}/api/tags`, {
|
|
113
|
-
signal: AbortSignal.timeout(5e3)
|
|
114
|
-
});
|
|
115
|
-
return response.ok;
|
|
116
|
-
} catch {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
async function probeLlamaCpp(baseUrl) {
|
|
121
|
-
try {
|
|
122
|
-
const response = await fetch(`${baseUrl}/health`, {
|
|
123
|
-
signal: AbortSignal.timeout(5e3)
|
|
124
|
-
});
|
|
125
|
-
if (!response.ok) return false;
|
|
126
|
-
const data = await response.json();
|
|
127
|
-
return "slots_idle" in data || "slots_processing" in data;
|
|
128
|
-
} catch {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async function probeSGLang(baseUrl) {
|
|
133
|
-
try {
|
|
134
|
-
const response = await fetch(`${baseUrl}/get_model_info`, {
|
|
135
|
-
signal: AbortSignal.timeout(5e3)
|
|
136
|
-
});
|
|
137
|
-
return response.ok;
|
|
138
|
-
} catch {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async function probeOpenAI(baseUrl) {
|
|
143
|
-
try {
|
|
144
|
-
const url = baseUrl.includes("/v1") ? baseUrl : `${baseUrl}/v1`;
|
|
145
|
-
const response = await fetch(`${url}/models`, {
|
|
146
|
-
signal: AbortSignal.timeout(5e3)
|
|
147
|
-
});
|
|
148
|
-
return response.ok;
|
|
149
|
-
} catch {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function getBackendDisplayName(backend) {
|
|
154
|
-
switch (backend) {
|
|
155
|
-
case "vllm":
|
|
156
|
-
return "vLLM";
|
|
157
|
-
case "sglang":
|
|
158
|
-
return "SGLang";
|
|
159
|
-
case "ollama":
|
|
160
|
-
return "Ollama";
|
|
161
|
-
case "llamacpp":
|
|
162
|
-
return "llama.cpp";
|
|
163
|
-
case "opencode-go":
|
|
164
|
-
return "OpenCode Go";
|
|
165
|
-
case "unknown":
|
|
166
|
-
return "Unknown";
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
13
|
// src/server/llm/models.ts
|
|
171
14
|
var modelCache = /* @__PURE__ */ new Map();
|
|
172
15
|
var llmStatus = "unknown";
|
|
@@ -295,203 +138,6 @@ var LLMError = class extends OpenFoxError {
|
|
|
295
138
|
}
|
|
296
139
|
};
|
|
297
140
|
|
|
298
|
-
// src/server/llm/profiles.ts
|
|
299
|
-
var DEFAULT_PROFILE = {
|
|
300
|
-
name: "default",
|
|
301
|
-
temperature: 0.7,
|
|
302
|
-
topP: 0.9,
|
|
303
|
-
supportsReasoning: false,
|
|
304
|
-
reasoningAsContent: false,
|
|
305
|
-
defaultMaxTokens: 4096,
|
|
306
|
-
supportsVision: true
|
|
307
|
-
};
|
|
308
|
-
var MOCK_PROFILE = {
|
|
309
|
-
name: "mock",
|
|
310
|
-
temperature: 0.7,
|
|
311
|
-
topP: 0.9,
|
|
312
|
-
supportsReasoning: false,
|
|
313
|
-
reasoningAsContent: false,
|
|
314
|
-
defaultMaxTokens: 1024,
|
|
315
|
-
supportsVision: false
|
|
316
|
-
};
|
|
317
|
-
var MODEL_PROFILES = [
|
|
318
|
-
{
|
|
319
|
-
pattern: "mistral",
|
|
320
|
-
profile: {
|
|
321
|
-
name: "Mistral",
|
|
322
|
-
temperature: 0.7,
|
|
323
|
-
topP: 0.9,
|
|
324
|
-
supportsReasoning: false,
|
|
325
|
-
reasoningAsContent: false,
|
|
326
|
-
defaultMaxTokens: 16384,
|
|
327
|
-
supportsVision: false
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
pattern: "qwen3-coder-next",
|
|
332
|
-
profile: {
|
|
333
|
-
name: "Qwen3-Coder-Next",
|
|
334
|
-
// Per Qwen docs: "temperature=1.0, top_p=0.95, top_k=40"
|
|
335
|
-
temperature: 1,
|
|
336
|
-
topP: 0.95,
|
|
337
|
-
topK: 40,
|
|
338
|
-
// "This model supports only non-thinking mode and does not generate <think></think> blocks"
|
|
339
|
-
supportsReasoning: false,
|
|
340
|
-
reasoningAsContent: false,
|
|
341
|
-
defaultMaxTokens: 16384,
|
|
342
|
-
supportsVision: false
|
|
343
|
-
}
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
pattern: "qwen3",
|
|
347
|
-
profile: {
|
|
348
|
-
name: "Qwen3",
|
|
349
|
-
temperature: 0.7,
|
|
350
|
-
topP: 0.9,
|
|
351
|
-
supportsReasoning: true,
|
|
352
|
-
reasoningAsContent: false,
|
|
353
|
-
defaultMaxTokens: 16384,
|
|
354
|
-
supportsVision: false
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
pattern: "qwen3-vl",
|
|
359
|
-
profile: {
|
|
360
|
-
name: "Qwen3-VL",
|
|
361
|
-
temperature: 0.7,
|
|
362
|
-
topP: 0.9,
|
|
363
|
-
supportsReasoning: true,
|
|
364
|
-
reasoningAsContent: false,
|
|
365
|
-
defaultMaxTokens: 16384,
|
|
366
|
-
supportsVision: true
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
pattern: "deepseek",
|
|
371
|
-
profile: {
|
|
372
|
-
name: "DeepSeek",
|
|
373
|
-
temperature: 0.6,
|
|
374
|
-
topP: 0.95,
|
|
375
|
-
supportsReasoning: true,
|
|
376
|
-
reasoningAsContent: false,
|
|
377
|
-
defaultMaxTokens: 16384,
|
|
378
|
-
supportsVision: false
|
|
379
|
-
}
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
pattern: "minimax-m2.5",
|
|
383
|
-
profile: {
|
|
384
|
-
name: "MiniMax-M2.5",
|
|
385
|
-
temperature: 1,
|
|
386
|
-
topP: 0.95,
|
|
387
|
-
topK: 40,
|
|
388
|
-
supportsReasoning: true,
|
|
389
|
-
reasoningAsContent: false,
|
|
390
|
-
defaultMaxTokens: 16384,
|
|
391
|
-
supportsVision: false
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
pattern: "minimax-m2.7",
|
|
396
|
-
profile: {
|
|
397
|
-
name: "MiniMax-M2.7",
|
|
398
|
-
temperature: 1,
|
|
399
|
-
topP: 0.95,
|
|
400
|
-
topK: 40,
|
|
401
|
-
supportsReasoning: true,
|
|
402
|
-
reasoningAsContent: false,
|
|
403
|
-
defaultMaxTokens: 16384,
|
|
404
|
-
supportsVision: false
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
pattern: "minimax",
|
|
409
|
-
profile: {
|
|
410
|
-
name: "MiniMax",
|
|
411
|
-
temperature: 1,
|
|
412
|
-
topP: 0.95,
|
|
413
|
-
topK: 40,
|
|
414
|
-
supportsReasoning: true,
|
|
415
|
-
reasoningAsContent: false,
|
|
416
|
-
defaultMaxTokens: 16384,
|
|
417
|
-
supportsVision: false
|
|
418
|
-
}
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
pattern: "minimax-m3",
|
|
422
|
-
profile: {
|
|
423
|
-
name: "MiniMax-M3",
|
|
424
|
-
temperature: 1,
|
|
425
|
-
topP: 0.95,
|
|
426
|
-
topK: 40,
|
|
427
|
-
supportsReasoning: true,
|
|
428
|
-
reasoningAsContent: false,
|
|
429
|
-
defaultMaxTokens: 16384,
|
|
430
|
-
supportsVision: true
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
pattern: "llava",
|
|
435
|
-
profile: {
|
|
436
|
-
name: "LLaVA",
|
|
437
|
-
temperature: 0.7,
|
|
438
|
-
topP: 0.9,
|
|
439
|
-
supportsReasoning: false,
|
|
440
|
-
reasoningAsContent: false,
|
|
441
|
-
defaultMaxTokens: 16384,
|
|
442
|
-
supportsVision: true
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
pattern: "llama",
|
|
447
|
-
profile: {
|
|
448
|
-
name: "Llama",
|
|
449
|
-
temperature: 0.7,
|
|
450
|
-
topP: 0.9,
|
|
451
|
-
supportsReasoning: false,
|
|
452
|
-
reasoningAsContent: false,
|
|
453
|
-
defaultMaxTokens: 16384,
|
|
454
|
-
supportsVision: false
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
pattern: "claude",
|
|
459
|
-
profile: {
|
|
460
|
-
name: "Claude",
|
|
461
|
-
temperature: 0.7,
|
|
462
|
-
topP: 0.9,
|
|
463
|
-
supportsReasoning: true,
|
|
464
|
-
reasoningAsContent: false,
|
|
465
|
-
defaultMaxTokens: 16384,
|
|
466
|
-
supportsVision: false
|
|
467
|
-
}
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
pattern: "gemma-4",
|
|
471
|
-
profile: {
|
|
472
|
-
name: "Gemma 4",
|
|
473
|
-
temperature: 0.7,
|
|
474
|
-
topP: 0.9,
|
|
475
|
-
supportsReasoning: true,
|
|
476
|
-
reasoningAsContent: false,
|
|
477
|
-
defaultMaxTokens: 16384,
|
|
478
|
-
supportsVision: true
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
];
|
|
482
|
-
function getModelProfile(modelName) {
|
|
483
|
-
const lowerName = modelName.toLowerCase();
|
|
484
|
-
if (lowerName.includes("mock")) {
|
|
485
|
-
return MOCK_PROFILE;
|
|
486
|
-
}
|
|
487
|
-
for (const { pattern, profile } of MODEL_PROFILES) {
|
|
488
|
-
if (lowerName.includes(pattern.toLowerCase())) {
|
|
489
|
-
return profile;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
return DEFAULT_PROFILE;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
141
|
// src/server/llm/client-pure.ts
|
|
496
142
|
function buildAttachmentContent(msgContent, attachments, modelSupportsVision) {
|
|
497
143
|
const content = [];
|
|
@@ -705,27 +351,37 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
|
|
|
705
351
|
onVisionFallbackStart,
|
|
706
352
|
onVisionFallbackDone
|
|
707
353
|
);
|
|
354
|
+
const temperature = request.temperature ?? profile.temperature;
|
|
355
|
+
const maxTokens = request.maxTokens ?? profile.defaultMaxTokens;
|
|
356
|
+
const topP = profile.topP;
|
|
357
|
+
const topK = capabilities.supportsTopK ? profile.topK : void 0;
|
|
708
358
|
const params = {
|
|
709
359
|
model,
|
|
710
360
|
messages: convertedMessages,
|
|
711
361
|
...request.tools ? { tools: convertTools(request.tools) } : {},
|
|
712
362
|
...request.toolChoice ? { tool_choice: request.toolChoice } : {},
|
|
713
|
-
temperature
|
|
714
|
-
max_tokens:
|
|
715
|
-
top_p:
|
|
363
|
+
temperature,
|
|
364
|
+
max_tokens: maxTokens,
|
|
365
|
+
top_p: topP,
|
|
716
366
|
stream: isStreaming,
|
|
717
367
|
...isStreaming ? { stream_options: { include_usage: true } } : {}
|
|
718
368
|
};
|
|
719
|
-
if (
|
|
369
|
+
if (topK !== void 0) {
|
|
720
370
|
;
|
|
721
|
-
params["top_k"] =
|
|
371
|
+
params["top_k"] = topK;
|
|
722
372
|
}
|
|
723
373
|
const shouldDisableThinking = isStreaming ? disableThinking || request.disableThinking : disableThinking;
|
|
724
374
|
if (capabilities.supportsChatTemplateKwargs && profile.supportsReasoning && shouldDisableThinking) {
|
|
725
375
|
;
|
|
726
376
|
params["chat_template_kwargs"] = { enable_thinking: false };
|
|
727
377
|
}
|
|
728
|
-
|
|
378
|
+
const modelParams = {
|
|
379
|
+
...temperature !== void 0 && { temperature },
|
|
380
|
+
...topP !== void 0 && { topP },
|
|
381
|
+
...topK !== void 0 && { topK },
|
|
382
|
+
...maxTokens !== void 0 && { maxTokens }
|
|
383
|
+
};
|
|
384
|
+
return { params, modelParams };
|
|
729
385
|
}
|
|
730
386
|
async function buildCreateParamsFromInput(input, isStreaming) {
|
|
731
387
|
const { model, request, profile, capabilities, disableThinking, visionFallbackEnabled = false, onVisionFallbackStart, onVisionFallbackDone } = input;
|
|
@@ -812,7 +468,7 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
812
468
|
try {
|
|
813
469
|
const shouldDisableThinking = disableThinking || request.disableThinking === true;
|
|
814
470
|
await ensureVisionFallbackConfigLoaded();
|
|
815
|
-
const { isVisionFallbackEnabled } = await import("./vision-fallback-
|
|
471
|
+
const { isVisionFallbackEnabled } = await import("./vision-fallback-VXGCQKLA.js");
|
|
816
472
|
const paramsOptions = {
|
|
817
473
|
model,
|
|
818
474
|
request,
|
|
@@ -827,7 +483,7 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
827
483
|
if (request.onVisionFallbackDone) {
|
|
828
484
|
paramsOptions.onVisionFallbackDone = request.onVisionFallbackDone;
|
|
829
485
|
}
|
|
830
|
-
const createParams = await buildNonStreamingCreateParams(paramsOptions);
|
|
486
|
+
const { params: createParams } = await buildNonStreamingCreateParams(paramsOptions);
|
|
831
487
|
const response = await openai.chat.completions.create(createParams, {
|
|
832
488
|
signal: request.signal
|
|
833
489
|
});
|
|
@@ -890,7 +546,7 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
890
546
|
});
|
|
891
547
|
try {
|
|
892
548
|
await ensureVisionFallbackConfigLoaded();
|
|
893
|
-
const { isVisionFallbackEnabled } = await import("./vision-fallback-
|
|
549
|
+
const { isVisionFallbackEnabled } = await import("./vision-fallback-VXGCQKLA.js");
|
|
894
550
|
const shouldDisableThinking = disableThinking || request.disableThinking === true;
|
|
895
551
|
const createParams = await buildStreamingCreateParams({
|
|
896
552
|
model,
|
|
@@ -902,7 +558,8 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
902
558
|
onVisionFallbackStart: request.onVisionFallbackStart,
|
|
903
559
|
onVisionFallbackDone: request.onVisionFallbackDone
|
|
904
560
|
});
|
|
905
|
-
const
|
|
561
|
+
const { params: streamingParams } = createParams;
|
|
562
|
+
const stream = await openai.chat.completions.create(streamingParams, {
|
|
906
563
|
signal: request.signal
|
|
907
564
|
});
|
|
908
565
|
let fullContent = "";
|
|
@@ -1097,13 +754,10 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
1097
754
|
|
|
1098
755
|
export {
|
|
1099
756
|
SessionNotFoundError,
|
|
1100
|
-
getModelProfile,
|
|
1101
|
-
detectBackend,
|
|
1102
|
-
getBackendDisplayName,
|
|
1103
757
|
createLLMClient,
|
|
1104
758
|
detectModel,
|
|
1105
759
|
getLlmStatus,
|
|
1106
760
|
setLlmStatus,
|
|
1107
761
|
clearModelCache
|
|
1108
762
|
};
|
|
1109
|
-
//# sourceMappingURL=chunk-
|
|
763
|
+
//# sourceMappingURL=chunk-FX4SUY2S.js.map
|
|
@@ -27,7 +27,7 @@ Options:
|
|
|
27
27
|
}
|
|
28
28
|
async function runNetworkSetup(mode) {
|
|
29
29
|
const { loadAuthConfig, saveAuthConfig, encryptPassword } = await import("./auth-JF2HDJ6P.js");
|
|
30
|
-
const { saveGlobalConfig } = await import("./config-
|
|
30
|
+
const { saveGlobalConfig } = await import("./config-SWDAJMQ3.js");
|
|
31
31
|
const { getAuthKeyPath } = await import("./paths-ZRI56O63.js");
|
|
32
32
|
const existingAuth = await loadAuthConfig(mode);
|
|
33
33
|
if (existingAuth) {
|
|
@@ -88,7 +88,7 @@ async function runNetworkSetup(mode) {
|
|
|
88
88
|
console.log("\u2713 Configuration saved!\n");
|
|
89
89
|
}
|
|
90
90
|
async function runConfig(mode) {
|
|
91
|
-
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-
|
|
91
|
+
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-SWDAJMQ3.js");
|
|
92
92
|
const { getGlobalConfigPath } = await import("./paths-ZRI56O63.js");
|
|
93
93
|
const config = await loadGlobalConfig(mode);
|
|
94
94
|
const configPath = getGlobalConfigPath(mode);
|
|
@@ -143,18 +143,18 @@ async function runCli(options) {
|
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
145
145
|
case "provider": {
|
|
146
|
-
const { runProviderCommand } = await import("./provider-
|
|
146
|
+
const { runProviderCommand } = await import("./provider-CDM4LQAC.js");
|
|
147
147
|
const [, subcommand] = positionals;
|
|
148
148
|
await runProviderCommand(mode, subcommand);
|
|
149
149
|
break;
|
|
150
150
|
}
|
|
151
151
|
default: {
|
|
152
|
-
const { configFileExists } = await import("./config-
|
|
152
|
+
const { configFileExists } = await import("./config-SWDAJMQ3.js");
|
|
153
153
|
const configExists = await configFileExists(mode);
|
|
154
154
|
if (!configExists) {
|
|
155
155
|
await runNetworkSetup(mode);
|
|
156
156
|
}
|
|
157
|
-
const { runServe } = await import("./serve-
|
|
157
|
+
const { runServe } = await import("./serve-X3PKC27B.js");
|
|
158
158
|
await runServe({
|
|
159
159
|
mode,
|
|
160
160
|
port: values.port ? parseInt(values.port) : void 0,
|
|
@@ -167,4 +167,4 @@ async function runCli(options) {
|
|
|
167
167
|
export {
|
|
168
168
|
runCli
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-HWOYZ245.js.map
|