openfox 2.0.0-beta.11 → 2.0.0-beta.13
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/{chat-handler-NMJCOCCB.js → chat-handler-DKX2XFHA.js} +8 -8
- package/dist/{chunk-EQQDA4D3.js → chunk-5RP2ZU2G.js} +14 -16
- package/dist/{chunk-4RLDN2LL.js → chunk-BNFQMAH6.js} +160 -39
- package/dist/{chunk-BU56QFHW.js → chunk-DBDMMSCM.js} +7 -8
- package/dist/{chunk-NSBYORD5.js → chunk-DHAKJSE7.js} +4 -2
- package/dist/{chunk-EZUR7OEP.js → chunk-HZODNSSV.js} +15 -9
- package/dist/{chunk-LCRJWUW7.js → chunk-LDHRZRCP.js} +6 -6
- package/dist/{chunk-VIIRNJDT.js → chunk-LXX2CPM5.js} +203 -236
- package/dist/{chunk-EXYMWI7A.js → chunk-OKLV3ZNN.js} +9 -5
- package/dist/{chunk-UKTPL5ZG.js → chunk-SW7MQGY3.js} +123 -214
- package/dist/{chunk-DMH6JVPF.js → chunk-YLQGD5SE.js} +28 -8
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-TDVA7MQN.js → config-FAT5XRFB.js} +5 -5
- package/dist/{events-UGTGGFG3.js → events-R7FRQEBE.js} +2 -2
- package/dist/{orchestrator-75L5UGDU.js → orchestrator-NNYZC7AY.js} +7 -7
- package/dist/package.json +1 -1
- package/dist/{processor-GHESQ2YV.js → processor-5T3CXD5I.js} +10 -5
- package/dist/{protocol-B9R1CUvt.d.ts → protocol-zn90yuIr.d.ts} +11 -2
- package/dist/{provider-BGH4MBLH.js → provider-2JYU6KGH.js} +9 -9
- package/dist/provider-manager-IP3HOGNB.js +16 -0
- package/dist/{serve-I6T7V62Z.js → serve-NSTNUQ2K.js} +13 -13
- package/dist/server/index.d.ts +21 -15
- package/dist/server/index.js +9 -9
- package/dist/shared/index.d.ts +2 -2
- package/dist/{tools-D3WWIOQD.js → tools-TJGSHOAR.js} +6 -6
- package/dist/web/assets/index-DIY3E8K9.js +299 -0
- package/dist/web/assets/{index-CSOB8dwI.css → index-Sdax8ayU.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-tJDr1ODC.js +0 -299
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getGlobalConfigPath
|
|
3
|
+
} from "./chunk-CQGTEGKL.js";
|
|
1
4
|
import {
|
|
2
5
|
detectModel
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SW7MQGY3.js";
|
|
4
7
|
import {
|
|
5
8
|
detectBackend
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
getGlobalConfigPath
|
|
9
|
-
} from "./chunk-CQGTEGKL.js";
|
|
9
|
+
} from "./chunk-LXX2CPM5.js";
|
|
10
10
|
|
|
11
11
|
// src/cli/config.ts
|
|
12
12
|
import { z } from "zod";
|
|
@@ -124,8 +124,15 @@ var oldLlmSchema = z.object({
|
|
|
124
124
|
model: z.string().default("auto"),
|
|
125
125
|
backend: z.enum(["auto", "vllm", "sglang", "ollama", "llamacpp"]).default("auto"),
|
|
126
126
|
maxContext: z.number().default(2e5),
|
|
127
|
-
|
|
127
|
+
// Deprecated: use reasoningEffort instead
|
|
128
|
+
disableThinking: z.boolean().optional(),
|
|
129
|
+
reasoningEffort: z.string().optional(),
|
|
128
130
|
apiKey: z.string().optional()
|
|
131
|
+
}).transform((data) => {
|
|
132
|
+
if (data.disableThinking && !data.reasoningEffort) {
|
|
133
|
+
return { ...data, reasoningEffort: "none", disableThinking: void 0 };
|
|
134
|
+
}
|
|
135
|
+
return { ...data, disableThinking: void 0 };
|
|
129
136
|
});
|
|
130
137
|
var oldConfigSchema = z.object({
|
|
131
138
|
llm: oldLlmSchema,
|
|
@@ -416,8 +423,7 @@ function mergeConfigs(...configs) {
|
|
|
416
423
|
url: "http://localhost:8000/v1",
|
|
417
424
|
model: "auto",
|
|
418
425
|
backend: "auto",
|
|
419
|
-
maxContext: 2e5
|
|
420
|
-
disableThinking: false
|
|
426
|
+
maxContext: 2e5
|
|
421
427
|
},
|
|
422
428
|
server: { port: 10369, host: "127.0.0.1", openBrowser: true },
|
|
423
429
|
logging: { level: "error" }
|
|
@@ -443,4 +449,4 @@ export {
|
|
|
443
449
|
activateProvider,
|
|
444
450
|
mergeConfigs
|
|
445
451
|
};
|
|
446
|
-
//# sourceMappingURL=chunk-
|
|
452
|
+
//# sourceMappingURL=chunk-HZODNSSV.js.map
|
|
@@ -33,7 +33,7 @@ Options:
|
|
|
33
33
|
}
|
|
34
34
|
async function runNetworkSetup(mode) {
|
|
35
35
|
const { loadAuthConfig, saveAuthConfig, encryptPassword } = await import("./auth-56SIRACI.js");
|
|
36
|
-
const { saveGlobalConfig } = await import("./config-
|
|
36
|
+
const { saveGlobalConfig } = await import("./config-FAT5XRFB.js");
|
|
37
37
|
const { getAuthKeyPath } = await import("./paths-X46PPOI2.js");
|
|
38
38
|
const existingAuth = await loadAuthConfig(mode);
|
|
39
39
|
if (existingAuth) {
|
|
@@ -94,7 +94,7 @@ async function runNetworkSetup(mode) {
|
|
|
94
94
|
console.log("\u2713 Configuration saved!\n");
|
|
95
95
|
}
|
|
96
96
|
async function runConfig(mode) {
|
|
97
|
-
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-
|
|
97
|
+
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-FAT5XRFB.js");
|
|
98
98
|
const { getGlobalConfigPath } = await import("./paths-X46PPOI2.js");
|
|
99
99
|
const config = await loadGlobalConfig(mode);
|
|
100
100
|
const configPath = getGlobalConfigPath(mode);
|
|
@@ -151,7 +151,7 @@ async function runCli(options) {
|
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
153
|
case "provider": {
|
|
154
|
-
const { runProviderCommand } = await import("./provider-
|
|
154
|
+
const { runProviderCommand } = await import("./provider-2JYU6KGH.js");
|
|
155
155
|
const [, subcommand] = positionals;
|
|
156
156
|
await runProviderCommand(mode, subcommand);
|
|
157
157
|
break;
|
|
@@ -188,12 +188,12 @@ async function runCli(options) {
|
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
default: {
|
|
191
|
-
const { configFileExists } = await import("./config-
|
|
191
|
+
const { configFileExists } = await import("./config-FAT5XRFB.js");
|
|
192
192
|
const configExists = await configFileExists(mode);
|
|
193
193
|
if (!configExists) {
|
|
194
194
|
await runNetworkSetup(mode);
|
|
195
195
|
}
|
|
196
|
-
const { runServe } = await import("./serve-
|
|
196
|
+
const { runServe } = await import("./serve-NSTNUQ2K.js");
|
|
197
197
|
const serveOptions = { mode };
|
|
198
198
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
199
199
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -205,4 +205,4 @@ async function runCli(options) {
|
|
|
205
205
|
export {
|
|
206
206
|
runCli
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-LDHRZRCP.js.map
|
|
@@ -2,6 +2,176 @@ import {
|
|
|
2
2
|
logger
|
|
3
3
|
} from "./chunk-K44MW7JJ.js";
|
|
4
4
|
|
|
5
|
+
// src/server/llm/profiles.ts
|
|
6
|
+
var DEFAULT_PROFILE = {
|
|
7
|
+
name: "default",
|
|
8
|
+
temperature: 0.7,
|
|
9
|
+
topP: 0.9,
|
|
10
|
+
defaultMaxTokens: 4096,
|
|
11
|
+
supportsVision: true
|
|
12
|
+
};
|
|
13
|
+
var MOCK_PROFILE = {
|
|
14
|
+
name: "mock",
|
|
15
|
+
temperature: 0.7,
|
|
16
|
+
topP: 0.9,
|
|
17
|
+
defaultMaxTokens: 1024,
|
|
18
|
+
supportsVision: false
|
|
19
|
+
};
|
|
20
|
+
var MODEL_PROFILES = [
|
|
21
|
+
{
|
|
22
|
+
pattern: "mistral",
|
|
23
|
+
profile: {
|
|
24
|
+
name: "Mistral",
|
|
25
|
+
temperature: 0.7,
|
|
26
|
+
topP: 0.9,
|
|
27
|
+
defaultMaxTokens: 16384,
|
|
28
|
+
supportsVision: false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
pattern: "qwen3-coder-next",
|
|
33
|
+
profile: {
|
|
34
|
+
name: "Qwen3-Coder-Next",
|
|
35
|
+
// Per Qwen docs: "temperature=1.0, top_p=0.95, top_k=40"
|
|
36
|
+
temperature: 1,
|
|
37
|
+
topP: 0.95,
|
|
38
|
+
topK: 40,
|
|
39
|
+
// "This model supports only non-thinking mode and does not generate <think></think> blocks"
|
|
40
|
+
defaultMaxTokens: 16384,
|
|
41
|
+
supportsVision: false
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
pattern: "qwen3",
|
|
46
|
+
profile: {
|
|
47
|
+
name: "Qwen3",
|
|
48
|
+
temperature: 0.7,
|
|
49
|
+
topP: 0.9,
|
|
50
|
+
defaultMaxTokens: 16384,
|
|
51
|
+
supportsVision: false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
pattern: "qwen3-vl",
|
|
56
|
+
profile: {
|
|
57
|
+
name: "Qwen3-VL",
|
|
58
|
+
temperature: 0.7,
|
|
59
|
+
topP: 0.9,
|
|
60
|
+
defaultMaxTokens: 16384,
|
|
61
|
+
supportsVision: true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
pattern: "deepseek",
|
|
66
|
+
profile: {
|
|
67
|
+
name: "DeepSeek",
|
|
68
|
+
temperature: 0.6,
|
|
69
|
+
topP: 0.95,
|
|
70
|
+
defaultMaxTokens: 16384,
|
|
71
|
+
supportsVision: false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
pattern: "minimax-m2.5",
|
|
76
|
+
profile: {
|
|
77
|
+
name: "MiniMax-M2.5",
|
|
78
|
+
temperature: 1,
|
|
79
|
+
topP: 0.95,
|
|
80
|
+
topK: 40,
|
|
81
|
+
defaultMaxTokens: 16384,
|
|
82
|
+
supportsVision: false
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
pattern: "minimax-m2.7",
|
|
87
|
+
profile: {
|
|
88
|
+
name: "MiniMax-M2.7",
|
|
89
|
+
temperature: 1,
|
|
90
|
+
topP: 0.95,
|
|
91
|
+
topK: 40,
|
|
92
|
+
defaultMaxTokens: 16384,
|
|
93
|
+
supportsVision: false
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
pattern: "minimax",
|
|
98
|
+
profile: {
|
|
99
|
+
name: "MiniMax",
|
|
100
|
+
temperature: 1,
|
|
101
|
+
topP: 0.95,
|
|
102
|
+
topK: 40,
|
|
103
|
+
defaultMaxTokens: 16384,
|
|
104
|
+
supportsVision: false
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
pattern: "minimax-m3",
|
|
109
|
+
profile: {
|
|
110
|
+
name: "MiniMax-M3",
|
|
111
|
+
temperature: 1,
|
|
112
|
+
topP: 0.95,
|
|
113
|
+
topK: 40,
|
|
114
|
+
defaultMaxTokens: 16384,
|
|
115
|
+
supportsVision: true
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
pattern: "llava",
|
|
120
|
+
profile: {
|
|
121
|
+
name: "LLaVA",
|
|
122
|
+
temperature: 0.7,
|
|
123
|
+
topP: 0.9,
|
|
124
|
+
defaultMaxTokens: 16384,
|
|
125
|
+
supportsVision: true
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
pattern: "llama",
|
|
130
|
+
profile: {
|
|
131
|
+
name: "Llama",
|
|
132
|
+
temperature: 0.7,
|
|
133
|
+
topP: 0.9,
|
|
134
|
+
defaultMaxTokens: 16384,
|
|
135
|
+
supportsVision: false
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
pattern: "claude",
|
|
140
|
+
profile: {
|
|
141
|
+
name: "Claude",
|
|
142
|
+
temperature: 0.7,
|
|
143
|
+
topP: 0.9,
|
|
144
|
+
defaultMaxTokens: 16384,
|
|
145
|
+
supportsVision: false
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
pattern: "gemma-4",
|
|
150
|
+
profile: {
|
|
151
|
+
name: "Gemma 4",
|
|
152
|
+
temperature: 0.7,
|
|
153
|
+
topP: 0.9,
|
|
154
|
+
defaultMaxTokens: 16384,
|
|
155
|
+
supportsVision: true
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
function getModelProfile(modelName) {
|
|
160
|
+
const lowerName = modelName.toLowerCase();
|
|
161
|
+
if (lowerName.includes("mock")) {
|
|
162
|
+
return MOCK_PROFILE;
|
|
163
|
+
}
|
|
164
|
+
for (const { pattern, profile } of MODEL_PROFILES) {
|
|
165
|
+
if (lowerName.includes(pattern.toLowerCase())) {
|
|
166
|
+
return profile;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return DEFAULT_PROFILE;
|
|
170
|
+
}
|
|
171
|
+
function modelSupportsVision(modelName) {
|
|
172
|
+
return getModelProfile(modelName).supportsVision;
|
|
173
|
+
}
|
|
174
|
+
|
|
5
175
|
// src/server/llm/url-utils.ts
|
|
6
176
|
var VERSION_PREFIX_REGEX = /\/v\d+(\/|$)/;
|
|
7
177
|
function hasVersionPrefix(url) {
|
|
@@ -21,33 +191,27 @@ function buildModelsUrl(baseUrl) {
|
|
|
21
191
|
// src/server/llm/backend.ts
|
|
22
192
|
var BACKEND_CAPABILITIES = {
|
|
23
193
|
vllm: {
|
|
24
|
-
supportsReasoningField: true,
|
|
25
194
|
supportsChatTemplateKwargs: true,
|
|
26
195
|
supportsTopK: true
|
|
27
196
|
},
|
|
28
197
|
sglang: {
|
|
29
|
-
supportsReasoningField: true,
|
|
30
198
|
supportsChatTemplateKwargs: true,
|
|
31
199
|
supportsTopK: true
|
|
32
200
|
},
|
|
33
201
|
ollama: {
|
|
34
|
-
supportsReasoningField: false,
|
|
35
202
|
supportsChatTemplateKwargs: false,
|
|
36
203
|
supportsTopK: false
|
|
37
204
|
},
|
|
38
205
|
llamacpp: {
|
|
39
|
-
supportsReasoningField: false,
|
|
40
206
|
supportsChatTemplateKwargs: false,
|
|
41
207
|
supportsTopK: true
|
|
42
208
|
},
|
|
43
209
|
"opencode-go": {
|
|
44
|
-
supportsReasoningField: false,
|
|
45
210
|
supportsChatTemplateKwargs: false,
|
|
46
211
|
supportsTopK: true
|
|
47
212
|
},
|
|
48
213
|
unknown: {
|
|
49
214
|
// Assume vLLM-like for unknown backends
|
|
50
|
-
supportsReasoningField: true,
|
|
51
215
|
supportsChatTemplateKwargs: true,
|
|
52
216
|
supportsTopK: true
|
|
53
217
|
}
|
|
@@ -179,206 +343,6 @@ function getBackendDisplayName(backend) {
|
|
|
179
343
|
}
|
|
180
344
|
}
|
|
181
345
|
|
|
182
|
-
// src/server/llm/profiles.ts
|
|
183
|
-
var DEFAULT_PROFILE = {
|
|
184
|
-
name: "default",
|
|
185
|
-
temperature: 0.7,
|
|
186
|
-
topP: 0.9,
|
|
187
|
-
supportsReasoning: false,
|
|
188
|
-
reasoningAsContent: false,
|
|
189
|
-
defaultMaxTokens: 4096,
|
|
190
|
-
supportsVision: true
|
|
191
|
-
};
|
|
192
|
-
var MOCK_PROFILE = {
|
|
193
|
-
name: "mock",
|
|
194
|
-
temperature: 0.7,
|
|
195
|
-
topP: 0.9,
|
|
196
|
-
supportsReasoning: false,
|
|
197
|
-
reasoningAsContent: false,
|
|
198
|
-
defaultMaxTokens: 1024,
|
|
199
|
-
supportsVision: false
|
|
200
|
-
};
|
|
201
|
-
var MODEL_PROFILES = [
|
|
202
|
-
{
|
|
203
|
-
pattern: "mistral",
|
|
204
|
-
profile: {
|
|
205
|
-
name: "Mistral",
|
|
206
|
-
temperature: 0.7,
|
|
207
|
-
topP: 0.9,
|
|
208
|
-
supportsReasoning: false,
|
|
209
|
-
reasoningAsContent: false,
|
|
210
|
-
defaultMaxTokens: 16384,
|
|
211
|
-
supportsVision: false
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
pattern: "qwen3-coder-next",
|
|
216
|
-
profile: {
|
|
217
|
-
name: "Qwen3-Coder-Next",
|
|
218
|
-
// Per Qwen docs: "temperature=1.0, top_p=0.95, top_k=40"
|
|
219
|
-
temperature: 1,
|
|
220
|
-
topP: 0.95,
|
|
221
|
-
topK: 40,
|
|
222
|
-
// "This model supports only non-thinking mode and does not generate <think></think> blocks"
|
|
223
|
-
supportsReasoning: false,
|
|
224
|
-
reasoningAsContent: false,
|
|
225
|
-
defaultMaxTokens: 16384,
|
|
226
|
-
supportsVision: false
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
pattern: "qwen3",
|
|
231
|
-
profile: {
|
|
232
|
-
name: "Qwen3",
|
|
233
|
-
temperature: 0.7,
|
|
234
|
-
topP: 0.9,
|
|
235
|
-
supportsReasoning: true,
|
|
236
|
-
reasoningAsContent: false,
|
|
237
|
-
defaultMaxTokens: 16384,
|
|
238
|
-
supportsVision: false
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
pattern: "qwen3-vl",
|
|
243
|
-
profile: {
|
|
244
|
-
name: "Qwen3-VL",
|
|
245
|
-
temperature: 0.7,
|
|
246
|
-
topP: 0.9,
|
|
247
|
-
supportsReasoning: true,
|
|
248
|
-
reasoningAsContent: false,
|
|
249
|
-
defaultMaxTokens: 16384,
|
|
250
|
-
supportsVision: true
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
pattern: "deepseek",
|
|
255
|
-
profile: {
|
|
256
|
-
name: "DeepSeek",
|
|
257
|
-
temperature: 0.6,
|
|
258
|
-
topP: 0.95,
|
|
259
|
-
supportsReasoning: true,
|
|
260
|
-
reasoningAsContent: false,
|
|
261
|
-
defaultMaxTokens: 16384,
|
|
262
|
-
supportsVision: false
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
pattern: "minimax-m2.5",
|
|
267
|
-
profile: {
|
|
268
|
-
name: "MiniMax-M2.5",
|
|
269
|
-
temperature: 1,
|
|
270
|
-
topP: 0.95,
|
|
271
|
-
topK: 40,
|
|
272
|
-
supportsReasoning: true,
|
|
273
|
-
reasoningAsContent: false,
|
|
274
|
-
defaultMaxTokens: 16384,
|
|
275
|
-
supportsVision: false
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
pattern: "minimax-m2.7",
|
|
280
|
-
profile: {
|
|
281
|
-
name: "MiniMax-M2.7",
|
|
282
|
-
temperature: 1,
|
|
283
|
-
topP: 0.95,
|
|
284
|
-
topK: 40,
|
|
285
|
-
supportsReasoning: true,
|
|
286
|
-
reasoningAsContent: false,
|
|
287
|
-
defaultMaxTokens: 16384,
|
|
288
|
-
supportsVision: false
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
pattern: "minimax",
|
|
293
|
-
profile: {
|
|
294
|
-
name: "MiniMax",
|
|
295
|
-
temperature: 1,
|
|
296
|
-
topP: 0.95,
|
|
297
|
-
topK: 40,
|
|
298
|
-
supportsReasoning: true,
|
|
299
|
-
reasoningAsContent: false,
|
|
300
|
-
defaultMaxTokens: 16384,
|
|
301
|
-
supportsVision: false
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
pattern: "minimax-m3",
|
|
306
|
-
profile: {
|
|
307
|
-
name: "MiniMax-M3",
|
|
308
|
-
temperature: 1,
|
|
309
|
-
topP: 0.95,
|
|
310
|
-
topK: 40,
|
|
311
|
-
supportsReasoning: true,
|
|
312
|
-
reasoningAsContent: false,
|
|
313
|
-
defaultMaxTokens: 16384,
|
|
314
|
-
supportsVision: true
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
pattern: "llava",
|
|
319
|
-
profile: {
|
|
320
|
-
name: "LLaVA",
|
|
321
|
-
temperature: 0.7,
|
|
322
|
-
topP: 0.9,
|
|
323
|
-
supportsReasoning: false,
|
|
324
|
-
reasoningAsContent: false,
|
|
325
|
-
defaultMaxTokens: 16384,
|
|
326
|
-
supportsVision: true
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
pattern: "llama",
|
|
331
|
-
profile: {
|
|
332
|
-
name: "Llama",
|
|
333
|
-
temperature: 0.7,
|
|
334
|
-
topP: 0.9,
|
|
335
|
-
supportsReasoning: false,
|
|
336
|
-
reasoningAsContent: false,
|
|
337
|
-
defaultMaxTokens: 16384,
|
|
338
|
-
supportsVision: false
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
pattern: "claude",
|
|
343
|
-
profile: {
|
|
344
|
-
name: "Claude",
|
|
345
|
-
temperature: 0.7,
|
|
346
|
-
topP: 0.9,
|
|
347
|
-
supportsReasoning: true,
|
|
348
|
-
reasoningAsContent: false,
|
|
349
|
-
defaultMaxTokens: 16384,
|
|
350
|
-
supportsVision: false
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
pattern: "gemma-4",
|
|
355
|
-
profile: {
|
|
356
|
-
name: "Gemma 4",
|
|
357
|
-
temperature: 0.7,
|
|
358
|
-
topP: 0.9,
|
|
359
|
-
supportsReasoning: true,
|
|
360
|
-
reasoningAsContent: false,
|
|
361
|
-
defaultMaxTokens: 16384,
|
|
362
|
-
supportsVision: true
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
];
|
|
366
|
-
function getModelProfile(modelName) {
|
|
367
|
-
const lowerName = modelName.toLowerCase();
|
|
368
|
-
if (lowerName.includes("mock")) {
|
|
369
|
-
return MOCK_PROFILE;
|
|
370
|
-
}
|
|
371
|
-
for (const { pattern, profile } of MODEL_PROFILES) {
|
|
372
|
-
if (lowerName.includes(pattern.toLowerCase())) {
|
|
373
|
-
return profile;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return DEFAULT_PROFILE;
|
|
377
|
-
}
|
|
378
|
-
function modelSupportsVision(modelName) {
|
|
379
|
-
return getModelProfile(modelName).supportsVision;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
346
|
// src/server/llm/client-pure.ts
|
|
383
347
|
function buildModelParams(params) {
|
|
384
348
|
return {
|
|
@@ -408,7 +372,14 @@ function convertToolCalls(toolCalls) {
|
|
|
408
372
|
}
|
|
409
373
|
}));
|
|
410
374
|
}
|
|
411
|
-
function
|
|
375
|
+
function getThinking(msg, override) {
|
|
376
|
+
if (override) {
|
|
377
|
+
const val = msg[override];
|
|
378
|
+
if (val) return val;
|
|
379
|
+
}
|
|
380
|
+
return msg["reasoning"] ?? msg["reasoning_content"] ?? msg["thinking"];
|
|
381
|
+
}
|
|
382
|
+
function buildAssistantMessage(msg, thinkingField) {
|
|
412
383
|
const result = {
|
|
413
384
|
role: "assistant",
|
|
414
385
|
content: msg.content || null
|
|
@@ -417,7 +388,7 @@ function buildAssistantMessage(msg) {
|
|
|
417
388
|
result["tool_calls"] = convertToolCalls(msg.toolCalls);
|
|
418
389
|
}
|
|
419
390
|
if (msg.thinkingContent) {
|
|
420
|
-
result["
|
|
391
|
+
result[thinkingField ?? "reasoning"] = msg.thinkingContent;
|
|
421
392
|
}
|
|
422
393
|
return result;
|
|
423
394
|
}
|
|
@@ -433,7 +404,7 @@ function convertAttachmentSync(attachment, modelSupportsVision2) {
|
|
|
433
404
|
text: `[Image: ${attachment.filename || "image"}] (vision not supported, cannot describe)`
|
|
434
405
|
};
|
|
435
406
|
}
|
|
436
|
-
function convertMessages(messages, modelSupportsVision2) {
|
|
407
|
+
function convertMessages(messages, modelSupportsVision2, thinkingField) {
|
|
437
408
|
const filtered = messages.filter((msg) => {
|
|
438
409
|
return !(msg.role === "assistant" && !msg.content?.trim() && (!msg.toolCalls || msg.toolCalls.length === 0));
|
|
439
410
|
});
|
|
@@ -454,7 +425,7 @@ function convertMessages(messages, modelSupportsVision2) {
|
|
|
454
425
|
};
|
|
455
426
|
}
|
|
456
427
|
if (msg.role === "assistant") {
|
|
457
|
-
return buildAssistantMessage(msg);
|
|
428
|
+
return buildAssistantMessage(msg, thinkingField);
|
|
458
429
|
}
|
|
459
430
|
if (msg.role === "user" && msg.attachments && msg.attachments.length > 0) {
|
|
460
431
|
const content = buildAttachmentContent(msg.content, msg.attachments, modelSupportsVision2);
|
|
@@ -479,10 +450,10 @@ function convertTools(tools) {
|
|
|
479
450
|
}
|
|
480
451
|
}));
|
|
481
452
|
}
|
|
482
|
-
async function buildChatCompletionCreateParams(model, request, profile, capabilities,
|
|
453
|
+
async function buildChatCompletionCreateParams(model, request, profile, capabilities, reasoningEffort, isStreaming, thinkingField) {
|
|
483
454
|
const userVisionOverride = request.modelSettings?.supportsVision;
|
|
484
455
|
const modelSupportsVision2 = userVisionOverride ?? profile.supportsVision ?? false;
|
|
485
|
-
const convertedMessages = convertMessages(request.messages, modelSupportsVision2);
|
|
456
|
+
const convertedMessages = convertMessages(request.messages, modelSupportsVision2, thinkingField);
|
|
486
457
|
const temperature = request.modelSettings?.temperature ?? request.temperature ?? profile.temperature;
|
|
487
458
|
const maxTokens = request.modelSettings?.maxTokens ?? request.maxTokens ?? profile.defaultMaxTokens;
|
|
488
459
|
const topP = request.modelSettings?.topP ?? profile.topP;
|
|
@@ -502,23 +473,34 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
|
|
|
502
473
|
;
|
|
503
474
|
params["top_k"] = topK;
|
|
504
475
|
}
|
|
505
|
-
const
|
|
506
|
-
if (
|
|
476
|
+
const resolvedEffort = reasoningEffort ?? request.reasoningEffort;
|
|
477
|
+
if (resolvedEffort) {
|
|
507
478
|
;
|
|
508
|
-
params["
|
|
479
|
+
params["reasoning_effort"] = resolvedEffort;
|
|
480
|
+
const chatTemplateKwargs = request.modelSettings?.chatTemplateKwargs;
|
|
481
|
+
if (chatTemplateKwargs) {
|
|
482
|
+
;
|
|
483
|
+
params["chat_template_kwargs"] = chatTemplateKwargs;
|
|
484
|
+
} else if (capabilities.supportsChatTemplateKwargs) {
|
|
485
|
+
;
|
|
486
|
+
params["chat_template_kwargs"] = {
|
|
487
|
+
enable_thinking: resolvedEffort !== "none"
|
|
488
|
+
};
|
|
489
|
+
}
|
|
509
490
|
}
|
|
510
491
|
const modelParams = buildModelParams({ temperature, topP, topK, maxTokens });
|
|
511
492
|
return { params, modelParams };
|
|
512
493
|
}
|
|
513
494
|
async function buildCreateParamsFromInput(input, isStreaming) {
|
|
514
|
-
const { model, request, profile, capabilities,
|
|
495
|
+
const { model, request, profile, capabilities, reasoningEffort, thinkingField } = input;
|
|
515
496
|
return buildChatCompletionCreateParams(
|
|
516
497
|
model,
|
|
517
498
|
request,
|
|
518
499
|
profile,
|
|
519
500
|
capabilities,
|
|
520
|
-
|
|
521
|
-
isStreaming
|
|
501
|
+
reasoningEffort,
|
|
502
|
+
isStreaming,
|
|
503
|
+
thinkingField
|
|
522
504
|
);
|
|
523
505
|
}
|
|
524
506
|
var buildNonStreamingCreateParams = (input) => buildCreateParamsFromInput(input, false);
|
|
@@ -537,20 +519,6 @@ function mapFinishReason(reason) {
|
|
|
537
519
|
return "stop";
|
|
538
520
|
}
|
|
539
521
|
}
|
|
540
|
-
function extractThinking(content) {
|
|
541
|
-
const thinkRegex = /<think>([\s\S]*?)<\/think>/g;
|
|
542
|
-
let thinkingContent = "";
|
|
543
|
-
let cleanContent = content;
|
|
544
|
-
let match;
|
|
545
|
-
while ((match = thinkRegex.exec(content)) !== null) {
|
|
546
|
-
thinkingContent += match[1];
|
|
547
|
-
cleanContent = cleanContent.replace(match[0], "");
|
|
548
|
-
}
|
|
549
|
-
return {
|
|
550
|
-
content: cleanContent.trim(),
|
|
551
|
-
thinkingContent: thinkingContent.trim() || null
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
522
|
|
|
555
523
|
// src/server/llm/streaming.ts
|
|
556
524
|
async function* streamWithSegments(client, request) {
|
|
@@ -630,10 +598,9 @@ async function* streamWithSegments(client, request) {
|
|
|
630
598
|
const ttft = ((firstTokenTime ?? endTime) - startTime) / 1e3;
|
|
631
599
|
const completionTime = (endTime - (firstTokenTime ?? startTime)) / 1e3;
|
|
632
600
|
const { promptTokens, completionTokens } = response.usage;
|
|
633
|
-
const effectiveThinkingContent = thinkingContent || content === "" && response.reasoning_content || "";
|
|
634
601
|
return {
|
|
635
602
|
content,
|
|
636
|
-
thinkingContent
|
|
603
|
+
thinkingContent,
|
|
637
604
|
toolCalls,
|
|
638
605
|
response,
|
|
639
606
|
segments,
|
|
@@ -656,10 +623,10 @@ export {
|
|
|
656
623
|
detectBackend,
|
|
657
624
|
getBackendDisplayName,
|
|
658
625
|
buildModelParams,
|
|
626
|
+
getThinking,
|
|
659
627
|
buildNonStreamingCreateParams,
|
|
660
628
|
buildStreamingCreateParams,
|
|
661
629
|
mapFinishReason,
|
|
662
|
-
extractThinking,
|
|
663
630
|
streamWithSegments
|
|
664
631
|
};
|
|
665
|
-
//# sourceMappingURL=chunk-
|
|
632
|
+
//# sourceMappingURL=chunk-LXX2CPM5.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getEventStore,
|
|
3
3
|
updateSessionMetadata
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DHAKJSE7.js";
|
|
5
5
|
import {
|
|
6
6
|
buildMessagesFromStoredEvents,
|
|
7
7
|
foldPendingConfirmations
|
|
@@ -56,7 +56,7 @@ Example inputs and outputs:
|
|
|
56
56
|
|
|
57
57
|
User message: {message}`;
|
|
58
58
|
async function generateSessionName(options) {
|
|
59
|
-
const { userMessage, llmClient, signal } = options;
|
|
59
|
+
const { userMessage, llmClient, signal, modelSettings, nonThinkingEnabled } = options;
|
|
60
60
|
try {
|
|
61
61
|
logger.debug("Generating session name", { messagePreview: userMessage.slice(0, 50) });
|
|
62
62
|
const prompt = SESSION_NAME_PROMPT.replace("{message}", userMessage);
|
|
@@ -72,9 +72,13 @@ async function generateSessionName(options) {
|
|
|
72
72
|
messages,
|
|
73
73
|
tools: [],
|
|
74
74
|
signal: composedSignal,
|
|
75
|
-
|
|
75
|
+
// Default to non-thinking (reasoningEffort: 'none') when not explicitly configured
|
|
76
|
+
// to prevent thinking output in session names. Only skip when user explicitly
|
|
77
|
+
// set nonThinkingEnabled to false.
|
|
78
|
+
...nonThinkingEnabled !== false ? { reasoningEffort: "none" } : {},
|
|
79
|
+
...modelSettings ? { modelSettings } : {}
|
|
76
80
|
});
|
|
77
|
-
let name = response.content.trim();
|
|
81
|
+
let name = (response.content || response.thinkingContent || "").trim();
|
|
78
82
|
if (name.length > 50) {
|
|
79
83
|
name = name.substring(0, 47) + "...";
|
|
80
84
|
}
|
|
@@ -143,4 +147,4 @@ export {
|
|
|
143
147
|
needsNameGenerationCheck,
|
|
144
148
|
applyGeneratedSessionName
|
|
145
149
|
};
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
150
|
+
//# sourceMappingURL=chunk-OKLV3ZNN.js.map
|